Bladeren bron

[Mod 0000] 接入统计及首页接入中断数量,部分页面支持全局选择器响应

houzekong 2 maanden geleden
bovenliggende
commit
6dc1aebf7f

+ 3 - 3
src/views/dashboard/SealedGoaf/configurable.data.sealedGoaf.ts

@@ -286,7 +286,7 @@ export const testConfigSealedGoaf: Config[] = [
             },
             {
               label: '中断',
-              value: '${zdNum}',
+              value: '${zdTotal}',
               to: '/basicinfo/mines-info?status=0',
             },
             {
@@ -320,8 +320,8 @@ export const testConfigSealedGoaf: Config[] = [
               prop: 'zxNum',
             },
             {
-              name: '离线',
-              prop: 'lxNum',
+              name: '中断',
+              prop: 'zdNum',
             },
             {
               name: '未接入',

+ 3 - 1
src/views/dashboard/SealedGoaf/index.vue

@@ -146,6 +146,7 @@
       let zxTotal = 0;
       let lxTotal = 0;
       let wjTotal = 0;
+      let zdTotal = 0;
 
       if (Array.isArray(accessDetails)) {
         accessDetails.forEach((item) => {
@@ -153,11 +154,12 @@
           zxTotal += Number(item.zxNum) || 0;
           lxTotal += Number(item.lxNum) || 0;
           wjTotal += Number(item.wjNum) || 0;
+          zdTotal += Number(item.zdNum) || 0;
         });
       }
       const goafAccessCount = {
         accessDetails,
-        totalNum: { yjTotal, zxTotal, lxTotal, wjTotal },
+        totalNum: { yjTotal, zxTotal, lxTotal, wjTotal, zdTotal },
       };
 
       // const coalSeamFireChartData = ['Ⅰ类容易自燃', 'Ⅱ类自燃', 'Ⅲ类不易自燃'].reduce(

+ 6 - 6
src/views/dashboard/basicInfo/accessStatistics/access.data.ts

@@ -43,10 +43,10 @@ export const accessStatisticsColumns: BasicColumn[] = [
     width: 120,
     align: 'center',
   },
-  // {
-  //   title: '离线数量',
-  //   dataIndex: 'lxNum',
-  //   width: 120,
-  //   align: 'center',
-  // },
+  {
+    title: '中断数量',
+    dataIndex: 'zdNum',
+    width: 120,
+    align: 'center',
+  },
 ];

+ 24 - 3
src/views/dashboard/basicInfo/accessStatistics/index.vue

@@ -17,17 +17,26 @@
   import type { BasicColumn } from '/@/components/Table/src/types/table';
   import { useRouter } from 'vue-router';
   import SvgIcon from '/@/components/Icon/src/SvgIcon.vue';
+  import { ref, watch } from 'vue';
+  import { useMineDepartmentStore } from '/@/store/modules/mine';
 
   const router = useRouter();
+  const deptId = ref();
 
   // 封装接口调用,获取数据后手动添加「总计」行
   const fetchTableData = async (params: any) => {
     // 1. 调用原始接口,获取数据
-    const originalRecords = await getGoafAccessCount(params);
+    setLoading(true);
+    const originalRecords = await getGoafAccessCount({
+      deptId: deptId.value,
+      ...params,
+    }).finally(() => {
+      setLoading(false);
+    });
     if (originalRecords.length === 0) return originalRecords; // 无数据时直接返回
 
     // 2. 定义需要求和的数值列字段
-    const numberFields = ['mineNum', 'yjNum', 'wxjrNum', 'jrNum', 'wjNum', 'zxNum', 'lxNum'];
+    const numberFields = ['mineNum', 'yjNum', 'wxjrNum', 'jrNum', 'wjNum', 'zxNum', 'lxNum', 'zdNum'];
 
     // 3. 构建「总计」行对象
     const totalRow = {
@@ -72,7 +81,7 @@
   // 拼接最终列配置(序号列 + 原有业务列)
   const finalTableColumns = [customIndexColumn, ...accessStatisticsColumns];
 
-  const [registerTable] = useTable({
+  const [registerTable, { reload, setLoading }] = useTable({
     title: '矿山信息表格',
     api: fetchTableData, // 数据统计接口
     columns: finalTableColumns,
@@ -101,6 +110,18 @@
       query: { deptId },
     });
   }
+
+  const mineStore = useMineDepartmentStore();
+  watch(
+    () => mineStore.getDepartId,
+    (v) => {
+      deptId.value = v || mineStore.getRootId;
+      reload();
+    },
+    {
+      immediate: true,
+    }
+  );
 </script>
 <style lang="less" scoped>
   :deep(.ant-table-thead th:nth-child(1)) {

+ 21 - 3
src/views/dashboard/basicInfo/closedStatistics/index.vue

@@ -18,14 +18,22 @@
   import { getClosedAccessCount } from '../basicInfo.api';
   import { SvgIcon } from '/@/components/Icon';
   import { useMineDepartmentStore } from '/@/store/modules/mine';
+  import { ref, watch } from 'vue';
 
   // 路由实例
   const router = useRouter();
   const mineStore = useMineDepartmentStore();
+  const deptId = ref();
+
   // 注册表格并获取相关方法
-  const [registerTable] = useTable({
+  const [registerTable, { reload, setLoading }] = useTable({
     title: '老空区永久密闭统计',
-    api: () => getClosedAccessCount({ deptId: mineStore.getRootId }), // 数据统计接口
+    api: () => {
+      setLoading(true);
+      return getClosedAccessCount({ deptId: deptId.value }).finally(() => {
+        setLoading(false);
+      });
+    }, // 数据统计接口
     columns: dataColumns,
     pagination: false,
     useSearchForm: false,
@@ -56,8 +64,18 @@
       // }
     });
   }
+
+  watch(
+    () => mineStore.getDepartId,
+    (v) => {
+      deptId.value = v || mineStore.getRootId;
+      reload();
+    },
+    {
+      immediate: true,
+    }
+  );
 </script>
->
 
 <style lang="less" scoped>
   .action-btn {