3
0
Эх сурвалжийг харах

[Fix 0000] 修复关联分析页面的矿井初始化和选择逻辑问题

houzekong 1 долоо хоног өмнө
parent
commit
93f955d786

+ 15 - 8
src/views/analysis/warningAnalysis/connectAnalysis/AnalysisChart.vue

@@ -22,8 +22,10 @@
           <!-- 时间选择 -->
           <!-- 时间选择 -->
           <div class="filter-section param-section">
           <div class="filter-section param-section">
             <span class="filter-label">老空区永久密闭:</span>
             <span class="filter-label">老空区永久密闭:</span>
-            <Select ref="select" v-model:value="goafId" style="width: 300px" placeholder="请选择老空区">
-              <SelectOption v-for="(item, index) in goafOptions" :key="index" :value="item.value">{{ item.label }} </SelectOption>
+            <Select ref="select" v-model:value="goafId" style="width: 300px" placeholder="请选择老空区" @change="generateChart">
+              <SelectOption v-for="(item, index) in goafOptions" :key="index" :value="item.value">
+                {{ item.label }}
+              </SelectOption>
             </Select>
             </Select>
           </div>
           </div>
         </Col>
         </Col>
@@ -83,10 +85,9 @@
   import echartContent from './components/echart-content.vue';
   import echartContent from './components/echart-content.vue';
   import echartDivider from './components/echart-divider.vue';
   import echartDivider from './components/echart-divider.vue';
   import { getGoafHistory } from './connectAnalysis.api';
   import { getGoafHistory } from './connectAnalysis.api';
-  
-  
   import { SvgIcon } from '/@/components/Icon';
   import { SvgIcon } from '/@/components/Icon';
   import { useInitForm } from './hooks/form';
   import { useInitForm } from './hooks/form';
+  import { useMineDepartmentStore } from '/@/store/modules/mine.js';
 
 
   // 这个页面被其他的页面需要,故添加部分props以作复用
   // 这个页面被其他的页面需要,故添加部分props以作复用
   const props = withDefaults(
   const props = withDefaults(
@@ -120,6 +121,7 @@
     }
     }
   );
   );
 
 
+  const mineStore = useMineDepartmentStore();
   const { goafOptions, goafId, innerValue, loading, filters, initGoafOptions } = useInitForm();
   const { goafOptions, goafId, innerValue, loading, filters, initGoafOptions } = useInitForm();
 
 
   // 组件注册
   // 组件注册
@@ -137,18 +139,19 @@
 
 
   //煤矿选项切换
   //煤矿选项切换
   function changeCascader(val) {
   function changeCascader(val) {
+    const dept = mineStore.findDepartById(innerValue.value);
+    if (!dept || !dept?.isLeaf) return;
+
     innerValue.value = val;
     innerValue.value = val;
     initGoafOptions(val).then(() => {
     initGoafOptions(val).then(() => {
-      if (echartData.flag) {
-        goafId.value;
-        generateChart();
-      }
+      generateChart();
     });
     });
   }
   }
   //时间选择选项切换
   //时间选择选项切换
   function changeTime(val) {
   function changeTime(val) {
     dateRange.value[0] = val[0];
     dateRange.value[0] = val[0];
     dateRange.value[1] = val[1];
     dateRange.value[1] = val[1];
+    generateChart();
   }
   }
   //图表选项标签切换
   //图表选项标签切换
   function checkBoxChange(val) {
   function checkBoxChange(val) {
@@ -162,6 +165,7 @@
       return message.info('请先选择煤矿及老空区');
       return message.info('请先选择煤矿及老空区');
     }
     }
 
 
+    loading.value = true;
     echartData.yData.length = 0;
     echartData.yData.length = 0;
     echartData.flag = false;
     echartData.flag = false;
 
 
@@ -177,6 +181,9 @@
       sort: 'asc',
       sort: 'asc',
       ...(props.requestParams || {}),
       ...(props.requestParams || {}),
     });
     });
+
+    loading.value = false;
+
     if (res) {
     if (res) {
       const data = res.records || [];
       const data = res.records || [];
       if (data.length) {
       if (data.length) {

+ 1 - 1
src/views/analysis/warningAnalysis/connectAnalysis/hooks/form.ts

@@ -19,7 +19,7 @@ export function useInitForm({ unlink }: { unlink?: boolean } = {}) {
   if (route.query.deptId) {
   if (route.query.deptId) {
     innerValue.value = route.query.deptId as string;
     innerValue.value = route.query.deptId as string;
   } else {
   } else {
-    const leaf = mineStore.findDepart((e) => e.isLeaf, mineStore.getRoot);
+    const leaf = mineStore.getDepart?.isLeaf ? mineStore.getDepart : mineStore.findDepart((e) => e.isLeaf, mineStore.getRoot);
     innerValue.value = leaf?.id as string;
     innerValue.value = leaf?.id as string;
   }
   }