Przeglądaj źródła

[Mod 0000] 为矿山基础信息和密闭监测添加瓦斯相关信息

houzekong 3 miesięcy temu
rodzic
commit
7ac24ba354

+ 18 - 20
src/views/dashboard/basicInfo/minesInfo/index.vue

@@ -5,7 +5,7 @@
       <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
     </template>
     <template #action="{ record }">
-      <button @click="handleGoToPageQuery(record, `/sealed/${record.areaId}`)" class="action-btn" title="密闭监测数据">
+      <button @click="handleGoToPageQuery(record, `/sealed/${record.parentId}`)" class="action-btn" title="密闭监测数据">
         <SvgIcon name="data" />
       </button>
       <button @click="handleGoToPage(record, '/basicinfo/access-statistics')" class="action-btn" title="接入统计数据">
@@ -19,19 +19,19 @@
 </template>
 
 <script setup lang="ts">
-  import { ref, nextTick, computed, onMounted } from 'vue';
+  import { ref, nextTick, onMounted } from 'vue';
   import { useRouter } from 'vue-router';
   import { BasicTable } from '/@/components/Table';
   import { SvgIcon } from '/@/components/Icon';
   import { message } from 'ant-design-vue';
   // 引入动态列/表单配置函数 + 类型
-  import { getColumns, searchFormSchema, type ProductionStatusMap } from './minesInfo.data';
+  import { columns, searchFormSchema, type ProductionStatusMap } from './minesInfo.data';
   import { getMineData } from '../basicInfo.api';
   // 引入字典获取方法
   import { getDictItemsByCode } from '/@/utils/dict';
   import { useListPage } from '/@/hooks/system/useListPage';
   import { useIntervalFn } from '@vueuse/core';
-  import { useModal } from '/@/components/Modal';
+  // import { useModal } from '/@/components/Modal';
 
   // 路由实例
   const router = useRouter();
@@ -79,8 +79,6 @@
     }
   };
 
-  // 5. 生成动态列和搜索表单(computed响应式更新)
-  const columns = computed(() => getColumns(dynamicProductionStatusMap));
   // ========== 表格注册 ==========
   const { tableContext: ctxRealtime, onExportXls } = useListPage({
     tableProps: {
@@ -102,7 +100,7 @@
     },
   });
   const [registerRealtimeTable, realtimeTable] = ctxRealtime;
-  const { pause, resume } = useIntervalFn(() => realtimeTable.reload({ silence: true }), 10000);
+  useIntervalFn(() => realtimeTable.reload({ silence: true }), 10000);
 
   // ========== 辅助方法 ==========
   // 安全刷新表格(避免表格未初始化导致的报错)
@@ -120,7 +118,7 @@
    * @param record 当前行数据
    * @param path 目标路径
    */
-  function handleGoToPage(record: any, path: string) {
+  function handleGoToPage(__: any, path: string) {
     router.push({
       path,
     });
@@ -133,18 +131,18 @@
       query: { mineCode },
     });
   }
-  const [registerRealtimeModal, { openModal: openRealtimeModal }] = useModal();
-
-  const openModal = (record) => {
-    openRealtimeModal(true, record);
-    // if (type === 'realtime') {
-    //   // 可向实时弹窗传递当前记录数据
-    // } else {
-    //   // 可向历史弹窗传递当前记录数据
-    //   openHistoryModal(true, record);
-    // }
-    pause();
-  };
+  // const [registerRealtimeModal, { openModal: openRealtimeModal }] = useModal();
+
+  // const openModal = (record) => {
+  //   openRealtimeModal(true, record);
+  //   // if (type === 'realtime') {
+  //   //   // 可向实时弹窗传递当前记录数据
+  //   // } else {
+  //   //   // 可向历史弹窗传递当前记录数据
+  //   //   openHistoryModal(true, record);
+  //   // }
+  //   pause();
+  // };
   // ========== 初始化 ==========
   onMounted(async () => {
     // 先获取生产状态字典,再加载表格

+ 109 - 94
src/views/dashboard/basicInfo/minesInfo/minesInfo.data.ts

@@ -1,7 +1,6 @@
 import { BasicColumn } from '/@/components/Table';
 import { FormSchema } from '/@/components/Table';
 import { h } from 'vue';
-import { Ref } from 'vue';
 import { StatusColorEnum } from '/@/enums/jeecgEnum';
 import { isEmpty } from 'lodash-es';
 
@@ -26,101 +25,104 @@ export type ProductionStatusMap = Record<
 >;
 
 // 3. 生成动态表格列(接收动态状态映射)
-export function getColumns(dynamicStatusMap: Ref<ProductionStatusMap>): BasicColumn[] {
-  return [
-    {
-      title: '煤矿编号',
-      dataIndex: 'mineCode',
-      width: 100,
-    },
-    {
-      title: '所属上级',
-      dataIndex: 'managementName',
-      width: 100,
-    },
-    {
-      title: '煤矿名称',
-      dataIndex: 'mineName',
-      width: 200,
-    },
-    {
-      title: '煤矿简称',
-      dataIndex: 'mineNameAbbr',
-      width: 100,
-      ifShow: false,
-    },
-    {
-      title: '生产状态',
-      dataIndex: 'gjMineStatus',
-      width: 100,
-      // customRender: ({ record }) => {
-      //   // 空值/异常值处理
-      //   const status = String(record.productionStatus || '');
-      //   // 从动态映射取值,兜底未知状态
-      //   const { label, color } = dynamicStatusMap.value[status] || {
-      //     label: '-',
-      //   };
-      //   // 渲染带颜色的文字
-      //   return h(
-      //     'span',
-      //     {
-      //       style: { color: StatusColorEnum[color] },
-      //     },
-      //     label
-      //   );
-      // },
-    },
-    {
-      title: '自燃倾向性',
-      dataIndex: 'alarmLevel',
-      width: 100,
-    },
-    {
-      title: '接入状态',
-      dataIndex: 'accessStatus',
-      width: 100,
-      customRender: ({ record }) => {
-        // 空值/异常值处理
-        const status = String(record.accessStatus);
-        if (isEmpty(status)) {
-          return h('span', '-');
-        }
-        const text = status === '1' ? '接入' : '未接入';
-        const textColor = status === '1' ? StatusColorEnum.green : StatusColorEnum.gold;
-        return h('span', { style: { color: textColor } }, text);
-      },
-    },
-    {
-      title: '在线状态',
-      dataIndex: 'status',
-      width: 100,
-      customRender: ({ record }) => {
-        const status = String(record.status);
-        if (isEmpty(status)) {
-          return h('span', '-');
-        }
-        const text = status === '1' ? '在线' : '离线';
-        const textColor = status === '1' ? StatusColorEnum.green : StatusColorEnum.red;
-        return h('span', { style: { color: textColor } }, text);
-      },
-    },
-    {
-      title: '应接数量',
-      dataIndex: 'yingjieNum',
-      width: 100,
-    },
-    {
-      title: '已接数量',
-      dataIndex: 'accessGoafNum',
-      width: 100,
+export const columns: BasicColumn[] = [
+  {
+    title: '煤矿编号',
+    dataIndex: 'mineCode',
+    width: 100,
+  },
+  {
+    title: '所属上级',
+    dataIndex: 'parentArea',
+    width: 100,
+  },
+  {
+    title: '煤矿名称',
+    dataIndex: 'mineName',
+    width: 200,
+  },
+  {
+    title: '煤矿简称',
+    dataIndex: 'mineNameAbbr',
+    width: 100,
+    ifShow: false,
+  },
+  {
+    title: '生产状态',
+    dataIndex: 'gjMineStatus',
+    width: 100,
+    // customRender: ({ record }) => {
+    //   // 空值/异常值处理
+    //   const status = String(record.productionStatus || '');
+    //   // 从动态映射取值,兜底未知状态
+    //   const { label, color } = dynamicStatusMap.value[status] || {
+    //     label: '-',
+    //   };
+    //   // 渲染带颜色的文字
+    //   return h(
+    //     'span',
+    //     {
+    //       style: { color: StatusColorEnum[color] },
+    //     },
+    //     label
+    //   );
+    // },
+  },
+  {
+    title: '自燃倾向性',
+    dataIndex: 'alarmLevel',
+    width: 100,
+  },
+  {
+    title: '瓦斯等级',
+    dataIndex: 'gasLevelName',
+    width: 100,
+  },
+  {
+    title: '接入状态',
+    dataIndex: 'accessStatus',
+    width: 100,
+    customRender: ({ record }) => {
+      // 空值/异常值处理
+      const status = String(record.accessStatus);
+      if (isEmpty(status)) {
+        return h('span', '-');
+      }
+      const text = status === '1' ? '接入' : '未接入';
+      const textColor = status === '1' ? StatusColorEnum.green : StatusColorEnum.gold;
+      return h('span', { style: { color: textColor } }, text);
     },
-    {
-      title: '未接数量',
-      dataIndex: 'notAccessGoafNum',
-      width: 100,
+  },
+  {
+    title: '在线状态',
+    dataIndex: 'status',
+    width: 100,
+    customRender: ({ record }) => {
+      const status = String(record.status);
+      if (isEmpty(status)) {
+        return h('span', '-');
+      }
+      const text = status === '1' ? '在线' : '离线';
+      const textColor = status === '1' ? StatusColorEnum.green : StatusColorEnum.red;
+      return h('span', { style: { color: textColor } }, text);
     },
-  ];
-}
+  },
+  {
+    title: '应接数量',
+    dataIndex: 'yingjieNum',
+    width: 100,
+  },
+  {
+    title: '已接数量',
+    dataIndex: 'accessGoafNum',
+    width: 100,
+  },
+  {
+    title: '未接数量',
+    dataIndex: 'notAccessGoafNum',
+    width: 100,
+  },
+];
 
 // 4. 生成动态搜索表单配置(接收动态下拉选项)
 export const searchFormSchema: FormSchema[] = [
@@ -171,6 +173,19 @@ export const searchFormSchema: FormSchema[] = [
     },
     colProps: { span: 6 },
   },
+  {
+    field: 'gasLevelName',
+    label: '瓦斯等级',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '低瓦斯', value: '低瓦斯' },
+        { label: '高瓦斯', value: '高瓦斯' },
+        { label: '突出', value: '突出' },
+      ],
+    },
+    colProps: { span: 6 },
+  },
   {
     field: 'riskLevel',
     label: '风险等级',

+ 18 - 0
src/views/monitor/sealedMonitor/monitor.data.ts

@@ -54,6 +54,11 @@ export const columns: BasicColumn[] = [
     dataIndex: 'coalSeamLevel',
     width: 100,
   },
+  {
+    title: '瓦斯等级',
+    dataIndex: 'gasLevelName',
+    width: 100,
+  },
   {
     title: '生产状态',
     dataIndex: 'gjMineStatus',
@@ -198,6 +203,19 @@ export const searchFormSchema: FormSchema[] = [
     },
     colProps: { span: 6 },
   },
+  {
+    field: 'gasLevelName',
+    label: '瓦斯等级',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '低瓦斯', value: '低瓦斯' },
+        { label: '高瓦斯', value: '高瓦斯' },
+        { label: '突出', value: '突出' },
+      ],
+    },
+    colProps: { span: 6 },
+  },
 ];
 
 export const modalDetailsData: {