diff --git a/src/packages/components/CustomComponents/CustomComponents/DeviceRunningState/index.vue b/src/packages/components/CustomComponents/CustomComponents/DeviceRunningState/index.vue index 661aecbb..6ee63fb9 100644 --- a/src/packages/components/CustomComponents/CustomComponents/DeviceRunningState/index.vue +++ b/src/packages/components/CustomComponents/CustomComponents/DeviceRunningState/index.vue @@ -81,11 +81,16 @@ const getData = async() => { offline_num: 0 } }) - if (systemConfig.dglt_device_status_type_config && systemConfig.dglt_device_status_type_config !== '[]') { + let config: any = [] + try { + config = JSON.parse(customData.value.config) + } catch (e) { + console.log(e) + } + if (config && config.length) { // 如果配置了展示的设备分类(不配置默认全部) systemDatas.value = systemDatas.value.filter((e: any) => { - const dglt_device_status_type_config = JSON.parse(systemConfig.dglt_device_status_type_config) - return dglt_device_status_type_config.find((v: any) => v.code === e.device_code) + return config.find((v: any) => v.code === e.device_code) }) } const params = { @@ -121,6 +126,8 @@ const openDialog = (item: any) => { }) } +watch(() => customData.value.config, getData) + let timer:unknown watch(() => [props.chartConfig.request.requestInterval, props.chartConfig.request.requestIntervalUnit].join('&&'), v => { if(!isPreview()) return diff --git a/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/config.ts b/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/config.ts index f1e63182..93b303d5 100644 --- a/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/config.ts +++ b/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/config.ts @@ -9,11 +9,11 @@ export const customData = { title: '近7日用电量', title1: '当月用电量', title2: '年用电量', - barId1: null, - barId2: null, - barName1: '1号楼', - barName2: '2号楼', enable: false, + arr: [ + {id: null, name: '1号楼'}, + {id: null, name: '2号楼'}, + ], showInterval: true, } diff --git a/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/configData.vue b/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/configData.vue index 38941c2f..f4464542 100644 --- a/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/configData.vue +++ b/src/packages/components/CustomComponents/CustomComponents/ElectricityConsumption/configData.vue @@ -13,24 +13,62 @@ - - + + + + + + + - - - - - - - - + + +
+ {{ item }} + + + + + + +
+
+