Quellcode durchsuchen

[Mod 0000]矿山基础信息下页面修改

wangkeyi vor 5 Monaten
Ursprung
Commit
f43717e196

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

@@ -14,17 +14,7 @@ export function getAccessStatisticsColumns(): BasicColumn[] {
       width: 80,
       fixed: 'left',
       align: 'center',
-      // 处理合计行序号为空的情况
-      customCell: (text) => text || '',
-      customHeaderCell: () => ({
-        rowSpan: 2, // 合并2行表头(第一行表头 + 第二行空白单元格)
-        style: {
-          textAlign: 'center', // 文本水平居中
-          verticalAlign: 'middle', // 文本垂直居中(解决合并后文字偏移)
-          borderRight: '1px solid #f0f0f0' // 修复合并后边框缺失问题
-        }
-      }),
-
+      customRender: ({ index }: { index: number }) => `${index + 1}`,
     },
     {
       title: '区域',
@@ -76,85 +66,4 @@ export function getAccessStatisticsColumns(): BasicColumn[] {
       align: 'center',
     },
   ];
-}
-
-export const tableMockData = [
-    {
-        id: '', // 序号为空
-        region: '合计',
-        totalCoalMines: 358,
-        shouldAccess: 304,
-        noNeedAccess: 54,
-        accessed: 297,
-        notAccessed: 7,
-        online: 289,
-        offline: 8,
-    },
-    // 各区域数据行
-    {
-        id: '101',
-        region: '执法一处',
-        totalCoalMines: 116,
-        shouldAccess: 99,
-        noNeedAccess: 17,
-        accessed: 97,
-        notAccessed: 2,
-        online: 96,
-        offline: 1,
-    },
-    {
-        id: '102',
-        region: '执法二处',
-        totalCoalMines: 107,
-        shouldAccess: 89,
-        noNeedAccess: 18,
-        accessed: 86,
-        notAccessed: 3,
-        online: 84,
-        offline: 2,
-    },
-    {
-        id: '103',
-        region: '执法三处',
-        totalCoalMines: 49,
-        shouldAccess: 45,
-        noNeedAccess: 4,
-        accessed: 45,
-        notAccessed: 0,
-        online: 44,
-        offline: 1,
-    },
-    {
-        id: '104',
-        region: '执法四处',
-        totalCoalMines: 43,
-        shouldAccess: 34,
-        noNeedAccess: 9,
-        accessed: 34,
-        notAccessed: 0,
-        online: 30,
-        offline: 4,
-    },
-    {
-        id: '105',
-        region: '执法五处',
-        totalCoalMines: 37,
-        shouldAccess: 33,
-        noNeedAccess: 4,
-        accessed: 33,
-        notAccessed: 0,
-        online: 33,
-        offline: 0,
-    },
-    {
-        id: '107',
-        region: '执法七处',
-        totalCoalMines: 6,
-        shouldAccess: 4,
-        noNeedAccess: 2,
-        accessed: 2,
-        notAccessed: 2,
-        online: 2,
-        offline: 0,
-    },
-]
+}

+ 1 - 1
src/views/dashboard/basicInfo/accessStatistics/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="p-4">
-    <BasicTable @register="registerTable" bordered :scroll="{ x: 1500 }" />
+    <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }"  />
   </div>
 </template>
 <script lang="ts">

+ 0 - 1
src/views/dashboard/basicInfo/closedStatistics/closed.data.ts

@@ -83,7 +83,6 @@ export function getClosedStatisticsColumns(): BasicColumn[] {
       title: '长期停建(失联)',
       dataIndex: 'mbStatusNum11',
       align: 'center',
-      width: 140,
     },
     {
       title: '停建整改',

+ 1 - 1
src/views/dashboard/basicInfo/closedStatistics/index.vue

@@ -24,7 +24,7 @@ export default defineComponent({
     const [registerTable] = useTable({
       api: getClosedAccessCount, // 密闭统计接口
       columns: getClosedStatisticsColumns(),
-      pagination: false, // 无分页
+      pagination: true, // 无分页
       showIndexColumn: false, // 关闭默认序号列,使用自定义序号列
     });
 

+ 113 - 16
src/views/dashboard/basicInfo/dataQuality/dataQuality.data.ts

@@ -2,7 +2,26 @@ import { BasicColumn, FormSchema } from '/@/components/Table';
 import { h } from 'vue';
 import { Tag } from 'ant-design-vue';
 
-// 新增:解析queJson并拼接orderNum+queCon的辅助函数
+// 生产状态映射表(扩展所有状态)
+const productionStatusMap: Record<string | number, { text: string; color: string }> = {
+  0: { text: '拟建矿井', color: 'blue' },
+  1: { text: '正常生产矿井', color: 'green' },
+  2: { text: '正常建设煤矿', color: 'green' },
+  3: { text: '自行停产矿井', color: 'green' },
+  4: { text: '正在关闭', color: 'green' },
+  5: { text: '责令停产整顿', color: 'green' },
+  6: { text: '责令停止建设', color: 'green' },
+  7: { text: '已关闭矿井', color: 'green' },
+  8: { text: '长期停产矿井', color: 'green' },
+  9: { text: '长期停建矿井', color: 'green' },
+  10: { text: '停产整改矿井', color: 'green' },
+  11: { text: '长期停建无法联系', color: 'green' },
+  12: { text: '停建整改', color: 'green' },
+  13: { text: '自行停建', color: 'green' },
+  14: { text: '正在实施关闭', color: 'green' },
+  15: { text: '已关闭矿井', color: 'green' },
+};
+// 解析queJson并拼接orderNum+queCon的辅助函数
 const formatQueJson = (queJsonStr: string) => {
   // 空值处理
   if (!queJsonStr) return '无质量问题';
@@ -18,30 +37,37 @@ const formatQueJson = (queJsonStr: string) => {
   }
 };
 
+// 通用空值处理函数(非在线状态的空值统一显示「—」)
+const formatEmptyValue = (value: any) => {
+  return value === null || value === undefined || value === '' || /^\s*$/.test(String(value));
+};
+
+
 /** 表格列配置 */
 export const columns: BasicColumn[] = [
   {
     title: '煤矿名称',
     dataIndex: 'mineName',
     width: 250,
+    customRender: ({ record }) => formatEmptyValue(record?.mineCode) ? '—' : record.mineCode,
   },
   {
     title: '煤矿简称',
     dataIndex: 'mineNameAbbr',
     width: 150,
+    customRender: ({ record }) => formatEmptyValue(record?.mineCode) ? '—' : record.mineCode,
   },
   {
     title: '生产状态',
     dataIndex: 'mineProStatus',
     width: 120,
     customRender: ({ record }) => {
-      const statusMap = {
-        '正常生产矿井': 'green',
-        '拟建矿井': 'blue',
-        '长期停产矿井': 'orange',
-      };
-      const color = statusMap[record.mineProStatus] || 'gray';
-      return h(Tag, { color }, () => record.mineProStatus);
+      // 空值处理
+      if (formatEmptyValue(record?.mineProStatus)) return '—';
+      // 状态映射 + 标签渲染
+      const status = String(record.mineProStatus);
+      const { text, color } = productionStatusMap[status] || { text: '未知状态', color: 'gray' };
+      return h(Tag, { color }, () => text);
     },
   },
   {
@@ -49,8 +75,13 @@ export const columns: BasicColumn[] = [
     dataIndex: 'mineLinkStatus',
     width: 100,
     customRender: ({ record }) => {
-      const color = record.mineLinkStatus === '在线' ? 'green' : 'red';
-      return h(Tag, { color }, () => record.mineLinkStatus);
+      // 未连接/空值 显示「/」
+      if (formatEmptyValue(record?.mineLinkStatus)) return '/';
+      // 状态映射 + 标签渲染
+      const status = String(record.mineLinkStatus);
+      const text = status === '1' ? '在线' : '离线';
+      const color = status === '1' ? 'green' : 'red';
+      return h(Tag, { color }, () => text);
     },
   },
   {
@@ -95,10 +126,7 @@ export const columns: BasicColumn[] = [
     title: '当前状态',
     dataIndex: 'isOk',
     width: 100,
-    customRender: ({ record }) => {
-      const color = record.isOk === '未解决' ? 'red' : 'green';
-      return h(Tag, { color }, () => record.isOk);
-    },
+    customRender: ({ record }) => formatEmptyValue(record?.mineCode) ? '—' : record.mineCode,
   },
   {
     title: '处理时间',
@@ -107,7 +135,6 @@ export const columns: BasicColumn[] = [
   },
 ];
 
-// 以下原有代码不变...
 /** 查询表单配置 */
 export const searchFormSchema: FormSchema[] = [
   {
@@ -115,13 +142,83 @@ export const searchFormSchema: FormSchema[] = [
     label: '煤矿名称',
     component: 'Input',
     colProps: { span: 6 },
+    // groupName: '常规查询',
   },
   {
     field: 'mineNameAbbr',
     label: '煤矿简称',
     component: 'Input',
     colProps: { span: 6 },
-  }
+    groupName: '常规查询',
+  },
+  {
+    field: 'productionStatus',
+    label: '生产状态',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '拟建矿井', value: '0' },
+        { label: '正常生产矿井', value: '1' },
+        { label: '长期停产矿井', value: '1' },
+      ],
+    },
+    colProps: { span: 6 },
+    groupName: '高级查询',
+  },
+  {
+    field: 'isConnected',
+    label: '是否需要接入',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '否', value: '0' },
+        { label: '是', value: '1' },
+      ],
+    },
+    colProps: { span: 6 },
+    groupName: '高级查询',
+  },
+
+  {
+    field: 'status',
+    label: '在线状态',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '离线', value: '0' },
+        { label: '在线', value: '1' },
+      ],
+    },
+    colProps: { span: 6 },
+    groupName: '高级查询',
+  },
+  {
+    field: 'riskLevel',
+    label: '风险等级',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: 'Ⅰ类容易自燃', value: '0' },
+        { label: 'Ⅱ类自燃', value: '1' },
+        { label: 'Ⅲ类不易自燃', value: '2' },
+      ],
+    },
+    colProps: { span: 6 },
+    groupName: '高级查询',
+  },
+  {
+    field: 'statusChange',
+    label: '状态变化',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '否', value: '0' },
+        { label: '是', value: '1' },
+      ],
+    },
+    colProps: { span: 6 },
+    groupName: '高级查询',
+  },
 ];
 
 // 模拟煤矿选项数据

+ 17 - 35
src/views/dashboard/basicInfo/dataQuality/index.vue

@@ -1,15 +1,12 @@
 <template>
   <div class="data-quality-page">
-    <!-- 查询表单 -->
-    <BasicForm @register="registerSearchForm" :model="searchModel" @finish="handleSearch" class="form-part" />
-
     <!-- Tab标签页 -->
-    <Tabs v-model:activeKey="activeKey" type="card" class="mb-4">
+    <Tabs v-model:activeKey="activeKey" type="line" class="mb-4">
       <TabPane key="unresolved" tab="未解决">
         <div class="add-button">
           <a-button type="primary" preIcon="mdi:page-next-outline" @click="handleOpenModal({}, 'add')"> 新增问题 </a-button>
         </div>
-        <BasicTable @register="registerUnresolvedTable">
+        <BasicTable style="padding: 0;" @register="registerUnresolvedTable">
           <template #action="{ record }">
             <button @click="handleOpenModal(record, 'edit')" class="action-btn">
               <SvgIcon name="edit" />
@@ -46,7 +43,6 @@
   import { ref, reactive, watch } from 'vue';
   import { useRouter } from 'vue-router';
   import { BasicTable, useTable } from '/@/components/Table';
-  import { BasicForm, useForm } from '/@/components/Form/index';
   import { useModal } from '/@/components/Modal';
   import { Tabs, TabPane } from 'ant-design-vue';
   import DataQualityModal from './components/DataQualityModal.vue';
@@ -57,40 +53,20 @@
   const router = useRouter();
   // 响应式数据
   const activeKey = ref('unresolved'); // 激活的Tab键
-  const searchModel = reactive({}); // 搜索表单模型
   const pageMode = ref('add');
-
-  // // 原始数据源(深拷贝避免修改原数据)
-  // const originUnresolved = JSON.parse(JSON.stringify(unresolvedData));
-  // const originResolved = JSON.parse(JSON.stringify(resolvedData));
-
-  // // 为每条记录添加查看详情事件
-  // originUnresolved.forEach((item) => {
-  //   item.onViewDetail = (record: any) => {
-  //     handleOpenModal(record, 'view');
-  //   };
-  // });
-  // originResolved.forEach((item) => {
-  //   item.onViewDetail = (record: any) => {
-  //     handleOpenModal(record, 'view');
-  //   };
-  // });
-  // 筛选后的数据源
-  // const filteredResolved = ref([...originResolved]);
-
-  // 搜索表单注册
-  const [registerSearchForm] = useForm({
-    labelWidth: 120,
-    schemas: searchFormSchema,
-    model: searchModel,
-  });
-
   // 未解决表格注册
   const [registerUnresolvedTable, { reload: reloadUnresolved }] = useTable({
     api: getQuaQueListByTab(),
     // dataSource: filteredUnresolved.value,
     columns,
-    pagination: false,
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchFormSchema,
+      showAdvancedButton: false,
+      schemaGroupNames: ['常规查询', '高级查询'],
+    },
+    useSearchForm: true,
+    pagination: true,
     striped: true,
     bordered: true,
     showIndexColumn: false,
@@ -103,13 +79,14 @@
       dataIndex: 'action',
       slots: { customRender: 'action' },
     },
+
   });
 
   // 已解决表格注册
   const [registerResolvedTable, { reload: reloadResolved }] = useTable({
     api: getQuaQueListByTab(),
     columns,
-    pagination: false,
+    pagination: true,
     striped: true,
     bordered: true,
     showIndexColumn: false,
@@ -123,6 +100,11 @@
       slots: { customRender: 'action' },
     },
     rowKey: 'id',
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchFormSchema,
+      showAdvancedButton: false,
+    },
   });
 
   // 弹框注册

+ 4 - 2
src/views/dashboard/basicInfo/minesInfo/index.vue

@@ -18,7 +18,7 @@
 <script setup lang="ts">
   import { useRouter } from 'vue-router';
   import { BasicTable, useTable } from '/@/components/Table';
-  import { columns, searchFormSchema, minesData } from './minesInfo.data';
+  import { columns, searchFormSchema } from './minesInfo.data';
   import { SvgIcon } from '/@/components/Icon';
   import { getMineData } from '../basicInfo.api'
 
@@ -36,7 +36,7 @@
       showAdvancedButton: false,
       schemaGroupNames: ['常规查询', '高级查询'],
     },
-    pagination: false,
+    pagination: true,
     useSearchForm: true,
     // showTableSetting: true,
     bordered: true,
@@ -50,6 +50,8 @@
     },
   });
 
+
+
   /**
    * 通用页面跳转方法
    * @param record 当前行数据

+ 78 - 15
src/views/dashboard/basicInfo/minesInfo/minesInfo.data.ts

@@ -3,57 +3,109 @@ import { FormSchema } from '/@/components/Table';
 import { h } from 'vue';
 import { Tag } from 'ant-design-vue';
 
+// 生产状态映射表(扩展所有状态)
+const productionStatusMap: Record<string | number, { text: string; color: string }> = {
+  0: { text: '拟建矿井', color: 'blue' },
+  1: { text: '正常生产矿井', color: 'green' },
+  2: { text: '正常建设煤矿', color: 'green' },
+  3: { text: '自行停产矿井', color: 'green' },
+  4: { text: '正在关闭', color: 'green' },
+  5: { text: '责令停产整顿', color: 'green' },
+  6: { text: '责令停止建设', color: 'green' },
+  7: { text: '已关闭矿井', color: 'green' },
+  8: { text: '长期停产矿井', color: 'green' },
+  9: { text: '长期停建矿井', color: 'green' },
+  10: { text: '停产整改矿井', color: 'green' },
+  11: { text: '长期停建无法联系', color: 'green' },
+  12: { text: '停建整改', color: 'green' },
+  13: { text: '自行停建', color: 'green' },
+  14: { text: '正在实施关闭', color: 'green' },
+  15: { text: '已关闭矿井', color: 'green' },
+};
+
+// 通用空值处理函数(非在线状态的空值统一显示「—」)
+const formatEmptyValue = (value: any) => {
+  return value === null || value === undefined || value === '' || /^\s*$/.test(String(value));
+};
+
 export const columns: BasicColumn[] = [
   {
     title: '煤矿编号',
     dataIndex: 'mineCode',
+    customRender: ({ record }) => formatEmptyValue(record?.mineCode) ? '—' : record.mineCode,
   },
   {
     title: '所属执法处',
     dataIndex: 'managementName',
+    customRender: ({ record }) => formatEmptyValue(record?.managementName) ? '—' : record.managementName,
   },
   {
     title: '煤矿名称',
     dataIndex: 'mineName',
+    customRender: ({ record }) => formatEmptyValue(record?.mineName) ? '—' : record.mineName,
   },
   {
     title: '煤矿简称',
     dataIndex: 'mineNameAbbr',
+    customRender: ({ record }) => formatEmptyValue(record?.mineNameAbbr) ? '—' : record.mineNameAbbr,
   },
   {
     title: '生产状态',
     dataIndex: 'productionStatus',
     customRender: ({ record }) => {
-      const status = record.productionStatus;
-      const enable = ~~status === 0;
-      const color = enable ? 'green' : 'red';
-      const text = enable ? '启用' : '停用';
-      return h(Tag, { color: color }, () => text);
+      // 空值处理
+      if (formatEmptyValue(record?.productionStatus)) return '—';
+      // 状态映射 + 标签渲染
+      const status = String(record.productionStatus);
+      const { text, color } = productionStatusMap[status] || { text: '未知状态', color: 'gray' };
+      return h(Tag, { color }, () => text);
     },
   },
   {
     title: '自燃情况',
     dataIndex: 'riskLevel',
+    customRender: ({ record }) => formatEmptyValue(record?.riskLevel) ? '—' : record.riskLevel,
   },
   {
     title: '接入状态',
     dataIndex: 'accessStatus',
+    customRender: ({ record }) => {
+      // 空值处理
+      if (formatEmptyValue(record?.accessStatus)) return '—';
+      // 状态映射 + 标签渲染
+      const status = String(record.accessStatus);
+      const text = status === '1' ? '已接入' : '未接入';
+      const color = status === '1' ? 'green' : 'gold'; // gold=黄色
+      return h(Tag, { color }, () => text);
+    },
   },
   {
     title: '在线状态',
     dataIndex: 'status',
+    customRender: ({ record }) => {
+      // 未连接/空值 显示「/」
+      if (formatEmptyValue(record?.status)) return '/';
+      // 状态映射 + 标签渲染
+      const status = String(record.status);
+      const text = status === '1' ? '在线' : '离线';
+      const color = status === '1' ? 'green' : 'red';
+      return h(Tag, { color }, () => text);
+    },
   },
   {
     title: '应接数量',
     dataIndex: 'yingjieNum',
+    customRender: ({ record }) => formatEmptyValue(record?.yingjieNum) ? '—' : record.yingjieNum,
   },
   {
     title: '已接数量',
     dataIndex: 'accessGoafNum',
+    customRender: ({ record }) => formatEmptyValue(record?.accessGoafNum) ? '—' : record.accessGoafNum,
   },
   {
     title: '未接数量',
     dataIndex: 'notAccessGoafNum',
+    customRender: ({ record }) => formatEmptyValue(record?.notAccessGoafNum) ? '—' : record.notAccessGoafNum,
   },
 ];
 
@@ -63,7 +115,6 @@ export const searchFormSchema: FormSchema[] = [
     label: '煤矿名称',
     component: 'Input',
     colProps: { span: 6 },
-    // groupName: '常规查询',
   },
   {
     field: 'mineNameAbbr',
@@ -80,7 +131,7 @@ export const searchFormSchema: FormSchema[] = [
       options: [
         { label: '拟建矿井', value: '0' },
         { label: '正常生产矿井', value: '1' },
-        { label: '长期停产矿井', value: '1' },
+        { label: '长期停产矿井', value: '8' },
       ],
     },
     colProps: { span: 6 },
@@ -99,7 +150,6 @@ export const searchFormSchema: FormSchema[] = [
     colProps: { span: 6 },
     groupName: '高级查询',
   },
-
   {
     field: 'status',
     label: '在线状态',
@@ -148,10 +198,10 @@ export const minesData = [
     managementName: '执法二处',
     mineName: '府谷县能源有限公司古城一号煤矿',
     mineNameAbbr: '府谷县一号煤矿',
-    productionStatus: '0',
+    productionStatus: '0', // 拟建矿井(蓝色)
     riskLevel: '0',
-    accessStatus: '0',
-    status: '0',
+    accessStatus: '0', // 未接入(黄色)
+    status: '0', // 离线(红色)
     yingjieNum: '0',
     accessGoafNum: '0',
     notAccessGoafNum: '0',
@@ -161,12 +211,25 @@ export const minesData = [
     managementName: '执法二处',
     mineName: '府谷县能源有限公司古城二号煤矿',
     mineNameAbbr: '府谷县二号煤矿',
-    productionStatus: '0',
+    productionStatus: '1', // 正常生产矿井(绿色)
     riskLevel: '0',
-    accessStatus: '0',
-    status: '0',
+    accessStatus: '1', // 已接入(绿色)
+    status: '1', // 在线(绿色)
     yingjieNum: '0',
     accessGoafNum: '0',
     notAccessGoafNum: '0',
   },
-];
+  {
+    mineCode: '',
+    managementName: null,
+    mineName: undefined,
+    mineNameAbbr: '   ',
+    productionStatus: '', // 空值显示「—」
+    riskLevel: null,
+    accessStatus: undefined, // 空值显示「—」
+    status: '', // 未连接显示「/」
+    yingjieNum: null,
+    accessGoafNum: '   ',
+    notAccessGoafNum: undefined,
+  },
+];