-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplatform_details.html
More file actions
277 lines (262 loc) · 12.6 KB
/
platform_details.html
File metadata and controls
277 lines (262 loc) · 12.6 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="img/favicon.ico" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<link href="css/viccom.css" rel="stylesheet" />
<title>信息详情</title>
</head>
<body>
<!-- 顶部导航 start -->
<nav class="nav_herder">
<div class="nav_left gate_hand" onClick="location='index.html'"><img src="img/cloud_thingslink_logo.png" class="logo"/>冬笋物联网</div>
<div class="pull-right nav_right">
<p onClick="location='shop.html'"><img src="img/top_appstore.png"/><span>应用商店</span></p><em>|</em>
<p class="J_getMembers hd"><img src="img/top_management.png"/><span>成员管理</span></p><em>|</em>
<p><img src="img/top_news.png"/></p><em>|</em>
<p onClick="location='personal_info.html'"><img src="img/top_avatar.png"/><span class="J_nickname">昵称</span></p><em>|</em>
<p><img src="img/top_quit.png" id="J_logout"/></p>
</div>
</nav>
<!-- 顶部导航 end -->
<div class="down-main">
<!-- 左侧导航 start -->
<div class="left-main left-full">
<div class="sidebar-fold"><img src="img/nav_shrink.png"/></div>
<div class="subNav bg-color" onClick="location='platform_message.html'"> <!-- 跳转页面 -->
<img src="img/platform1.png" style="width: 30px;" class="hd_img"/>
<img src="img/platform_select.png" style="width: 30px;" class="hover_img"/>
<p class="sublist-title">平台消息</p>
</div>
<div class="subNav" onClick="location='device_message.html'">
<img src="img/device2.png" style="width: 30px;" class="hd_img"/>
<img src="img/device_select.png" style="width: 30px;" class="hover_img"/>
<p class="sublist-title">设备消息</p>
</div>
</div>
<!-- 左侧导航 end -->
<div class="right-product my-index right-full">
<!-- 标题 -->
<p class="mes_title" style="position: relative;">平台消息 > <span class="mes_name_title"></span> > <span> 信息详情</span><i id="goBack" style="right: 17px; top: 17px;" onclick="history.go(-1)" class="glyphicon glyphicon-arrow-left"></i></p>
<!-- 表格 -->
<div style="margin: 15px;border: 1px solid #E5E9EE;">
<table id="details_table" class="table dataTable no-footer "
style="background-color:#FFFFFF;">
<tr>
<td style="width: 12%;">标题</td>
<td id="subject"></td>
</tr>
<tr>
<td>所属设备序列号</td>
<td id="device"></td>
</tr>
<tr>
<td>发生时刻设备所属公司</td>
<td id="owner_company"></td>
</tr>
<tr>
<td>触发用户用户名</td>
<td id="user"></td>
</tr>
<tr>
<td>发生时间</td>
<td id="creation"></td>
</tr>
<tr>
<td>执行结果</td>
<td id="status"></td>
</tr>
<tr>
<td>记录类型</td>
<td id="type"></td>
</tr>
<tr>
<td>详细信息</td>
<td id="message"></td>
</tr>
<tr>
<td>是否确认消息</td>
<td id="disposed"></td>
</tr>
<tr>
<td>确认消息用户</td>
<td id="disposed_user"></td>
</tr>
</table>
</div>
</div>
</div>
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/jQuery.cookie.js" type="text/javascript"></script>
<script>
var token = $.cookie('DS_auth_token');
$.ajaxSetup({
headers: { // 默认添加请求头
"X-Frappe-CSRF-Token": token
}
});
var dataS = {
"disposed":1,
"name": decodeURI(window.location.href.split("=")[1])
};
$.ajax({
url:"/apis/api/method/iot.user_api.dispose_device_activity",
type:"POST",
data:JSON.stringify(dataS),
contentType:"application/json",
dataType:'JSON',
success:function(data){
console.log('success')
var data = {name:decodeURI(window.location.href.split("=")[1])};
$.ajax({
url: '/apis/api/method/iot.user_api.device_activity_detail',
type: 'GET',
data:data,
dataType: 'json',
success: function (req) {
console.log(req);
var data = req.message;
var obj = JSON.parse(req.message.message);
console.log(obj);
var text;
//设备状态
if(obj.hasOwnProperty('device_status')){
if(obj.device_status == "ONLINE"){
text = '设备上线'
} else{
text = '设备离线'
}
//设备操作
} else if(obj.hasOwnProperty('action')){
if(obj.channel == "app"){
if(obj.action == "option"){ //开机自启动
if(obj.data.value == 1){
text = '开启应用'+ obj.data.inst+'开机自启动'
}else if(obj.data.value == 0){
text = '关闭应用'+ obj.data.inst+'开机自启动'
}
}
else if(obj.action == "restart"){
text = '重启应用'+ obj.data.inst;
}else if(obj.action == "start"){
text = '启动应用'+obj.data.inst;
}else if(obj.action == "stop"){
text = '停止应用'+obj.data.inst;
}else if(obj.action == "conf"){
text = '更改应用'+obj.data.inst+'应用配置';
}else if(obj.action == "upload_comm"){
if(obj.data.sec == 0){
text = '停止上传应用'+obj.data.inst+'报文';
}else if(obj.data.sec == 120){
text = '上传应用'+obj.data.inst+'报文';
}
}else if(obj.action == "install"){
text = '安装应用'+obj.data.name+'实例名'+obj.data.inst;
}else if(obj.action == "uninstall"){
text = '卸载应用'+obj.data.inst;
}else if(obj.action == "query_comm"){
text = '应用'+obj.data.inst+'查询报文';
}else if(obj.action == "query_log"){
text = '应用'+obj.data.inst+'查询日志';
}else if(obj.action == "list"){
text = '刷新应用列表';
}else if(obj.action == "upgrade"){
text = '应用'+obj.data.inst+'升级到最新版本'
}else if(obj.action == "rename"){
text = '应用'+obj.data.inst+'重命名为'+obj.data.new_name;
}
} //app
else if(obj.channel == "sys"){
if(obj.action == "enable/beta"){
if(obj.data == 0){
text = '网关关闭beta模式';
}else if(obj.data == 1){
text = '网关开启beta模式';
}
}else if(obj.action == "enable/data"){
if(obj.data == 0){
text = '网关关闭数据上传';
}else if(obj.data == 1){
text = '网关开启数据上传';
}
}else if(obj.action == "enable/log"){
if(obj.data == ""){
text = '网关关闭日志上送';
}else if(obj.data == 120){
text = '网关开启日志上送';
}
}else if(obj.action == "enable/comm"){
if(obj.data.sec == 0){
text = '网关停止报文上送';
}else if(obj.data.sec == 120){
text = '网关开启报文上送';
}
}else if(obj.action == "restart"){
text = '网关IOT程序重启';
}else if(obj.action == "reboot"){
text = '网关设备重启';
}else if(obj.action == "cloud_conf"){
text = '网关云中心配置选项更新';
}else if(obj.action == "enable/data_one_short"){
if(obj.data.sec == ""){
text = '网关关闭临时上传数据';
}else if(obj.data.sec == 120){
text = '网关开启临时上传数据';
}
}else if(obj.action == "ext/upgrade"){
text = '网关更新扩展库'+obj.data.name;
}else if(obj.action == "ext/list"){
text = '网关上传扩展库列表';
}else if(obj.action == "cfg/download"){
text = '网关IOT固件配置下载';
}else if(obj.action == "cfg/upload"){
text = '网关IOT固件配置上传';
}else if(obj.action == "upgrade"){
text = '网关升级到最新版本';
}else if(obj.action == "enable/event"){
text = '网关更改事件上传等级';
}else if(obj.action == "enable/stat"){
text = '网关开启统计数据上传';
}else if(obj.action == "batch_script"){
text = '网关执行批量操作';
}else if(obj.action == "upgrade/ack"){
text = '网关IOT固件升级确认';
}
} //sys
else if(obj.channel == "command"){
text = '网关应用设备执行'+obj.data.cmd+'指令';
} //command
else if(obj.channel == "putput"){
text = '网关设备应用'+obj.data.output+'数据输出';
} //output
}
$(".mes_name_title").text(text);
$("#subject").text(text);
$("#device").text(data.device);
$("#owner_company").text(data.owner_company);
$("#user").text(data.user);
$("#creation").text(data.creation);
$("#status").text(data.status);
$("#type").text(data.doctype);
$("#message").text(data.message);
if(data.disposed = 0){
$('#disposed').text('未确认')
} else{
$('#disposed').text('已确认')
}
$("#disposed_user").text(data.disposed_by);
},
error: function (e) {
console.log("error");
}
});
},
error:function(error){
console.log('error')
}
})
</script>
</body>
</html>