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: '-' }, ]; /** 报警级别映射 */ export const alarmLevelMap: Record = { '1': { label: '一级', color: StatusColorEnum.red }, '2': { label: '二级', color: StatusColorEnum.orange }, '3': { label: '三级', color: StatusColorEnum.yellow }, }; /** 报警状态映射 */ export const alarmStatusMap: Record = { '0': { label: '未处理', color: StatusColorEnum.red }, '1': { label: '处理中', color: StatusColorEnum.orange }, '2': { label: '已处理', color: StatusColorEnum.green }, }; /** 超限报警列表表格列 */ export const columns: BasicColumn[] = [ { title: '煤矿名称', dataIndex: 'mineName', fixed: 'left', width: 180, }, { title: '测风点名称', dataIndex: 'pointName', width: 160, }, { title: '监测区域', dataIndex: 'monitorArea', width: 120, }, { title: '报警类型', dataIndex: 'alarmType', width: 120, customRender: ({ text }) => { const map: Record = { windSpeedOver: '风速超限', windVolumeLow: '风量不足', windVolumeUnclosed: '风量不闭合', }; return map[text] || text; }, }, { title: '实测值', dataIndex: 'measuredValue', width: 100, }, { title: '标准/阈值', dataIndex: 'thresholdValue', width: 100, }, { title: '偏差', dataIndex: 'deviation', width: 90, customRender: ({ text }) => (text != null ? `${text}%` : '-'), }, { title: '报警级别', dataIndex: 'alarmLevel', width: 90, customRender: ({ text }) => { const info = alarmLevelMap[text]; return info ? h('span', { style: { color: info.color, fontWeight: 'bold' } }, info.label) : text; }, }, { title: '报警时间', dataIndex: 'alarmTime', width: 170, }, { title: '状态', dataIndex: 'status', width: 90, customRender: ({ text }) => { const info = alarmStatusMap[text]; return info ? h('span', { style: { color: info.color } }, info.label) : text; }, }, ]; /** 测风点监测地点列表表格列 */ export const pointListColumns: BasicColumn[] = [ { title: '测风点编号', dataIndex: 'pointCode', width: 130, }, { title: '监测地点名称', dataIndex: 'locationName', width: 200, }, { title: '类型', dataIndex: 'pointType', width: 120, customRender: ({ text }) => { const map: Record = { totalInlet: '总进风', totalOutlet: '总回风', workingFace: '工作面', districtReturn: '采区回风', headingFace: '掘进面', }; return map[text] || text; }, }, { title: '当前状态', dataIndex: 'currentStatus', width: 100, customRender: ({ text }) => { const color = text === 'normal' ? StatusColorEnum.green : StatusColorEnum.red; const label = text === 'normal' ? '正常' : '异常'; return h('span', { style: { color, fontWeight: 'bold' } }, label); }, }, ]; /** 查询表单 */ export const schemas: FormSchema[] = [ { label: '煤矿名称', field: 'deptId', component: 'MineCascader', colProps: { span: 6 }, rules: [], }, { label: '报警类型', field: 'alarmType', component: 'Select', colProps: { span: 6 }, componentProps: { options: [ { label: '全部', value: '' }, { label: '风速超限', value: 'windSpeedOver' }, { label: '风量不足', value: 'windVolumeLow' }, { label: '风量不闭合', value: 'windVolumeUnclosed' }, ], }, rules: [], }, { label: '报警级别', field: 'alarmLevel', component: 'Select', colProps: { span: 6 }, componentProps: { options: [ { label: '全部', value: '' }, { label: '一级', value: '1' }, { label: '二级', value: '2' }, { label: '三级', value: '3' }, ], }, rules: [], }, { label: '日期范围', field: 'dateRange', component: 'RangePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', showTime: { format: 'HH:mm:ss' }, }, rules: [], }, ]; /** 处理记录表格列 */ export const handleRecordColumns: BasicColumn[] = [ { title: '煤矿名称', dataIndex: 'mineName', fixed: 'left', width: 180, }, { title: '报警类型', dataIndex: 'alarmType', width: 120, customRender: ({ text }) => { const map: Record = { windSpeedOver: '风速超限', windVolumeLow: '风量不足', windVolumeUnclosed: '风量不闭合', }; return map[text] || text; }, }, { title: '测风点名称', dataIndex: 'pointName', width: 160, }, { title: '处理人', dataIndex: 'handler', width: 100, }, { title: '处理情况', dataIndex: 'handleContent', width: 250, ellipsis: true, }, { title: '处理时间', dataIndex: 'handleTime', width: 170, }, ];