index.vue
11.2 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
<template>
<div class="system-container">
<div class="container">
<h1>围栏列表</h1>
<div class="m-b-md title_tips">用于统计和展示设备的围栏关联信息</div>
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :model="searchForm" :inline="true" size="small">
<el-form-item>
<div class="pre_select_box">
<el-select v-model="searchForm.timeType" class="small_select mr5" placeholder="请选择">
<el-option label="创建时间" value="1"></el-option>
<el-option label="监控时间" value="2"></el-option>
</el-select>
<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>
</div>
</el-form-item>
<el-form-item label="状态:">
<el-select v-model="searchForm.enableStatus" class="small_select">
<el-option label="全部" value=""></el-option>
<el-option v-for="(item,index) in FENCE_TYPE_LIST" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="监控类型:">
<el-select v-model="searchForm.triggerType" class="small_select">
<el-option label="全部" value=""></el-option>
<el-option v-for="(item,index) in FENCE_MONITOR_LIST" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="围栏类型:">
<el-select v-model="searchForm.source" class="small_select">
<el-option label="全部" value=""></el-option>
<el-option label="有线设备围栏" value="1"></el-option>
<el-option label="无线设备围栏" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字:">
<el-input placeholder="设备号 | 姓名 | 车架号|围栏名称" class="long_input" maxlength="20" v-model.trim="searchForm.term">
</el-input>
</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>围栏列表</span>
<div>
<auth-button type="primary" icon="el-icon-plus" size="mini" pid="ADD_WIRELESS_DEVICE_FENCE" @click.native="addFence({source:0})">新增无线设备围栏</auth-button>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addFence({source:1})">新增有线设备围栏</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="围栏名称" prop="fenceName" show-overflow-tooltip></el-table-column>
<el-table-column label="围栏类型" prop="fenceName" show-overflow-tooltip>
<template slot-scope="{row}">{{ fenceSource[row.source]||'--' }}</template>
</el-table-column>
<el-table-column label="监控类型" prop="triggerType" show-overflow-tooltip></el-table-column>
<el-table-column label="监控时间" prop="timeType" show-overflow-tooltip width="160">
<template slot-scope="{row}">{{row.startTime}}~{{row.endTime}}</template>
</el-table-column>
<el-table-column label="关联设备数" prop="linkDeviceCnt" show-overflow-tooltip></el-table-column>
<el-table-column label="报警设备数" prop="alarmDeviceCnt" show-overflow-tooltip></el-table-column>
<el-table-column label="状态" prop="enableStatusDesc" show-overflow-tooltip></el-table-column>
<el-table-column label="报警次数" prop="alarmCnt" show-overflow-tooltip></el-table-column>
<el-table-column label="最新报警时间" prop="lastAlarmDate" show-overflow-tooltip>
<template slot-scope="{row}">{{row.lastAlarmDate||'--'}}</template>
</el-table-column>
<el-table-column label="创建时间" prop="createdDate" show-overflow-tooltip></el-table-column>
<el-table-column label="创建人" prop="creator" show-overflow-tooltip>
<template slot-scope="{row}">{{row.creator||'--'}}</template>
</el-table-column>
<el-table-column label="操作" prop="creator" width="200" fixed="right">
<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)">编辑</el-link>
<el-link type="primary" class="el_link" :underline="false" @click="removeFence(row)">删除</el-link>
<el-link type="primary" class="el_link" :underline="false" @click="lookDetail(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>
<!-- <glsx-table ref="glsxTable" v-loading="loading" :list="tableData" :column="columnList" :pageTotal="pageTotal" @change="getList">
<div slot="operate" slot-scope="{scope}" width="170">
<el-link type="primary" :underline="false" @click="updateStatus(scope)">{{scope.enableStatus == 1?'关闭':'开启'}}</el-link>
<el-link type="primary" :underline="false" @click="lookDetail(scope)">编辑</el-link>
<el-link type="primary" :underline="false" @click="lookDetail(scope)">删除</el-link>
<el-link type="primary" :underline="false" @click="lookDetail(scope)">查看预警</el-link>
</div>
</glsx-table> -->
<!-- 列表 end -->
</div>
</div>
</template>
<script>
import GlsxTable from "@/components/glsx-table";
import { GET_FAKEOFFLINE_LIST, GET_FAKEOFFLINE_EXPORT } from "services/report";
import {
EXPORT_FENCE_INFO,
STARTSTOP_FENCE_INFO,
DELETE_FENCE_INFO,
GET_FENCE_LIST,
} from "@/services/fence";
import { deepClone, showToast, showModal, downFileByPath } from "@/utils/util";
import moment from "moment";
import { FENCE_MONITOR_LIST, FENCE_TYPE_LIST } from "@/common/constants";
export default {
components: {
GlsxTable,
},
data() {
return {
searchForm: { timeType: "1", enableStatus: "", triggerType: "" },
tableData: [],
pageTotal: 0,
pageSize: 10,
pageNumber: 1,
pageSizes: [10, 20, 30, 40],
dloading: false,
showPopover: false,
loading: false,
FENCE_MONITOR_LIST,
FENCE_TYPE_LIST,
fenceSource: {
0: "无线设备围栏",
1: "有线设备围栏",
},
};
},
mounted() {
this.getList();
},
methods: {
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
let o = oParams.timeDate;
if (o && o.length > 0) {
oParams.beginDate = o[0];
oParams.endDate = o[1];
}
delete oParams.timeDate;
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_FENCE_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_FENCE_INFO(oParams).then((res) => {
_this.dloading = false;
if (res.code != 200) {
return false;
}
downFileByPath(res.data);
//window.open(res.data);
});
},
// 重置
rest() {
this.searchForm = { timeType: "1", enableStatus: "", triggerType: "" };
this.pageSize = 10;
this.pageNumber = 1;
this.getList();
},
// 开启关闭
updateStatus(row) {
let _this = this;
let _typeList = {
1: "关闭",
0: "开启",
};
showModal({
message: `确定${_typeList[row.enableStatus]}'${row.fenceName}'吗?`,
showCancelButton: true,
type: "warning",
success: function () {
let oParams = {};
oParams.fenceId = row.id;
STARTSTOP_FENCE_INFO(oParams).then((res) => {
if (res.code == 200) {
showToast({
message: `${_typeList[row.enableStatus]}成功`,
type: "success",
});
_this.getList();
}
});
},
});
},
//每页展示
changePageSize(e) {
this.pageSize = e;
this.getList();
},
// 删除围栏
removeFence(row) {
let _this = this;
showModal({
message: `确定删除${row.fenceName}吗?`,
showCancelButton: true,
type: "warning",
success: function () {
let oParams = {};
oParams.fenceId = row.id;
DELETE_FENCE_INFO(oParams).then((res) => {
if (res.code == 200) {
showToast({
message: "删除成功",
type: "success",
});
_this.getList();
}
});
},
});
},
// 新增围栏
addFence(row) {
let path = `/oEshield#/monitor/addFence?source=${row.source}`;
if (row && row.id) {
path = `/oEshield#/monitor/addFence?id=${row.id}&source=${row.source}`;
}
history.pushState({}, path, path);
//window.open(path);
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/common.scss";
.table_box {
margin: 10px 0;
}
</style>>