Browse Source

粉尘监测echarts修改-更新提交

lxh 8 months ago
parent
commit
a8849dd6f6

+ 3 - 3
src/views/vent/monitorManager/alarmMonitor/warn/dustWarn.vue

@@ -159,7 +159,7 @@ function topAreaClick(index) {
     echartDat.push({ id: '1', time: JSON.parse(choiceData[index].readData.expectInfo)['aveTime'], value: JSON.parse(choiceData[index].readData.expectInfo)['aveVal'] })
     echartDat.push({ id: '2', time: JSON.parse(choiceData[index].readData.expectInfo)['nowTime'], value: JSON.parse(choiceData[index].readData.expectInfo)['nowVal'] })
     let unique = uniqueObjects(echartDat, 'time');
-    let setData = [...echartDatas.value, ...unique]
+    let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
     setData.forEach((m, n) => {
         echartDataFc.xData.push(m.time);
         if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {
@@ -230,7 +230,7 @@ function getSysWarnList(id, type) {
                 echartDat.push({ id: '1', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveVal'] })
                 echartDat.push({ id: '2', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowVal'] })
                 let unique = uniqueObjects(echartDat, 'time');
-                let setData = [...echartDatas.value, ...unique]
+                let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
                 setData.forEach((m, n) => {
                     echartDataFc.xData.push(m.time);
                     if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {
@@ -261,7 +261,7 @@ function getSysWarnList(id, type) {
                 echartDat.push({ id: '1', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveVal'] })
                 echartDat.push({ id: '2', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowVal'] })
                 let unique = uniqueObjects(echartDat, 'time');
-                let setData = [...echartDatas.value, ...unique]
+                let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
                 setData.forEach((m, n) => {
                     echartDataFc.xData.push(m.time);
                     if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {

+ 2 - 1
src/views/vent/monitorManager/deviceMonitor/components/device/modal/dust.modal.vue

@@ -285,7 +285,8 @@ export default defineComponent({
           echartDat.push({ id: '2', time: JSON.parse(item.readData.expectInfo)['nowTime'], value: JSON.parse(item.readData.expectInfo)['nowVal'] })
 
           let unique = uniqueObjects(echartDat, 'time');
-          let setData = [...echartDatas.value, ...unique]
+          let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
+          
           setData.forEach((m, n) => {
             if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {
               m.ratio = m.value