deviceTepeManage.vue
16.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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<template>
<div class="app-container">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="设备类型" name="type">
<!-- <Device ref="Device" /> -->
<el-form
:model="queryConfig"
ref="queryConfig"
label-width="110px"
class="demo-queryConfig"
>
<el-row :gutter="10">
<el-col :span="4">
<el-form-item label="设备类型编码:" prop="">
<el-input
v-model="queryConfig.code"
placeholder="请选择设备类型编码"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="设备类型名称:" prop="">
<el-input
v-model="queryConfig.name"
placeholder="请选择设备类型名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="描述:" prop="">
<el-input
v-model="queryConfig.description"
placeholder="请选择描述"
></el-input>
</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" @click="details()"
>查询详情</el-button
>
<el-button class="T1" size="small" @click="btnAdd()"
>新增设备类型</el-button
>
<el-button class="T1" size="small" @click="edit()"
>编辑设备类型</el-button
>
<el-button
class="T1"
size="small"
@click="deleteData()"
type="danger"
>删除设备类型</el-button
>
<!-- <el-button class="T1" @click="goodsTypeModify()" disabled
>导出</el-button
> -->
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="table">
<el-table
:data="tableData"
border
stripe
:height="TableHeight"
@selection-change="handleSelectionChange"
:header-cell-style="{ color: '#000000' }"
>
<el-table-column
type="selection"
align="center"
width="55"
></el-table-column>
<el-table-column prop="id" label="id" width="80"> </el-table-column>
<el-table-column prop="code" label="设备类型编码">
</el-table-column>
<el-table-column prop="name" label="设备类型名"> </el-table-column>
<el-table-column prop="description" label="描述"> </el-table-column>
<el-table-column prop="created" label="创建时间"> </el-table-column>
<el-table-column prop="createdBy" label="创建人"> </el-table-column>
<el-table-column prop="updated" label="更新时间"> </el-table-column>
<el-table-column prop="updatedBy" label="更新人"> </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>
</el-tab-pane>
<el-tab-pane label="设备类型属性" name="typeProperties">
<el-form
:model="queryConfig"
ref="queryConfig"
label-width="110px"
class="demo-queryConfig"
>
<el-row :gutter="10">
<el-col :span="4">
<el-form-item label="设备类型编码:" prop="">
<el-input
v-model="queryConfig.deviceCode"
:disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="设备类型名:" prop="">
<el-input
v-model="queryConfig.deviceName"
:disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="属性编码:" prop="">
<el-input
v-model="queryConfig.equipmentTypePropTemplateCode"
placeholder="请选择属性编码"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="属性类型:" prop="">
<el-select
v-model="queryConfig.typeId"
placeholder="请选择属性类型"
>
<el-option
v-for="item in optionsBllResult"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</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"
>刷新</el-button
>
<el-button class="T1" @click="details()">新增明细</el-button>
<el-button class="T1" @click="details()">编辑明细</el-button>
<el-button class="T1" @click="details()" type="danger"
>删除明细</el-button
>
<!-- <el-button class="T1" @click="goodsTypeModify()" disabled
>明细导出</el-button
> -->
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="table">
<el-table
:data="tableDataTwo"
border
stripe
:height="TableHeight"
@selection-change="handleSelectionChangeTwo"
:header-cell-style="{ color: '#000000' }"
>
<el-table-column
type="selection"
align="center"
width="55"
></el-table-column>
<el-table-column prop="id" label="id"> </el-table-column>
<el-table-column prop="code" label="属性编码"> </el-table-column>
<el-table-column prop="name" label="属性名"> </el-table-column>
<el-table-column prop="propType" label="属性类型">
</el-table-column>
<el-table-column prop="dataType" label="数据类型">
</el-table-column>
<el-table-column prop="address" label="地址"> </el-table-column>
<el-table-column prop="monitorCompareValue" label="监控比较值">
</el-table-column>
<el-table-column prop="monitorNormal" label="监控正常输出">
</el-table-column>
<el-table-column prop="monitorFailure" label="监控异常输出">
</el-table-column>
<el-table-column prop="description" label="描述"> </el-table-column>
<el-table-column prop="created" label="创建时间"> </el-table-column>
<el-table-column prop="createdBy" label="创建人"> </el-table-column>
<el-table-column prop="updated" label="更新时间"> </el-table-column>
<el-table-column prop="updatedBy" label="更新人"> </el-table-column>
</el-table>
</div>
<!-- <DeviceAttributes ref="DeviceAttributes"/> -->
</el-tab-pane>
</el-tabs>
<!-- 新增弹框 -->
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="20%">
<el-form label-width="120px">
<el-row :gutter="25">
<el-col :span="25">
<el-form-item label="设备编码">
<el-input
v-model="elAddDialog.code"
placeholder="请输入设备编码"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="25">
<el-col :span="25">
<el-form-item label="连接名">
<el-input
v-model="elAddDialog.connectName"
placeholder="请输入连接名"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="25">
<el-col :span="25">
<el-form-item label="IP">
<el-input
v-model="elAddDialog.ip"
placeholder="请输入IP"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="taskAdd()">创 建</el-button>
<el-button @click="">清 空</el-button>
<el-button @click="close()">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
GetEquipmentTypes,
GetEquipmentTypePropTemplates,
DeleteEquipmentTypes,
} from "@/api/deviceManage/deviceTepeManage";
import Device from "./deviceManage/device.vue";
import DeviceAttributes from "./deviceManage/device.vue";
export default {
components: {
Device,
DeviceAttributes,
},
data() {
return {
activeName: "type",
tableData: [],
tableDataTwo: [],
//查询条件
queryConfig: {
currentPage: 1,
pageSize: 20,
code: "",
name: "",
description: "",
//设备属性参数
deviceCode: "",
deviceName: "",
propType: "",
},
//新增修改条件
elAddDialog: {
code: "",
name: "",
equipmentTypeId: 0,
connectName: "",
ip: "",
destinationArea: "",
description: "",
disable: false,
},
//新增修改备用条件
elAddDialogTwo: {
code: "",
name: "",
equipmentTypeId: 0,
connectName: "",
ip: "",
destinationArea: "",
description: "",
disable: false,
},
total: 0,
form: {
startTime: this.$moment()
.subtract(3, "days")
.format("YYYY-MM-DD 00:00:00"),
endTime: this.$moment().add(1, "days").format("YYYY-MM-DD 23:59:59"),
},
optionsBllResult: [
{
value: 0,
label: "自身属性",
},
{
value: 1,
label: "PLC数据地址",
},
{
value: 2,
label: "PLC监控地址",
},
],
dialogFormVisible: false,
multipleSelection: [],
multipleSelectionTwo: [],
detailsData: [],
title: "",
};
},
created() {
this.getTableList();
},
computed: {
TableHeight() {
return `calc(100vh - 380px )`;
},
},
methods: {
btnAction() {
this.getTableList();
},
//表格数据
getTableList() {
const params = {
pageNumber: this.queryConfig.currentPage,
perPageCount: this.queryConfig.pageSize,
queryConfig: {
code: this.queryConfig.code,
name: this.queryConfig.name,
description: this.queryConfig.description,
},
};
this.listLoading = true;
GetEquipmentTypes(params).then((response) => {
this.total = response.data.totalCount;
this.tableData = response.data.data;
this.listLoading = false;
});
},
//查询详情
details() {
if (this.multipleSelection.length == 0) {
this.$alert("请选择一条数据!", "标题名称", {
confirmButtonText: "确定",
});
} else {
let parmes;
this.multipleSelection.forEach((X) => {
parmes = {
id: X.id,
code: X.code,
name: X.name,
typeId: X.equipmentTypeId,
ip: X.ip,
destinationArea: X.destinationArea,
requestOrigin: 0,
};
});
GetEquipmentTypePropTemplates(parmes).then((response) => {
if (response.code == "Success") {
if (response.data.length == 0) {
} else {
this.queryConfig.deviceCode = parmes.code;
this.queryConfig.deviceName = parmes.name;
this.tableDataTwo = response.data;
this.activeName = "typeProperties";
}
}
});
}
},
//新增按钮
btnAdd() {
this.title = "新增";
this.dialogFormVisible = true;
this.elAddDialog = this.elAddDialogTwo;
},
//修改按钮
edit() {
this.title = "编辑";
if (this.multipleSelection.length == 0) {
this.$alert("请选择一条数据!", "标题名称", {
confirmButtonText: "确定",
});
} else {
// this.multipleSelection.forEach((x) => {
// this.elAddDialog = {
// id: x.id,
// code: x.code,
// name: x.name,
// equipmentTypeId: x.equipmentTypeId,
// connectName: x.connectName,
// ip: x.ip,
// destinationArea: x.destinationArea,
// description: x.description,
// disable: x.disable,
// };
// });
this.dialogFormVisible = true;
}
},
//新增修改接口
taskAdd() {
SaveEquipment(this.elAddDialog).then((response) => {
if (response.code == "Success") {
this.$message({
message: "数据操作成功",
type: "success",
});
this.getTableList();
}
});
},
//删除按钮
deleteData() {
if (this.multipleSelection.length == 0) {
this.$alert("请选择最少一条数据!", "标题名称", {
confirmButtonText: "确定",
});
} else {
let prams = [];
this.multipleSelection.forEach((x) => {
prams.push(x);
});
DeleteEquipmentTypes(prams).then((response) => {
if (response.code == "Success") {
this.getTableList();
this.$message({
message: "删除成功",
type: "success",
});
}
});
}
},
//获取表格行数据
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleSelectionChangeTwo(val) {
this.multipleSelectionTwo = val;
},
//分页
handleSizeChange(val) {
this.queryConfig.pageSize = val;
this.queryConfig.currentPage = 1;
this.getTableList();
},
handleCurrentChange(val) {
this.queryConfig.currentPage = val;
this.getTableList();
},
handleClick(tab, event) {
console.log(tab, event);
},
//禁用字体颜色
getStatusStyle(status) {
return {
color: status === "已禁用" ? "red" : "green", // 根据状态设置字体颜色
};
},
close() {
this.dialogFormVisible = false;
},
},
};
</script>
<style>
/* 修改复选框大小 */
.el-table .el-checkbox {
transform: scale(1.8) !important; /* 调整大小 */
margin-top: 5px;
}
.el-row {
margin-bottom: 5px;
}
.interfacel-content {
display: flex;
border-radius: 4px;
min-height: 46px;
margin-bottom: 10px;
align-items: center;
}
.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>