Преглед на файлове

feat: 数值长度调整

sunxiao преди 8 месеца
родител
ревизия
5f30013153
променени са 5 файла, в които са добавени 35 реда и са изтрити 14 реда
  1. 2 1
      src/utils/format.js
  2. 8 1
      src/views/analyse/ForecastView.vue
  3. 10 1
      src/views/analyse/PymolView.vue
  4. 7 4
      src/views/analyse/WaterView.vue
  5. 8 7
      src/views/analyse/config/index.jsx

+ 2 - 1
src/utils/format.js

@@ -1,7 +1,7 @@
 import { ORDER_OPTION_ENUM } from "./enum";
 
 
-export const formatToData = (dataSource, warnKey, isNoUnit) => {
+export const formatToData = ({ dataSource, warnKey, isNoUnit, statusVal }) => {
   const reuslt = {
     title: dataSource?.title,
     list: []
@@ -10,6 +10,7 @@ export const formatToData = (dataSource, warnKey, isNoUnit) => {
   reuslt.list = Object.entries(dataSource).map(([key, value]) => {
     if ( Number.isFinite(value) ) value = Number(value.toFixed(2));
     if ( key.includes("值") && !isNoUnit) value = value? value + 'mg/L' : '';
+    if ( key === '状态' ) value =  statusVal;
     return { label: key, value, isWarning: warnKey === key };
   });
   return reuslt;

+ 8 - 1
src/views/analyse/ForecastView.vue

@@ -32,11 +32,14 @@ const subMenuRef = ref(null);
 const jsTableData = ref([]);
 const csTableData = ref([]);
 
+const warningActive = ref(0);
+
 // 切换Tabs
 const onChangeTabs = warningStatus => {
   answerResult.value = '';
   textDataSources.value = '';
   onRestore({ warningStatus });
+  warningActive.value = warningStatus;
   subMenuRef.value.scrollToTop();
 }
 
@@ -51,7 +54,11 @@ const handleOpenContent = async ({ id, reason: title }) => {
   chartTitle.value = chartsTitle;
 
   basic.title = title
-  textDataSources.value = formatToData(basic, '预测值');
+  textDataSources.value = formatToData({
+    dataSource: basic,
+    warnKey: '预测值',
+    statusVal: !!warningActive.value ? '已完成' : basic['状态']
+  });
 
   jsTableData.value = [jsData];
   csTableData.value = [csData];

+ 10 - 1
src/views/analyse/PymolView.vue

@@ -25,11 +25,14 @@ const subMenuRef = ref(null);
 const jsTableData = ref([]);
 const csTableData = ref([]);
 
+const warningActive = ref(0);
+
 // 切换Tabs
 const onChangeTabs = warningStatus => {
   answerResult.value = '';
   textDataSources.value = '';
   onRestore({ warningStatus })
+  warningActive.value = warningStatus;
   subMenuRef.value.scrollToTop();
 }
 
@@ -42,7 +45,13 @@ const handleOpenContent = async ({ id, reason:title }) => {
   answerResult.value = data.answer;
 
   basic.title = title
-  textDataSources.value = formatToData(basic, '报警值', true);
+
+  textDataSources.value = formatToData({
+    dataSource: basic,
+    warnKey: '报警值',
+    isNoUnit: true,
+    statusVal: !!warningActive.value ? '系统关闭' : basic['状态']
+  });
 
   jsTableData.value = [jsData];
   csTableData.value = [csData];

+ 7 - 4
src/views/analyse/WaterView.vue

@@ -86,6 +86,8 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
   const showVal = JSON.parse(data.showVal);
   const { basic, jsData, csData } = showVal;
 
+  console.log( csData );
+
   try {
     const answer = JSON.parse(data.answer);
     const reportList = [];
@@ -102,7 +104,6 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
           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 = {
@@ -117,7 +118,6 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
     })
 
     if ( reportList.length ) {
-      console.log( reportList.join("") );
       answerResult.value.push({
         biz: 'DECISION_REPORT',
         answer: reportList.join(""),
@@ -151,7 +151,6 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
       loading: false,
       delayLoading: false
     })
-    console.log("error", error);
   }
 
   cancelFetch();
@@ -214,7 +213,11 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
   // }
 
   basic.title = title;
-  textDataSources.value = formatToData(basic, '报警值');
+  textDataSources.value = formatToData({
+    dataSource: basic,
+    warnKey: '报警值',
+    statusVal: !!warningActive.value ? '系统关闭' : basic['状态']
+  });
 
   jsTableData.value = [jsData];
   csTableData.value = [csData];

+ 8 - 7
src/views/analyse/config/index.jsx

@@ -5,7 +5,8 @@ import { truncateDecimals } from "@/utils/format";
 export const renderRowDom = ({ row, key }) => {
   const { exceed, value } = row[key] || {};
   const cls = exceed ? 'text-[#F44C49] font-bold' : 'text-[1A2029]';
-  return (<span class={ cls }>{truncateDecimals(value)} {exceed && <i>↑</i>}</span>);
+  const num = value ? (value.toFixed(2)) : "";
+  return (<span class={ cls }>{num} {exceed && <i>↑</i>}</span>);
 } 
 
 export const renderTooltip = (trigger, content) => {
@@ -80,7 +81,7 @@ export const outColumns = [
     align: 'center',
     className: 'small',
     width: '80px',
-    render: (row) => renderRowDom({ row, key: '流量' })
+    render: (row) => renderRowDom({ row, key: 'COD' })
   },
   {
     title: () => renderTooltip(h( 'span', 'xsy1(mg/L)' ), '1号好氧池硝酸盐 | 连续检测'),
@@ -89,7 +90,7 @@ export const outColumns = [
     align: 'center',
     className: 'small',
     width: '80px',
-    render: (row) => renderRowDom({ row, key: 'COD' })
+    render: (row) => renderRowDom({ row, key: 'HYC1' })
   },
   {
     title: () => renderTooltip(h( 'span', 'xsy2(mg/L)' ), '2号好氧池硝酸盐 | 连续检测'),
@@ -98,10 +99,10 @@ export const outColumns = [
     align: 'center',
     className: 'small',
     width: '80px',
-    render: (row) => renderRowDom({ row, key: 'TN' })
+    render: (row) => renderRowDom({ row, key: 'HYC2' })
   },
   {
-    title: () => renderTooltip(h( 'span', 'NH₃-N(mg/L)' ), '出水氨氮 | 在线检测'),
+    title: () => renderTooltip(h( 'span', 'NH₃-N(mg/L)' ), '出水氨氮 | 在线仪表'),
     key: 'NH3-N',
     titleAlign: 'center',
     align: 'center',
@@ -111,12 +112,12 @@ export const outColumns = [
   },
   {
     title: () => renderTooltip(h( 'span', 'zlsy(mg/L)' ), '二沉池正磷酸盐 | 连续检测'),
-    key: 'TP',
+    key: 'RCC',
     titleAlign: 'center',
     align: 'center',
     className: 'small',
     width: '80px',
-    render: (row) => renderRowDom({ row, key: 'TP' })
+    render: (row) => renderRowDom({ row, key: 'RCC' })
   },
   {
     title: () => renderTooltip(h( 'span', 'SS(mg/L)' ), '出水SS | 在线仪表'),