|
@@ -88,26 +88,22 @@
|
|
|
<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, BasicColumn, FormSchema } from '/@/components/Table';
|
|
|
|
|
|
|
+ import { BasicTable, useTable } 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';
|
|
|
import { SvgIcon } from '/@/components/Icon';
|
|
import { SvgIcon } from '/@/components/Icon';
|
|
|
- import {
|
|
|
|
|
- getColumns,
|
|
|
|
|
- getSearchFormSchema,
|
|
|
|
|
- type ProductionStatusMap,
|
|
|
|
|
- } from './dataQuality.data';
|
|
|
|
|
|
|
+ import { getColumns, getSearchFormSchema, type ProductionStatusMap } from './dataQuality.data';
|
|
|
import { getDataQuaQueList, addDataQuaQue, deleteDataQuaQue, editDataQuaQue } from '../basicInfo.api';
|
|
import { getDataQuaQueList, addDataQuaQue, deleteDataQuaQue, editDataQuaQue } from '../basicInfo.api';
|
|
|
import { findNode } from '/@/utils/helper/treeHelper';
|
|
import { findNode } from '/@/utils/helper/treeHelper';
|
|
|
- import { useMineStore } 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 * as XLSX from 'xlsx';
|
|
|
// 路由实例
|
|
// 路由实例
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
// 实例化矿井Store
|
|
// 实例化矿井Store
|
|
|
- const mineStore = useMineStore();
|
|
|
|
|
|
|
+ const mineStore = useMineDepartmentStore();
|
|
|
// 响应式数据
|
|
// 响应式数据
|
|
|
const activeKey = ref('unresolved'); // 激活的Tab键
|
|
const activeKey = ref('unresolved'); // 激活的Tab键
|
|
|
const pageMode = ref('add');
|
|
const pageMode = ref('add');
|
|
@@ -121,7 +117,8 @@
|
|
|
// 3. 颜色分配规则(可根据业务灵活调整)
|
|
// 3. 颜色分配规则(可根据业务灵活调整)
|
|
|
const getStatusColor = (statusText: string) => {
|
|
const getStatusColor = (statusText: string) => {
|
|
|
if (statusText.includes('正常生产')) return 'green'; // 正常生产 → 绿色
|
|
if (statusText.includes('正常生产')) return 'green'; // 正常生产 → 绿色
|
|
|
- if (statusText.includes('拟建矿井')) return 'blue'; // 拟建矿井 → 蓝色
|
|
|
|
|
|
|
+ if (statusText.includes('拟建矿井'))
|
|
|
|
|
+ return 'blue'; // 拟建矿井 → 蓝色
|
|
|
else return 'red'; // 停产/停建/关闭/整改/责令 → 红色
|
|
else return 'red'; // 停产/停建/关闭/整改/责令 → 红色
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -135,12 +132,12 @@
|
|
|
// 生成动态映射和下拉选项
|
|
// 生成动态映射和下拉选项
|
|
|
const statusMap: ProductionStatusMap = {};
|
|
const statusMap: ProductionStatusMap = {};
|
|
|
const statusOptions: { label: string; value: string | number }[] = [];
|
|
const statusOptions: { label: string; value: string | number }[] = [];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
statusList.forEach((item) => {
|
|
statusList.forEach((item) => {
|
|
|
const value = item.value; // 接口返回的value(数字/字符串)
|
|
const value = item.value; // 接口返回的value(数字/字符串)
|
|
|
const label = item.text || item.label; // 接口返回的文本
|
|
const label = item.text || item.label; // 接口返回的文本
|
|
|
const color = getStatusColor(label); // 按规则分配颜色
|
|
const color = getStatusColor(label); // 按规则分配颜色
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 填充映射表
|
|
// 填充映射表
|
|
|
statusMap[value] = { label, value, color };
|
|
statusMap[value] = { label, value, color };
|
|
|
// 填充下拉选项
|
|
// 填充下拉选项
|
|
@@ -152,7 +149,7 @@
|
|
|
dynamicProductionStatusOptions.value = statusOptions;
|
|
dynamicProductionStatusOptions.value = statusOptions;
|
|
|
|
|
|
|
|
// 刷新表格(确保表格使用最新的映射)
|
|
// 刷新表格(确保表格使用最新的映射)
|
|
|
- await safeReloadActiveTable();
|
|
|
|
|
|
|
+ await safeReloadActiveTable();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('获取生产状态列表失败:', error);
|
|
console.error('获取生产状态列表失败:', error);
|
|
|
message.error('生产状态数据加载失败');
|
|
message.error('生产状态数据加载失败');
|
|
@@ -171,7 +168,7 @@
|
|
|
columns: columns, // 绑定动态列
|
|
columns: columns, // 绑定动态列
|
|
|
formConfig: {
|
|
formConfig: {
|
|
|
labelWidth: 120,
|
|
labelWidth: 120,
|
|
|
- schemas: searchFormSchema.value,
|
|
|
|
|
|
|
+ schemas: searchFormSchema.value,
|
|
|
showAdvancedButton: false,
|
|
showAdvancedButton: false,
|
|
|
schemaGroupNames: ['常规查询'],
|
|
schemaGroupNames: ['常规查询'],
|
|
|
},
|
|
},
|
|
@@ -237,7 +234,7 @@
|
|
|
console.error('解析质量问题JSON失败:', error);
|
|
console.error('解析质量问题JSON失败:', error);
|
|
|
return '问题数据解析失败';
|
|
return '问题数据解析失败';
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 安全重载当前激活的表格
|
|
// 安全重载当前激活的表格
|
|
|
async function safeReloadActiveTable() {
|
|
async function safeReloadActiveTable() {
|
|
@@ -256,39 +253,39 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // 按需重载双表格(仅在「标记已解决」等跨Tab操作时用)
|
|
|
|
|
- async function reloadBothTableSafely() {
|
|
|
|
|
- await nextTick();
|
|
|
|
|
- // 未解决表格:await + try/catch 捕获异步错误
|
|
|
|
|
- try {
|
|
|
|
|
- await reloadUnresolved();
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.warn('未解决表格暂未就绪,跳过重载:', e);
|
|
|
|
|
- }
|
|
|
|
|
- // 已解决表格:同理,一个报错不影响另一个
|
|
|
|
|
- try {
|
|
|
|
|
- await reloadResolved();
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.warn('已解决表格暂未就绪,跳过重载:', e);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 按需重载双表格(先注释掉)
|
|
|
|
|
+ // async function reloadBothTableSafely() {
|
|
|
|
|
+ // await nextTick();
|
|
|
|
|
+ // // 未解决表格:await + try/catch 捕获异步错误
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // await reloadUnresolved();
|
|
|
|
|
+ // } catch (e) {
|
|
|
|
|
+ // console.warn('未解决表格暂未就绪,跳过重载:', e);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // // 已解决表格:同理,一个报错不影响另一个
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // await reloadResolved();
|
|
|
|
|
+ // } catch (e) {
|
|
|
|
|
+ // console.warn('已解决表格暂未就绪,跳过重载:', e);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
// tabs切换事件
|
|
// tabs切换事件
|
|
|
async function handleTabChange(key: string) {
|
|
async function handleTabChange(key: string) {
|
|
|
activeKey.value = key;
|
|
activeKey.value = key;
|
|
|
await safeReloadActiveTable();
|
|
await safeReloadActiveTable();
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据标签获取表格数据(已解决/未解决)
|
|
* 根据标签获取表格数据(已解决/未解决)
|
|
|
* @param result 弹框数据
|
|
* @param result 弹框数据
|
|
|
*/
|
|
*/
|
|
|
- function getQuaQueListByTab() {
|
|
|
|
|
- return async (params: any) => {
|
|
|
|
|
- const isOk = activeKey.value === 'resolved' ? true : false;
|
|
|
|
|
- return await getDataQuaQueList({ ...params, isOk: isOk });
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // function getQuaQueListByTab() {
|
|
|
|
|
+ // return async (params: any) => {
|
|
|
|
|
+ // const isOk = activeKey.value === 'resolved' ? true : false;
|
|
|
|
|
+ // return await getDataQuaQueList({ ...params, isOk: isOk });
|
|
|
|
|
+ // };
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 打开弹框函数
|
|
* 打开弹框函数
|
|
@@ -310,24 +307,20 @@
|
|
|
} else if (pageMode.value === 'edit') {
|
|
} else if (pageMode.value === 'edit') {
|
|
|
await editDataQuaQue(result);
|
|
await editDataQuaQue(result);
|
|
|
}
|
|
}
|
|
|
- await safeReloadActiveTable();
|
|
|
|
|
|
|
+ await safeReloadActiveTable();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- console.log('操作失败:', error);
|
|
|
|
|
|
|
+ console.error('操作失败:', error);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
- * 通用页面跳转方法
|
|
|
|
|
- * @param record 当前行数据
|
|
|
|
|
- * @param path 目标路径(树形结构所在页面的路由地址)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * 通用页面跳转方法
|
|
|
|
|
+ * @param record 当前行数据
|
|
|
|
|
+ * @param path 目标路径(树形结构所在页面的路由地址)
|
|
|
|
|
+ */
|
|
|
async function handleGoToPage(record: any) {
|
|
async function handleGoToPage(record: any) {
|
|
|
try {
|
|
try {
|
|
|
const mineCode = record.mineCode;
|
|
const mineCode = record.mineCode;
|
|
|
- const targetNode = findNode(
|
|
|
|
|
- mineStore.getMineTree,
|
|
|
|
|
- (item) => item.id === mineCode,
|
|
|
|
|
- { id: 'id', pid: 'parentId', children: 'childDepart' }
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ const targetNode = findNode(mineStore.getDepartTree, (item) => item.id === mineCode, { id: 'id', pid: 'parentId', children: 'childDepart' });
|
|
|
|
|
|
|
|
let minePath = '';
|
|
let minePath = '';
|
|
|
if (targetNode) {
|
|
if (targetNode) {
|
|
@@ -338,7 +331,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 跳转页面(可携带拼接后的矿名/路径等参数)
|
|
// 跳转页面(可携带拼接后的矿名/路径等参数)
|
|
|
- router.push({ path: `/sealed/${minePath}`, query: {} });
|
|
|
|
|
|
|
+ router.push({ path: `/sealed/${minePath}`, query: { mineCode } });
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('矿节点定位失败:', error);
|
|
console.error('矿节点定位失败:', error);
|
|
|
message.error('矿节点定位失败,请稍后重试');
|
|
message.error('矿节点定位失败,请稍后重试');
|
|
@@ -368,7 +361,7 @@
|
|
|
try {
|
|
try {
|
|
|
await deleteDataQuaQue({ id: record.id });
|
|
await deleteDataQuaQue({ id: record.id });
|
|
|
await nextTick();
|
|
await nextTick();
|
|
|
- await safeReloadActiveTable();
|
|
|
|
|
|
|
+ await safeReloadActiveTable();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('删除失败:', error);
|
|
console.error('删除失败:', error);
|
|
|
}
|
|
}
|
|
@@ -382,12 +375,12 @@
|
|
|
const copyRecord = {
|
|
const copyRecord = {
|
|
|
...record,
|
|
...record,
|
|
|
isOk: true,
|
|
isOk: true,
|
|
|
- updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
|
|
+ updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
};
|
|
};
|
|
|
try {
|
|
try {
|
|
|
await editDataQuaQue(copyRecord);
|
|
await editDataQuaQue(copyRecord);
|
|
|
- await safeReloadActiveTable();
|
|
|
|
|
- }catch (error) {
|
|
|
|
|
|
|
+ await safeReloadActiveTable();
|
|
|
|
|
+ } catch (error) {
|
|
|
console.error('操作失败:', error);
|
|
console.error('操作失败:', error);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -440,7 +433,7 @@
|
|
|
let hideLoading: () => void = () => {};
|
|
let hideLoading: () => void = () => {};
|
|
|
try {
|
|
try {
|
|
|
hideLoading = message.loading('正在导出数据,请稍候...');
|
|
hideLoading = message.loading('正在导出数据,请稍候...');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const unresolvedList = await getAllUnresolvedData();
|
|
const unresolvedList = await getAllUnresolvedData();
|
|
|
const resolvedList = await getAllResolvedData();
|
|
const resolvedList = await getAllResolvedData();
|
|
|
|
|
|
|
@@ -469,7 +462,7 @@
|
|
|
// ========== 初始化:先获取状态数据,再加载表格 ==========
|
|
// ========== 初始化:先获取状态数据,再加载表格 ==========
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
await fetchProductionStatus(); // 先获取动态状态数据
|
|
await fetchProductionStatus(); // 先获取动态状态数据
|
|
|
- await safeReloadActiveTable();
|
|
|
|
|
|
|
+ await safeReloadActiveTable();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|