From e5a9c08749b9c2034fd5a4e7f93c14e804db2778 Mon Sep 17 00:00:00 2001 From: nieli <329261568@qq.com> Date: Mon, 12 Dec 2022 15:10:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E5=A4=87=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20=E5=BC=80=E6=94=BE=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=20=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/components/EUpdateTable/EFailMessage.vue | 52 +++++ src/components/EUpdateTable/ETableInput.vue | 54 +++++ .../DeviceAlarmConfig/DeviceAlarmConfig.vue | 188 ++++++++++++++++-- src/views/profile/DeviceDetailsView/info.vue | 64 +++++- .../DeviceTimingConfig/DeviceTimingConfig.vue | 63 +++--- 6 files changed, 374 insertions(+), 51 deletions(-) create mode 100644 src/components/EUpdateTable/EFailMessage.vue create mode 100644 src/components/EUpdateTable/ETableInput.vue diff --git a/.env.development b/.env.development index e859f106..19b8309e 100644 --- a/.env.development +++ b/.env.development @@ -14,11 +14,11 @@ port= 9988 // 陈志荣 本地 //target = http://192.168.18.140:8899 // 黄明 本地 - target = http://192.168.18.134:8899 +// target = http://192.168.18.134:8899 //target = http://192.168.18.139:8899 // target = http://192.168.18.136:8899 // 测试端 // target = http://192.168.10.241:32024 // 开发端 -// target = http://192.168.10.241:30646 + target = http://192.168.10.241:30646 diff --git a/src/components/EUpdateTable/EFailMessage.vue b/src/components/EUpdateTable/EFailMessage.vue new file mode 100644 index 00000000..a9213349 --- /dev/null +++ b/src/components/EUpdateTable/EFailMessage.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/components/EUpdateTable/ETableInput.vue b/src/components/EUpdateTable/ETableInput.vue new file mode 100644 index 00000000..ed121688 --- /dev/null +++ b/src/components/EUpdateTable/ETableInput.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue b/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue index 15576ec3..6396907a 100644 --- a/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue +++ b/src/views/profile/DeviceAlarmConfig/DeviceAlarmConfig.vue @@ -1,6 +1,6 @@ @@ -75,18 +91,31 @@ prop="alarmValue" label="告警值" align="center" - > + > + + + + > + + + > + +
- 注意*: + 注意*: 欠压:报警值 < 最小预警值 < 最大预警值 < 正常值
过压:正常值 < 最小预警值 < 最大预警值 < 报警值 @@ -198,6 +227,7 @@ import { deviceSendAlarmConfig, } from "@/api/iot/device"; import DialogTemplate from "@/components/DialogTemplate"; +import ETableInput from '@/components/EUpdateTable/ETableInput' export default { name: "DeviceAlarmConfig", props: { @@ -212,13 +242,14 @@ export default { }, components: { DialogTemplate, + ETableInput }, data() { return { list: [], alarmParamOption: [], loading: false, - updateGenTable: false, + updateGenTable: true, title: "修改", open: false, form: {}, @@ -226,6 +257,7 @@ export default { isAck: false, disabledAck: false, uvpList: ["ul_cfg"], + monthTradingTableHeight: 'auto', rules: { warnValueMin: [ { @@ -263,6 +295,113 @@ export default { }, }, methods: { + handleAlarmSta(v) { + console.log(v) + }, + + alarmValueTableCallback(row, callback) { + console.log(row) + if (!row.alarmSta) { + callback(); + return + } + + if(!row.alarmValue && row.alarmValue !== 0) { + callback('告警值不能为空!') + return + } + + const isExp = + /^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/; + + if (row.alarmValue && !isExp.test(row.alarmValue)) { + callback("只可以输入数字类型!"); + return + } + + if (!row.warnSta) { + callback(); + return + } + + if (this.uvpList.indexOf(row.type) >= 0) { + if ( + (row.warnValueMin || row.warnValueMin === 0) && + +row.warnValueMin < +row.alarmValue + ) { + callback("需要小于最小预警值!"); + return + } + } else { + if ( + (row.warnValueMax || row.warnValueMax === 0) && + +row.warnValueMax > +row.alarmValue + ) { + callback("需要大于最大预警值!"); + return + } + } + callback(); + }, + + warnValueMaxTableCallback(row, callback) { + if (!row.warnSta) { + callback(); + return + } + + if (!row.warnValueMax && row.warnValueMax !== 0) { + callback(); + return + } + + const isExp = + /^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/; + + if (row.warnValueMax && !isExp.test(row.warnValueMax)) { + callback("只可以输入数字类型!"); + return + } + + if ( + (row.warnValueMin || row.warnValueMin === 0) && + +row.warnValueMax < +row.warnValueMin + ) { + callback("需要大于最小预警值!"); + return + } + callback(); + }, + + warnValueMinTableCallback(row, callback) { + if (!row.warnSta) { + callback(); + return + } + + if (!row.warnValueMin && row.warnValueMin !== 0) { + callback(); + return + } + + const isExp = + /^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/; + if (row.warnValueMin && !isExp.test(row.warnValueMin)) { + callback("只可以输入数字类型!"); + return + } + + if ( + (row.warnValueMax || row.warnValueMax === 0) && + +row.warnValueMin > +row.warnValueMax + ) { + callback("需要小于最大预警值!"); + return + } + + callback(); + }, + alarmValue(rule, value, callback) { if (!this.form.alarmSta) { callback(); @@ -341,6 +480,7 @@ export default { }, handleSendAck() { var deviceId = this.deviceId; + var list = [...this.list]; this.$prompt("请输入登录密码", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", @@ -349,7 +489,9 @@ export default { inputErrorMessage: "登录密码不能为空", }).then(({ value }) => { let params = { - data: {}, + data: { + params: list, + }, deviceId: deviceId, verifyKey: value, }; @@ -374,15 +516,17 @@ export default { const list = this.list.map((v) => { return v.type === this.form.type ? Object.assign(v, this.form) : v; }); - updateDeviceAlarmConfig({ - devKey: this.deviceKey, - params: [...list], - }).then((res) => { - this.getList(); - // this.disabledAck = true; - this.open = false; - this.$forceUpdate(); - }); + this.open = false; + this.$forceUpdate(); + // 暂时不保存-- 使用统一保存下发方式 + // updateDeviceAlarmConfig({ + // devKey: this.deviceKey, + // params: [...list], + // }).then((res) => { + // this.getList(); + // this.open = false; + // this.$forceUpdate(); + // }); } }); }, @@ -397,7 +541,6 @@ export default { return this.selectDictLabel(this.alarmParamOption, row.type); }, getList() { - console.log(this.deviceKey); if (!this.deviceKey && this.deviceKey !== "0") { return; } @@ -405,6 +548,7 @@ export default { getDeviceAlarmConfig(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; this.loading = false; }) diff --git a/src/views/profile/DeviceDetailsView/info.vue b/src/views/profile/DeviceDetailsView/info.vue index 45f2c163..06d36d12 100644 --- a/src/views/profile/DeviceDetailsView/info.vue +++ b/src/views/profile/DeviceDetailsView/info.vue @@ -63,7 +63,11 @@ {{ infoData.devicePassword }} - 修改密码
@@ -195,6 +199,61 @@
+ +
+
+
+ 告警配置 +
+
+
+ +
+ +
+ +
+
+
+ 定时器 +
+
+
+ +
+ +
+