<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
>
<head>
    <meta charset="UTF-8">
    <title>设备告警查看</title>
    <link rel="stylesheet" href="/css/metroStyle/metroStyle.css">
    <link rel="stylesheet" href="/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/css/public.css">
    <style type="text/css">
        .layui-form-label {
            width: 100px;
        }
        #container{height:500px;}
    </style>
</head>
<body class="child-body">
<div class="child-nav">
    <span class="layui-breadcrumb">
         <a>系统管理</a>
         <a href="/admin/device/list">设备告警列表</a>
         <a><cite>查看设备告警</cite></a>
    </span>
    <a class="layui-btn layui-btn-sm" href="javascript:location.replace(location.href);" title="刷新"
       style="float:right;margin-top: 3px"><i class="layui-icon" style="line-height:30px">&#x1002;</i></a>
</div>
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-header">查看设备告警</div>
        <div class="layui-card-body">
            <form class="layui-form" action="/admin/deviceEvent/save" method="post">
                <input type="hidden" id="deviceEventId" name="id" th:value="${deviceEvent.id}">
                <div class="layui-form-item">
                    <label class="layui-form-label">设备id</label>
                    <div class="layui-input-inline">
                        <input type="text" name="deviceId" th:value="${device.deviceId}" lay-verify="required"
                               lay-vertype="tips" class="layui-input" readonly disabled="disabled">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">设备类型</label>
                    <div class="layui-input-inline">
                        <select name="deviceType" lay-verify="required" readonly disabled="disabled">
                            <option value="YG" th:selected="${#strings.equals(device.deviceType,'YG')}">烟感</option>
                            <option value="JG" th:selected="${#strings.equals(device.deviceType,'JG')}">井盖</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">告警内容</label>
                    <div class="layui-input-inline">
                        <input type="text" name="content" th:value="${deviceEvent.content}" lay-verify="required"
                               lay-vertype="tips" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">处理状态</label>
                    <div class="layui-input-inline">
                        <!--<select name="handleStatus" lay-verify="required" readonly disabled="disabled">-->
                        <select name="handleStatus" lay-verify="required" >
                            <option value="0" th:selected="${#strings.equals(deviceEvent.handleStatus,'0')}">待解决</option>
                            <option value="1" th:selected="${#strings.equals(deviceEvent.handleStatus,'1')}">已立案</option>
                            <option value="2" th:selected="${#strings.equals(deviceEvent.handleStatus,'2')}">出警中</option>
                            <option value="3" th:selected="${#strings.equals(deviceEvent.handleStatus,'3')}">已解决</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="createTime" th:value="${deviceEvent.createTime}" lay-verify="required"
                               lay-vertype="tips" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">地址</label>
                    <div class="layui-input-block">
                        <div class="layui-col-xs6">
                            <input id="addressSearch" type="text" name="address" th:value="${device.address}" lay-verify="required"
                                   lay-vertype="tips" class="layui-input" readonly>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <div id="container"></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="save"
                                th:text="${#strings.equals(device.id,null)?'保存':'修改'}"></button>
                        <a href="javascript:history.back()" type="button" class="layui-btn layui-btn-primary">返回</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=YCABZ-AFPRX-VD54O-TL3VN-TL7A3-KPBQJ"></script>
<script src="/plugins/layui/layui.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/map.js"></script>
<script type="text/javascript">
    layui.use(['element', 'form', 'laydate', 'upload'], function () {
        var form = layui.form, $ = layui.jquery;

        //监听提交
        form.on('submit(save)', function (data) {
            var headers = {};
            headers['X-CSRF-TOKEN'] = "[[${_csrf.token}]]";
            $.ajax({
                url: data.form.action,
                type: data.form.method,
                headers: headers,
                data: data.field,
                dataType: 'json',
                success: function (data) {
                    if (data.code == 0) {
                        layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                            location.href = "/admin/deviceEvent/list";
                        });
                    } else {
                        layer.msg(data.msg, {time: 1000});
                    }
                }
            });
            return false;
        });

        form.render();
    });
</script>
</body>
</html>