|
|
@@ -1,25 +1,34 @@
|
|
|
import { BasicColumn, FormSchema } from '/@/components/Table';
|
|
|
import { h } from '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 productionStatusMap: Record<string | number, { label: string; value: number; color: string }> = {
|
|
|
+ 0: { label: '正常生产矿井', value: 0, color: 'green' },
|
|
|
+ 1: { label: '拟建矿井', value: 1, color: 'blue' },
|
|
|
+ 2: { label: '正常建设煤矿', value: 2, color: 'green' },
|
|
|
+ 3: { label: '自行停产矿井', value: 3, color: 'green' },
|
|
|
+ 4: { label: '正在关闭', value: 4, color: 'green' },
|
|
|
+ 5: { label: '责令停产整顿', value: 5, color: 'green' },
|
|
|
+ 6: { label: '责令停止建设', value: 6, color: 'green' },
|
|
|
+ 7: { label: '已关闭矿井', value: 7, color: 'green' },
|
|
|
+ 8: { label: '长期停产矿井', value: 8, color: 'green' },
|
|
|
+ 9: { label: '长期停建矿井', value: 9, color: 'green' },
|
|
|
+ 10: { label: '停产整改矿井', value: 10, color: 'green' },
|
|
|
+ 11: { label: '长期停建无法联系', value: 11, color: 'green' },
|
|
|
+ 12: { label: '停建整改', value: 12, color: 'green' },
|
|
|
+ 13: { label: '自行停建', value: 13, color: 'green' },
|
|
|
+ 14: { label: '正在实施关闭', value: 14, color: 'green' },
|
|
|
+ // 15: { label: '已关闭矿井', value: 15, color: 'green' },
|
|
|
+};
|
|
|
+
|
|
|
+// 颜色映射
|
|
|
+const colorHexMap: Record<string, string> = {
|
|
|
+ blue: '#1890ff',
|
|
|
+ green: '#208840',
|
|
|
+ gold: '#faad14',
|
|
|
+ red: '#f5222d',
|
|
|
+ gray: '#8c8c8c',
|
|
|
+ black: '#000000',
|
|
|
};
|
|
|
// 解析queJson并拼接orderNum+queCon的辅助函数
|
|
|
const formatQueJson = (queJsonStr: string) => {
|
|
|
@@ -37,11 +46,6 @@ const formatQueJson = (queJsonStr: string) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 通用空值处理函数(非在线状态的空值统一显示「—」)
|
|
|
-const formatEmptyValue = (value: any) => {
|
|
|
- return value === null || value === undefined || value === '' || /^\s*$/.test(String(value));
|
|
|
-};
|
|
|
-
|
|
|
/** 表格列配置 */
|
|
|
export const columns: BasicColumn[] = [
|
|
|
{
|
|
|
@@ -59,11 +63,10 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'mineProStatus',
|
|
|
width: 120,
|
|
|
customRender: ({ record }) => {
|
|
|
- // 空值处理
|
|
|
- // 状态映射 + 标签渲染
|
|
|
- const status = String(record.mineProStatus);
|
|
|
- const { text, color } = productionStatusMap[status] || { text: '未知状态', color: 'gray' };
|
|
|
- return h(Tag, { color }, () => text);
|
|
|
+ // 空值/异常值处理
|
|
|
+ const status = record.mineProStatus;
|
|
|
+ const { label, color } = productionStatusMap[status] || { label: '未知状态', color: 'balck' };
|
|
|
+ return h('span', { style: { color: colorHexMap[color] || colorHexMap.gray } }, label);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
@@ -71,12 +74,14 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'mineLinkStatus',
|
|
|
width: 100,
|
|
|
customRender: ({ record }) => {
|
|
|
- // 未连接/空值 显示「/」
|
|
|
- // 状态映射 + 标签渲染
|
|
|
- const status = String(record.mineLinkStatus);
|
|
|
- const text = status === '1' ? '在线' : '离线';
|
|
|
- const color = status === '1' ? 'green' : 'red';
|
|
|
- return h(Tag, { color }, () => text);
|
|
|
+ console.log(record.mineLinkStatus);
|
|
|
+ const status = record.mineLinkStatus;
|
|
|
+ if (status === undefined || status === null) {
|
|
|
+ return h('span', { style: { color: colorHexMap.black } }, '/');
|
|
|
+ }
|
|
|
+ const text = status === 1 ? '在线' : '离线';
|
|
|
+ const textColor = status === 1 ? colorHexMap.green : colorHexMap.red;
|
|
|
+ return h('span', { style: { color: textColor } }, text);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
@@ -89,38 +94,22 @@ export const columns: BasicColumn[] = [
|
|
|
const displayText = formatQueJson(text);
|
|
|
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px' } }, [
|
|
|
h('span', { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, displayText),
|
|
|
- h(
|
|
|
- 'button',
|
|
|
- {
|
|
|
- onClick: () => {
|
|
|
- record.onViewDetail?.(record);
|
|
|
- },
|
|
|
- title: '查看详情',
|
|
|
- style: {
|
|
|
- padding: '5px',
|
|
|
- },
|
|
|
- },
|
|
|
- [
|
|
|
- h('div', {
|
|
|
- style: {
|
|
|
- background: `url('/@/assets/images/basicInfo/dataQuality/icon-view.svg')`,
|
|
|
- width: '16px',
|
|
|
- height: '16px',
|
|
|
- backgroundSize: 'contain',
|
|
|
- backgroundRepeat: 'no-repeat',
|
|
|
- },
|
|
|
- class: 'action-icon',
|
|
|
- alt: '查看详情',
|
|
|
- }),
|
|
|
- ]
|
|
|
- ),
|
|
|
]);
|
|
|
},
|
|
|
+ slots: {
|
|
|
+ customRender : 'queJson'
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '当前状态',
|
|
|
dataIndex: 'isOk',
|
|
|
width: 100,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ const status = record.isOk;
|
|
|
+ const text = status ? '已解决' : '未解决';
|
|
|
+ const textColor = status ? colorHexMap.green : colorHexMap.red;
|
|
|
+ return h('span', { style: { color: textColor } }, text);
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '处理时间',
|
|
|
@@ -132,11 +121,11 @@ export const columns: BasicColumn[] = [
|
|
|
/** 查询表单配置 */
|
|
|
export const searchFormSchema: FormSchema[] = [
|
|
|
{
|
|
|
- field: 'mineName',
|
|
|
+ field: 'mineCode',
|
|
|
label: '煤矿名称',
|
|
|
- component: 'Input',
|
|
|
+ component: 'MineCascader',
|
|
|
colProps: { span: 6 },
|
|
|
- // groupName: '常规查询',
|
|
|
+ groupName: '常规查询',
|
|
|
},
|
|
|
{
|
|
|
field: 'mineNameAbbr',
|
|
|
@@ -157,91 +146,35 @@ export const searchFormSchema: FormSchema[] = [
|
|
|
],
|
|
|
},
|
|
|
colProps: { span: 6 },
|
|
|
- groupName: '高级查询',
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'isConnected',
|
|
|
- label: '是否需要接入',
|
|
|
- component: 'Select',
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- { label: '否', value: '0' },
|
|
|
- { label: '是', value: '1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- colProps: { span: 6 },
|
|
|
- groupName: '高级查询',
|
|
|
+ groupName: '常规查询',
|
|
|
},
|
|
|
|
|
|
{
|
|
|
- field: 'status',
|
|
|
+ field: 'mineLinkStatus',
|
|
|
label: '在线状态',
|
|
|
component: 'Select',
|
|
|
componentProps: {
|
|
|
options: [
|
|
|
{ label: '离线', value: '0' },
|
|
|
{ label: '在线', value: '1' },
|
|
|
+ { label: '未连接', value: '2' },
|
|
|
],
|
|
|
},
|
|
|
colProps: { span: 6 },
|
|
|
- groupName: '高级查询',
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'riskLevel',
|
|
|
- label: '风险等级',
|
|
|
- component: 'Select',
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- { label: 'Ⅰ类容易自燃', value: '0' },
|
|
|
- { label: 'Ⅱ类自燃', value: '1' },
|
|
|
- { label: 'Ⅲ类不易自燃', value: '2' },
|
|
|
- ],
|
|
|
- },
|
|
|
- colProps: { span: 6 },
|
|
|
- groupName: '高级查询',
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'statusChange',
|
|
|
- label: '状态变化',
|
|
|
- component: 'Select',
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- { label: '否', value: '0' },
|
|
|
- { label: '是', value: '1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- colProps: { span: 6 },
|
|
|
- groupName: '高级查询',
|
|
|
+ groupName: '常规查询',
|
|
|
},
|
|
|
];
|
|
|
|
|
|
-// 模拟煤矿选项数据
|
|
|
-export const mineOptions = [
|
|
|
- { label: '神东集团布尔台煤矿', value: '神东集团布尔台煤矿' },
|
|
|
- { label: '府谷县后安能源有限公司古城一号煤矿', value: '府谷县后安能源有限公司古城一号煤矿' },
|
|
|
-];
|
|
|
// 模拟煤矿在线状态选项数据
|
|
|
export const mineLinkStatusOptions = [
|
|
|
- { label: '在线', value: '1' },
|
|
|
- { label: '离线', value: '0' },
|
|
|
+ { label: '在线', value: 1 },
|
|
|
+ { label: '离线', value: 0 },
|
|
|
];
|
|
|
-export const topFormSchema = [
|
|
|
+export const topFormSchema: FormSchema[]= [
|
|
|
{
|
|
|
- field: 'mineName',
|
|
|
+ field: 'mineCode',
|
|
|
label: '煤矿名称',
|
|
|
- component: 'Select',
|
|
|
- componentProps: {
|
|
|
- options: mineOptions,
|
|
|
- },
|
|
|
- required: true,
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'mineLinkStatus',
|
|
|
- label: '当前状态',
|
|
|
- component: 'Select',
|
|
|
- componentProps: {
|
|
|
- options: mineLinkStatusOptions,
|
|
|
- },
|
|
|
+ component: 'MineCascader',
|
|
|
required: true,
|
|
|
},
|
|
|
];
|