index.vue
10.3 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<template>
<div class="system-container">
<div class="container">
<h1>POI列表</h1>
<div class="m-b-md title_tips">
支持使用者自定义黑区、二押点以及异常聚集点POI信息,对应POI信息会参与大数据算法,并以“黑区警情”对外呈现。
</div>
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :model="searchForm" :inline="true" size="small">
<el-form-item label="关键字:">
<el-input
placeholder="POI名称|创建人"
maxlength="20"
v-model.trim="searchForm.keywords"
>
</el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="searchForm.timeDate"
class="data_picker"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="~"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="POI类型:">
<el-select v-model="searchForm.poiType" class="small_select">
<el-option label="全部" value=""></el-option>
<el-option label="黑区圆心" value="1"></el-option>
<el-option label="二押点" value="2"></el-option>
<el-option label="异常聚集点" value="3"></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="POI归属:">
<el-popover
v-model="showGlsxOranization"
placement="bottom-start"
width="400"
trigger="click"
>
<div>
<glsx-organization @change="onChange"></glsx-organization>
</div>
<el-input
v-model="searchForm.orgName"
:placeholder="searchForm.specialShopName || '所属组织'"
slot="reference"
readonly
clearable
>
</el-input>
</el-popover>
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getList(1)"
>搜索</el-button
>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-refresh" @click="rest()"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
<!-- 搜索区域 end -->
<!-- 按钮区域 开始 -->
<div class="links_group">
<span>POI列表</span>
<div>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="addFence()"
>新增POI</el-button
>
<el-button
type="primary"
icon="el-icon-download"
size="mini"
:loading="dloading"
@click="downloadExcel"
>导出Excel</el-button
>
</div>
</div>
<!-- 按钮区域 end -->
<!-- 列表 开始 -->
<div class="table_box">
<el-table
class="el_table"
border
size="small"
:data="tableData"
v-loading="loading"
>
<el-table-column
label="POI名称"
prop="poiName"
show-overflow-tooltip
/>
<el-table-column
label="POI类型"
prop="poiTypeStr"
show-overflow-tooltip
/>
<el-table-column
label="状态"
prop="enableStatusStr"
show-overflow-tooltip
/>
<el-table-column
label="创建时间"
prop="createdDate"
show-overflow-tooltip
width="160"
/>
<el-table-column
label="创建人"
prop="createUserName"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="POI归属"
prop="belongLevels"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="操作"
prop="creator"
width="150"
fixed="right"
align="center"
>
<template slot-scope="{ row }">
<el-link
type="primary"
class="el_link"
:underline="false"
@click="updateStatus(row)"
>{{ row.enableStatus == 1 ? "关闭" : "开启" }}</el-link
>
<el-link
type="primary"
class="el_link"
:underline="false"
@click="addFence(row)"
v-if="row.enableStatus == 1"
>编辑</el-link
>
<el-link
type="primary"
class="el_link"
:underline="false"
@click="removeFence(row)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination
background
layout="sizes, total,prev, pager, next, jumper"
:total="pageTotal"
:current-page.sync="pageNumber"
:page-size.sync="pageSize"
:page-sizes="pageSizes"
@current-change="getList"
@size-change="changePageSize"
/>
</div>
</div>
<!-- 列表 end -->
</div>
</div>
</template>
<script>
import {
EXPORT_FENCE_INFO,
STARTSTOP_FENCE_INFO,
DELETE_FENCE_INFO,
} from "@/services/fence";
import {
GET_POI_LIST,
EXPORT_POI_INFO,
DELETE_POI_INFO,
MODIFY_POI_INFO,
} from "@/services/poi";
import { deepClone, showToast, showModal, downFileByPath } from "@/utils/util";
import GlsxOrganization from "@/components/glsx-organization";
export default {
components: {
GlsxOrganization,
},
data() {
return {
searchForm: { poiType: "" },
tableData: [],
pageTotal: 0,
pageSize: 10,
pageNumber: 1,
pageSizes: [10, 20, 30, 40],
dloading: false,
showPopover: false,
loading: false,
showGlsxOranization: false,
};
},
mounted() {
this.getList();
},
methods: {
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
let o = oParams.timeDate;
if (o && o.length > 0) {
oParams.createBeginDate = o[0];
oParams.createEndDate = o[1];
}
delete oParams.timeDate;
delete oParams.orgName;
return oParams;
},
// 获取列表
getList(current) {
let oParams = this.getParams();
oParams.pageSize = this.pageSize;
oParams.pageNumber = current || 1;
this.loading = true;
if (current) {
this.pageNumber = current;
}
GET_POI_LIST(oParams)
.then((res) => {
this.loading = false;
let { data } = res;
let { list, totalElements } = data;
this.pageTotal = totalElements || 0;
this.tableData = list || [];
})
.catch((error) => {
this.loading = false;
});
},
// 查看详情
lookDetail(row) {
let path = `/trialRun#/alarmCenter/fence`;
// let endPath = `${path}?fenceId=${row.id}&name=${row.fenceName}`
let endPath = `${path}?name=${row.fenceName}`;
this.$root.parentCommon.setBreadCrumbs(path);
history.pushState({}, endPath, endPath);
//this.$router.push({ path: path, query: { fenceId: row.id,name:row.name } });
},
// 导出excel
downloadExcel() {
let _this = this;
let oParams = this.getParams();
_this.dloading = true;
EXPORT_POI_INFO(oParams).then((res) => {
_this.dloading = false;
if (res.code != 200) {
return false;
}
downFileByPath(res.data);
//window.open(res.data);
});
},
// 重置
rest() {
this.searchForm = { poiType: "" };
this.pageSize = 10;
this.pageNumber = 1;
this.getList();
},
// 开启关闭
updateStatus(row) {
let _this = this;
let _typeList = {
1: "关闭",
0: "开启",
};
showModal({
message: `确定${_typeList[row.enableStatus]}'${row.poiName}'吗?`,
showCancelButton: true,
type: "warning",
success: function () {
let oParams = {};
oParams.id = row.id;
oParams.enableStatus = row.enableStatus ? 0 : 1;
MODIFY_POI_INFO(oParams).then((res) => {
if (res.code == 200) {
showToast({
message: `${_typeList[row.enableStatus]}成功`,
type: "success",
});
_this.getList();
}
});
},
});
},
//每页展示
changePageSize(e) {
this.pageSize = e;
this.getList();
},
// 删除poi
removeFence(row) {
let _this = this;
showModal({
message: `确认删除【${row.poiName}】的【${row.poiTypeStr}】POI信息吗?`,
showCancelButton: true,
type: "warning",
success: function () {
let oParams = {};
oParams.id = row.id;
DELETE_POI_INFO(oParams).then((res) => {
if (res.code == 200) {
showToast({
message: "删除成功",
type: "success",
});
_this.getList();
}
});
},
});
},
// 新增POI
addFence(row) {
let path = `/oEshield#/monitor/addPoi`;
if (row) {
path = `/oEshield#/monitor/addPoi?id=${row.id}`;
}
history.pushState({}, path, path);
//window.open(path);
},
// 监听归属
onChange(e) {
this.showGlsxOranization = false;
console.log(e);
if (e) {
//this.orgInfo = e.origin;
// this.searchForm.orgType = e.origin.type;
this.$set(this.searchForm, "orgId", e.origin.orgId);
this.$set(this.searchForm, "orgName", e.origin.orgName);
}
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/common.scss";
.table_box {
margin: 10px 0;
}
</style>>