Browse Source

更新

wangqin
hui 8 months ago
parent
commit
85cbd546a9
  1. 1
      ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/Text.vue
  2. 53
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/components/DeviceParams.vue

1
ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/components/Text.vue

@ -33,7 +33,6 @@ export default {
); );
if (templateResult && templateResult != item.key) return templateResult; if (templateResult && templateResult != item.key) return templateResult;
return result || item.text || "-"; return result || item.text || "-";
}, },
getDisplayColor() { getDisplayColor() {

53
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/components/DeviceParams.vue

@ -63,6 +63,22 @@ export default {
dc: '12v', 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) { for (const key in deviceInfo.formatValue) {
// electricity // electricity
// voltage // voltage
@ -70,6 +86,7 @@ export default {
const args = key.match(/[a-z]+|[0-9]+$/g); const args = key.match(/[a-z]+|[0-9]+$/g);
const type = args[0], num = args.slice(-1)[0], prefix = args.slice(0, 2).join('_'); 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( this.devicesList.push(
{ {
label: `支路${num}${typeMap[type]}) 电压`, label: `支路${num}${typeMap[type]}) 电压`,
@ -91,21 +108,24 @@ export default {
{ {
label: '风扇', label: '风扇',
key: `fan_status`, key: `fan_status`,
// key: `aa_electricity_1`,
text: { 0: '正常', 1: '开' }[deviceInfo.formatValue['fan_status']] || '-', text: { 0: '正常', 1: '开' }[deviceInfo.formatValue['fan_status']] || '-',
gridColumn: 1 gridColumn: 2,
}, state: (deviceInfo.formatValue['fan_status']==='0')
{
label: '箱门',
key: `door_status`,
text: { 0: '关闭', 1: '打开' }[deviceInfo.formatValue['door_status']] || '-',
gridColumn: 1
}, },
{ {
label: '温度', label: '温度',
key: `temperature`, key: `temperature`,
text: deviceInfo.formatValue['temperature'] ? `${deviceInfo.formatValue['temperature']} °C` : '-', 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: '湿度', label: '湿度',
key: `humidity`, key: `humidity`,
@ -128,10 +148,19 @@ export default {
}, },
methods: { methods: {
async handleSwitcherChange(value, data) { 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; data.state = value;
let op = ["关闭", "开启"][+data.state]; const isContinue = await confirm({ message: `${str}` })
const isContinue = await confirm({ message: `${op}该支路?` })
.catch(() => { .catch(() => {
console.log(data.state,value,333)
data.state = !value; data.state = !value;
}); });
@ -142,7 +171,7 @@ export default {
url: `/business/device/functions/${this.dialogData.iotDeviceId}/${102}`, url: `/business/device/functions/${this.dialogData.iotDeviceId}/${102}`,
method: "POST", method: "POST",
data: { data: {
deviceName: data.key.match(/^[a-z]+_out|[0-9]+/g).join("_") + "_en", deviceName,
// 1=0= // 1=0=
value: value ? 1 : 0 value: value ? 1 : 0
} }
@ -161,7 +190,7 @@ export default {
}) })
}, },
getSlotKey(key) { getSlotKey(key) {
return key.includes('electricity') ? key : '' return key.includes('electricity') || key.includes('fan') ? key : ''
} }
} }
} }

Loading…
Cancel
Save