|
@@ -6,7 +6,7 @@
|
|
|
<BasicTable style="padding: 0" @register="registerUnresolvedTable">
|
|
<BasicTable style="padding: 0" @register="registerUnresolvedTable">
|
|
|
<template #resetBefore>
|
|
<template #resetBefore>
|
|
|
<a-button type="primary" class="ml-8px" preIcon="mdi:page-next-outline" @click="handleOpenModal({}, 'add')"> 新增问题 </a-button>
|
|
<a-button type="primary" class="ml-8px" preIcon="mdi:page-next-outline" @click="handleOpenModal({}, 'add')"> 新增问题 </a-button>
|
|
|
- <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="handleExportExcel"> 导出 </a-button>
|
|
|
|
|
|
|
+ <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXlsA"> 导出 </a-button>
|
|
|
</template>
|
|
</template>
|
|
|
<!-- <template #submitBefore>
|
|
<!-- <template #submitBefore>
|
|
|
<a-button type="primary" preIcon="mdi:page-next-outline" @click="handleOpenModal({}, 'add')"> 新增问题 </a-button>
|
|
<a-button type="primary" preIcon="mdi:page-next-outline" @click="handleOpenModal({}, 'add')"> 新增问题 </a-button>
|
|
@@ -61,7 +61,7 @@
|
|
|
<TabPane key="resolved" tab="已解决">
|
|
<TabPane key="resolved" tab="已解决">
|
|
|
<BasicTable style="padding: 0" @register="registerResolvedTable">
|
|
<BasicTable style="padding: 0" @register="registerResolvedTable">
|
|
|
<template #resetBefore>
|
|
<template #resetBefore>
|
|
|
- <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="handleExportExcel"> 导出 </a-button>
|
|
|
|
|
|
|
+ <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXlsB"> 导出 </a-button>
|
|
|
</template>
|
|
</template>
|
|
|
<template #queJson="{ record }">
|
|
<template #queJson="{ record }">
|
|
|
<div style="display: flex; align-items: center; gap: 8px; width: 100%">
|
|
<div style="display: flex; align-items: center; gap: 8px; width: 100%">
|
|
@@ -90,7 +90,7 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, nextTick, computed, onMounted } from 'vue';
|
|
import { ref, nextTick, computed, onMounted } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
|
- import { BasicTable, useTable } from '/@/components/Table';
|
|
|
|
|
|
|
+ import { BasicTable } from '/@/components/Table';
|
|
|
import { useModal } from '/@/components/Modal';
|
|
import { useModal } from '/@/components/Modal';
|
|
|
import { Tabs, TabPane, Popconfirm, message } from 'ant-design-vue';
|
|
import { Tabs, TabPane, Popconfirm, message } from 'ant-design-vue';
|
|
|
import DataQualityModal from './components/DataQualityModal.vue';
|
|
import DataQualityModal from './components/DataQualityModal.vue';
|
|
@@ -101,7 +101,8 @@
|
|
|
import { useMineDepartmentStore } from '/@/store/modules/mine';
|
|
import { useMineDepartmentStore } from '/@/store/modules/mine';
|
|
|
import { getDictItemsByCode } from '/@/utils/dict';
|
|
import { getDictItemsByCode } from '/@/utils/dict';
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
- import * as XLSX from 'xlsx';
|
|
|
|
|
|
|
+ import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
|
|
+
|
|
|
// 路由实例
|
|
// 路由实例
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
// 实例化矿井Store
|
|
// 实例化矿井Store
|
|
@@ -163,63 +164,85 @@
|
|
|
const searchFormSchema = computed(() => getSearchFormSchema(dynamicProductionStatusOptions));
|
|
const searchFormSchema = computed(() => getSearchFormSchema(dynamicProductionStatusOptions));
|
|
|
|
|
|
|
|
// 未解决表格注册
|
|
// 未解决表格注册
|
|
|
- const [registerUnresolvedTable, { reload: reloadUnresolved }] = useTable({
|
|
|
|
|
- api: async (params: any) => {
|
|
|
|
|
- return await getDataQuaQueList({ ...params, isOk: false });
|
|
|
|
|
- },
|
|
|
|
|
- columns: columns, // 绑定动态列
|
|
|
|
|
- formConfig: {
|
|
|
|
|
- labelWidth: 120,
|
|
|
|
|
- schemas: searchFormSchema.value,
|
|
|
|
|
- showAdvancedButton: false,
|
|
|
|
|
- schemaGroupNames: ['常规查询'],
|
|
|
|
|
- actionColOptions: { span: 6 },
|
|
|
|
|
- },
|
|
|
|
|
- useSearchForm: true,
|
|
|
|
|
- pagination: true,
|
|
|
|
|
- showIndexColumn: false,
|
|
|
|
|
- indexColumnProps: {
|
|
|
|
|
- title: '序号',
|
|
|
|
|
|
|
+ const { tableContext: tableContextA, onExportXls: onExportXlsA } = useListPage({
|
|
|
|
|
+ tableProps: {
|
|
|
|
|
+ api: async (params: any) => {
|
|
|
|
|
+ return await getDataQuaQueList({ ...params, isOk: false });
|
|
|
|
|
+ },
|
|
|
|
|
+ columns: columns, // 绑定动态列
|
|
|
|
|
+ formConfig: {
|
|
|
|
|
+ labelWidth: 120,
|
|
|
|
|
+ schemas: searchFormSchema.value,
|
|
|
|
|
+ showAdvancedButton: false,
|
|
|
|
|
+ schemaGroupNames: ['常规查询'],
|
|
|
|
|
+ actionColOptions: { span: 6 },
|
|
|
|
|
+ },
|
|
|
|
|
+ useSearchForm: true,
|
|
|
|
|
+ pagination: true,
|
|
|
|
|
+ showIndexColumn: false,
|
|
|
|
|
+ indexColumnProps: {
|
|
|
|
|
+ title: '序号',
|
|
|
|
|
+ },
|
|
|
|
|
+ // canResize: false,
|
|
|
|
|
+ actionColumn: {
|
|
|
|
|
+ width: 200,
|
|
|
|
|
+ title: '操作',
|
|
|
|
|
+ dataIndex: 'action',
|
|
|
|
|
+ slots: { customRender: 'action' },
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: false, // 先不立即加载,等状态数据获取后再加载
|
|
|
},
|
|
},
|
|
|
- // canResize: false,
|
|
|
|
|
- actionColumn: {
|
|
|
|
|
- width: 200,
|
|
|
|
|
- title: '操作',
|
|
|
|
|
- dataIndex: 'action',
|
|
|
|
|
- slots: { customRender: 'action' },
|
|
|
|
|
|
|
+ exportConfig: {
|
|
|
|
|
+ url: '/province/dataQuaQue/exportDataQuaQueList',
|
|
|
|
|
+ name: '数据质量',
|
|
|
|
|
+ params: {
|
|
|
|
|
+ isOk: 0,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
- immediate: false, // 先不立即加载,等状态数据获取后再加载
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ const [registerUnresolvedTable, { reload: reloadUnresolved }] = tableContextA;
|
|
|
|
|
+
|
|
|
// 已解决表格注册
|
|
// 已解决表格注册
|
|
|
- const [registerResolvedTable, { reload: reloadResolved }] = useTable({
|
|
|
|
|
- api: async (params: any) => {
|
|
|
|
|
- return await getDataQuaQueList({ ...params, isOk: true });
|
|
|
|
|
- },
|
|
|
|
|
- columns: columns,
|
|
|
|
|
- formConfig: {
|
|
|
|
|
- labelWidth: 120,
|
|
|
|
|
- schemas: searchFormSchema.value,
|
|
|
|
|
- showAdvancedButton: false,
|
|
|
|
|
- schemaGroupNames: ['常规查询'],
|
|
|
|
|
|
|
+ const { tableContext: tableContextB, onExportXls: onExportXlsB } = useListPage({
|
|
|
|
|
+ tableProps: {
|
|
|
|
|
+ api: async (params: any) => {
|
|
|
|
|
+ return await getDataQuaQueList({ ...params, isOk: true });
|
|
|
|
|
+ },
|
|
|
|
|
+ columns: columns,
|
|
|
|
|
+ formConfig: {
|
|
|
|
|
+ labelWidth: 120,
|
|
|
|
|
+ schemas: searchFormSchema.value,
|
|
|
|
|
+ showAdvancedButton: false,
|
|
|
|
|
+ schemaGroupNames: ['常规查询'],
|
|
|
|
|
+ },
|
|
|
|
|
+ useSearchForm: true,
|
|
|
|
|
+ pagination: true,
|
|
|
|
|
+ striped: true,
|
|
|
|
|
+ // bordered: true,
|
|
|
|
|
+ showIndexColumn: false,
|
|
|
|
|
+ indexColumnProps: {
|
|
|
|
|
+ title: '序号',
|
|
|
|
|
+ },
|
|
|
|
|
+ actionColumn: {
|
|
|
|
|
+ width: 60,
|
|
|
|
|
+ title: '操作',
|
|
|
|
|
+ dataIndex: 'action',
|
|
|
|
|
+ slots: { customRender: 'action' },
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: false, // 先不立即加载
|
|
|
},
|
|
},
|
|
|
- useSearchForm: true,
|
|
|
|
|
- pagination: true,
|
|
|
|
|
- striped: true,
|
|
|
|
|
- // bordered: true,
|
|
|
|
|
- showIndexColumn: false,
|
|
|
|
|
- indexColumnProps: {
|
|
|
|
|
- title: '序号',
|
|
|
|
|
|
|
+ exportConfig: {
|
|
|
|
|
+ url: '/province/dataQuaQue/exportDataQuaQueList',
|
|
|
|
|
+ name: '数据质量',
|
|
|
|
|
+ params: {
|
|
|
|
|
+ isOk: 1,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
- actionColumn: {
|
|
|
|
|
- width: 60,
|
|
|
|
|
- title: '操作',
|
|
|
|
|
- dataIndex: 'action',
|
|
|
|
|
- slots: { customRender: 'action' },
|
|
|
|
|
- },
|
|
|
|
|
- immediate: false, // 先不立即加载
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ const [registerResolvedTable, { reload: reloadResolved }] = tableContextB;
|
|
|
|
|
+
|
|
|
// 弹框注册
|
|
// 弹框注册
|
|
|
const [registerModal, { openModal }] = useModal();
|
|
const [registerModal, { openModal }] = useModal();
|
|
|
|
|
|
|
@@ -395,80 +418,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取全部未解决数据(不分页)
|
|
|
|
|
- */
|
|
|
|
|
- async function getAllUnresolvedData() {
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await getDataQuaQueList({ pageNum: 1, pageSize: 9999, isOk: false });
|
|
|
|
|
- return res.records || [];
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('获取未解决数据失败:', error);
|
|
|
|
|
- return [];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取全部已解决数据(不分页)
|
|
|
|
|
- */
|
|
|
|
|
- async function getAllResolvedData() {
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await getDataQuaQueList({ pageNum: 1, pageSize: 9999, isOk: true });
|
|
|
|
|
- return res.records || [];
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('获取已解决数据失败:', error);
|
|
|
|
|
- return [];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 格式化导出数据(统一字段名 + 状态文本)
|
|
|
|
|
- */
|
|
|
|
|
- function formatExportData(dataList: any[]) {
|
|
|
|
|
- return dataList.map((item) => ({
|
|
|
|
|
- 煤矿名称: item.mineName || '',
|
|
|
|
|
- 煤矿简称: item.mineNameAbbr || '',
|
|
|
|
|
- 生产状态: dynamicProductionStatusMap.value[item.mineProStatus]?.label || '-',
|
|
|
|
|
- 在线状态: item.mineLinkStatus === 1 ? '在线' : item.mineLinkStatus === 0 ? '离线' : '/',
|
|
|
|
|
- 质量问题详情: formatQueJson(item.queJson),
|
|
|
|
|
- 当前状态: item.isOk ? '已解决' : '未解决',
|
|
|
|
|
- 处理时间: item.updateTime || '',
|
|
|
|
|
- }));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 导出Excel核心方法
|
|
|
|
|
- */
|
|
|
|
|
- async function handleExportExcel() {
|
|
|
|
|
- let hideLoading: () => void = () => {};
|
|
|
|
|
- try {
|
|
|
|
|
- hideLoading = message.loading('正在导出数据,请稍候...');
|
|
|
|
|
-
|
|
|
|
|
- const unresolvedList = await getAllUnresolvedData();
|
|
|
|
|
- const resolvedList = await getAllResolvedData();
|
|
|
|
|
-
|
|
|
|
|
- const formattedUnresolved = formatExportData(unresolvedList);
|
|
|
|
|
- const formattedResolved = formatExportData(resolvedList);
|
|
|
|
|
-
|
|
|
|
|
- const workbook = XLSX.utils.book_new();
|
|
|
|
|
- const unresolvedSheet = XLSX.utils.json_to_sheet(formattedUnresolved);
|
|
|
|
|
- const resolvedSheet = XLSX.utils.json_to_sheet(formattedResolved);
|
|
|
|
|
-
|
|
|
|
|
- XLSX.utils.book_append_sheet(workbook, unresolvedSheet, '未解决');
|
|
|
|
|
- XLSX.utils.book_append_sheet(workbook, resolvedSheet, '已解决');
|
|
|
|
|
-
|
|
|
|
|
- const fileName = `数据质量问题_${dayjs().format('YYYYMMDDHHmmss')}.xlsx`;
|
|
|
|
|
- XLSX.writeFile(workbook, fileName);
|
|
|
|
|
-
|
|
|
|
|
- hideLoading();
|
|
|
|
|
- message.success('导出成功!');
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- if (hideLoading) hideLoading();
|
|
|
|
|
- console.error('Excel导出失败:', error);
|
|
|
|
|
- message.error('导出失败,请稍后重试');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// ========== 初始化:先获取状态数据,再加载表格 ==========
|
|
// ========== 初始化:先获取状态数据,再加载表格 ==========
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
await fetchProductionStatus(); // 先获取动态状态数据
|
|
await fetchProductionStatus(); // 先获取动态状态数据
|