yanghao 1 settimana fa
parent
commit
5ce708445d
1 ha cambiato i file con 22 aggiunte e 9 eliminazioni
  1. 22 9
      src/views/pms/qhse/socSummary/index.vue

+ 22 - 9
src/views/pms/qhse/socSummary/index.vue

@@ -252,6 +252,7 @@ const handleDeptNodeClick = async (row) => {
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.pageNo = 1
+  resetDrilldown()
   getList()
   getStatic()
 }
@@ -518,7 +519,21 @@ const socChartOption = computed<EChartsOption>(() => {
 })
 
 let staticLoading = ref(false)
+async function loadChildChartData(drilldownKey: string, socClass: string | number) {
+  const res = await IotSocSummaryApi.getSocSummaryStatisticsChild({
+    deptId: queryParams.deptId || userStore.user.deptId,
+    observationDate: queryParams.observationDate,
+    socClass
+  })
+
+  currentDrilldownKey.value = drilldownKey
+  currentDrilldownId.value = socClass
+  childData.value = res?.total || res?.list || res || []
+}
+
 async function getStatic() {
+  const drilldownKey = currentDrilldownKey.value
+  const drilldownId = currentDrilldownId.value
   if (queryParams.deptId) {
     staticLoading.value = true
     const res = await IotSocSummaryApi.getSocSummaryStatistics({
@@ -528,6 +543,9 @@ async function getStatic() {
     })
     totalData.value = res.total || res || []
     childData.value = []
+    if (drilldownKey && drilldownId !== undefined) {
+      await loadChildChartData(drilldownKey, drilldownId)
+    }
     staticLoading.value = false
   } else {
     staticLoading.value = true
@@ -539,6 +557,9 @@ async function getStatic() {
     })
     totalData.value = res.total || res || []
     childData.value = []
+    if (drilldownKey && drilldownId !== undefined) {
+      await loadChildChartData(drilldownKey, drilldownId)
+    }
     staticLoading.value = false
   }
 }
@@ -551,15 +572,7 @@ const handleChartClick = async (params: any) => {
   if (DRILLDOWN_KEYS.some((item) => item === name) && socClass !== undefined) {
     staticLoading.value = true
     try {
-      const res = await IotSocSummaryApi.getSocSummaryStatisticsChild({
-        deptId: queryParams.deptId || userStore.user.deptId,
-        observationDate: queryParams.observationDate,
-        socClass
-      })
-
-      currentDrilldownKey.value = name
-      currentDrilldownId.value = socClass
-      childData.value = res?.total || res?.list || res || []
+      await loadChildChartData(name, socClass)
     } finally {
       staticLoading.value = false
     }