Files
geg-gas-web/src/views/mdm/Port/components/config.ts

632 lines
18 KiB
TypeScript
Raw Normal View History

2025-10-24 11:05:26 +08:00
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
2025-10-24 17:19:02 +08:00
useCustomConfig: false
2025-10-24 11:05:26 +08:00
};
export const searchFormSchema: FormSchema[] = [
2025-10-24 17:19:02 +08:00
{
field: 'fullName',
label: '名称',
component: 'Input'
2025-10-24 11:05:26 +08:00
},
2025-10-24 17:19:02 +08:00
{
field: 'valid',
label: '有效标志',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body
}
}
2025-10-24 11:05:26 +08:00
];
export const columns: BasicColumn[] = [
2025-10-24 17:19:02 +08:00
{
dataIndex: 'code',
title: '编码',
componentType: 'input',
align: 'left',
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
sorter: true
},
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
{
dataIndex: 'fullName',
title: '名称',
componentType: 'input',
align: 'left',
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
sorter: true
},
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
{
dataIndex: 'shortName',
title: '简称',
componentType: 'input',
align: 'left',
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
sorter: true
},
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
{
dataIndex: 'regionCode',
title: '所属国家和地区',
componentType: 'cascader',
align: 'left',
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
sorter: true
},
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
{
dataIndex: 'valid',
title: '有效标志',
componentType: 'select',
align: 'left',
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
sorter: true
},
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
{
dataIndex: 'note',
title: '备注',
componentType: 'textarea',
align: 'left',
2025-10-24 11:05:26 +08:00
2025-10-24 17:19:02 +08:00
sorter: true
}
2025-10-24 11:05:26 +08:00
];
//表单事件
export const formEventConfigs = {
2025-10-24 17:19:02 +08:00
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] }
}
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] }
}
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] }
}
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] }
}
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false
}
]
2025-10-24 11:05:26 +08:00
};
export const formProps: FormProps = {
2025-10-24 17:19:02 +08:00
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: 'ea4fcc80a1dd40219bcc8e28b7052655',
field: 'code',
label: '编码',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入编码',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' }
}
2025-10-24 11:05:26 +08:00
},
2025-10-24 17:19:02 +08:00
{
key: '1b3bf1efab214701a9588b4cfb9dfd5c',
field: 'fullName',
label: '名称',
type: 'input',
component: 'Input',
colProps: { span: 16 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入名称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: true,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' }
}
2025-10-24 11:05:26 +08:00
},
2025-10-24 17:19:02 +08:00
{
key: '0dcc7f43f9e34f1b87cc2f730417b3e0',
field: 'shortName',
label: '简称',
type: 'input',
component: 'Input',
colProps: { span: 8 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入简称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: true,
showLabel: true,
required: true,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' }
}
},
{
field: 'regionCode',
label: '所属国家/地区',
type: 'areacascader',
component: 'AreaCascader',
2025-10-24 17:19:02 +08:00
colProps: { span: 16 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择区域',
2025-10-24 17:19:02 +08:00
showLabel: true,
disabled: false,
allowClear: true,
clearable: false,
2025-10-24 17:19:02 +08:00
required: false,
rules: [],
events: {},
isShow: true,
style: { width: '100%' },
fieldNames: { label: 'fullName', value: 'code', children: 'children' },
excludeType: 'CONTINENT'
2025-10-24 17:19:02 +08:00
}
},
{
key: 'cd46b163fa8345809ab5d579d96f40f2',
field: 'capacity',
label: '吞吐量',
type: 'number',
component: 'InputNumber',
colProps: { span: 8 },
defaultValue: null,
componentProps: {
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
width: '100%',
span: '',
defaultValue: 0.0,
formatter(value: number) {
if (!value) return '';
console.log(value);
// 3. 保留4位小数toFixed会自动四舍五入
const fixedNum = parseFloat(value).toFixed(4); // 结果为字符串,如 "12345.6700"、"-1234.5679"
// 4. 分割整数部分和小数部分
const [integerPart, decimalPart] = fixedNum.split('.');
// 5. 处理整数部分:添加千分位分隔符
// 正则解释:\B 匹配非单词边界,(?=(\d{3})+(?!\d)) 正向预查每3位数字
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
// 6. 拼接整数、小数部分,返回结果
return `${formattedInteger}.${decimalPart}`;
// return value.toLocaleString('zh-CN', {
// minimumFractionDigits: 4,
// maximumFractionDigits: 4
// });
},
min: null,
max: null,
step: 0.0001,
maxlength: '',
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '16e52805d5334759be1d2f40d517efa6',
field: 'longitude',
label: '连线经度',
type: 'number',
component: 'InputNumber',
colProps: { span: 8 },
defaultValue: null,
componentProps: {
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
width: '100%',
precision: '2',
span: '',
defaultValue: null,
min: null,
max: null,
step: 0.01,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '6b1a921de60d4676be79074cefe0327a',
field: 'latitude',
label: '连线纬度',
type: 'number',
component: 'InputNumber',
colProps: { span: 8 },
defaultValue: null,
componentProps: {
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
precision: '2',
width: '100%',
span: '',
defaultValue: null,
min: null,
max: null,
step: 0.01,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '68e573db83d941efb9a5687f84726b6b',
field: 'limit1',
label: '限制1',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入限制1',
maxlength: null,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '34c007fd1d9544ecb3a5ecea5d7f7b1b',
field: 'limit2',
label: '限制2',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入限制2',
maxlength: null,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '9099e3d919a64dfe860719c34fcaf37d',
field: 'limit3',
label: '限制3',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入限制3',
maxlength: null,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '16fbe387e5c6471b9be06524f4766f10',
field: 'limit4',
label: '限制4',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入限制4',
maxlength: null,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: 'ef6536972cc54e21b09b4f5637730d0b',
field: 'sort',
label: '显示顺序',
type: 'number',
component: 'InputNumber',
colProps: { span: 8 },
defaultValue: null,
componentProps: {
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
width: '100%',
span: '',
defaultValue: null,
min: 0,
max: null,
step: 1,
maxlength: '',
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
},
{
key: '03f1a079e8544b77a793460306207f41',
field: 'valid',
label: '有效标志',
type: 'select',
component: 'XjrSelect',
colProps: { span: 8 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择有效标志',
sepTextField: '',
showLabel: true,
showSearch: false,
clearable: false,
disabled: true,
mode: 'multiple',
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' }
],
defaultSelect: null,
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7'
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
itemId: '1978057078528327681',
style: { width: '100%' }
}
},
{
key: 'e15f5901160a49e9969fdd7d61e00053',
field: 'note',
label: '备注',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入备注',
maxlength: null,
rows: 4,
autoSize: false,
showCount: false,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
}
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: []
};