diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/Text.vue b/ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/Text.vue index 403be982..aaed8681 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/Text.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/Text.vue @@ -33,7 +33,6 @@ export default { ); if (templateResult && templateResult != item.key) return templateResult; - return result || item.text || "-"; }, getDisplayColor() { diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/components/DeviceParams.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/components/DeviceParams.vue index 81ecb8ba..3cc445ed 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/components/DeviceParams.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/components/DeviceParams.vue @@ -63,6 +63,22 @@ export default { dc: '12v', } + // { + // ac_out_electricity_1 :"0.07A" + // ac_out_electricity_2 :"4.69A" + // ac_out_voltage_1 :"217.26V" + // ac_out_voltage_2 :"217.30V" + // dc_out_electricity_1 :"0.00A" + // dc_out_electricity_2 :"0.00A" + // dc_out_voltage_1 :"11.44V" + // dc_out_voltage_2 :"11.45V" + // door_status :"1" + // fan_status :"0" + // humidity :"20.3" + // power_status :"1" + // temperature :"18.4" + // } + for (const key in deviceInfo.formatValue) { // electricity 电流 // voltage 电压 @@ -70,6 +86,7 @@ export default { const args = key.match(/[a-z]+|[0-9]+$/g); const type = args[0], num = args.slice(-1)[0], prefix = args.slice(0, 2).join('_'); + // console.log(type , num , prefix , "+++=========="); //dc 2 dc_out this.devicesList.push( { label: `支路${num} (${typeMap[type]}) 电压`, @@ -91,21 +108,24 @@ export default { { label: '风扇', key: `fan_status`, + // key: `aa_electricity_1`, text: { 0: '正常', 1: '开' }[deviceInfo.formatValue['fan_status']] || '-', - gridColumn: 1 - }, - { - label: '箱门', - key: `door_status`, - text: { 0: '关闭', 1: '打开' }[deviceInfo.formatValue['door_status']] || '-', - gridColumn: 1 + gridColumn: 2, + state: (deviceInfo.formatValue['fan_status']==='0') }, + { label: '温度', key: `temperature`, text: deviceInfo.formatValue['temperature'] ? `${deviceInfo.formatValue['temperature']} °C` : '-', - gridColumn: 1 + gridColumn: 2 }, + { + label: '箱门', + key: `door_status`, + text: { 0: '关闭', 1: '打开' }[deviceInfo.formatValue['door_status']] || '-', + gridColumn: 1 + }, { label: '湿度', key: `humidity`, @@ -128,10 +148,19 @@ export default { }, methods: { async handleSwitcherChange(value, data) { + let str = data.state ? "关闭" : "开启"; + let deviceName = ""; + if(data.key.includes("fan")){ + str += "风扇?"; + deviceName = "fan_out_en"; + }else{ + str += "该支路?" + deviceName = data.key.match(/^[a-z]+_out|[0-9]+/g).join("_") + "_en"; //dc_out_2_en ac_out_2_en; + } data.state = value; - let op = ["关闭", "开启"][+data.state]; - const isContinue = await confirm({ message: `${op}该支路?` }) + const isContinue = await confirm({ message: `${str}` }) .catch(() => { + console.log(data.state,value,333) data.state = !value; }); @@ -142,7 +171,7 @@ export default { url: `/business/device/functions/${this.dialogData.iotDeviceId}/${102}`, method: "POST", data: { - deviceName: data.key.match(/^[a-z]+_out|[0-9]+/g).join("_") + "_en", + deviceName, // 开关:1=打开,0=关闭 value: value ? 1 : 0 } @@ -161,7 +190,7 @@ export default { }) }, getSlotKey(key) { - return key.includes('electricity') ? key : '' + return key.includes('electricity') || key.includes('fan') ? key : '' } } }