import type { BasicColumn, FormSchema } from '/@/components/Table'; import { h } from 'vue'; import { StatusColorEnum } from '/@/enums/jeecgEnum'; /** 顶部统计卡片(暂为占位,接口就绪后接入) */ export const boardData = [ { label: '接入矿井总数', value: '-' }, { label: '在线率', value: '-' }, { label: '风量异常矿井', value: '-' }, { label: '疑似隐蔽工作面', value: '-' }, ]; /** 接入状态映射(Mine.accessStatus:1已接入、0未接入) */ export const accessStatusMap: Record = { '1': '已接入', '0': '未接入', }; /** 隐蔽工作面判断结果映射(Mine.judgeResult:0数据不足、1疑似、2正常) */ export const judgeResultMap: Record = { '0': '数据不足', '1': '疑似', '2': '正常', }; /** 风量闭合结果映射(Mine.m3Closed:0数据不足、1不闭合、2闭合) */ export const m3ClosedMap: Record = { '0': '数据不足', '1': '不闭合', '2': '闭合', }; /** 隐蔽工作面判识全览实时表格列(getMineData → Mine) */ export const columns: BasicColumn[] = [ { title: '矿井名称', dataIndex: 'mineName', fixed: 'left', width: 220, }, { title: '矿编码', dataIndex: 'mineCode', width: 110, }, // { // title: '矿井全称', // dataIndex: 'corpName', // width: 220, // ellipsis: true, // }, { title: '接入状态', dataIndex: 'accessStatus', width: 110, customRender: ({ text }) => { const label = accessStatusMap[String(text)] ?? '-'; const color = String(text) === '1' ? StatusColorEnum.green : StatusColorEnum.red; return h('span', { style: { color, fontWeight: 'bold' } }, label); }, }, { title: '煤矿状态', dataIndex: 'mkMineStatus', width: 110, }, // { // title: '父级组织', // dataIndex: 'parentArea', // width: 120, // ellipsis: true, // }, { title: '判识结果', dataIndex: 'judgeResult', width: 110, customRender: ({ text }) => { const label = judgeResultMap[String(text)] ?? '-'; const color = String(text) === '1' ? StatusColorEnum.red : String(text) === '2' ? StatusColorEnum.green : StatusColorEnum.gray; return h('span', { style: { color, fontWeight: 'bold' } }, label); }, }, { title: '风量闭合', dataIndex: 'm3Closed', width: 110, customRender: ({ text }) => { const label = m3ClosedMap[String(text)] ?? '-'; const color = String(text) === '1' ? StatusColorEnum.red : String(text) === '2' ? StatusColorEnum.green : StatusColorEnum.gray; return h('span', { style: { color, fontWeight: 'bold' } }, label); }, }, { title: '风量异常数', dataIndex: 'm3Exception', width: 110, }, { title: '测风地点数', dataIndex: 'mineAreaList', width: 110, customRender: ({ text }) => (Array.isArray(text) ? text.length : '-'), }, { title: '测风装置数', dataIndex: 'windrectList', width: 110, customRender: ({ text }) => (Array.isArray(text) ? text.length : '-'), }, { title: '上次实时数据上传时间', dataIndex: 'lastCdssTime', width: 180, }, // { // title: '上次定义数据上传时间', // dataIndex: 'lastCddyTime', // width: 180, // }, ]; /** 历史数据表格列(暂无接口,先用同构占位列) */ export const historyColumns: BasicColumn[] = [ { title: '矿井名称', dataIndex: 'mineName', fixed: 'left', width: 180, }, { title: '矿编码', dataIndex: 'mineCode', width: 110, }, { title: '接入状态', dataIndex: 'accessStatus', width: 110, customRender: ({ text }) => accessStatusMap[String(text)] ?? '-', }, { title: '测风地点数', dataIndex: 'mineAreaList', width: 110, customRender: ({ text }) => (Array.isArray(text) ? text.length : '-'), }, { title: '测风装置数', dataIndex: 'windrectList', width: 110, customRender: ({ text }) => (Array.isArray(text) ? text.length : '-'), }, { title: '上次实时数据上传时间', dataIndex: 'lastCdssTime', width: 180, }, ]; /** 实时监测查询表单(getMineData:deptId 必填) */ export const schemas: FormSchema[] = [ { label: '矿井名称', field: 'mineName', component: 'Input', colProps: { span: 6 }, componentProps: { placeholder: '请输入矿井名称', }, }, { label: '接入状态', field: 'accessStatus', component: 'Select', colProps: { span: 6 }, componentProps: { options: [ { label: '已接入', value: 1 }, { label: '未接入', value: 0 }, ], }, }, { label: '判识结果', field: 'judgeResult', component: 'Select', colProps: { span: 6 }, componentProps: { options: [ { label: '数据不足', value: 0 }, { label: '疑似', value: 1 }, { label: '正常', value: 2 }, ], }, }, { label: '风量闭合', field: 'm3Closed', component: 'Select', colProps: { span: 6 }, componentProps: { options: [ { label: '数据不足', value: 0 }, { label: '不闭合', value: 1 }, { label: '闭合', value: 2 }, ], }, }, ]; /** 历史数据查询表单(暂无接口,占位) */ export const historySchemas: FormSchema[] = [];