whh преди 9 месеца
родител
ревизия
4565f2abef
променени са 3 файла, в които са добавени 130 реда и са изтрити 58 реда
  1. 2 2
      src/components/RecodeSquareCardItem/index.vue
  2. 116 50
      src/views/analyse/WaterView.vue
  3. 12 6
      src/views/screen/components/liuliang.vue

+ 2 - 2
src/components/RecodeSquareCardItem/index.vue

@@ -78,11 +78,11 @@ const dataSources = computed(() => {
   }
   if (item.type == 2) {
     return [
-      { label: '预警时间', value: item.createTime },
+      { label: '预警时间', value: item.updateTime },
       { label: '超标时间', value: item.time },
       { label: '现在值', value: Number(item?.warningVal?.toFixed(2)) ?? '', unit: 'mg/L' },
       { label: '预测值', value: Number(item?.forecastVal?.toFixed(2)) ?? '', type: 'wraning', unit: 'mg/L' },
-      { label: '设计值', value: item.designVal, unit: 'mg/L' }
+      { label: '标准值', value: item.designVal, unit: 'mg/L' }
     ]
   }
 });

+ 116 - 50
src/views/analyse/WaterView.vue

@@ -78,72 +78,138 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
   flowParams.simulate = '{}';
 
   answerLoading.value = false;
+  
+  answerResult.value = [];
 
   const { data } = await waterApi.getWaringDetails(id);
-
-  const answer = JSON.parse(data.answer);
   const showVal = JSON.parse(data.showVal);
   const { basic, jsData, csData } = showVal;
- 
-  cancelFetch();
 
-  answerResult.value = [];
+  try {
+    const answer = JSON.parse(data.answer);
+    const reportList = [];
+    const alertList = [];
+    let simulateObj = null;
+  
+    answer.map(item => {
+      const answerObjItem = JSON.parse(item);
+      switch(answerObjItem.biz) {
+        case "DECISION_REPORT":
+          reportList.push(answerObjItem.message);
+          break
+        case "DECISION_ALERT":
+          alertList.push(answerObjItem);
+          break
+        case "DECISION_SIMULATE":
+          console.log( "DECISION_SIMULATE", answerObjItem.message );
+          if (warningActive.value === 1) return; 
+          const { off, on, pred } = JSON.parse(answerObjItem.message);
+          simulateObj = {
+            biz: 'DECISION_SIMULATE',
+            off,
+            on,
+            pred,
+            isDisable: false
+          }
+          modalData.value = simulateObj;
+      }
+    })
 
-  const reportList = [];
-  const alertList = [];
-  let simulateObj = null;
- 
-  answer.map(item => {
-    const answerObjItem = JSON.parse(item);
-    switch(answerObjItem.biz) {
-      case "DECISION_REPORT":
-        reportList.push(answerObjItem.message);
-        break
-      case "DECISION_ALERT":
-        alertList.push(answerObjItem);
-        break
-      case "DECISION_SIMULATE":
-        console.log( "DECISION_SIMULATE", answerObjItem.message );
-        if (warningActive.value === 1) return; 
-        const { off, on, pred } = JSON.parse(answerObjItem.message);
-        console.log( JSON.parse(answerObjItem.message) );
-        simulateObj = {
-          biz: 'DECISION_SIMULATE',
-          off,
-          on,
-          pred,
-          isDisable: false
-        }
-        modalData.value = simulateObj;
+    if ( reportList.length ) {
+      answerResult.value.push({
+        biz: 'DECISION_REPORT',
+        answer: reportList.join(""),
+        loading: false,
+        delayLoading: false
+      })
+    }
+
+    if ( alertList.length ) {
+      const [ parseAnswer ] = alertList.map(item => {
+        item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
+        return item;
+      })
+      answerResult.value.push({
+        biz: 'DECISION_ALERT',
+        loading: false,
+        delayLoading: false,
+        isAllSelect: false,
+        list: parseAnswer?.message
+      })
     }
-  })
 
-  if ( reportList.length ) {
+    if (simulateObj) {
+      answerResult.value.push(simulateObj);
+    }
+    
+  } catch (error) {
     answerResult.value.push({
       biz: 'DECISION_REPORT',
-      answer: reportList.join(""),
+      answer: data.answer,
       loading: false,
       delayLoading: false
     })
+    console.log("error", error);
   }
 
-  if ( alertList.length ) {
-    const [ parseAnswer ] = alertList.map(item => {
-      item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
-      return item;
-    })
-    answerResult.value.push({
-      biz: 'DECISION_ALERT',
-      loading: false,
-      delayLoading: false,
-      isAllSelect: false,
-      list: parseAnswer?.message
-    })
-  }
+  cancelFetch();
 
-  if (simulateObj) {
-    answerResult.value.push(simulateObj);
-  }
+  // answerResult.value = [];
+
+  // const reportList = [];
+  // const alertList = [];
+  // let simulateObj = null;
+ 
+  // answer.map(item => {
+  //   const answerObjItem = JSON.parse(item);
+  //   switch(answerObjItem.biz) {
+  //     case "DECISION_REPORT":
+  //       reportList.push(answerObjItem.message);
+  //       break
+  //     case "DECISION_ALERT":
+  //       alertList.push(answerObjItem);
+  //       break
+  //     case "DECISION_SIMULATE":
+  //       console.log( "DECISION_SIMULATE", answerObjItem.message );
+  //       if (warningActive.value === 1) return; 
+  //       const { off, on, pred } = JSON.parse(answerObjItem.message);
+  //       simulateObj = {
+  //         biz: 'DECISION_SIMULATE',
+  //         off,
+  //         on,
+  //         pred,
+  //         isDisable: false
+  //       }
+  //       modalData.value = simulateObj;
+  //   }
+  // })
+
+  // if ( reportList.length ) {
+  //   answerResult.value.push({
+  //     biz: 'DECISION_REPORT',
+  //     answer: reportList.join(""),
+  //     loading: false,
+  //     delayLoading: false
+  //   })
+  // }
+
+  // if ( alertList.length ) {
+  //   const [ parseAnswer ] = alertList.map(item => {
+  //     item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
+  //     return item;
+  //   })
+  //   answerResult.value.push({
+  //     biz: 'DECISION_ALERT',
+  //     loading: false,
+  //     delayLoading: false,
+  //     isAllSelect: false,
+  //     list: parseAnswer?.message
+  //   })
+  // }
+
+  // if (simulateObj) {
+  //   answerResult.value.push(simulateObj);
+  // }
 
   basic.title = title;
   textDataSources.value = formatToData(basic, '报警值');

+ 12 - 6
src/views/screen/components/liuliang.vue

@@ -22,6 +22,12 @@ const showHBarrow = (value) => {
 const showVal = (value) => {
   return value ? Number(value).toFixed(2) : 0
 }
+
+const getStyle = (value) => {
+  return {
+    color: value > 0 ? '#F0727A' : '#38c348'
+  }
+}
 </script>
 
 <template>
@@ -38,34 +44,34 @@ const showVal = (value) => {
         <li class="box-wrap-item">
           <div class="dess">瞬时 m³/h</div>
           <div class="num">{{ showVal(screenData.jsSlq) }}</div>
-          <div class="footer">{{ showHBarrow(screenData.ssJsHb) }}%</div>
+          <div class="footer" :style="getStyle(screenData.ssJsHb)">{{ showHBarrow(screenData.ssJsHb) }}%</div>
         </li>
         <li class="box-wrap-item">
           <div class="dess">昨日累计 m³/d</div>
           <div class="num">{{ showVal(screenData.zrZJSL) }}</div>
-          <div class="footer">{{ showHBarrow(screenData.zrZJsHb) }}%</div>
+          <div class="footer" :style="getStyle(screenData.zrZJsHb)">{{ showHBarrow(screenData.zrZJsHb) }}%</div>
         </li>
         <li class="box-wrap-item">
           <div class="dess">周均值 m³/d</div>
           <div class="num">{{ showVal(screenData.szZJSAvg) }}</div>
-          <div class="footer">{{ showHBarrow(screenData.szZJSHb) }}%</div>
+          <div class="footer" :style="getStyle(screenData.szZJSHb)">{{ showHBarrow(screenData.szZJSHb) }}%</div>
         </li>
       </ul>
       <ul class="box-wrap-list" v-show="index === 1">
         <li class="box-wrap-item">
           <div class="dess">瞬时 m³/h</div>
           <div class="num">{{ showVal(screenData.csSlqc) }}</div>
-          <div class="footer">{{ showHBarrow(screenData.ssCsHb) }}%</div>
+          <div class="footer" :style="getStyle(screenData.ssCsHb)">{{ showHBarrow(screenData.ssCsHb) }}%</div>
         </li>
         <li class="box-wrap-item">
           <div class="dess">昨日累计 m³/d</div>
           <div class="num">{{ showVal(screenData.zrZCSL) }}</div>
-          <div class="footer">{{ showHBarrow(screenData.zrZCsHb) }}%</div>
+          <div class="footer" :style="getStyle(screenData.zrZCsHb)">{{ showHBarrow(screenData.zrZCsHb) }}%</div>
         </li>
         <li class="box-wrap-item">
           <div class="dess">周均值 m³/d</div>
           <div class="num">{{ showVal(screenData.szZCSAvg) }}</div>
-          <div class="footer">{{ showHBarrow(screenData.szZCSHb) }}%</div>
+          <div class="footer" :style="getStyle(screenData.szZCSHb)">{{ showHBarrow(screenData.szZCSHb) }}%</div>
         </li>
       </ul>
     </div>