Przeglądaj źródła

feat: 碳源投加问题修改

sunxiao 5 miesięcy temu
rodzic
commit
cc7c2c5cbf

+ 3 - 3
src/components/Layout/TheLogo.vue

@@ -17,11 +17,11 @@ const handleClick = () => router.push('/');
 
 <template>
   <div class="logo-main flex items-center justify-between py-[14px] px-[20px]">
-    <div class="title flex items-center space-x-2 cursor-pointer" @click="handleClick">
-      <div class="w-[28px] h-[28px]">
+    <div class="w-full title flex items-center space-x-2 cursor-pointer" @click="handleClick">
+      <div class="w-[28px] h-[28px] flex-shrink-0">
         <SvgIcon name="common-logo" size="28"></SvgIcon>
       </div>
-      <span class="block w-[114px] font-[10px] text-left">LibraAI智能体运营平台<br>锡林浩特水务集团</span>
+      <span class="block w-full font-[10px] text-left">LibraAI智能体运营平台<br>锡林浩特水务集团</span>
     </div>
     <!-- 图标 -->
     <div class="icon-group flex items-center justify-center"  @click="changeCollapse" v-show="!subMenuCollapse">

+ 53 - 28
src/views/control/MedicinalView.vue

@@ -1,6 +1,6 @@
 <script setup>
-import { ref, onMounted, computed, unref, watch, h } from 'vue';
-import { NScrollbar, useMessage, NTabs, NTabPane, NSwitch, useNotification, NButton } from 'naive-ui';
+import { ref, onMounted, computed, unref, watch, h, onUnmounted } from 'vue';
+import { NScrollbar, useMessage, NTabs, NTabPane, NSwitch, useNotification } from 'naive-ui';
 import { TheChatView } from '@/components';
 import { controlApi } from "@/api/control";
 import BaseTitle from './components/BaseTitle.vue';
@@ -15,9 +15,12 @@ const notification = useNotification()
 const message = useMessage();
 const isVisibleBtn = ref(true);
 const isVisibleUpdateInfo = ref(false);
-const systemStatus = ref(0);
 const zuTaiStatus = ref({});
 const minAndMaxValue = ref({});
+let msgReactive = '';
+let timer1 = '';
+let timer2 = '';
+let timerInterval = '';
 const resultNumberSet = ref({
   flowNum1: 0,
   flowNum2: 0,
@@ -157,21 +160,6 @@ const onEditCancel = () => {
   })
 }
 
-// 最终提交
-const onFinalResult = async (type) => {
-  const name = type == 'one' ? '南池' : '北池';
-
-  if ( type == 'one' ) {
-    systemStatus.value.activeOne = systemStatus.value.activeOne === 1 ? 0 : 1;
-  } else {
-    systemStatus.value.activeTwo = systemStatus.value.activeTwo === 1 ? 0 : 1;
-  }
-
-  controlApi.putSystemStatus({ ...systemStatus.value });
-
-  message.success(`${name}投药状态更改成功`);
-}
-
 // 切换tabs
 const onUpdateTab = (index) => {
   dataSourceParams.value.type = index;
@@ -265,10 +253,11 @@ const handleMedicateAmount = () => {
 
   if ( type == 0 ) {
     // && dataSourceParams.value.medicineAmountOne != updateNum1
-    if ( !dataSourceParams.value.typeOne  ) {
-      const medicineAmountOne = dataSourceParams.value.medicineAmountOne
+    if ( !dataSourceParams.value.typeOne  ) { // 手动
+      const medicineAmountOne = dataSourceParams.value.medicineAmountOne;
       if ( medicineAmountOne && medicineAmountOne != 0 ) {
         resultNumberSet.value.updateNum1 = dataSourceParams.value.medicineAmountOne;
+        resultNumberSet.value.currentResultNum1 = dataSourceParams.value.medicineAmountOne;
         isVisibleUpdateInfo.value = true;
         // message.warning("北池有新的投放方案, 请查看");
       } else {
@@ -290,6 +279,7 @@ const handleMedicateAmount = () => {
       const medicineAmountTwo = dataSourceParams.value.medicineAmountTwo;
       if (medicineAmountTwo && medicineAmountTwo != 0 ) {
         resultNumberSet.value.updateNum2 = dataSourceParams.value.medicineAmountTwo;
+        resultNumberSet.value.currentResultNum2 = dataSourceParams.value.medicineAmountTwo;
         isVisibleUpdateInfo.value = true;
         // message.warning("南池有新的投放方案, 请查看");
       } else {
@@ -438,7 +428,28 @@ const waringTips = () => {
   console.log("warningList", warningList);
 }
 
+
 onMounted(async () => {
+  let countDown = 5;
+  timer1 = setTimeout(() => {
+    message.warning('有新检测数据,30秒后刷新系统,请注意保存设置', 
+      { duration: 6 * 1000 }
+    )
+    timer2 = setTimeout(() => {
+      msgReactive = message.create('即将更新系统数据,5秒后刷新', {
+        type: 'warning',
+        duration: 6 * 10000
+      });
+      timerInterval = setInterval(() => {
+        if ( countDown == 1 ) {
+          clearInterval(timerInterval);
+          return location.reload();
+        }
+        countDown --;
+        msgReactive.content = `即将更新系统数据,${countDown}秒后刷新`;
+      }, 1000)
+    }, 25 * 1000)
+  }, 4.5 * 60 * 1000);
 
   const { data: valSet } = await controlApi.getMinMaxVal();
   
@@ -465,7 +476,7 @@ onMounted(async () => {
     } = data;
     
     // 0 不可以  组态投放 1 可以   系统投放
-    zuTaiStatus.value = { activeTwo: addTypeOne, activeTwo: addTypeTwo };
+    zuTaiStatus.value = { activeOne: addTypeOne, activeTwo: addTypeTwo };
 
     // 系数
     baseSourceParams.value = {
@@ -496,8 +507,8 @@ onMounted(async () => {
       jsLlTypeTwo, jsLlTwo, jsCodTypeTwo, jsCodTwo, hycXsyTypeTwo, hycXsyTwo, qycYxyTypeTwo, qycYxyTwo, qycAdTypeTwo, qycAdTwo, jsTnTypeTwo, jsTnTwo,
       htfksdTwo, jzxsTwo, xzxsTwo, kzxsTwo, slfpxsTwo, tydlTwo, zhxsTwo, sxpsTwo, yymdTwo, zxqdllTwo, tdbTwo,
 
-      medicineAmountOne: typeOne === 0 ? 0 : medicineAmountOne,
-      medicineAmountTwo: typeTwo === 0 ? 0 : medicineAmountTwo,
+      medicineAmountOne: typeOne == 0 || !typeOne ? null : medicineAmountOne,
+      medicineAmountTwo: typeTwo == 0 || !typeOne ? null : medicineAmountTwo,
 
       addDifferenceOne,
       addDifferenceTwo
@@ -537,6 +548,12 @@ onMounted(async () => {
   // });
 })
 
+onUnmounted(() => {
+  clearTimeout(timer1);
+  clearTimeout(timer2);
+  clearTimeout(timerInterval);
+})
+
 </script>
 
 <template>
@@ -683,8 +700,15 @@ onMounted(async () => {
                       <div class="w-full flex items-center justify-between" v-show="!dataSourceParams.typeOne">
                         <span>人工投放:</span>
                         <div class="w-[200px] flex items-center space-x-[8px]">
-                          <BaseInput :isCloseIcon="false" v-model="dataSourceParams.medicineAmountOne"
-                            @on-blur="handleMedicateAmount" unit="L/h">
+                          <BaseInput
+                            placeholder="请输入人工投放量"
+                            :isCloseIcon="false"
+                            v-model="dataSourceParams.medicineAmountOne"
+                            @on-blur="handleMedicateAmount"
+                            unit="L/h"
+                            :min="minAndMaxValue.minAddAmount"
+                            :max="minAndMaxValue.maxAddAmount"
+                          >
                           </BaseInput>
                         </div>
                       </div>
@@ -813,6 +837,8 @@ onMounted(async () => {
                                   :unit="index === 0 ? 'mg/L' : ''"
                                   :isNeedFlotBtn="false"
                                   :readonly="index === northColumnData.length - 1"
+                                  :min="minAndMaxValue.minAddAmount"
+                                  :max="minAndMaxValue.maxAddAmount"
                                 >
                                 </BaseInput>
                               </div>
@@ -820,12 +846,11 @@ onMounted(async () => {
                           </ul>
                         </BaseCard>
                       </div>
-                      
                       <div class="w-full flex items-center justify-between" v-show="!dataSourceParams.typeTwo">
                         <span>人工投放:</span>
                         <div class="w-[200px] flex items-center space-x-[8px  ]">
                           <BaseInput :isCloseIcon="false" v-model="dataSourceParams.medicineAmountTwo"
-                            @on-blur="handleMedicateAmount" unit="L/h">
+                            @on-blur="handleMedicateAmount" unit="L/h" placeholder="请输入人工投放量">
                           </BaseInput>
                         </div>
                       </div>
@@ -851,9 +876,9 @@ onMounted(async () => {
               >
               </TheResultPanel>
               <TheEchartPanel
-                v-model:change="isVisibleUpdateInfo"
                 :htfksdOne="dataSourceParams.htfksdOne"
                 :htfksdTwo="dataSourceParams.htfksdTwo"
+                v-model:change="isVisibleUpdateInfo"
               ></TheEchartPanel>
             </div>
           </div>

+ 62 - 41
src/views/control/components/TheEchartPanel.vue

@@ -25,22 +25,22 @@ const tabList = ['水质', '系数'];
 
 const selectOptions = ref([]);
 
-const selectEnum = {
-  0:  '进水流量',
-  1:  '北池-好氧池硝酸盐',
-  2:  '南池-好氧池硝酸盐',
-  3:  '北池-缺氧池氨氮',
-  4:  '南池-缺氧池氨氮',
-  5:  '进水COD-连续检测',
-  6:  '进水COD-在线仪表',
-  7:  '进水总氮',
-  8:  '碳源投加量-北池-计算投药量',
-  9:  '碳源投加量-南池-计算投药量',
-  10: '碳源投加量-北池-反馈流量',
-  11: '碳源投加量-南池-反馈流量',
-  12: '北池-后反馈设定',
-  13: '南池-后反馈设定'
-}
+let selectEnum = new Map([
+  ['0', '进水流量'],
+  ['1',  '北池-好氧池硝酸盐'],
+  ['2',  '南池-好氧池硝酸盐'],
+  ['12', '北池-后反馈设定'],
+  ['13', '南池-后反馈设定'],
+  ['3',  '北池-缺氧池氨氮'],
+  ['4',  '南池-缺氧池氨氮'],
+  ['5',  '进水COD-连续检测'],
+  ['6',  '进水COD-在线仪表'],
+  ['7',  '进水总氮'],
+  ['8',  '碳源投加量-北池-计算投药量'],
+  ['9',  '碳源投加量-南池-计算投药量'],
+  ['10', '碳源投加量-北池-反馈流量'],
+  ['11', '碳源投加量-南池-反馈流量']
+])
 
 let echartOptions = [
   { label: "进水流量", value: 0, style: "font-size: 12px" },
@@ -106,18 +106,29 @@ const handleSwitchTab = (index) => {
 const handleSelectOptions = (selectOptionList) => {
   let tempArr = selectOptionList;
   if ( activeIndex.value === 0 ) {
-    if ( selectOptionList.length === 1 && selectOptionList[selectOptionList.length - 1] == 12 ) {
-      selectOptions.value[selectOptions.value.length - 1].disabled = true;
-      tempArr = [];
+    if ( selectOptionList.length <= 1 && selectOptionList.every(item => item > 11) ) {
+      const [item] = selectOptionList;
+      if ( (item == 12 || item == 13) || (!item && item != 0) ) {
+        selectOptions.value.forEach(item => {
+          if ( item.value == 12 || item.value == 13 ) {
+            item.disabled = true;
+          }
+        });
+        tempArr = [];
+      }
     } else {
-      selectOptions.value[selectOptions.value.length - 1].disabled = !selectOptionList.length;
+      selectOptions.value.forEach(item => {
+        if ( item.value == 12 || item.value == 13 ) {
+          item.disabled = false;
+        }
+      });
     }
+    localStorage.setItem('selectValue', JSON.stringify(tempArr));
   }
 
   selectValue.value = tempArr;
-  
-  activeIndex.value === 0 ? initWaterEchart() : intiCoefficientEchartData();
 
+  activeIndex.value === 0 ? initWaterEchart() : intiCoefficientEchartData();
 }
 
 const initWaterEchart = async () => {
@@ -129,7 +140,7 @@ const initWaterEchart = async () => {
 
     tempArr.push(data);
     return ({
-      name: selectEnum[key],
+      name: selectEnum.get(key),
       data
     });
   });
@@ -151,14 +162,7 @@ const windowResize = () => echart.resize();
 
 const getWaterEchartOptions = ({ data, xAxis = [] }) => {
   
-  const lengthList = []
-  let isOff = false;
-  
   const series = data.map(item => {
-    lengthList.push(item.data.length);
-    if ( item.name === '北池-后反馈设定' ) {
-      isOff = true;
-    }
     const d1 = item.data.map(item => {
       return [
         item.time.trim(),
@@ -172,16 +176,16 @@ const getWaterEchartOptions = ({ data, xAxis = [] }) => {
         smooth: true,
         type: 'line',
         symbolSize: 10,
+        // lineStyle: {
+        //   color: '#1ee7ff'
+        // },
+        // itemStyle: {
+        //   color: 'red'
+        // },
         data: d1,
       }
   })
 
-
-  // 12 13
-  console.log( selectValue.value );
-  console.log( selectValue.value.includes(12) );
-  // console.log( selectValue.value.some(item => item == 12 || item == 13) );
-
   if ( selectValue.value.includes('12') ) {
     const data = xAxis.map(time => [time, props.htfksdOne]);
     series.push({
@@ -190,6 +194,9 @@ const getWaterEchartOptions = ({ data, xAxis = [] }) => {
       smooth: true,
       type: 'line',
       symbolSize: 10,
+      lineStyle: {
+        color: 'red'
+      },
       itemStyle: {
         color: 'red'
       },
@@ -205,6 +212,9 @@ const getWaterEchartOptions = ({ data, xAxis = [] }) => {
       smooth: true,
       type: 'line',
       symbolSize: 10,
+      lineStyle: {
+        color: 'red'
+      },
       itemStyle: {
         color: 'red'
       },
@@ -238,7 +248,7 @@ const getWaterEchartOptions = ({ data, xAxis = [] }) => {
     },
     xAxis: {
       type: 'time',
-      boundaryGap: false,
+      boundaryGap: ['5%', '5%'],
       axisLine: {
         show: false
       },
@@ -247,9 +257,12 @@ const getWaterEchartOptions = ({ data, xAxis = [] }) => {
       },
       axisTick: {
         show: false,
-        alignWithLabel: true
+        // alignWithLabel: true
       },
       axisLabel: {
+        // margin: 10,
+        // showMaxLabel: true,
+        // rotate: 1,
         formatter: function (value) {
           return dayjs(value).format('YYYY/MM/DD')
         }
@@ -441,9 +454,17 @@ watch(() => isDomSizeChange.value, (val) => {
 });
 
 onMounted(async () => {
-  echartOptions = Object.entries(selectEnum).map(([key, value]) => {
-    return { label: value, value: key, style: "font-size: 12px"}
-  });
+  
+  const localCacheSelectVal = localStorage.getItem('selectValue');
+ 
+  let tempArr = [];
+  selectEnum.forEach(function(value, key) {
+    tempArr.push({ label: value, value: key, style: "font-size: 12px"});
+  })
+  
+  echartOptions = tempArr;
+
+  selectValue.value = localCacheSelectVal ? JSON.parse(localCacheSelectVal) : [0]
 
   selectOptions.value = echartOptions;
 

+ 10 - 3
src/views/control/components/TheResultPanel.vue

@@ -50,13 +50,20 @@ const noticeTextVal = computed(() => {
 })
 
 const emitEvent = (type) => {
-  // emit('on-click', type);
 
   const name = type == 'one' ? '北池' : '南池';
+  
+
 
   if ( type == 'one' ) {
+    if ( modelSystemStatus.activeOne != 1 ) {
+      return message.warning(name + '-在组态投放下无法开启投放', {duration: 5 * 1000});
+    }
     systemStatus.value.activeOne = systemStatus.value.activeOne === 1 ? 0 : 1;
   } else {
+    if ( modelSystemStatus.activeTwo != 1 ) {
+      return message.warning(name + '-在组态投放下无法开启投放', {duration: 5 * 1000});
+    }
     systemStatus.value.activeTwo = systemStatus.value.activeTwo === 1 ? 0 : 1;
   }
 
@@ -127,7 +134,7 @@ onMounted(() => {
               <div class="circle3" v-show="systemStatus.activeOne === 1"></div>
               <div class="inner space-y-[4px]">
                 <SvgIcon name="control-icon-result-btn" size="14" />
-                <span>{{ systemStatus.activeOne === 1 ? "启动中" : "未启动" }}</span>
+                <span>{{ systemStatus.activeOne === 1 ? "停止" : "启动" }}</span>
               </div>
             </div>
           </div>
@@ -159,7 +166,7 @@ onMounted(() => {
               <div class="circle3" v-show="systemStatus.activeTwo === 1"></div>
               <div class="inner space-y-[4px]">
                 <SvgIcon name="control-icon-result-btn" size="14" />
-                <span>{{ systemStatus.activeTwo === 1 ? "启动中" : "未启动" }}</span>
+                <span>{{ systemStatus.activeTwo === 1 ? "停止" : "启动" }}</span>
               </div>
             </div>
           </div>

+ 8 - 1
src/views/user/index.vue

@@ -60,6 +60,7 @@ const customRenderData = [
     title: '加药量偏移报警值',
     children: [
       { key: 'jylpybjz', label: '大于设定值触发报警', unit: 'L/h', min: 0, max: 999999 },
+      { key: 'timeVal', label: '偏移量统计时间,建议填写5的倍数值', unit: '分', min: 0, max: 999999, precision: 0 },
     ]
   }
 ]
@@ -136,7 +137,13 @@ onMounted(() => {
                 <h4 class="mb-[8px]">{{ item.title }}</h4>
                 <ul class="flex items-center space-x-[24px]">
                   <li class="w-[264px]" v-for="val in item.children">
-                    <BaseNumberInput :unit="val.unit" v-model:value="formValue[val.key]" :min="val.min" :max="val.max"></BaseNumberInput>
+                    <BaseNumberInput
+                      v-model:value="formValue[val.key]"
+                      :unit="val.unit"
+                      :min="val.min"
+                      :max="val.max"
+                      :precision="val.precision"
+                    ></BaseNumberInput>
                     <span class="text-[#B0B7C0] text-[12px]">{{ val.label }}</span>
                   </li>
                   <li v-if="item.title === '投药量'">