operaterLog_frm.html
11.9 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>
<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">
<meta name="referrer" content="no-referrer">
<title>操作日志_frm</title>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/api.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/aui.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/home.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/element.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/style.css"/>
<style>
html,
body{
background-color: #F4F6F9;
}
</style>
</head>
<body>
<div id="app">
<template>
<div class="store01001-operate-log-protect-panel" id="operater_panel" v-for="(list_d, list_i) in list">
<div v-if="list.length > 0" class="store01001-operate-log-protect-list">
<div class="store01001-operate-log-info-panel">
<div class="aui-row aui-row-flex store01001-operate-log-top-14">
<div class="aui-col aui-col-span-2 aui-row-flex-start">
<div class="store01001-operate-log-number-id">{{ list_i+1 }}</div>
</div>
<div class="aui-col aui-col-span-10 aui-row-flex-start">
<span class="store01001-operate-log-operator" id="operator">操作者:<span style="color:#5B7FF8;">{{ list_d.userName }}</span></span>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<div v-if="list_d.downResult === '1'" class="store01001-operate-log-operater-status">发送成功</div>
<div v-if="list_d.downResult === '0'" class="store01001-operate-log-operater-status store01001-operate-log-err-status">发送失败</div>
<div v-if="list_d.downResult != '0' && list_d.downResult !='1'" class="store01001-operate-log-operater-status">发送中</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div v-if="list_d.upResult === '1'" class="store01001-operate-log-operater-status">接收成功</div>
<div v-if="list_d.upResult === '0'" class="store01001-operate-log-operater-status store01001-operate-log-err-status">接收失败</div>
<div v-if="list_d.upResult != '0' && list_d.upResult != '1'" class="store01001-operate-log-operater-status">接收中</div>
</div>
</div>
</div>
</div>
<div class="store01001-operate-log-list-line"></div>
<div class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<div class="store01001-operate-log-operater-dot"></div>
<div class="store01001-operate-log-operater-cmd"> 操作指令</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div class="store01001-operate-log-operater-cmd-value">{{ list_d.value | commandFilter }}</div>
</div>
</div>
<div v-if="list_d.value != '' || list_d.retValue != ''" class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<div class="store01001-operate-log-operater-dot"></div>
<div class="store01001-operate-log-operater-cmd"> 参数</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div class="store01001-operate-log-operater-cmd-value"> {{ list_d.value | valueFilter }}</div>
</div>
</div>
<div class="aui-row aui-row-flex" style="margin-top:0px;">
<div class="aui-col aui-col-span-12 aui-row-flex-start">
<div class="store01001-operate-log-operater-dot"></div>
<div class="store01001-operate-log-operater-cmd"> 操作时间</div>
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end">
<div class="store01001-operate-log-operater-cmd-value">{{ parseTime(list_d.createdAt,'{y}-{m}-{d} {h}:{i}:{s}') }}</div>
</div>
</div>
<div style="height:7px;"></div>
</div>
</div>
</div>
<div style="margin-top:50px;"></div>
</template>
</div>
</body>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/api.js"></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/vue.min.js"></script>
<!-- <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/common.js"></script> -->
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/element.js"></script>
<!-- <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/ctrl.js"></script> -->
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/fastclick.js "></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/common.js"></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/ctrl.js"></script>
<script type="text/javascript">
var vm,
that;
var setParamList= [
{paramsTitle: "温度报警值" ,paramSign: "rw_temp_val"},
{paramsTitle: "湿度报警值" ,paramSign: "rw_humidity_val"},
{paramsTitle: "温度报警时间" ,paramSign: "rw_temp_time"},
{paramsTitle: "湿度报警时间" ,paramSign: "rw_humidity_time"},
{paramsTitle: "温度报警使能" ,paramSign: "rw_temp_switch"},
{paramsTitle: "湿度报警使能" ,paramSign: "rw_humidity_switch"},
{paramsTitle: "报警总开关" ,paramSign: "rw_alarm_pattern"},
{paramsTitle: "温度报警模式" ,paramSign: "rw_temp_pattern"},
{paramsTitle: "湿度报警模式" ,paramSign: "rw_humidity_pattern"},
]
apiready = function(){
api.parseTapmode();
$(function() {
FastClick.attach(document.body);
});
//---------初始化vue
vm = new Vue({
el: '#app',
data: {
page: 1,
limit: 10,
hasNext: true,
imei: api.pageParam.imei,
productId: api.pageParam.productId,
token: api.getPrefs({sync: true,key: 'userToken'}),
userId: api.getPrefs({sync: true,key: 'userId'}),
time: "",
type: 'set',
list: [],
},
mounted() {
//window.chooseProduct = this.chooseProduct;
},
created() {
that = this
/**上拉加载 */
api.addEventListener({
name: 'scrolltobottom',
extra: {
threshold: 0
}
}, function(ret, err) {
if (that.hasNext) {
that.page += 1;
}
that.getLogList();
});
api.addEventListener({
name: 'changeOperaterType4Log'
}, function(ret, err){
if( ret && ret.value.curName ){
that.type = ret.value.curCmd
that.page = 1
that.hasNext = true
that.list = []
that.getLogList()
}
});
api.addEventListener({
name: 'chanegOperateSearchDate'
}, function(ret, err){
if( ret && ret.value.selected_time ){
that.time = ret.value.selected_time
that.page = 1
that.hasNext = true
that.list = []
that.getLogList()
}
});
/** 下拉刷新 */
api.setRefreshHeaderInfo({
loadingImg:'../../image/alpha0.png',
bgColor: 'rgba(255,255,255,0)',
textColor: '#AEB8CE',
textDown: '刷新操作日志列表...',
textUp: '松开刷新...'
}, function(ret, err) {
that.page = 1;
that.time = '';
that.hasNext = true;
that.list = []
//-----
api.sendEvent({
name: 'cleanOperaterCondition',
});
that.getLogList()
api.refreshHeaderLoadDone();
});
that.getLogList()
},
filters: {
valueFilter(v) {
let params_ = JSON.parse(v).params
let params = ''
for (var val in params_) {
setParamList.forEach(d => {
if (d.paramSign === 'rw_envir_temp_sign' && params_[val] === '1') {
params += '开启 '
}else if (d.paramSign === 'rw_envir_temp_sign' && params_[val] === '0') {
params += '关闭 '
}
});
if (!params_.rw_envir_temp_sign) {
params += params_[val] + ' '
}
}
return params
},
commandFilter(v) {
let params_ = JSON.parse(v).params
let params = ''
for (var val in params_) {
setParamList.forEach(d => {
if (d.paramSign === val) {
console.log(d.paramSign + '-----' + params_[val]);
if (d.paramSign === 'w_fhz_handle' && params_[val] === '392') {
params += '指令合闸 '
}else if (d.paramSign === 'w_fhz_handle' && params_[val] === '665') {
params += '指令分闸 '
}else {
params += d.paramsTitle + ' '
}
}
});
}
return params
}
},
methods: {
async getLogList() {
if (!this.hasNext) {
return;
}
let params = {
imei: this.imei,
limit: this.limit,
page: this.page,
token: this.token,
type: this.type
}
if (this.time != '') {
params.time = this.time
}
let listRes = await get_ty_operate_log_list(params)
if (listRes.code === 0 && listRes.data.rows.length > 0) {
let listD = listRes.data.rows
listD.forEach(d => {
let count = 0
for(var key in JSON.parse(d.value).params){
if (key === 'rw_year_month' || key === 'rw_day_hours' || key === 'rw_minutes_seconds') {
count+=1
}
}
if (count === 0) {
this.list.push(d)
}
});
console.log(JSON.stringify(this.list));
}else {
// addAlert('网络错误!');
api.toast({
msg: '暂无数据',
duration: 2000,
location: 'bottom'
});
}
}
}
})
};
</script>
</html>