deviceStateManage.vue
8.17 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
<template>
<div class="app-container">
<el-form
:model="queryConfig"
ref="queryConfig"
label-width="110px"
style="margin-top: 15px"
class="demo-queryConfig"
>
<el-row :gutter="10">
<el-col :span="4">
<el-form-item label="设备编码:" prop="">
<el-input
v-model="queryConfig.equipmentCode"
placeholder="请选择设备编码"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="设备名称:" prop="">
<el-input
v-model="queryConfig.equipmentName"
placeholder="请选择设备名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="设备状态:" prop="">
<el-select
v-model="queryConfig.equipmentStatus"
placeholder="请选择设备类型"
>
<el-option
v-for="item in deviceType"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="记录状态:" prop="">
<el-select
v-model="queryConfig.recordStatus"
placeholder="请选择设备类型"
>
<el-option
v-for="item in recordStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="开始时间">
<el-date-picker
v-model="queryConfig.startTime"
type="datetime"
placeholder="选择日期时间"
style="width: 99%"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="结束时间">
<el-date-picker
v-model="queryConfig.endTime"
type="datetime"
placeholder="选择日期时间"
style="width: 99%"
/>
</el-form-item>
</el-col>
<el-col :span="23" class="button-col">
<el-form-item label="" prop="">
<el-button
icon="el-icon-search"
class="T1"
@click="btnAction()"
type="primary"
size="small"
>查询</el-button
>
<el-button
class="T1"
size="small"
icon="el-icon-download"
@click="ExportList()"
>导出</el-button
>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="table">
<el-table
:data="tableData"
border
highlight-current-row
:height="TableHeight"
@selection-change="handleSelectionChange"
:header-cell-style="{ color: '#000000' }"
>
<el-table-column prop="id" label="id" width="80"> </el-table-column>
<el-table-column prop="equipmentCode" label="设备编码">
</el-table-column>
<el-table-column prop="equipmentName" label="设备名称">
</el-table-column>
<el-table-column prop="equipmentStatus" label="设备状态">
</el-table-column>
<el-table-column prop="isEnd" label="是否结束"> </el-table-column>
<el-table-column prop="duration" label="持续时间" width="160">
</el-table-column>
<el-table-column prop="startTime" label="开始时间" width="160">
</el-table-column>
<el-table-column prop="endTime" label="结束时间" width="160">
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
style="margin-top: 15px"
align="center"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryConfig.currentPage"
:page-sizes="[20, 50, 100]"
:page-size="queryConfig.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
/>
</div>
</div>
</div>
</template>
<script>
import {
GetDictWithDetailsLangs,
GetEquipmentStatusRecordDtosByPage,
} from "@/api/deviceManage/deviceStateManage";
import downloadFile from "@/api/user";
export default {
data() {
return {
activeName: "alarmMessage",
tableData: [],
tableDataTwo: [],
//查询条件
queryConfig: {
currentPage: 1,
pageSize: 20,
equipmentCode: "",
equipmentName: "",
equipmentStatus: "",
recordStatus: "",
startTime: this.$moment()
.subtract(7, "days")
.format("YYYY-MM-DD 00:00:00"),
endTime: this.$moment().add(1, "days").format("YYYY-MM-DD 23:59:59"),
},
//新增修改条件
elAddDialog: {
code: "",
name: "",
equipmentTypeId: 0,
connectName: "",
ip: "",
destinationArea: "",
description: "",
disable: false,
recordType: "",
},
total: 0,
deviceType: [],
recordStatus: [],
multipleSelection: [],
export: "http://localhost:5221/api/Equipment/ExportEquipmentStatusRecord",
};
},
created() {
this.dictionary("EquipmentStatuses");
this.dictionary("RecordStatuses");
this.getTableList();
},
computed: {
TableHeight() {
return `calc(100vh - 350px )`;
},
},
methods: {
btnAction() {
this.getTableList();
},
dictionary(data) {
let params = { Code: data };
GetDictWithDetailsLangs(params).then((response) => {
response.data.dictDetails.forEach((x) => {
if (data == "EquipmentStatuses") {
this.deviceType.push({ value: x.value, label: x.name });
if (this.deviceType.length > 0) {
this.queryConfig.equipmentStatus = this.deviceType[0].value;
}
} else if (data == "RecordStatuses") {
this.recordStatus.push({ value: x.value, label: x.name });
if (this.recordStatus.length > 0) {
this.queryConfig.recordStatus = this.recordStatus[0].value;
}
}
});
});
},
//表格数据
getTableList() {
const params = {
pageNumber: this.queryConfig.currentPage,
perPageCount: this.queryConfig.pageSize,
queryConfig: this.queryConfig,
};
this.listLoading = true;
GetEquipmentStatusRecordDtosByPage(params).then((response) => {
this.total = response.data.totalCount;
response.data.data.forEach((x) => {
if (x.isEnd == true) {
x.isEnd = "是";
} else {
x.isEnd = "否";
}
});
this.tableData = response.data.data;
this.listLoading = false;
});
},
//d导出
ExportList() {
const params = {
pageNumber: this.queryConfig.currentPage,
perPageCount: this.queryConfig.pageSize,
queryConfig: this.queryConfig,
};
let text = "设备状态信息数据.xlsx";
// 调用下载函数
downloadFile(this.export, params, text);
},
//获取表格行数据
handleSelectionChange(val) {
this.multipleSelection = val;
},
//分页
handleSizeChange(val) {
this.queryConfig.pageSize = val;
this.queryConfig.currentPage = 1;
this.getTableList();
},
handleCurrentChange(val) {
this.queryConfig.currentPage = val;
this.getTableList();
},
},
};
</script>
<style>
.el-row {
margin-bottom: 5px;
}
.table {
border: 1px solid #e5e9f2;
}
.T1 {
border: 1px solid #b3d8ff;
}
.pagination-container {
text-align: center; /* 使分页组件靠右 */
margin-top: 20px; /* 添加顶部间距 */
}
.button-col {
display: flex;
justify-content: flex-end; /* 按钮靠右对齐 */
}
.custom-input .el-input__inner {
background-color: #ffeb3b; /* 设置输入框背景颜色为黄色 */
}
</style>