operaterLog_frm.html
8.1 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>操作日志_frm</title>
<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
<link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
<link rel="stylesheet" type="text/css" href="../../css/operaterLog/operaterLog.css"/>
<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
<link rel="stylesheet" type="text/css" href="../../css/style.css" />
<style>
html,
body{
background-color: #F4F6F9;
}
</style>
</head>
<body>
<div class="protect-panel" id="operater_panel">
<!-- <div class="protect-list" style="margin-left:0px;margin-right:0px;">
<div class="aui-row aui-row-flex" style="background-color:#F4F6F9;height:400px;">
<div class="aui-col aui-col-span-24 aui-row-flex-center aui-row-flex-middle" style="height:400px;">
<img src="../../image/img-nullInfo.png" style="height:5rem;width:7rem;margin-bottom:10px;" />
<div style="font-size:16px;font-family:PingFang SC;font-weight:500;color:rgba(55,57,78,1);" >这里还没有内容</div>
<div style="font-size:14px;font-family:PingFang SC;font-weight:500;color:rgba(129,130,149,1);">先去别的地方看看吧~</div>
</div>
</div>
</div> -->
<!-- <div class="protect-list">
<div class="info-panel">
<div class="aui-row aui-row-flex top-14">
<div class="aui-col aui-col-span-2 aui-row-flex-start">
<div class="number-id">99</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<span class="operator" id="operator">操作者:<span style="color:#5B7FF8;">测试测</span></span>
<div class="operater-status err-status">失败</div>
</div>
<div class="aui-col aui-col-span-10 aui-row-flex-end">
<span class="action-time">2019-07-15 12:32:16</span>
</div>
</div>
<div class="list-line"></div>
<div class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<div class="operater-dot"></div>
<div class="operater-cmd"> 操作指令</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div class="operater-cmd-value">设置过载电流动作值</div>
</div>
</div>
<div class="aui-row aui-row-flex aui-hide" style="margin-top:0px;">
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<div class="operater-dot"></div>
<div class="operater-cmd"> 参数</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div class="operater-cmd-value">60</div>
</div>
</div>
<div style="height:7px;"></div>
</div>
</div> -->
</div>
<div style="margin-top:50px;"></div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
var userId;
var token;
var defaultImei;
var squence = 0;
var page = 1;
var pageSize = 100;
var selected_status = 'all';
var selected_time = '';
var hasNext = true;
apiready = function(){
api.parseTapmode();
defaultImei = $api.getStorage('defaultDevice');
token = $api.getStorage('userToken');
userId = $api.getStorage('userID');
/**上拉加载 */
api.addEventListener({
name: 'scrolltobottom',
extra: {
threshold: 0
}
}, function(ret, err) {
if (hasNext) {
page += 1;
}
getOperateList();
});
/** 下拉刷新 */
api.setRefreshHeaderInfo({
loadingImg:'../../image/alpha0.png',
bgColor: 'rgba(255,255,255,0)',
textColor: '#AEB8CE',
textDown: '刷新操作日志列表...',
textUp: '松开刷新...'
}, function(ret, err) {
page = 1;
selected_time = '';
selected_status = 'all';
squence = 0;
hasNext = true;
//---移除dom中的所有元素
var allDom = $api.domAll('.protect-list');
for (var i = 0; i < allDom.length; i++) {
$api.remove(allDom[i]);
}
sequence = 0;
//-----
api.sendEvent({
name: 'cleanOperaterCondition',
});
getOperateList();
api.refreshHeaderLoadDone();
});
api.addEventListener({
name: 'changeOperaterLogType'
}, function(ret, err){
if( ret && ret.value.curSelect ){
selected_status = ret.value.curSelect;
page = 1;
squence = 0;
hasNext = true;
//移除dom中的所有元素
var allDom = $api.domAll('.protect-list'); //list-panel
for (var i = 0; i < allDom.length; i++) {
$api.remove(allDom[i]);
}
getOperateList();
}
});
api.addEventListener({
name: 'chanegOperateSearchDate'
}, function(ret, err){
if( ret && ret.value.selected_time ){
selected_time = ret.value.selected_time;
page = 1;
squence = 0;
hasNext = true;
//移除dom中的所有元素
var allDom = $api.domAll('.protect-list'); //list-panel
for (var i = 0; i < allDom.length; i++) {
$api.remove(allDom[i]);
}
getOperateList();
}
});
getOperateList();
};
function getOperateList() {
if (!hasNext) {
return;
}
var nullDom = $api.domAll('.no-data');
for (var i = 0; i < nullDom.length; i++) {
$api.remove(nullDom[i]);
}
var url_ = HOST + '/iot_api/v1/app/get_log_list?page=' + page + '&limit=' + pageSize + '&imei=' + defaultImei;
if (selected_status) {
url_ = url_ + '&log_type=' + selected_status;
}
if (selected_time && selected_time != '') {
url_ = url_ + '&date=' + selected_time;
}
api.ajax({
url: url_,
method: 'GET',
headers: {
'Content-Type': 'application/json;charset=utf-8',
'token': token
},
data: {
body: {
}
}
}, function(ret, err) {
if (ret && ret.code == 0) {
hasNext = ret.data.next;
var logList = ret.data.rows;
// if (logList==0) {
// noData($api.byId("operater_panel"));
// }
if (logList.length != 0) {
for(var i in logList){
if (logList[i].command == '&S9+' && api.pageParam.from) {
continue;
}
squence += 1;
if (logList[i].command == '&S9+') {
var addOperaterListDom = addOperaterListHtml(logList[i],squence,true);
}else {
var addOperaterListDom = addOperaterListHtml(logList[i],squence,false);
}
$api.append($api.byId("operater_panel"), addOperaterListDom);
}
}else {
console.log('>>>>');
noData($api.byId("operater_panel"),5);
}
}else {
api.toast({
msg: '网络异常',
duration: 2000,
location: 'bottom'
});
}
});
}
</script>
</html>