sgj
11 小时以前 67b2e6a3b7e4254be92e3ecbcd7b6e9f61b3aae3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="zh-cn" xmlns:th=http://www.thymeleaf.org>
<head>
    <meta charset="utf-8">
    <title>警告详细</title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" th:href="@{/ajax/libs/mui/css/mui.min.css}">
    <style>
        .mui-content {
            margin: 0 5px;
        }
 
        .mui-table-view {
            position: unset;
            margin-top: 10px;
            border-radius: 6px;
        }
 
        .mui-table-view-chevron .mui-table-view-cell {
            padding-right: 10px;
        }
 
        .mui-table-view-cell {
            padding: 10px 10px;
        }
 
        .mui-table-view-cell p {
            font-size: 17px;
        }
 
        .mui-ellipsis {
            margin-top: 5px;
            margin-bottom: 10px;
            font-size: 18px;
        }
 
        .first {
            font-size: 15px;
            float: right;
        }
 
        .sec {
            border-radius: 6px;
            margin-top: 10px;
            margin-bottom: 10px;
            list-style: none;
            background: #FFFFFF;
        }
 
        .four {
            padding: 7px 10px;
        }
 
        .sec-2 {
            margin-top: 10px;
            margin-bottom: 10px;
            font-size: 18px;
        }
 
        input[type=color], input[type=date], input[type=datetime-local], input[type=datetime], input[type=email], input[type=month], input[type=number], input[type=password], input[type=search], input[type=tel], input[type=text], input[type=time], input[type=url], input[type=week], select, textarea {
            border-radius: 4px;
            padding: 10px 10px;
            margin-bottom: unset;
            background-color: #eee;
            border: 1px solid #eee;
        }
 
        .title {
            text-align: center;
            background: #8bd2f5;
            border-radius: 6px 6px 0 0;
            font-size: 15px;
        }
 
        .mui-btn {
            font-size: 22px;
            padding: 6px 20px;
            border-radius: 6px;
        }
 
        .mui-button-row {
            margin-bottom: 10px;
        }
 
        .head {
            margin-top: 44px;
        }
    </style>
</head>
<body>
<div id="head">
    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title">警告详细</h1>
    </header>
</div>
<div id="content" class="mui-content head">
    <div>
        <ul class="mui-table-view mui-table-view-chevron">
            <div class="title">警告信息</div>
            <li id="handle1" class="mui-table-view-cell">
                <!--                <h4 class="mui-ellipsis">高温警告<span class="first">未处理</span></h4>-->
                <!--                <h5 class="mui-ellipsis">温湿度#1</h5>-->
                <!--                <h5 class="mui-ellipsis">2020-10-10 10:10:10</h5>-->
                <!--                <p >您好,你的设备温湿度#1于2020-10-10 10:10:10触发高温告警,请及时处理!</p>-->
            </li>
        </ul>
    </div>
    <div class="sec">
        <div class="title">处理信息</div>
        <div id="handle2" class="four">
            <!--            <h5 class="sec-2">张三</h5>-->
            <!--            <h5 class="sec-2">2020-10-10 10:10:10</h5>-->
            <!--            <textarea id="textarea" rows="5" placeholder="处理说明"></textarea>-->
        </div>
    </div>
    <div class="mui-button-row">
        <button id="btn1" type="button" class="mui-btn mui-btn-primary" onclick="toHandle()">处理</button>&nbsp;&nbsp;
        <button type="button" class="mui-btn mui-btn-danger" onclick="toPage()">返回</button>
    </div>
 
</div>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/wx/wx-common.js}"></script>
<script th:src="@{/ajax/libs/mui/js/mui.js}"></script>
<script th:inline="javascript">
    var warnId = [[${id}]];  //设备id
    var companyId = [[${companyId}]];  //组织编码
    var userName = [[${userName}]];    //当前操作人账号
    var loginType = [[${loginType}]];  //登录方式
    $(function () {
        mui.init();
        try {
            getDeviceList();
        } catch (e) {
            mui.alert(e, '提示', ["确定"], function () {
            }, "div");
        }
        // getDeviceList()
    });
 
    //获取用户设备信息
    function getDeviceList() {
        var data = {
            "id": warnId,
        };
        wxCommon.postJson("../wx/getSnapReplyInfoById", data, function (result) {
            if (result.code == "0000") {
                initData(result.data);
            } else {
                $("#listData").html('');
                mui.alert(result.msg, '提示', ["确定"], function () {
                }, "div");
            }
        });
    }
 
    //初始化页面数据
    function initData(data) {
 
        var html1 = '';
        var html2 = '';
        html1 += '<h4 class="mui-ellipsis">' + data.id;
        html1 += '<span class="first">' + data.deptId + '</span></h4>';
        html1 += '<h5 class="mui-ellipsis">' + data.createTime + '</h5>';
        html1 += '<p>' + data.content + '</p>';
 
        //未处理
        if(data.isHandle && data.isHandle == "N"){
            html2 += '<input id="days" type="number" min="1" step="1" placeholder="未来正常天数" style="width: 100%; margin-top: 10px;margin-bottom: 10px" oninput="this.value = this.value.replace(/\\D|^0/g, \'\')" />';
            html2 += '<textarea id="remark" rows="5" placeholder="处理说明"></textarea>';
        }else{
            html2 += '<p>' + '未来正常天数:'+ data.days + '</p>';
            html2 += '<p>' + '处理说明:'+ data.remark + '</p>';
 
        }
        $("#handle1").html(html1);
        $("#handle2").html(html2);
    }
 
    //警告处理提交
    function toHandle() {
        var remarkDetail = $("#remark").val();
        var days = $("#days").val();
 
 
        var data = {
            "id": warnId,
            "userName": userName,
            "remark": remarkDetail,
            "days": days
        };
        wxCommon.postJson("../wx/handleSnapReply", data, function (result) {
            if (result.code == "0000") {
                mui.toast("处理成功!");
                toPage();
            } else {
                mui.alert(result.msg, '提示', ["确定"], function () {
                }, "div");
            }
        });
    }
 
    //返回警报列表
    function toPage() {
        location.reload();
        // 返回上一页
        // 微信 H5 环境:使用 localStorage 标记
        localStorage.setItem('needRefresh', 'true');
        mui.back();
    }
 
</script>
</body>
</html>