From 10e298362323abb7eb2a935e5d118bdb1ecf64df Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Thu, 29 Aug 2024 10:09:27 +0800 Subject: [PATCH] =?UTF-8?q?=20fast(=E8=AE=BE=E5=A4=87=E8=AF=A6=E6=83=85):?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E8=AE=BE=E5=A4=87=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/api/iot/device.js | 17 + .../DeviceAlarmConfig/DeviceAlarmConfig.vue | 326 ++++++++++-------- 3 files changed, 194 insertions(+), 150 deletions(-) diff --git a/.gitignore b/.gitignore index 3a6b6c32..7162e932 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ selenium-debug.log package-lock.json yarn.lock /dist.zip +/src/assets/download.zip diff --git a/src/api/iot/device.js b/src/api/iot/device.js index bc3b9175..13f7bd87 100644 --- a/src/api/iot/device.js +++ b/src/api/iot/device.js @@ -205,6 +205,23 @@ export function updateDeviceAlarmConfig(data) { }); } +// 获取设备功能列表 +export function getDeviceAlarmConfigList(devKey) { + return request({ + url: "/iot/func/" + devKey, + method: "get", + }); +} + +// 更新设备功能 +export function updateDeviceAlarmConfigList(data) { + return request({ + url: "/iot/func", + method: "put", + data: data + }); +} + // 同步设备告警配置 export function deviceSendAlarmConfig(data) { return request({ diff --git a/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue b/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue index e4a266b0..79e9c79f 100644 --- a/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue +++ b/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue @@ -3,175 +3,96 @@ 同步下发刷新告警配置 - -
-

设备配置需要先下发到指定设备,设备配置完成后同步到云端平台

- 注意*: - - 欠压:报警值 < 预警值 < 正常值
- 过压:正常值 < 预警值 < 报警值 -
-
- -
+ + + + + + + + + + + + + + +
- - - - - - - - - - - - - +
+ + + + + + + + + + + + 修改 + 下发 + + + + + + - - - - - - - - - - +
@@ -179,12 +100,12 @@ @@ -246,7 +167,7 @@ import { getDeviceAlarmConfig, updateDeviceAlarmConfig, - deviceSendAlarmConfig, + deviceSendAlarmConfig, getDeviceAlarmConfigList, updateDeviceAlarmConfigList } from "@/api/iot/device"; import DialogTemplate from "@/components/DialogTemplate"; import ETableInput from '@/components/EUpdateTable/ETableInput' @@ -314,6 +235,9 @@ export default { ], }, ackList: [], + activeName:'', + groupList:[], + groupActive:'' }; }, created() { @@ -334,6 +258,13 @@ export default { } }, methods: { + getAttrType(obj){ + if(obj.key.endsWith('_state')){ + return 'switch'; + }else{ + return 'input'; + } + }, handleAlarmSta(v) { console.log(v) }, @@ -393,7 +324,7 @@ export default { this.handleDisableAce(callback()); return } - + if (!row.warnValueMax && row.warnValueMax !== 0) { this.handleDisableAce(callback()); return @@ -420,7 +351,7 @@ export default { warnValueMinTableCallback(row, callback) { if (!row.warnSta) { callback(); - return + return } if (!row.warnValueMin && row.warnValueMin !== 0) { @@ -432,7 +363,7 @@ export default { /^((\-)*([1-9][0-9]*)|(\-)*([0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/; if (row.warnValueMin && !isExp.test(row.warnValueMin)) { callback("只可以输入数字类型!"); - return + return } if ( @@ -624,16 +555,74 @@ export default { alarmTypeFormatter(row, column) { return this.selectDictLabel(this.alarmParamOption, row.type); }, + //属性配置列表 + resetAttr(){ + this.getList(); + }, + //下发配置 + sendAttr(data,index,i){ + console.log("下发配置",data) + updateDeviceAlarmConfigList(data).then((res) => { + console.log("res",res) + if(res.code === 200){ + this.msgSuccess(res.msg); + this.groupList[index].list[i].disabled = true; + } + + }); + }, + //切换状态 + toggleState(index,i){ + this.groupList[index].list[i].disabled = !this.groupList[index].list[i].disabled; + }, getList() { if (!this.deviceKey && this.deviceKey !== "0") { return; } this.loading = true; - getDeviceAlarmConfig(this.deviceKey) + getDeviceAlarmConfigList(this.deviceKey) .then((response) => { - this.list = response.data.alarmCfg; - this.monthTradingTableHeight = this.list.length >= 6 ? '387' : 'auto' - this.isAck = response.data.isAck === 1 ? true : false; + console.log("获取设备功能列表",response) + let groupList = []; + if(response?.data.length>0){ + response.data.forEach((item,index)=>{ + let flag = true; + groupList.forEach((val,i)=>{ + if(val.funcType === item.funcType){ + groupList[i].list.push({ + ...item, + disabled: true, + }); + flag = false; + } + }) + if(flag){ + groupList.push({ + funcType: item.funcType, + funcTypeName: item.funcTypeName, + list: [{ + ...item, + disabled: true, + }] + }) + } + }); + this.groupList = groupList; + this.list = groupList[0].list; + this.groupActive = groupList[0].funcType; + // this.list = response.data.map(item=>{ + // return { + // ...item, + // disabled: true, + // }; + // }); + }else{ + this.groupList = []; + this.list = []; + } + + // this.monthTradingTableHeight = this.list.length >= 6 ? '387' : 'auto' + // this.isAck = response.data.isAck === 1 ? true : false; this.loading = false; }) .catch((e) => { @@ -679,4 +668,41 @@ export default { margin: 0; } } +.device-attr-box{ + padding: 0 20px; +} +.alarm-list{ + //border-left:1px solid #666; + .el-collapse{ + border-top: none; + } + .el-tabs__content{ + height: auto !important; + } +} + + + +