|
@@ -3,57 +3,109 @@ import { FormSchema } from '/@/components/Table';
|
|
|
import { h } from 'vue';
|
|
import { h } from 'vue';
|
|
|
import { Tag } from 'ant-design-vue';
|
|
import { Tag } from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
|
+// 生产状态映射表(扩展所有状态)
|
|
|
|
|
+const productionStatusMap: Record<string | number, { text: string; color: string }> = {
|
|
|
|
|
+ 0: { text: '拟建矿井', color: 'blue' },
|
|
|
|
|
+ 1: { text: '正常生产矿井', color: 'green' },
|
|
|
|
|
+ 2: { text: '正常建设煤矿', color: 'green' },
|
|
|
|
|
+ 3: { text: '自行停产矿井', color: 'green' },
|
|
|
|
|
+ 4: { text: '正在关闭', color: 'green' },
|
|
|
|
|
+ 5: { text: '责令停产整顿', color: 'green' },
|
|
|
|
|
+ 6: { text: '责令停止建设', color: 'green' },
|
|
|
|
|
+ 7: { text: '已关闭矿井', color: 'green' },
|
|
|
|
|
+ 8: { text: '长期停产矿井', color: 'green' },
|
|
|
|
|
+ 9: { text: '长期停建矿井', color: 'green' },
|
|
|
|
|
+ 10: { text: '停产整改矿井', color: 'green' },
|
|
|
|
|
+ 11: { text: '长期停建无法联系', color: 'green' },
|
|
|
|
|
+ 12: { text: '停建整改', color: 'green' },
|
|
|
|
|
+ 13: { text: '自行停建', color: 'green' },
|
|
|
|
|
+ 14: { text: '正在实施关闭', color: 'green' },
|
|
|
|
|
+ 15: { text: '已关闭矿井', color: 'green' },
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 通用空值处理函数(非在线状态的空值统一显示「—」)
|
|
|
|
|
+const formatEmptyValue = (value: any) => {
|
|
|
|
|
+ return value === null || value === undefined || value === '' || /^\s*$/.test(String(value));
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
export const columns: BasicColumn[] = [
|
|
export const columns: BasicColumn[] = [
|
|
|
{
|
|
{
|
|
|
title: '煤矿编号',
|
|
title: '煤矿编号',
|
|
|
dataIndex: 'mineCode',
|
|
dataIndex: 'mineCode',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.mineCode) ? '—' : record.mineCode,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '所属执法处',
|
|
title: '所属执法处',
|
|
|
dataIndex: 'managementName',
|
|
dataIndex: 'managementName',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.managementName) ? '—' : record.managementName,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '煤矿名称',
|
|
title: '煤矿名称',
|
|
|
dataIndex: 'mineName',
|
|
dataIndex: 'mineName',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.mineName) ? '—' : record.mineName,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '煤矿简称',
|
|
title: '煤矿简称',
|
|
|
dataIndex: 'mineNameAbbr',
|
|
dataIndex: 'mineNameAbbr',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.mineNameAbbr) ? '—' : record.mineNameAbbr,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '生产状态',
|
|
title: '生产状态',
|
|
|
dataIndex: 'productionStatus',
|
|
dataIndex: 'productionStatus',
|
|
|
customRender: ({ record }) => {
|
|
customRender: ({ record }) => {
|
|
|
- const status = record.productionStatus;
|
|
|
|
|
- const enable = ~~status === 0;
|
|
|
|
|
- const color = enable ? 'green' : 'red';
|
|
|
|
|
- const text = enable ? '启用' : '停用';
|
|
|
|
|
- return h(Tag, { color: color }, () => text);
|
|
|
|
|
|
|
+ // 空值处理
|
|
|
|
|
+ if (formatEmptyValue(record?.productionStatus)) return '—';
|
|
|
|
|
+ // 状态映射 + 标签渲染
|
|
|
|
|
+ const status = String(record.productionStatus);
|
|
|
|
|
+ const { text, color } = productionStatusMap[status] || { text: '未知状态', color: 'gray' };
|
|
|
|
|
+ return h(Tag, { color }, () => text);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '自燃情况',
|
|
title: '自燃情况',
|
|
|
dataIndex: 'riskLevel',
|
|
dataIndex: 'riskLevel',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.riskLevel) ? '—' : record.riskLevel,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '接入状态',
|
|
title: '接入状态',
|
|
|
dataIndex: 'accessStatus',
|
|
dataIndex: 'accessStatus',
|
|
|
|
|
+ customRender: ({ record }) => {
|
|
|
|
|
+ // 空值处理
|
|
|
|
|
+ if (formatEmptyValue(record?.accessStatus)) return '—';
|
|
|
|
|
+ // 状态映射 + 标签渲染
|
|
|
|
|
+ const status = String(record.accessStatus);
|
|
|
|
|
+ const text = status === '1' ? '已接入' : '未接入';
|
|
|
|
|
+ const color = status === '1' ? 'green' : 'gold'; // gold=黄色
|
|
|
|
|
+ return h(Tag, { color }, () => text);
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '在线状态',
|
|
title: '在线状态',
|
|
|
dataIndex: 'status',
|
|
dataIndex: 'status',
|
|
|
|
|
+ customRender: ({ record }) => {
|
|
|
|
|
+ // 未连接/空值 显示「/」
|
|
|
|
|
+ if (formatEmptyValue(record?.status)) return '/';
|
|
|
|
|
+ // 状态映射 + 标签渲染
|
|
|
|
|
+ const status = String(record.status);
|
|
|
|
|
+ const text = status === '1' ? '在线' : '离线';
|
|
|
|
|
+ const color = status === '1' ? 'green' : 'red';
|
|
|
|
|
+ return h(Tag, { color }, () => text);
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '应接数量',
|
|
title: '应接数量',
|
|
|
dataIndex: 'yingjieNum',
|
|
dataIndex: 'yingjieNum',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.yingjieNum) ? '—' : record.yingjieNum,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '已接数量',
|
|
title: '已接数量',
|
|
|
dataIndex: 'accessGoafNum',
|
|
dataIndex: 'accessGoafNum',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.accessGoafNum) ? '—' : record.accessGoafNum,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '未接数量',
|
|
title: '未接数量',
|
|
|
dataIndex: 'notAccessGoafNum',
|
|
dataIndex: 'notAccessGoafNum',
|
|
|
|
|
+ customRender: ({ record }) => formatEmptyValue(record?.notAccessGoafNum) ? '—' : record.notAccessGoafNum,
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -63,7 +115,6 @@ export const searchFormSchema: FormSchema[] = [
|
|
|
label: '煤矿名称',
|
|
label: '煤矿名称',
|
|
|
component: 'Input',
|
|
component: 'Input',
|
|
|
colProps: { span: 6 },
|
|
colProps: { span: 6 },
|
|
|
- // groupName: '常规查询',
|
|
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
field: 'mineNameAbbr',
|
|
field: 'mineNameAbbr',
|
|
@@ -80,7 +131,7 @@ export const searchFormSchema: FormSchema[] = [
|
|
|
options: [
|
|
options: [
|
|
|
{ label: '拟建矿井', value: '0' },
|
|
{ label: '拟建矿井', value: '0' },
|
|
|
{ label: '正常生产矿井', value: '1' },
|
|
{ label: '正常生产矿井', value: '1' },
|
|
|
- { label: '长期停产矿井', value: '1' },
|
|
|
|
|
|
|
+ { label: '长期停产矿井', value: '8' },
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
colProps: { span: 6 },
|
|
colProps: { span: 6 },
|
|
@@ -99,7 +150,6 @@ export const searchFormSchema: FormSchema[] = [
|
|
|
colProps: { span: 6 },
|
|
colProps: { span: 6 },
|
|
|
groupName: '高级查询',
|
|
groupName: '高级查询',
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
field: 'status',
|
|
field: 'status',
|
|
|
label: '在线状态',
|
|
label: '在线状态',
|
|
@@ -148,10 +198,10 @@ export const minesData = [
|
|
|
managementName: '执法二处',
|
|
managementName: '执法二处',
|
|
|
mineName: '府谷县能源有限公司古城一号煤矿',
|
|
mineName: '府谷县能源有限公司古城一号煤矿',
|
|
|
mineNameAbbr: '府谷县一号煤矿',
|
|
mineNameAbbr: '府谷县一号煤矿',
|
|
|
- productionStatus: '0',
|
|
|
|
|
|
|
+ productionStatus: '0', // 拟建矿井(蓝色)
|
|
|
riskLevel: '0',
|
|
riskLevel: '0',
|
|
|
- accessStatus: '0',
|
|
|
|
|
- status: '0',
|
|
|
|
|
|
|
+ accessStatus: '0', // 未接入(黄色)
|
|
|
|
|
+ status: '0', // 离线(红色)
|
|
|
yingjieNum: '0',
|
|
yingjieNum: '0',
|
|
|
accessGoafNum: '0',
|
|
accessGoafNum: '0',
|
|
|
notAccessGoafNum: '0',
|
|
notAccessGoafNum: '0',
|
|
@@ -161,12 +211,25 @@ export const minesData = [
|
|
|
managementName: '执法二处',
|
|
managementName: '执法二处',
|
|
|
mineName: '府谷县能源有限公司古城二号煤矿',
|
|
mineName: '府谷县能源有限公司古城二号煤矿',
|
|
|
mineNameAbbr: '府谷县二号煤矿',
|
|
mineNameAbbr: '府谷县二号煤矿',
|
|
|
- productionStatus: '0',
|
|
|
|
|
|
|
+ productionStatus: '1', // 正常生产矿井(绿色)
|
|
|
riskLevel: '0',
|
|
riskLevel: '0',
|
|
|
- accessStatus: '0',
|
|
|
|
|
- status: '0',
|
|
|
|
|
|
|
+ accessStatus: '1', // 已接入(绿色)
|
|
|
|
|
+ status: '1', // 在线(绿色)
|
|
|
yingjieNum: '0',
|
|
yingjieNum: '0',
|
|
|
accessGoafNum: '0',
|
|
accessGoafNum: '0',
|
|
|
notAccessGoafNum: '0',
|
|
notAccessGoafNum: '0',
|
|
|
},
|
|
},
|
|
|
-];
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ mineCode: '',
|
|
|
|
|
+ managementName: null,
|
|
|
|
|
+ mineName: undefined,
|
|
|
|
|
+ mineNameAbbr: ' ',
|
|
|
|
|
+ productionStatus: '', // 空值显示「—」
|
|
|
|
|
+ riskLevel: null,
|
|
|
|
|
+ accessStatus: undefined, // 空值显示「—」
|
|
|
|
|
+ status: '', // 未连接显示「/」
|
|
|
|
|
+ yingjieNum: null,
|
|
|
|
|
+ accessGoafNum: ' ',
|
|
|
|
|
+ notAccessGoafNum: undefined,
|
|
|
|
|
+ },
|
|
|
|
|
+];
|