Browse Source

feat: 碳源投加 - 细节问题调整

sunxiao 1 month ago
parent
commit
e0378da848

+ 3 - 3
src/api/control.js

@@ -27,12 +27,12 @@ export const controlApi = {
   postAddRecord: data => http.post(`/business/medicineParamSetting`, data),
 
   /**
-   * 碳源投加 系统是否可以投放
+   * 碳源投加 系统是否可以投放 - 获取
    */
   getSystemStatus: () => http.get(`/front/bigModel/smartAdd/getSwitchStatus`),
   
   /**
-   * 碳源投加 系统是否可以投放
+   * 碳源投加 系统是否可以投放 - 更新
    */
-  putSystemStatus: data => http.get(`/front/bigModel/smartAdd/updateSwitchStatus`, data),
+  putSystemStatus: data => http.put(`/front/bigModel/smartAdd/updateSwitchStatus`, data),
 }

+ 7 - 16
src/views/control/MedicinalView.vue

@@ -2,17 +2,12 @@
 import { ref, onMounted, watch, computed, unref } from 'vue';
 import { NScrollbar, useMessage, NTabs, NTabPane } from 'naive-ui';
 import { TheChatView } from '@/components';
-
 import { controlApi } from "@/api/control";
-
-import BaseButton from './components/BaseButton.vue';
 import BaseTitle from './components/BaseTitle.vue';
 import BaseRadioCard from './components/BaseRadioCard.vue';
 import BaseCard from './components/BaseCard.vue';
-import BaseRadioGroup from './components/BaseRadioGroup.vue';
 import BaseChooseItem from './components/BaseChooseItem.vue';
 import BaseInput from './components/BaseInput.vue';
-
 import TheResultPanel from './components/TheResultPanel.vue';
 import TheEchartPanel from './components/TheEchartPanel.vue';
 
@@ -20,7 +15,6 @@ const message = useMessage();
 const isVisibleBtn = ref(true);
 const isVisibleUpdateInfo = ref(false);
 const systemStatus = ref(0);
-const configureStatus = ref(1);
 
 const columnData = ref([
   { label: '后反馈设定', key: 'htfksd', value: '' },
@@ -69,9 +63,7 @@ const baseSourceParams = ref({
 // 当前Tab选中的key
 const tabActiveKey = computed(() => tabKeyEnum[baseSourceParams.value.type]);
 
-// 系统状态开关
-const systemSwitchType = computed(() => baseSourceParams.value.addType === 0 && systemStatus.value === 1);
-
+// 编辑系数 - confirm
 const onEditConfirm = () => {
   isVisibleBtn.value = true;
   columnData.value = columnData.value.map(item => {
@@ -82,8 +74,11 @@ const onEditConfirm = () => {
     })
     return item;
   })
+
+  handleMedicateAmount();
 }
 
+// 编辑系数 - 取消
 const onEditCancel = () => {
   isVisibleBtn.value = true;
 
@@ -143,7 +138,7 @@ const getTotalNum = () => {
 
 const onConfirmUpdate = async () => {
 
-  const data = await controlApi.postAddRecord({
+  await controlApi.postAddRecord({
     ...dataSourceParams.value[tabKeyEnum[baseSourceParams.value.type]],
     ...baseSourceParams.value,
   });
@@ -178,7 +173,7 @@ const handleMedicateAmount = () => {
       isVisibleUpdateInfo.value = true;
     }
   }
-  console.log( r1, lastNum );
+
   if ( type === 'onePool' && r1 !== lastNum ) {
     updateNum.value = r1;
     isVisibleUpdateInfo.value = true;
@@ -188,7 +183,6 @@ const handleMedicateAmount = () => {
     updateNum.value = r2;
     isVisibleUpdateInfo.value = true;
   }
-
 }
 
 onMounted(async () => {
@@ -236,14 +230,12 @@ onMounted(async () => {
   controlApi.getSystemStatus().then(({ data }) => {
     // 0不允许  1允许
     systemStatus.value = data;
-    console.log( "获取是否允许投药开关", data );
   });
 })
 
 </script>
 
 <template>
-  {{ systemSwitchType }}
   <section class="flex items-start h-full">
     <TheChatView leftTitle="智适应碳源投加" :isChatSlot="false" :isFooter="false">
       <template #control>
@@ -461,7 +453,6 @@ onMounted(async () => {
                         </p>
                       </div>
                       <div class="space-y-[12px]">
-                        {{  }}
                         <BaseChooseItem
                           tab-key="twoPool"
                           title="进水流量"
@@ -588,7 +579,7 @@ onMounted(async () => {
                       </span>
                       <div style="width: 140px;" v-show="!isVisibleBtn">
                         <BaseInput :unit="index === 0 ? 'mg/L' : ''" size='small' :isNeedFlotBtn="false"
-                          v-model="baseSourceParams[item.key]" isCenter placeholder=""></BaseInput>
+                          v-model="baseSourceParams[item.key]" isCenter placeholder="" :readonly="index === columnData.length - 1"></BaseInput>
                       </div>
                     </li>
                   </ul>

+ 8 - 0
src/views/control/components/BaseInput.vue

@@ -35,6 +35,10 @@ const props = defineProps({
   isCloseIcon: {
     type: Boolean,
     default: true
+  },
+  readonly: {
+    type: Boolean,
+    default: false
   }
 })
 
@@ -97,6 +101,10 @@ const inputThemeOverrides = {
       size="small"
       round
       style="width: 100%;"
+      :readonly="readonly"
+      :max="99999.99"
+      :min="0"
+      :precision="2"
       :placeholder="placeholder"
       :on-blur="onBlur"
       :on-focus="onFocus"

+ 2 - 5
src/views/control/components/TheEchartPanel.vue

@@ -1,6 +1,6 @@
 <script setup>
-import { ref, watch, computed, onMounted, unref, onUnmounted } from 'vue';
-import { NTabs, NTab, NSelect, NDatePicker, NRadio, NRadioButton } from "naive-ui";
+import { ref, computed, onMounted, unref, onUnmounted } from 'vue';
+import { NTabs, NTab, NSelect, NDatePicker } from "naive-ui";
 import * as echarts from 'echarts';
 import { startOfDay } from "date-fns/esm"
 import { controlApi } from "@/api/control"
@@ -19,7 +19,6 @@ const echartDataSource = ref({});
 const echartRef = ref(null);
 const isEmpty = ref(false);
 const activeIndex = ref(0);
-const value = ref();
 
 const tabList = ['水质', '系数'];
 
@@ -59,8 +58,6 @@ const seriesName = computed(() => {
 // 切换tab选项
 const handleSwitchTab = (index) => {;
   activeIndex.value = index;
-  console.log( "dateRangeRef", dateRangeRef.value );
-  console.log( "datePickerValue", datePickerValue.value );
   if ( !index ) {
     // echart
     tempTabItemTwoKey = selectValue.value;

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

@@ -1,5 +1,5 @@
 <script setup>
-import { ref, computed } from 'vue';
+import { computed } from 'vue';
 import { useMessage, NNumberAnimation } from 'naive-ui';
 import BaseTitle from './BaseTitle.vue';
 import { SvgIcon } from '@/components';
@@ -8,7 +8,6 @@ const message = useMessage();
 const isVisibleBtn = defineModel();
 const modelSystemStatus = defineModel('system');
 const emit = defineEmits(['on-click', 'on-update']);
-const isVisible = ref(false);
 
 const props = defineProps({
   flowNum: {
@@ -32,8 +31,6 @@ const props = defineProps({
 const systemSwitchType = computed(() => props.configurationStatus === 0 && modelSystemStatus.value === 1);
 
 const emitEvent = () => {
-  console.log( props.configurationStatus, modelSystemStatus.value );
-
   if ( props.configurationStatus === 1 ) {
     return message.warning('当前组态未启用,无法投放');
   } else {
@@ -93,7 +90,7 @@ const emitUpdate = async () => {
           </div>
         </div>
         <div class="btn-card">
-          <div :class="['round-btn', { active: doseNum }]" @click="emitEvent">
+          <div :class="['round-btn', {disable: configurationStatus === 1}]" @click="emitEvent">
             <div class="circle1" v-show="systemSwitchType"></div>
             <div class="circle2" v-show="systemSwitchType"></div>
             <div class="circle3" v-show="systemSwitchType"></div>
@@ -195,15 +192,19 @@ const emitUpdate = async () => {
     }
   }
 
-  .active {
-    transition: all 0.5s;
-    background: #898EFE;
-
-    .inner {
-      background: #2454FF;
-    }
+  .disable {
+    cursor: not-allowed;
   }
 
+  // .active {
+  //   transition: all 0.5s;
+  //   background: #898EFE;
+
+  //   .inner {
+  //     background: #2454FF;
+  //   }
+  // }
+
   .circle1,
   .circle2,
   .circle3 {