diff --git a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue index 238adb5..6ddc6cf 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue @@ -140,30 +140,31 @@ .then((res) => { if (res.msg === 'success') { logList.value = res.data; - infoObject.value = { ...logList.value[0] }; - infoObject.value.state = infoObject.value.state.value; - let colorMap = { - 1: 'rgba(255, 188, 70, 1)', - 2: 'rgba(67, 136, 251, 1)', - 3: 'rgba(41, 196, 154, 1)', - 4: 'rgba(243, 97, 99, 1)', - 5: 'rgba(141, 150, 163, 1)', - }; - let bgColorMap = { - 1: 'rgba(255, 188, 70, 0.1)', - 2: 'rgba(67, 136, 251, 0.1)', - 3: 'rgba(41, 196, 154, 0.1)', - 4: 'rgba(243, 97, 99, 0.1)', - 5: 'rgba(141, 150, 163, 0.1)', - }; - logList.value.forEach((item) => { - item.stateName = item.state.label; - item.color = colorMap[item.state.value]; - item.bgColor = bgColorMap[item.state.value]; - item.src = 'state-' + item.state.value; - }); - console.log(logList.value); - config.value.dataSource = logList.value; + if (logList.value.length > 0) { + infoObject.value = { ...logList.value[0] }; + infoObject.value.state = infoObject.value.state.value; + let colorMap = { + 1: 'rgba(255, 188, 70, 1)', + 2: 'rgba(67, 136, 251, 1)', + 3: 'rgba(41, 196, 154, 1)', + 4: 'rgba(243, 97, 99, 1)', + 5: 'rgba(141, 150, 163, 1)', + }; + let bgColorMap = { + 1: 'rgba(255, 188, 70, 0.1)', + 2: 'rgba(67, 136, 251, 0.1)', + 3: 'rgba(41, 196, 154, 0.1)', + 4: 'rgba(243, 97, 99, 0.1)', + 5: 'rgba(141, 150, 163, 0.1)', + }; + logList.value.forEach((item) => { + item.stateName = item.state.label; + item.color = colorMap[item.state.value]; + item.bgColor = bgColorMap[item.state.value]; + item.src = 'state-' + item.state.value; + }); + config.value.dataSource = logList.value; + } } }); }; diff --git a/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue index aadfdf8..17453ae 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue @@ -147,29 +147,31 @@ .then((res) => { if (res.msg === 'success') { logList.value = res.data; - infoObject.value = { ...logList.value[0] }; - infoObject.value.state = infoObject.value.state.value; - let colorMap = { - 1: 'rgba(255, 188, 70, 1)', - 2: 'rgba(67, 136, 251, 1)', - 3: 'rgba(41, 196, 154, 1)', - 4: 'rgba(243, 97, 99, 1)', - 5: 'rgba(141, 150, 163, 1)', - }; - let bgColorMap = { - 1: 'rgba(255, 188, 70, 0.1)', - 2: 'rgba(67, 136, 251, 0.1)', - 3: 'rgba(41, 196, 154, 0.1)', - 4: 'rgba(243, 97, 99, 0.1)', - 5: 'rgba(141, 150, 163, 0.1)', - }; - logList.value.forEach((item) => { - item.stateName = item.state.label; - item.color = colorMap[item.state.value]; - item.bgColor = bgColorMap[item.state.value]; - item.src = 'state-' + item.state.value; - }); - config.value.dataSource = logList.value; + if (logList.value.length > 0) { + infoObject.value = { ...logList.value[0] }; + infoObject.value.state = infoObject.value.state.value; + let colorMap = { + 1: 'rgba(255, 188, 70, 1)', + 2: 'rgba(67, 136, 251, 1)', + 3: 'rgba(41, 196, 154, 1)', + 4: 'rgba(243, 97, 99, 1)', + 5: 'rgba(141, 150, 163, 1)', + }; + let bgColorMap = { + 1: 'rgba(255, 188, 70, 0.1)', + 2: 'rgba(67, 136, 251, 0.1)', + 3: 'rgba(41, 196, 154, 0.1)', + 4: 'rgba(243, 97, 99, 0.1)', + 5: 'rgba(141, 150, 163, 0.1)', + }; + logList.value.forEach((item) => { + item.stateName = item.state.label; + item.color = colorMap[item.state.value]; + item.bgColor = bgColorMap[item.state.value]; + item.src = 'state-' + item.state.value; + }); + config.value.dataSource = logList.value; + } } }); }; diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue index 0cbeecd..f2e8401 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue @@ -49,7 +49,6 @@ visible.value = false; }; const toggle = async (data) => { - console.log(data, 'xxxxxx'); let states = await getEnum({ params: { enumType: 'AlarmLogStateEnum' } }); stateOptions.value = states.data; let stateMap = {