Files
tms-erp-web/src/option/business/shipping-template.js
T
2026-09-16 06:30:30 +08:00

326 lines
8.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {
auditColumns,
createCrudOption,
selectRule,
textRule,
transportTypeOptions,
withSearchPlaceholders,
} from './common';
const templateTypeOptions = [
{ label: '运输计划', value: '运输计划' },
{ label: '运单', value: '运单' },
];
export const config = {
title: '发货模板',
permission: 'shipping_template',
detailButton: true,
detailButtonIgnoreDraftStatus: true,
detailSections: [
{
title: '模板信息',
fields: [
['templateCode', '模板编号'],
['templateName', '模板名称'],
['templateType', '模板类型'],
['transportType', '运输方式'],
['remark', '备注', 2],
],
},
{
title: '基本信息',
fields: [
['projectName', '项目'],
['contractName', '客户合同'],
['transportType', '运输方式'],
['basicRemark', '备注', 2],
],
},
{
title: '收发货信息',
fields: [
['departureContact', '发货联系人'],
['departurePhone', '发货联系方式'],
['departureAddress', '发货地址', 2],
['arrivalContact', '收货联系人'],
['arrivalPhone', '收货联系方式'],
['arrivalAddress', '收货地址', 2],
],
},
],
tableColumnOrder: [
'templateCode',
'templateName',
'templateType',
'transportType',
'createUserName',
'updateTime',
'remark',
'createTime',
],
exportColumns: [
{ prop: 'templateCode', label: '模板编号' },
{ prop: 'templateName', label: '模板名称' },
{ prop: 'templateType', label: '模板类型' },
{ prop: 'transportType', label: '运输方式' },
{ prop: 'createUserName', label: '创建人' },
{ prop: 'updateTime', label: '更新时间' },
{ prop: 'remark', label: '备注' },
{ prop: 'createTime', label: '创建时间' },
],
enableAllDept: false,
enableProjectSelect: true,
projectQueryParams: {
approvalStatuses: 'approved,change_approved',
},
contractQueryParams: {
contractCategory: '客户合同',
},
excludeVoidedProjects: true,
enableAttachmentTable: true,
detailAttachmentDescriptionPlain: true,
enableTransportPlanForm: true,
enableShippingTemplateFreight: true,
editableRoadAddress: false,
fixedTransportAddressType: true,
enableTemplateCodePreview: true,
attachmentTitle: '附件',
defaultForm: {
templateType: '运输计划',
transportType: '公路运输',
transportTypeName: '公路运输',
},
transportFormRequiredFields: [
['projectName', '项目'],
['contractName', '客户合同'],
['transportType', '运输方式'],
['departureAddress', '发货地址'],
['arrivalAddress', '收货地址'],
],
actions: ['copy'],
operations: [
{
action: 'createFromTemplate',
label: '从模板新建',
permission: 'shipping_template_add',
},
],
};
export const option = {
...createCrudOption(
withSearchPlaceholders([
{
label: '',
prop: 'templateInfoTitle',
formslot: true,
span: 24,
order: 400,
hide: true,
labelWidth: 0,
},
{
label: '模板类型',
prop: 'templateType',
type: 'select',
search: true,
searchOrder: 2,
span: 8,
order: 390,
dicData: templateTypeOptions,
minWidth: 120,
rules: selectRule('模板类型'),
display: true,
},
{
label: '模板名称',
prop: 'templateName',
search: true,
searchOrder: 3,
span: 8,
order: 380,
minWidth: 150,
rules: textRule('模板名称', 50, true),
display: true,
},
{
label: '模板编号',
prop: 'templateCode',
search: true,
searchOrder: 4,
span: 8,
order: 370,
minWidth: 170,
disabled: true,
placeholder: '系统自动生成',
display: true,
},
{
label: '备注',
prop: 'remark',
type: 'textarea',
minRows: 2,
span: 24,
order: 360,
minWidth: 180,
maxlength: 200,
showWordLimit: true,
rules: textRule('备注', 200),
display: true,
},
{
label: '',
prop: 'basicInfoTitle',
formslot: true,
span: 24,
order: 350,
hide: true,
labelWidth: 0,
},
{
label: '项目',
prop: 'projectName',
formslot: true,
search: true,
searchOrder: 1,
span: 8,
order: 340,
minWidth: 150,
rules: textRule('项目', 100, true),
display: true,
},
{
label: '客户合同',
prop: 'contractName',
formslot: true,
span: 8,
order: 330,
minWidth: 160,
rules: textRule('客户合同', 100, true),
display: true,
},
{
label: '运输方式',
prop: 'transportType',
type: 'select',
span: 8,
order: 320,
dicData: transportTypeOptions,
minWidth: 130,
rules: selectRule('运输方式'),
display: true,
},
{
label: '备注',
prop: 'basicRemark',
type: 'textarea',
minRows: 2,
span: 24,
order: 315,
minWidth: 180,
maxlength: 200,
showWordLimit: true,
rules: textRule('备注', 200),
display: true,
},
{
label: '',
prop: 'shippingInfoTitle',
formslot: true,
span: 24,
order: 310,
hide: true,
labelWidth: 0,
},
{
label: '发货地址',
prop: 'departureAddress',
formslot: true,
span: 24,
order: 300,
minWidth: 220,
rules: textRule('发货地址', 255, true),
display: true,
},
{
label: '收货地址',
prop: 'arrivalAddress',
formslot: true,
span: 24,
order: 290,
minWidth: 220,
rules: textRule('收货地址', 255, true),
display: true,
},
{
label: '',
prop: 'goodsInfoTitle',
formslot: true,
span: 24,
order: 280,
hide: true,
labelWidth: 0,
},
{
label: '',
prop: 'goodsJson',
type: 'textarea',
formslot: true,
span: 24,
order: 270,
hide: true,
labelWidth: '0px',
className: 'shipping-template-page__full-form-item',
},
{ label: '运费信息', prop: 'freightJson', hide: true, display: false },
{
label: '',
prop: 'attachmentTitle',
formslot: true,
span: 24,
order: 260,
hide: true,
labelWidth: 0,
},
{
label: '',
prop: 'attachmentsJson',
type: 'textarea',
formslot: true,
span: 24,
order: 250,
hide: true,
labelWidth: '0px',
className: 'shipping-template-page__full-form-item',
},
{ label: '项目ID', prop: 'projectId', hide: true, display: false },
{ label: '客户合同ID', prop: 'contractId', hide: true, display: false },
{ label: '发货地', prop: 'departureName', hide: true, display: false },
{ label: '发货联系人', prop: 'departureContact', hide: true, display: false },
{ label: '发货联系方式', prop: 'departurePhone', hide: true, display: false },
{ label: '收货地', prop: 'arrivalName', hide: true, display: false },
{ label: '收货联系人', prop: 'arrivalContact', hide: true, display: false },
{ label: '收货联系方式', prop: 'arrivalPhone', hide: true, display: false },
{
label: '所属组织',
prop: 'deptName',
minWidth: 150,
addDisplay: false,
editDisplay: false,
display: false,
},
...auditColumns.map(column => ({
...column,
display: false,
})),
])
),
dialogWidth: '92%',
dialogTop: '4vh',
// label 宽度一致(容纳 6 汉字,超出换行由全局样式控制),右对齐由 labelPosition: 'right' 保证
labelWidth: 100,
// 自定义弹窗 class,用于让新增/编辑弹窗体占满视口高度、视觉居中(参照 vehicle/customer-archive)
dialogCustomClass: 'shipping-template-dialog',
};