|
|
@@ -8,76 +8,40 @@
|
|
|
<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="接入统计数据">
|
|
|
+ <button @click="handleGoToPageQuery(record, '/basicinfo/access-statistics')" class="action-btn" title="接入统计数据">
|
|
|
<SvgIcon name="info" />
|
|
|
</button>
|
|
|
<button @click="handleGoToPageQuery(record, '/warningAnalysis/connectAnalysis')" class="action-btn" title="智能分析数据">
|
|
|
<SvgIcon name="chart" />
|
|
|
</button>
|
|
|
</template>
|
|
|
+ <template #expandedRowRender="{ record }">
|
|
|
+ <BasicTable :dataSource="record.coalSeamList" :columns="coalSeamColumns" :pagination="false">
|
|
|
+ <!-- <template #action="{ record }">
|
|
|
+ <button @click="handleEdit(record, 'goaf')" class="action-btn" title="编辑">
|
|
|
+ <SvgIcon name="edit" />
|
|
|
+ </button>
|
|
|
+ </template> -->
|
|
|
+ </BasicTable>
|
|
|
+ </template>
|
|
|
</BasicTable>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { ref, nextTick, onMounted } from 'vue';
|
|
|
- import { useRouter } from 'vue-router';
|
|
|
+ import { useRouter, useRoute } from 'vue-router';
|
|
|
import { BasicTable } from '/@/components/Table';
|
|
|
import { SvgIcon } from '/@/components/Icon';
|
|
|
- import { message } from 'ant-design-vue';
|
|
|
// 引入动态列/表单配置函数 + 类型
|
|
|
- import { columns, searchFormSchema, type ProductionStatusMap } from './minesInfo.data';
|
|
|
+ import { coalSeamColumns, columns, searchFormSchema } 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';
|
|
|
|
|
|
// 路由实例
|
|
|
const router = useRouter();
|
|
|
-
|
|
|
- // ========== 动态生产状态配置 ==========
|
|
|
- // 1. 响应式存储动态状态映射(key: 状态值,value: 配置)
|
|
|
- const dynamicProductionStatusMap = ref<ProductionStatusMap>({});
|
|
|
- // 2. 响应式存储动态下拉选项(供搜索表单使用)
|
|
|
- const dynamicProductionStatusOptions = ref<{ label: string; value: string | number }[]>([]);
|
|
|
-
|
|
|
- // 3. 生产状态颜色分配规则(和dataQuality保持一致)
|
|
|
- const getStatusColor = (statusText: string) => {
|
|
|
- if (statusText.includes('正常生产')) return 'green';
|
|
|
- if (statusText.includes('拟建矿井')) return 'blue';
|
|
|
- return 'red'; // 其他状态统一红色
|
|
|
- };
|
|
|
-
|
|
|
- // 4. 从接口获取生产状态字典,生成动态映射/选项
|
|
|
- const fetchProductionStatus = async () => {
|
|
|
- try {
|
|
|
- const statusList = await getDictItemsByCode('mineProStatus');
|
|
|
- if (!Array.isArray(statusList)) return;
|
|
|
-
|
|
|
- const statusMap: ProductionStatusMap = {};
|
|
|
- const statusOptions: { label: string; value: string | number }[] = [];
|
|
|
-
|
|
|
- statusList.forEach((item) => {
|
|
|
- const value = item.value;
|
|
|
- const label = item.text || item.label;
|
|
|
- const color = getStatusColor(label);
|
|
|
-
|
|
|
- statusMap[value] = { label, value, color };
|
|
|
- statusOptions.push({ label, value });
|
|
|
- });
|
|
|
-
|
|
|
- // 赋值到响应式变量
|
|
|
- dynamicProductionStatusMap.value = statusMap;
|
|
|
- dynamicProductionStatusOptions.value = statusOptions;
|
|
|
-
|
|
|
- // 刷新表格(使用最新的状态映射)
|
|
|
- await safeReloadTable();
|
|
|
- } catch (error) {
|
|
|
- console.error('获取生产状态字典失败:', error);
|
|
|
- message.error('生产状态数据加载失败');
|
|
|
- }
|
|
|
- };
|
|
|
+ const route = useRoute();
|
|
|
|
|
|
// ========== 表格注册 ==========
|
|
|
const { tableContext: ctxRealtime, onExportXls } = useListPage({
|
|
|
@@ -85,6 +49,7 @@
|
|
|
api: getMineData, // 数据统计接口
|
|
|
columns, // 绑定动态列
|
|
|
formConfig: {
|
|
|
+ model: { deptId: route.query.deptId },
|
|
|
labelWidth: 120,
|
|
|
schemas: searchFormSchema, // 绑定动态搜索表单
|
|
|
showAdvancedButton: false,
|
|
|
@@ -99,36 +64,19 @@
|
|
|
params: {},
|
|
|
},
|
|
|
});
|
|
|
- const [registerRealtimeTable, realtimeTable] = ctxRealtime;
|
|
|
+ const [registerRealtimeTable] = ctxRealtime;
|
|
|
// useIntervalFn(() => realtimeTable.reload({ silence: true }), 10000);
|
|
|
|
|
|
- // ========== 辅助方法 ==========
|
|
|
- // 安全刷新表格(避免表格未初始化导致的报错)
|
|
|
- async function safeReloadTable() {
|
|
|
- await nextTick();
|
|
|
- try {
|
|
|
- await realtimeTable.reload();
|
|
|
- } catch (e) {
|
|
|
- console.warn('矿山信息表格重载失败:', e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 通用页面跳转方法
|
|
|
* @param record 当前行数据
|
|
|
* @param path 目标路径
|
|
|
*/
|
|
|
- function handleGoToPage(__: any, path: string) {
|
|
|
- router.push({
|
|
|
- path,
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
function handleGoToPageQuery(record: any, path: string) {
|
|
|
- const id = record.deptId;
|
|
|
+ const deptId = record.deptId;
|
|
|
router.push({
|
|
|
path,
|
|
|
- query: { id },
|
|
|
+ query: { deptId },
|
|
|
});
|
|
|
}
|
|
|
// const [registerRealtimeModal, { openModal: openRealtimeModal }] = useModal();
|
|
|
@@ -143,11 +91,6 @@
|
|
|
// // }
|
|
|
// pause();
|
|
|
// };
|
|
|
- // ========== 初始化 ==========
|
|
|
- onMounted(async () => {
|
|
|
- // 先获取生产状态字典,再加载表格
|
|
|
- await fetchProductionStatus();
|
|
|
- });
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|