From bdd1d87b6824bb948eb859d72a1c5b93d4c99200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=92=A6?= <360013221@qq.com> Date: Fri, 17 May 2024 14:22:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E6=B5=81=E5=8C=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DeviceControlDialog.vue | 117 ++++++++++++++---- .../components/DeviceParams.vue | 43 ++++--- .../Dialogs/ConfluenceArea/index.vue | 13 +- 3 files changed, 126 insertions(+), 47 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceControlDialog.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceControlDialog.vue index a8b7b0bb..24c2b99c 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceControlDialog.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceControlDialog.vue @@ -1,19 +1,18 @@ @@ -23,6 +22,8 @@ import Button from "@screen/components/Buttons/Button.vue"; import Dialog from "@screen/components/Dialog/index.vue"; import request from "@/utils/request"; + +import { Message } from 'element-ui' import Form from "@screen/components/FormConfig"; export default { name: "DeviceControlDialog", @@ -36,6 +37,12 @@ export default { event: "update:value", }, props: { + + rebind: { + type: Function, + default: null + }, + visible: Boolean, dialogData: { type: Object, @@ -80,36 +87,106 @@ export default { "triggerTextDuration", "normalTextDisplaySettings", "vehicleDetectorSensitivity", - "calculationCycle" + "calculationCycle", + "firstTimePeriodStartTTime", + "firstTimePeriodEndTime", + "firstTimePeriodRedAndBlueFlash", + "firstTimePeriodScreenSwitch", + "firstTimePeriodWhetherToReport", + "firstTimePeriodHornSwitch", + "secondTimePeriodStartTTime", + "secondTimePeriodEndTime", + "secondTimePeriodRedAndBlueFlash", + "secondTimePeriodScreenSwitch", + "secondTimePeriodWhetherToReport", + "secondTimePeriodHornSwitch", + "thirdlyTimePeriodStartTTime", + "thirdlyTimePeriodEndTime", + "thirdlyTimePeriodRedAndBlueFlash", + "thirdlyTimePeriodScreenSwitch", + "thirdlyTimePeriodWhetherToReport", + "thirdlyTimePeriodHornSwitch" ] } }, methods:{ handleSubmit(){ - this.$message.success('发送成功') + const self = this; + this.$refs.FormConfigRef.validate().then((data) => { + + data.numberOfDevices = this.dialogData.iotDeviceId.substr(this.dialogData.iotDeviceId.lastIndexOf('-')+1) + request({ + url: `/business/device/functions/${self.dialogData.iotDeviceId}/0b`, + method: "POST", + data: data + }) + .then(result => { + if (result.code != 200) { + Message.error("操作失败"); + self.rebind() + self.modelVisible = false + return; + }; + Message.success("操作成功"); + }) + .catch(() => { + Message.error("操作失败"); + }) + }) } }, async created() { - let devs = []; request({ url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`, method: "get", }).then(result => { if (result.code != 200) return Message.error("操作失败"); - console.log(result.data) + + let pv = ""; + result.data.forEach(x=>{ + pv += `${x.propertyName},${x.type},${x.property}.` + }) + let n = _.find(result.data,{property:'numberOfPeriods'}); - + let _formList = []; this.list.forEach(e => { const p = _.find(result.data,{property:e}) if(p) { if(p.type === 'string' || p.type === 'long'){ - this.formList.push( { + _formList.push( { label: p.propertyName+':', key: p.property, }) - } - else if(p.property==="colour"){ - this.formList.push({ + } else if(p.type === 'enum' ){ + if(p.property.indexOf('PeriodHornSwitch') !== -1 || + p.property.indexOf('PeriodRedAndBlueFlash') !== -1 || + p.property.indexOf('PeriodWhetherToReport') !== -1 || + p.property.indexOf('firstTimePeriodScreenSwitch') !== -1 ){ // 号角开关 | 红蓝爆闪灯 + _formList.push({ + label: p.propertyName+':', + key: p.property, + type: "RadioGroup", + options: { + activeColor: "linear-gradient(180deg, #37E7FF 0%, #009BCC 100%)", + options: [ + { + key: "0", + label: "关闭", + }, + { + key: "1", + label: "开启", + }, + ], + }, + }) + } else if(p.property.indexOf('PeriodHornSwitch') !== -1){ + + } + + + } else if(p.property==="colour"){ + _formList.push({ label: p.propertyName+':', key: p.property, type: "select", @@ -118,9 +195,8 @@ export default { options: this.enum_color } }) - } - else if(p.property==="wordFlickerFrequency"){ - this.formList.push({ + } else if(p.property==="wordFlickerFrequency"){ + _formList.push({ label: p.propertyName+':', key: p.property, type: "select", @@ -130,11 +206,10 @@ export default { } }) } - this.formData[ p.property] =p.formatValue + this.formData[p.property] = p.value } - }) - console.log(this.formList,this.formData) + this.formList = _formList; }) } @@ -143,12 +218,12 @@ export default {