Procházet zdrojové kódy

feat: 火灾分析-火灾分布排序

TwoKe945 před 1 rokem
rodič
revize
16b665e739

+ 30 - 6
app/src/views/FireCondition/components/FireDistribution.vue

@@ -64,6 +64,7 @@ export default {
   methods: {
     changeHandler(idx) {
       this.idx = idx;
+      this.list = toFirst(this.sortData(this.list), this.qx, 'qx')
     },
     getPercent(bn, tq) {
       if (bn - tq === 0) {
@@ -86,21 +87,44 @@ export default {
         return null;
       }
     },
+    sortData(tempData) {
+      const sub1 = tempData.filter(item => {
+        if (this.idx === 0) {
+          return item.hzIcon === upIcon
+        } else {
+          return item.wrIcon === upIcon
+        }
+      }).sort((a,b) => parseInt(b.hzPercent.replace("%", "")) - parseInt(a.hzPercent.replace("%", "")))
+      const sub2 = tempData.filter(item => {
+        if (this.idx === 0) {
+          return item.hzIcon === null
+        } else {
+          return item.wrIcon === null
+        }
+      })
+      const sub3 = tempData.filter(item => {
+        if (this.idx === 0) {
+          return item.hzIcon === downIcon
+        } else {
+          return item.wrIcon === downIcon
+        }
+      }).sort((a,b) =>  parseInt(a.hzPercent.replace("%", "")) - parseInt(b.hzPercent.replace("%", "")))
+      return [...sub1, ...sub2, ...sub3]
+    },
     loadData() {
       this.reload = false
       fireDistribution({
         pageSize: 100,
         pageNum: 1,
-        // qx: this.qx
       }).then(res => {
         let tempData = res.data.rows.map(item => ({...item,
-          hzPercent: this.getPercent(item.bnhzqs, item.tqhzqs),
-          wrPercent: this.getPercent(item.bnwrs, item.tqwrs),
-          hzIcon: this.getIcon(item.bnhzqs, item.tqhzqs),
-          wrIcon: this.getIcon(item.bnwrs, item.tqwrs),
+          hzPercent: this.getPercent(item.bnhzqs, item.tqhzqs || 0),
+          wrPercent: this.getPercent(item.bnwrs, item.tqwrs || 0),
+          hzIcon: this.getIcon(item.bnhzqs, item.tqhzqs || 0),
+          wrIcon: this.getIcon(item.bnwrs, item.tqwrs || 0),
           isActive: item.qx === this.qx
         }))
-        this.list = toFirst(tempData, this.qx, 'qx')
+        this.list = toFirst(this.sortData(tempData), this.qx, 'qx')
         this.reload = true
       })
     }

+ 3 - 1
app/src/views/FireCondition/components/KeyIndex/KeyChart.vue

@@ -65,6 +65,7 @@ export default {
           axisLine: {
             show: false,
           },
+          minInterval: 1,
           axisLabel: {
             color: '#fff'
           },
@@ -82,7 +83,8 @@ export default {
       },
         grid: {
           right: '8px',
-          top: '20px'
+          top: '20px',
+          left: "65px"
         },
         series: [
           {

+ 5 - 2
utils/index.js

@@ -19,16 +19,19 @@ export {
 
 export function calcPercent(bn, tq) {
   if (bn - tq === 0) {
-    return '0%'
+    return '-'
   }
   if (tq === 0) {
-    return '100%'
+    return '-'
   }
   return `${(parseInt((Math.abs(bn - tq) / tq).toFixed(2) * 100 ))}%`
 }
 
 
 export function getState(bn, tq) {
+  if(tq === 0) {
+    return 0;
+  }
   if (bn -tq > 0) {
     return 1;
   } else if (bn - tq < 0){