operateFun.html
6.85 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
<!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>操作及报警</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/home.css"/>
<link rel="stylesheet" type="text/css" href="../../../css/element.css"/>
<link rel="stylesheet" type="text/css" href="../../../css/style.css"/>
<style>
html,
body {
background: #FFFFFF;
}
</style>
</head>
<body>
<div id="app">
<template>
<div class="operate-and-alert-area-inside">
<span class="operate-and-alert-title">{{ operateTitle }}</span>
<div class="normal-line-s"></div>
</div>
<div class="operation-menu-list" >
<el-row>
<div v-for="(list_d, list_i) in operateList">
<el-col :span=12 style="margin-top: 10px;">
<div class="operation-panel" style="margin-right:5px;">
<div style="margin-left:15px;margin-right:15px;margin-bottom:10px;">
<div class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-12 aui-row-flex-start" style="margin-top:12.5px;">
<img :src="list_d.url" style="height:44px;width:44px;">
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end" >
<div class="operation-btn" tapmode @click="deviceOperation(list_i+1 ,this, list_d.name ,'&S9+', list_d.command);"><span :id="'loading'+ (list_i+1)"> {{ list_d.name }}</span></div>
</div>
</div>
</div>
</div>
</el-col>
</div>
</el-row>
</div>
<div class="operate-and-alert-area-inside">
<span class="operate-and-alert-title">{{ alertStatus }}</span>
<div class="normal-line-s"></div>
<div v-if="alertList.length > 0" class="operate-and-alert-alert-lists" v-for="(list_d, list_i) in alertList">
<p class="operate-and-alert-alert-list">
<el-row>
<el-col :span=8 class="operate-and-alert-alert-list-title">
{{ list_d.type }}
</el-col>
<el-col :span=16 class="operate-and-alert-alert-list-time">
{{ list_d.time }}
</el-col>
</el-row>
</p>
</div>
<div v-if="alertList.length === 0" class="operate-and-alert-alert-lists" >
<p style="text-align: center;">暂无报警信息</p>
</div>
</div>
</template>
</div>
</body>
<script type="text/javascript" src="../../../script/api.js"></script>
<script type="text/javascript" src="../../../script/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../../script/vue.min.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script type="text/javascript" src="../../../script/element.js"></script>
<script type="text/javascript" src="../../../script/ctrl.js"></script>
<script type="text/javascript">
var vm,
inputDialogJSON,
apiready = function(){
api.parseTapmode();
inputDialogJSON = returnInputDialogJSON()
//---------初始化vue
vm = new Vue({
el: '#app',
data: {
operateTitle: '远程操作',
alertStatus: '报警状态',
operateList: [
{
name: "分闸",
url: "http://iot.uccc.cc:9090/product/01001/lazha.png",
command: "4"
},
{
name: "自检",
url: "http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_02.png",
command: "8"
},
{
name: "复位",
url: "http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_03.png",
command: "16"
},
{
name: "消音",
url: "http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_05.png",
command: "2"
}
],
alertList: [],
},
mounted() {
// window.returnInputDialogJSON = this.chooseProduct;
},
created() {
this.initAlarm()
},
methods: {
async deviceOperation(squ,dom,name,cmd,val) {
let dialogBox = api.require('dialogBox')
dialogBox.input(inputDialogJSON, async function(ret) {
if (ret.eventType == 'left') {
var dialogBox = api.require('dialogBox');
dialogBox.close({
dialogName: 'input'
});
}else if (ret.eventType == "right") {
api.toast({msg: JSON.stringify(),duration: 2000,location: 'bottom'});
if (!api.pageParam.status) {
api.toast({msg: '该设备不在线无法操作!',duration: 2000,location: 'bottom'});
return;
}
const params = {
imei: api.pageParam.imei,
userId: api.pageParam.userId,
token: api.pageParam.token,
}
let deviceInfos = await get_device_infos_by_imei(params)
if (deviceInfos.data.device.password === ret.text) {
//handle operate...
}else {
api.toast({msg: '设备密码错误!',duration: 2000,location: 'bottom'});
}
}
});
},
async initAlarm() {
let url = "&page=1&limit=2&type=app&status=未处理&keyword=" + api.pageParam.imei
let res = await get_warning_list_by_user_id(api.pageParam.userId, url, api.pageParam.token)
let resList = res.data.rows
//this.alertList
if (api.pageParam.deviceType == 'TY-500') {
resList.forEach(d => {
let j = handleFormatTY500Alert(d) //[{"Xxx: time"}]
if (j.length > 0) {
j.forEach(e => {
this.alertList.push(e)
})
}
});
}else {
}
}
}
})
};
</script>
</html>