history.js
6.5 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
new Vue({
el: '#his',
data() {
return {
city: '',
reservoir: {},
monitor: {},
lslist:[],
xzdsk:'',
fy:'',
sbid:'',
checkindex: 0,
monitor: 0,
selectedCityId:"",
selectedShuikuId:"",
selectedShebeiId:"",
curpage:1,
pages:1,
selectArr:[],
}
},
methods:{
selectAll(event){//全选
var _this = this;
if(!event.currentTarget.checked) {
this.selectArr = [];
}else{
this.selectArr = [];
this.lslist.forEach((item,i)=>{
this.selectArr.push(item.id)
})
}
},
deleteSel(){//选择删除
console.log(this.selectArr);
if(this.selectArr.length>0){
var durl = "https://gjsk.xp.yn.cn/api/video/index/bat_delete_alarm_log";
axios.post(durl,{"delete_ids":this.selectArr}).then(response => (
alert(response.data.msg),
this.xkxz(this.selectedShebeiId)
));
}
// let arr = [];
// var len = this.lslist.length;
// for(let i = 0;i<len;i++) {
// if (this.selectArr.indexOf(i) >=0 ) {
//
// }else{
// arr.push(this.lslist[i]);
// }
// }
// this.lslist = arr;
// this.selectArr = [];
},
xkxz:function(event){
this.lslist = [];
this.selectedShebeiId =event;
var url = "https://gjsk.xp.yn.cn/api/video/index/history2?monitor=" + event +"&page=1"
var urlpage = "https://gjsk.xp.yn.cn/api/video/index/page2?monitor=" + event
// console.log(urlpage)
axios.get(url).then(response => (
this.lslist = response.data.data,
this.sbid = event
));
axios.get(urlpage).then(res => (
this.fy = res.data.data.list,
this.pages = res.data.data.pages
));
},
// 水库请求
skn:function(id){
this.lslist = []
this.fy = []
this.pages =1
// this.monitor = id
// alert(this.monitor)
// 获取硬件设备
this.selectedShuikuId =id;
this.selectedShebeiId ="";
axios.get("https://gjsk.xp.yn.cn/api/video/index/monitor2/?reservoir="+ id)
.then(response => (
this.monitor = response.data.data
))
.catch(function(error) { // 请求失败处理
console.log(error);
});
console.log(this.monitor.length)
},
// 上一页
deduction(){
if(this.curpage - 1 >0){
this.curpage = this.curpage-1;
this.selectArr=[];
this.fyclick();
}else{
this.curpage = 1;
}
},
// 下一页
score(){ //若果是最后一页
if(this.curpage >= this.pages ){
this.curpage = this.pages;
}else{
this.curpage= this.curpage+1;
this.selectArr=[];
this.fyclick();
}
},
fyclick:function(){
var url = "https://gjsk.xp.yn.cn/api/video/index/history2?monitor=" + this.sbid + "&page=" + this.curpage
axios.get(url).then(response => (
this.lslist = response.data.data
));
this.checkindex = index
// this.sw = true
// console.log(index)
}
},
mounted() {
var url = "https://gjsk.xp.yn.cn/api/video/index/history2?monitor=iDS-2DC7423MW-AB20210402AACHF77587632&page=1"
var pageurl = "https://gjsk.xp.yn.cn/api/video/index/page2?monitor=iDS-2DC7423MW-AB20210402AACHF77587632"
axios.get(url).then(response => (
this.lslist = response.data.data
));
axios.get(pageurl).then(res => (
this.fy = res.data.data.list,
this.pages = res.data.data.pages
));
// 获取城市
axios.get('https://gjsk.xp.yn.cn/api/video/index/city')
.then(response => (
this.city = response.data.data[0].name,
this.selectedCityId = response.data.data[0].id
))
.catch(function(error) { // 请求失败处理
console.log(error);
});
// 获取水库
axios.get('https://gjsk.xp.yn.cn/api/video/index/reservoir?city=4')
.then(response => (
this.reservoir = response.data.data
))
.catch(function(error) { // 请求失败处理
console.log(error);
});
// 获取今日统计
axios.get('https://gjsk.xp.yn.cn/api/video/index/fyclick?reservoir=23')
.then(response => (
this.early = response.data.data,
this.sum = this.early.sum,
this.exist = this.early.exist,
this.line = this.early.line
))
// .catch(function(error) { // 请求失败处理
// console.log(error);
// });
// 人员入侵预警
},
filters: {
capitalize: function (value) {
if (value == 1){
return "入侵记录"
}else{
return "进入记录"
}
},
settime:function(value){
return new Date(parseInt(value) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
}
}
// filters:{
// ivc(val){
// if(){
// return "入侵"
// }else{
// return "进入"
// }
// }
// }
})
//2
var sbzt = new Vue({
el: '#right1',
data:{
early:{},
sum:'',
exist: '',
line: '',
},
methods:{
sbzt:function(id){
// 获取今日统计
axios.get('https://gjsk.xp.yn.cn/api/video/index/quantity?reservoir=23')
.then(response => (
this.early = response.data.data,
this.sum = this.early.sum,
this.exist = this.early.exist,
this.line = this.early.line
))
.catch(function(error) { // 请求失败处理
console.log(error);
});
}
},
mounted() {
this.sbzt()
// 获取城市
// 人员入侵预警
}
})
//3
var sbyj = new Vue({
el: '#right2',
data() {
return {
name: '',
monitoring: '',
record: '',
createtime: '',
address: ''
}
},
mounted() {
// console.log("另一个vue",skxz.sbdata)
axios.get('https://gjsk.xp.yn.cn/api/video/index/perEarly?monitor=iDS-2DC7423MW-AB20210402AACHF77587632')
.then(response => (
this.name = response.data.data.reservoir[0].name,
this.monitoring = response.data.data.monitoring[0].name,
this.record = response.data.data.record,
this.createtime = response.data.data.date.createtime,
this.address = response.data.data.reservoir[0].address,
// console.log(111111111111111111111111111111111111111111111111111111111111111111111),
console.log(response)
))
.catch(function(error) { // 请求失败处理
console.log(error);
});
}
})
//历史记录