Przeglądaj źródła

feat: 碳源投加, 数值绑定调整

sunxiao 6 miesięcy temu
rodzic
commit
95153af4a1

+ 1 - 1
src/components/Chat/ChatText.vue

@@ -164,7 +164,7 @@ const text = computed(() => {
   word-break: break-word;
 
   .custom-table-wrapper {
-    width: 710px;
+    width: 760px;
     padding: 10px 10px 4px 10px;
     background: #eff8fc;
     margin-bottom: 16px;

+ 54 - 23
src/views/control/MedicinalView.vue

@@ -1,6 +1,6 @@
 <script setup>
-import { ref, onMounted, watch, computed, unref } from 'vue';
-import { NScrollbar, useMessage, NTabs, NTabPane } from 'naive-ui';
+import { ref, onMounted, computed, unref } from 'vue';
+import { NScrollbar, useMessage, NTabs, NTabPane, c } from 'naive-ui';
 import { TheChatView } from '@/components';
 import { controlApi } from "@/api/control";
 import BaseTitle from './components/BaseTitle.vue';
@@ -24,7 +24,7 @@ const columnData = ref([
   { label: '水量分配系数', key: 'slfpxs', value: '' },
   { label: '碳源当量', key: 'tydl', value: '' },
   { label: '转换系数', key: 'zhxs', value: '' },
-  { label: '稀释配属', key: 'sxps', value: '' },
+  { label: '稀释倍数', key: 'sxps', value: '' },
   { label: '药剂密度', key: 'yymd', value: '' },
   { label: '最小启动流量', key: 'zxqdll', value: '' },
   { label: '碳氮比', key: 'tdb', value: '' }
@@ -90,11 +90,11 @@ const onEditCancel = () => {
 const onFinalResult = () => {
   const addStatus = systemStatus.value === 0 ? 1 : 0;
 
-  controlApi.putSystemStatus({ addStatus })
+  controlApi.putSystemStatus({ addStatus });
 
   systemStatus.value = addStatus;
 
-  message.warning(addStatus === 0 ? '当前投药状态,已停用' : '当前投药状态,投放中');
+  message.warning(addStatus === 0 ? '当前投药状态:已停用' : '当前投药状态:投放中');
 
 }
 
@@ -105,7 +105,6 @@ const onUpdateTab = (index) => {
     isVisibleUpdateInfo.value = false;
     return;
   }
-  updateNum.value = null;
   handleMedicateAmount();
 }
 
@@ -125,13 +124,13 @@ const getTotalNum = () => {
   const rOne1 = (((2*hycXsyOne-htfksd)+((qycAdOne+qycYxyOne)*xzxs-htfksd))*(jzxs-1))*(jsLlOne*slfpxs)/1000;
   const rOne2 = (rOne1*kzxs-(jsLlOne*slfpxs*jsCodOne*zhxs/1000))/tydl;
   const rOne3 = rOne2/yymd/1000*sxps
-  
+
   const rTwo1 = (((2*hycXsyTwo-htfksd)+((qycAdTwo+qycYxyTwo)*xzxs-htfksd))*(jzxs-1))*(jsLlTwo*slfpxs)/1000;
   const rTwo2 = (rTwo1*kzxs-(jsLlTwo*slfpxs*jsCodTwo*zhxs/1000))/tydl;
   const rTwo3 = rTwo2/yymd/1000*sxps
 
-  const r1 = (rOne3 < 0 || !rOne3) ? 0 : rOne3.toFixed(3);
-  const r2 = (rTwo3 < 0 || !rTwo3) ? 0 : rTwo3.toFixed(3);
+  const r1 = Number((rOne3 < 0 || !rOne3) ? 0 : rOne3.toFixed(3)) || 0;
+  const r2 = Number((rTwo3 < 0 || !rTwo3) ? 0 : rTwo3.toFixed(3)) || 0;
 
   return [ r1, r2 ];
 }
@@ -155,39 +154,44 @@ const handleMedicateAmount = () => {
   const type = tabActiveKey.value;
   const lastNum = unref(updateNum);
 
-  if ( tabActiveKey === 'worker' ) {
+  if ( tabActiveKey.value === 'worker' ) {
     const medicineNum = dataSourceParams.value.worker.medicineAmount;
-    if ( medicineNum && lastNum != medicineNum ) {
+    if ( medicineNum || medicineNum == 0 ) {
       updateNum.value = medicineNum;
       isVisibleUpdateInfo.value = true;
+      message.warning("有新投放方案, 请查看")
+    } else {
+      isVisibleUpdateInfo.value = false;
     }
     return;
   }
 
   const [r1, r2] = getTotalNum();
+  const maxR = Math.max( r1, r2 );
 
-  if ( type === 'auto') {
-    const maxR = Math.max( r1, r2 );
-    if ( maxR != lastNum ) {
-      updateNum.value = maxR;
-      isVisibleUpdateInfo.value = true;
-    }
+  if ( type === 'auto' && maxR !== lastNum) {
+    updateNum.value = maxR;
+    isVisibleUpdateInfo.value = true;
+    message.warning("有新的投放方案, 请查看");
   }
 
-  if ( type === 'onePool' && r1 !== lastNum ) {
+  if ( type === 'onePool' && r1 != lastNum ) {
     updateNum.value = r1;
     isVisibleUpdateInfo.value = true;
+    r1 !== lastNum && message.warning("有新的投放方案, 请查看");
   }
 
-  if ( type === 'twoPool' && r2 !== lastNum) {
+  if ( type === 'twoPool' && r2 != lastNum ) {
     updateNum.value = r2;
     isVisibleUpdateInfo.value = true;
+    message.warning("有新的投放方案, 请查看");
   }
+
 }
 
 onMounted(async () => {
   // 获取最后一条记录  getSystemStatus
-  controlApi.getBaseData().then(({ data }) => {
+  await controlApi.getBaseData().then(({ data }) => {
     const {
       numberBeng = 0, type = 0,
       htfksd, jzxs, xzxs, kzxs, slfpxs, tydl, zhxs, sxps, yymd, zxqdll, tdb,
@@ -203,7 +207,7 @@ onMounted(async () => {
       addType
     };
 
-    updateNum.value = medicineAmount
+    updateNum.value = medicineAmount;
 
     doseNum.value = medicineAmount;
 
@@ -219,11 +223,40 @@ onMounted(async () => {
 
   // 获取实时数据
   controlApi.getNumValue().then(({ data }) => {
+
     Object.entries(data).forEach(([key, val]) => {
       data[key] = val;
     });
     // water实时数据
     waterConfigParams.value = data;
+
+    const params = {
+      jsLlType: 1,
+      jsLlOne: data.jslYB,
+      jsLlTwo: data.jslYB,
+      jsCodType: 1,
+      jsCodOne: data.jsCodYB,
+      jsCodTwo: data.jsCodYB,
+      hycXsyType: 1,
+      hycXsyOne: data.hyXsyHYOne,
+      hycXsyTwo: data.hyXsyHYTwo,
+      qycYxyType: 1,
+      qycYxyOne: data.qyXsyHYOne,
+      qycYxyTwo: data.qyXsyHYTwo,
+      qycAdType: 1,
+      qycAdOne: data.qyAdHYOne,
+      qycAdTwo: data.qyAdHYTwo,
+      jsTnType: 1,
+      jsTnOne: data.jsTnYB,
+      jsTnTwo: data.jsTnYB
+    }
+
+    Object.keys(dataSourceParams.value).forEach(key => {
+      const item = dataSourceParams.value[key];
+      if ( !Object.keys(item).length ) {
+        dataSourceParams.value[key] = params
+      }
+    })
   })
 
   // 获取是否允许投药开关
@@ -241,9 +274,7 @@ onMounted(async () => {
       <template #control>
         <div class="control-container space-x-[12px]">
           <div class="left-section">
-
             <BaseTitle title="智能投加计算"></BaseTitle>
-
             <n-scrollbar class="scrollbar" style="height: 100%;">
               <div class="form-content">
 

+ 4 - 4
src/views/control/components/BaseChooseItem.vue

@@ -1,5 +1,5 @@
 <script setup>
-import { ref, computed, watch } from 'vue';
+import { ref, computed, watch, watchEffect } from 'vue';
 import { useMessage } from 'naive-ui';
 
 import BaseButton from './BaseButton.vue';
@@ -40,8 +40,8 @@ const props = defineProps({
   }
 })
 
-watch(() => modelType.value, (num) => {
-  if ( num === 0 ) {
+watchEffect(() => {
+  if ( modelType.value === 0 ) {
     if ( props.tabKey == 'auto' ) {
       inpVal.value = modelValue1.value;
     }
@@ -49,7 +49,7 @@ watch(() => modelType.value, (num) => {
       inpVal.value = modelValue1.value;
     }
     if ( props.tabKey == 'twoPool' ) {
-      inpVal.value = modelValue2.value;
+      inpVal.value = modelValue1.value;
     }
   }
 })

+ 5 - 20
src/views/control/components/BaseInput.vue

@@ -80,19 +80,6 @@ const handleInpValue = (event, type) => {
     emit('click:cancel', null);
   }
 }
-
-const inputThemeOverrides = {
-  peers: {
-    Input: {
-      text: '#333',
-      border: '1px solid #d7d9e5',
-      borderRadius: '4px',
-      borderHover: '1px solid #2454FF',
-      borderFocus: '1px solid #2454FF',
-      boxShadowFocus: '0 0 0 2px rgba(36, 84, 255, 0.2)'
-    }
-  }
-}
 </script>
 
 <template>
@@ -101,18 +88,16 @@ const inputThemeOverrides = {
       size="small"
       round
       style="width: 100%;"
-      :readonly="readonly"
+      :precision="2"
       :max="99999.99"
       :min="0"
-      :precision="2"
       :placeholder="placeholder"
+      :show-button="false"
+      :on-update:value="onInput"
       :on-blur="onBlur"
       :on-focus="onFocus"
-      :on-update:value="onInput"
-      :show-button="false"
       :value="modelValue"
     >
-
       <template #suffix>
         <div class="unit" v-if="unit">{{ unit }}</div>
       </template>
@@ -121,9 +106,9 @@ const inputThemeOverrides = {
       <!-- <li>
         <SvgIcon name="control-icon-confirm" size="16" @mousedown="handleInpValue($event, 'confirm')"></SvgIcon>
       </li> -->
-      <li v-if="isCloseIcon">
+      <!-- <li v-if="isCloseIcon">
         <SvgIcon name="control-icon-cancel" size="16" @mousedown="handleInpValue($event, 'cancel')"></SvgIcon>
-      </li>
+      </li> -->
     </ul>
   </div>
 </template>

+ 7 - 4
src/views/control/components/TheEchartPanel.vue

@@ -6,6 +6,8 @@ import { startOfDay } from "date-fns/esm"
 import { controlApi } from "@/api/control"
 import dayjs from 'dayjs';
 
+const modelValue = defineModel("height");
+
 let echart = null;
 let tempTabItemOneKey = 0;
 let tempTabItemTwoKey = 'jzxs';
@@ -48,7 +50,7 @@ const coefficientOptions = [
 const seriesName = computed(() => {
   let name = '';
   if ( activeIndex.value === 0) {
-    name = selectOptions.value.find(({ value }) => selectValue.value === value).label
+    name = echartOptions.find(({ value }) => selectValue.value === value).label
   } else {
     name = coefficientOptions.find(item => item.value === selectValue.value).label
   }
@@ -56,7 +58,8 @@ const seriesName = computed(() => {
 })
 
 // 切换tab选项
-const handleSwitchTab = (index) => {;
+const handleSwitchTab = (index) => {
+  if ( activeIndex.value === index ) return;
   activeIndex.value = index;
   if ( !index ) {
     // echart
@@ -101,7 +104,7 @@ const getEchartOptions = (data, type) => {
       top: '40px',
       bottom: '50px',
       left: '6%',
-      right: '6%'
+      right: '6%',
     },
     tooltip: {
       trigger: 'axis',
@@ -338,7 +341,7 @@ onUnmounted(() => {
 .echart-card_view {
   display: flex;
   flex-flow: column;
-  height: calc(100% - 228px);
+  height: calc(100% - 256px);
   padding: 0px 16px 0 25px;
   border-radius: 10px;
 

+ 22 - 13
src/views/control/components/TheResultPanel.vue

@@ -16,11 +16,11 @@ const props = defineProps({
   },
   updateNum: {
     type: Number,
-    default: ''
+    default: 0
   },
   doseNum: {
     type: Number,
-    default: ''
+    default: 0
   },
   configurationStatus: {
     type: Number,
@@ -48,16 +48,18 @@ const emitUpdate = async () => {
   <div>
     <BaseTitle title="智能投加计算结果" type="second"></BaseTitle>
     <div class="result-card_view">
-      <ul class="update-message space-x-[16px]" v-show="isVisibleBtn">
-        <li class="flex space-x-[4px]">
-          <SvgIcon name="control-icon-warning" size="16"></SvgIcon>
-          <span>有新投放方案,系统加药量计算为:{{ updateNum }}m³/h,是否更新?</span>
-        </li>
-        <li class="space-x-[10px]">
-          <span class="text-[#ed742f] cursor-pointer" @click="emitUpdate">更新投放量</span>
-          <span class="text-[#88909b] cursor-pointer" @click="isVisibleBtn = false">取消</span>
-        </li>
-      </ul>
+      <div class="update-message-box">
+        <ul class="update-message space-x-[16px]" v-show="isVisibleBtn">
+          <li class="flex space-x-[4px]">
+            <SvgIcon name="control-icon-warning" size="16"></SvgIcon>
+            <span>有新投放方案,系统加药量计算为:{{ updateNum }}m³/h,是否更新?</span>
+          </li>
+          <li class="space-x-[10px]">
+            <span class="text-[#ed742f] cursor-pointer" @click="emitUpdate">更新投放量</span>
+            <span class="text-[#88909b] cursor-pointer" @click="isVisibleBtn = false">取消</span>
+          </li>
+        </ul>
+      </div>
       <div class="result-card">
         <div class="result-inner space-x-[8px]">
           <div class="result-card_item">
@@ -108,12 +110,19 @@ const emitUpdate = async () => {
 <style lang="scss" scoped>
 
 .result-card_view {
+  position: relative;
+  height: 190px;
   padding: 0px 16px 24px 16px;
 
+  .update-message-box {
+    height: 37px;
+  }
+
   .update-message {
     display: flex;
     align-items: center;
-    height: 37px;
+    width: 100%;
+    height: 100%;
     padding-left: 16px;
     padding-bottom: 7px;
     flex-shrink: 0;