| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546 |
- import dayjs from 'dayjs';
- import { BasicColumn } from '/@/components/Table';
- import { FormSchema } from '/@/components/Table';
- import { TreeItem } from '/@/components/Tree/index';
- import { ModuleDataChart } from '/@/components/Configurable/types';
- import { h } from 'vue';
- import { StatusColorEnum } from '/@/enums/jeecgEnum';
- const riskMap = {
- '1': '低风险',
- '2': '一般风险',
- '3': '较高风险',
- '4': '高风险',
- };
- // 实时数据相关
- export const columns: BasicColumn[] = [
- // {
- // title: '序号',
- // dataIndex: 'orderNo',
- // width: 60,
- // },
- // {
- // title: '区域',
- // dataIndex: 'coalSeamName',
- // width: 80,
- // },
- {
- title: '煤矿名称',
- dataIndex: 'mineName',
- width: 200,
- },
- {
- title: '密闭名称',
- dataIndex: 'devicePos',
- width: 100,
- },
- {
- title: '所属煤层',
- dataIndex: 'coalSeamName',
- width: 100,
- },
- {
- title: 'CO(ppm)',
- dataIndex: 'coVal',
- width: 100,
- },
- {
- title: 'CO2(%)',
- dataIndex: 'co2Val',
- width: 100,
- },
- {
- title: 'CH4(%)',
- dataIndex: 'ch4Val',
- width: 100,
- },
- {
- title: 'C2H2(ppm)',
- dataIndex: 'c2h2Val',
- width: 100,
- },
- {
- title: 'C2H4(ppm)',
- dataIndex: 'c2h4Val',
- width: 100,
- },
- {
- title: 'O2(%)',
- dataIndex: 'o2Val',
- width: 100,
- },
- {
- title: '温度(℃)',
- dataIndex: 'temperature',
- width: 100,
- },
- {
- title: '压差(Pa)',
- dataIndex: 'sourcePressure',
- width: 100,
- },
- {
- title: '自然发火隐患等级',
- dataIndex: 'fireAlarm',
- width: 100,
- customRender({ record }) {
- return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
- },
- },
- {
- title: '是否漏风',
- dataIndex: 'leakageAlarm',
- width: 100,
- customRender({ record }) {
- // return alarmTextRender(record.leakageAlarm?.alarmLevel, record.leakageAlarm?.split('-')[0]);
- return alarmCellRender(record.leakageAlarm, (r) => r.alarmName.split('-')[1]);
- },
- },
- {
- title: '压差隐患等级',
- dataIndex: 'sourcePressureAlarm',
- width: 100,
- customRender({ record }) {
- return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
- },
- },
- {
- title: '密闭启封判定',
- dataIndex: 'unsealAlarm',
- width: 100,
- customRender({ record }) {
- return alarmCellRender(record.unsealAlarm);
- },
- },
- // {
- // title: '爆炸危险性',
- // dataIndex: 'explosionHazard',
- // width: 80,
- // },
- {
- title: '更新时间',
- dataIndex: 'readTime',
- width: 100,
- },
- ];
- export const searchFormSchema: FormSchema[] = [
- {
- field: 'mineNameAbbr',
- label: '煤矿简称',
- component: 'Input',
- colProps: { span: 6 },
- },
- {
- field: 'productStatus',
- label: '生产状态',
- component: 'Select',
- componentProps: {
- options: [
- { label: '拟建矿井', value: '0' },
- { label: '正常生产矿井', value: '1' },
- { label: '长期停产矿井', value: '1' },
- ],
- },
- colProps: { span: 6 },
- },
- {
- field: 'riskLevel',
- label: '自燃情况',
- component: 'Select',
- componentProps: {
- options: [
- { label: 'Ⅰ类容易自燃', value: '0' },
- { label: 'Ⅱ类自燃', value: '1' },
- { label: 'Ⅲ类不易自燃', value: '2' },
- ],
- },
- colProps: { span: 6 },
- },
- ];
- export const modalDetailsData: {
- basicInfo: Record<string, any>[];
- board: Record<string, any>[];
- gasConcentrationConfig: ModuleDataChart;
- pressureConfig: ModuleDataChart;
- } = {
- basicInfo: [
- {
- label: '煤矿名称',
- value: 'mineName',
- },
- {
- label: '设备位置',
- value: 'devicePos',
- },
- // {
- // label: '所属煤层',
- // value: 'coalSeamName',
- // },
- // {
- // label: '自燃情况',
- // value: 'Ⅰ类容易自燃',
- // },
- {
- label: '自然发火隐患',
- value: 'fireAlarm',
- customRender({ record }) {
- return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
- },
- },
- {
- label: '是否漏风',
- value: 'leakageAlarm',
- customRender({ record }) {
- return alarmCellRender(record.leakageAlarm);
- },
- },
- {
- label: '压差隐患等级',
- value: 'sourcePressureAlarm',
- customRender({ record }) {
- return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
- },
- },
- {
- label: '密闭启封判定',
- value: 'unsealAlarm',
- customRender({ record }) {
- return alarmCellRender(record.unsealAlarm);
- },
- },
- ],
- board: [
- {
- label: 'CO(ppm)',
- value: 'coVal',
- },
- {
- label: 'CO2(PPM)',
- value: 'co2Val',
- },
- {
- label: 'O2(%)',
- value: 'o2Val',
- },
- {
- label: 'CH4(%)',
- value: 'ch4Val',
- },
- {
- label: 'C2H4(ppm)',
- value: 'c2h4Val',
- },
- {
- label: 'C2H2(ppm)',
- value: 'c2h2Val',
- },
- {
- label: '温度(℃)',
- value: 'temperature',
- },
- {
- label: '压差(Pa)',
- value: 'sourcePressure',
- },
- ],
- gasConcentrationConfig: {
- type: 'line_smooth', // 使用光滑曲线类型
- legend: { show: true },
- xAxis: [
- {
- show: true,
- name: '时间',
- axisLabel: { color: '#000000' },
- },
- ],
- yAxis: [
- {
- show: true,
- name: '浓度(%)',
- position: 'left',
- splitLine: { show: false },
- axisLine: {
- show: true,
- lineStyle: { color: '#333' },
- },
- axisLabel: { color: '#000000' },
- nameTextStyle: { color: '#000' },
- },
- ],
- series: [
- {
- label: '氧气浓度',
- readFrom: 'chartData',
- xprop: 'readTime',
- yprop: 'o2Val',
- },
- {
- label: '一氧化碳浓度',
- readFrom: 'chartData',
- xprop: 'readTime',
- yprop: 'coVal',
- },
- {
- label: '二氧化碳浓度',
- readFrom: 'chartData',
- xprop: 'readTime',
- yprop: 'co2Val',
- },
- ],
- readFrom: '',
- },
- pressureConfig: {
- type: 'line', // 使用普通折线图类型
- legend: { show: true },
- xAxis: [
- {
- show: true,
- name: '时间',
- axisLabel: { color: '#000000' },
- },
- ],
- yAxis: [
- {
- show: true,
- position: 'left',
- name: '压力(kPa)',
- axisLabel: { color: '#000000' },
- },
- ],
- series: [
- {
- label: '压差',
- readFrom: 'chartData',
- xprop: 'readTime',
- yprop: 'sourcePressure',
- },
- ],
- readFrom: '',
- },
- };
- // 历史数据相关
- export const historicalColumns: BasicColumn[] = [
- // {
- // title: '序号',
- // dataIndex: 'orderNo',
- // width: 60,
- // },
- // {
- // title: '区域',
- // dataIndex: 'enforcement',
- // width: 100,
- // },
- {
- title: '煤矿名称',
- dataIndex: 'mineName',
- width: 200,
- },
- {
- title: '密闭名称',
- dataIndex: 'devicePos',
- width: 100,
- },
- {
- title: '所属煤层',
- dataIndex: 'coalSeamName',
- width: 100,
- },
- {
- title: 'CO(ppm)',
- dataIndex: 'coVal',
- width: 100,
- },
- {
- title: 'CO2(%)',
- dataIndex: 'co2Val',
- width: 100,
- },
- {
- title: 'CH4(%)',
- dataIndex: 'ch4Val',
- width: 100,
- },
- {
- title: 'C2H2(ppm)',
- dataIndex: 'c2h2Val',
- width: 100,
- },
- {
- title: 'C2H4(ppm)',
- dataIndex: 'c2h4Val',
- width: 100,
- },
- {
- title: 'O2(%)',
- dataIndex: 'o2Val',
- width: 100,
- },
- {
- title: '温度(℃)',
- dataIndex: 'temperature',
- width: 100,
- },
- {
- title: '压差(Pa)',
- dataIndex: 'sourcePressure',
- width: 100,
- },
- // {
- // title: '爆炸危险性',
- // dataIndex: 'explosionHazard',
- // width: 100,
- // },
- {
- title: '更新时间',
- dataIndex: 'createTime',
- width: 100,
- },
- ];
- export const historicalFormSchema: FormSchema[] = [
- // {
- // field: 'mineCode',
- // label: '煤矿名称',
- // component: 'MineCascader',
- // slot: 'mine-cascader',
- // colProps: { span: 6 },
- // },
- // {
- // field: 'mineNameAbbr',
- // label: '煤矿简称',
- // component: 'Input',
- // colProps: { span: 6 },
- // },
- // {
- // field: 'productStatus',
- // label: '生产状态',
- // component: 'Select',
- // componentProps: {
- // options: [
- // { label: '拟建矿井', value: '0' },
- // { label: '正常生产矿井', value: '1' },
- // { label: '长期停产矿井', value: '1' },
- // ],
- // },
- // colProps: { span: 6 },
- // },
- // {
- // field: 'riskLevel',
- // label: '自燃情况',
- // component: 'Select',
- // componentProps: {
- // options: [
- // { label: 'Ⅰ类容易自燃', value: '0' },
- // { label: 'Ⅱ类自燃', value: '1' },
- // { label: 'Ⅲ类不易自燃', value: '2' },
- // ],
- // },
- // colProps: { span: 6 },
- // },
- // {
- // field: 'coalSeam',
- // label: '所属煤层',
- // component: 'Select',
- // componentProps: {
- // options: [
- // { label: '煤层1', value: '0' },
- // { label: '煤层2', value: '1' },
- // { label: '煤层3', value: '2' },
- // ],
- // },
- // colProps: { span: 6 },
- // },
- {
- field: 'goafId',
- label: '密闭名称',
- component: 'ApiSelect',
- slot: 'goaf-select',
- colProps: { span: 6 },
- },
- {
- field: 'startTime',
- label: '起始日期',
- component: 'DatePicker',
- componentProps: {
- //日期格式化,页面上显示的值
- format: 'YYYY-MM-DD hh:mm:ss',
- //返回值格式化(绑定值的格式)
- valueFormat: 'YYYY-MM-DD hh:mm:ss',
- },
- defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD hh:mm:ss'),
- colProps: { span: 6 },
- },
- {
- field: 'endTime',
- label: '结束日期',
- component: 'DatePicker',
- componentProps: {
- //日期格式化,页面上显示的值
- format: 'YYYY-MM-DD hh:mm:ss',
- //返回值格式化(绑定值的格式)
- valueFormat: 'YYYY-MM-DD hh:mm:ss',
- },
- defaultValue: dayjs().format('YYYY-MM-DD hh:mm:ss'),
- colProps: { span: 6 },
- },
- ];
- export const treeData: TreeItem[] = [
- {
- title: '气体参数 ',
- key: '0-0',
- children: [
- { title: 'CO', key: '0-0-0' },
- { title: 'CH4', key: '0-0-1' },
- { title: 'C2H4', key: '0-0-2' },
- { title: 'C2H2', key: '0-0-3' },
- { title: 'CO2', key: '0-0-4' },
- { title: 'O2', key: '0-0-5' },
- ],
- },
- {
- title: '内外压力及压差',
- key: '1-1',
- children: [
- { title: '内压力', key: '1-1-0' },
- { title: '外压力', key: '1-1-1' },
- { title: '压差', key: '1-1-2' },
- ],
- },
- {
- title: '温度',
- key: '2-2',
- },
- ];
- function getTagColor(level: string) {
- switch (level) {
- case '4':
- return StatusColorEnum.red;
- case '3':
- return StatusColorEnum.purple;
- case '2':
- return StatusColorEnum.gold;
- case '1':
- return StatusColorEnum.blue;
- default:
- return 'inhert';
- }
- }
- export function alarmCellRender(
- record: any,
- valFn: (record: any) => string = (r) => r.alarmName,
- lvFn: (record: any) => string = (r) => r.alarmLevel
- ) {
- // if (!record) return h(Tag, { bordered: false, color: 'default' }, () => '-');
- // return h(Tag, { bordered: false, color: getTagColor(record.alarmLevel) }, () => record.alarmName);
- if (!record) return h('span', '-');
- const val = valFn(record);
- const lv = lvFn(record);
- return h('span', { style: { color: getTagColor(lv) } }, val);
- }
|