From a09f984cbe2369e13d8694e91c4f8165ec6c2ba9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 20 八月 2025 14:05:10 +0800
Subject: [PATCH] 动态溯源模块优化

---
 src/constant/scene-types/options.js                   |    4 ++
 src/views/sourcetrace/SourceTrace.vue                 |   45 ++++++++++++++--------
 src/api/index.js                                      |    4 +-
 src/components.d.ts                                   |    2 
 src/views/sourcetrace/component/ClueRecordItem.vue    |    2 
 src/views/sourcetrace/component/SourceTraceFilter.vue |   41 ++++++++++++++------
 6 files changed, 65 insertions(+), 33 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index ef12b54..edabfb4 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,8 +1,8 @@
 import axios from 'axios';
 import { ElMessage } from 'element-plus';
 
-const openLog = true;
-const debug = true;
+const openLog = false;
+const debug = false;
 
 let ip1 = 'http://47.100.191.150:9029/';
 let ws = `47.100.191.150:9031`;
diff --git a/src/components.d.ts b/src/components.d.ts
index 80dc883..fa422c5 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -14,7 +14,6 @@
     'CardDialog copy': typeof import('./components/CardDialog copy.vue')['default']
     CheckButton: typeof import('./components/common/CheckButton.vue')['default']
     ConfigManage: typeof import('./components/map/ConfigManage.vue')['default']
-    copy: typeof import('./components/CardDialog copy.vue')['default']
     CoreHeader: typeof import('./components/core/CoreHeader.vue')['default']
     CoreMenu: typeof import('./components/core/CoreMenu.vue')['default']
     DataSummary: typeof import('./components/monitor/DataSummary.vue')['default']
@@ -39,6 +38,7 @@
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElIcon: typeof import('element-plus/es')['ElIcon']
     ElInput: typeof import('element-plus/es')['ElInput']
+    ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
     ElLink: typeof import('element-plus/es')['ElLink']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElPagination: typeof import('element-plus/es')['ElPagination']
diff --git a/src/constant/scene-types/options.js b/src/constant/scene-types/options.js
index 1bba61d..07d6822 100644
--- a/src/constant/scene-types/options.js
+++ b/src/constant/scene-types/options.js
@@ -82,5 +82,9 @@
   {
     label: '甯傛帶鐐�',
     value: '20'
+  },
+  {
+    label: '灏忓井绔�',
+    value: '21'
   }
 ];
diff --git a/src/views/sourcetrace/SourceTrace.vue b/src/views/sourcetrace/SourceTrace.vue
index 2ef9353..73dcd07 100644
--- a/src/views/sourcetrace/SourceTrace.vue
+++ b/src/views/sourcetrace/SourceTrace.vue
@@ -200,7 +200,10 @@
         }
 
         // 鍒ゆ柇鍦烘櫙绫诲瀷鏄惁閫変腑
-        if (v.pollutedSource.sceneList.length == 0) {
+        if (
+          v.pollutedSource == undefined ||
+          v.pollutedSource.sceneList.length == 0
+        ) {
           b3 = selectedSceneTypes.value.indexOf(NO_SCENE) != -1;
         } else {
           b3 =
@@ -306,25 +309,29 @@
       }
 
       // 绛涢�夊満鏅被鍨�
-      if (objData.pollutedSource.sceneList.length == 0) {
-        // 鑻ユ病鏈夋壘鍒伴闄╂簮鏃讹紝灏嗚鍒嗙被璁惧畾涓簄ull
-        if (sceneOptions.value.findIndex((v) => v.value == NO_SCENE) == -1) {
-          sceneOptions.value.push({
-            label: '鏈煡',
-            value: NO_SCENE
-          });
-          selectedSceneTypes.value.push(NO_SCENE);
-        }
-      } else {
-        objData.pollutedSource.sceneList.forEach((s) => {
-          if (sceneOptions.value.findIndex((v) => v.value == s.typeId) == -1) {
+      if (objData.pollutedSource != undefined) {
+        if (objData.pollutedSource.sceneList.length == 0) {
+          // 鑻ユ病鏈夋壘鍒伴闄╂簮鏃讹紝灏嗚鍒嗙被璁惧畾涓簄ull
+          if (sceneOptions.value.findIndex((v) => v.value == NO_SCENE) == -1) {
             sceneOptions.value.push({
-              label: s.type,
-              value: s.typeId
+              label: '鏈煡',
+              value: NO_SCENE
             });
-            selectedSceneTypes.value.push(s.typeId);
+            selectedSceneTypes.value.push(NO_SCENE);
           }
-        });
+        } else {
+          objData.pollutedSource.sceneList.forEach((s) => {
+            if (
+              sceneOptions.value.findIndex((v) => v.value == s.typeId) == -1
+            ) {
+              sceneOptions.value.push({
+                label: s.type,
+                value: s.typeId
+              });
+              selectedSceneTypes.value.push(s.typeId);
+            }
+          });
+        }
       }
     // case '2':
     //   break;
@@ -355,6 +362,10 @@
   dataAnalysisApi
     .fetchPollutionTraceHistory(props.missionCode)
     .then((res) => {
+      factorOptions.value = [];
+      selectedFactorTypes.value = [];
+      sceneOptions.value = [];
+      selectedSceneTypes.value = [];
       const objList = JSON.parse(res.data);
       objList.forEach((obj) => {
         obj._type = obj.msgType + '';
diff --git a/src/views/sourcetrace/component/ClueRecordItem.vue b/src/views/sourcetrace/component/ClueRecordItem.vue
index ab8223c..f34ad6c 100644
--- a/src/views/sourcetrace/component/ClueRecordItem.vue
+++ b/src/views/sourcetrace/component/ClueRecordItem.vue
@@ -43,7 +43,7 @@
           <el-text :type="noWarn ? 'info' : 'warning'">
             {{
               item.pollutedSource.sceneList.length == 0
-                ? '鏈壘鍒伴闄╂簮'
+                ? '鍙兘瀛樺湪鐜板満姹℃煋锛岃娉ㄦ剰鍛ㄨ竟鎯呭喌銆�'
                 : '鎵惧埌' + item.pollutedSource.sceneList.length + '涓闄╂簮'
             }}
           </el-text>
diff --git a/src/views/sourcetrace/component/SourceTraceFilter.vue b/src/views/sourcetrace/component/SourceTraceFilter.vue
index e2d4512..75cad99 100644
--- a/src/views/sourcetrace/component/SourceTraceFilter.vue
+++ b/src/views/sourcetrace/component/SourceTraceFilter.vue
@@ -26,15 +26,15 @@
           size="default"
           :min="1"
         >
-          <el-space>
-            <el-checkbox
-              v-for="item in factorOptions"
-              :value="item.value"
-              :key="item.label"
-            >
-              {{ item.label }}
-            </el-checkbox>
-          </el-space>
+          <!-- <el-space> -->
+          <el-checkbox
+            v-for="item in factorOptions"
+            :value="item.value"
+            :key="item.label"
+          >
+            {{ item.label }}
+          </el-checkbox>
+          <!-- </el-space> -->
         </el-checkbox-group>
       </el-space>
     </div>
@@ -65,13 +65,30 @@
 import { ref } from 'vue';
 
 const props = defineProps({
-  // 鏁版嵁鍒囩墖锛岀嚎绱€�佹彁绀恒�佹函婧�
+  /**
+   * 鍖呭惈杩借釜淇℃伅鐨勬暟鎹垏鐗囷紝鍖呮嫭绾跨储銆佹彁绀哄拰婧簮鏁版嵁
+   * @type {Array}
+   */
   dataSlice: Array,
-  // 鐩戞祴鍥犲瓙
+  /**
+   * 鐩戞祴鍥犲瓙绫诲瀷鏁扮粍
+   * @type {Array}
+   */
   factorType: Array,
+  /**
+   * 鐩戞祴鍥犲瓙鐨勫彲鐢ㄩ�夐」
+   * @type {Array<{value: string, label: string}>}
+   */
   factorOptions: Array,
-  // 鍦烘櫙绫诲瀷
+  /**
+   * 鐢ㄤ簬杩囨护鐨勫満鏅被鍨嬫暟缁�
+   * @type {Array}
+   */
   sceneType: Array,
+  /**
+   * 鍦烘櫙閫夋嫨鐨勫彲鐢ㄩ�夐」
+   * @type {Array<{value: string, label: string}>}
+   */
   sceneOptions: Array
 });
 

--
Gitblit v1.9.3