import { BasicColumn, FormSchema } from '/@/components/Table'; const colHalf = { span: 12 }; const deptSelectBase = { sync: false, checkStrictly: true, defaultExpandLevel: 2, }; const deptSelectSingleProps = { ...deptSelectBase, multiple: false, }; const deptSelectProps = { ...deptSelectBase, multiple: true, }; const hasWorkflowInfo = ({ values }) => !!(values.proofreadBy || values.proofreadTime || values.auditBy || values.auditTime || values.approveBy || values.approveTime); function sectionDivider(label: string, field: string, ifShow?: FormSchema['ifShow']): FormSchema { return { field, label, component: 'Divider', componentProps: { orientation: 'left', plain: false }, colProps: { span: 24 }, ifShow, }; } export const columns: BasicColumn[] = [ { title: 'PS编码', align: 'center', dataIndex: 'psCode', width: 140 }, { title: '类型', align: 'center', dataIndex: 'psType_dictText', width: 110 }, { title: '发放日期', align: 'center', dataIndex: 'issueDate', width: 110 }, { title: '发送部门', align: 'center', dataIndex: 'sendDeptId_dictText', width: 120 }, { title: '收信部门', align: 'center', dataIndex: 'receiveDeptId_dictText', width: 160 }, { title: '参照部门', align: 'center', dataIndex: 'referenceDeptId_dictText', width: 160 }, { title: '标题', align: 'center', dataIndex: 'title', width: 180 }, { title: '目的', align: 'center', dataIndex: 'purpose', width: 160, defaultHidden: true }, { title: '依据', align: 'center', dataIndex: 'basis', width: 160, defaultHidden: true }, { title: '担当', align: 'center', dataIndex: 'responsiblePerson', width: 90 }, { title: '状态', align: 'center', dataIndex: 'status_dictText', width: 90 }, { title: '编制人', align: 'center', dataIndex: 'compileBy', width: 100, customRender: ({ record }) => record?.createBy_dictText || record?.createBy || '', }, { title: '校对人', align: 'center', dataIndex: 'proofreadBy', width: 100, defaultHidden: true }, { title: '校对时间', align: 'center', dataIndex: 'proofreadTime', width: 165, defaultHidden: true }, { title: '审核人', align: 'center', dataIndex: 'auditBy', width: 100, defaultHidden: true }, { title: '审核时间', align: 'center', dataIndex: 'auditTime', width: 165, defaultHidden: true }, { title: '批准人', align: 'center', dataIndex: 'approveBy', width: 100, defaultHidden: true }, { title: '批准时间', align: 'center', dataIndex: 'approveTime', width: 165, defaultHidden: true }, { title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120, defaultHidden: true }, { title: '施工代号', align: 'center', dataIndex: 'constructionCode_dictText', width: 110, defaultHidden: true }, { title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true }, { title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 }, { title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true }, { title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 165, defaultHidden: true }, ]; export const searchFormSchema: FormSchema[] = [ { label: 'PS编码', field: 'psCode', component: 'JInput', colProps: { span: 6 } }, { label: '标题', field: 'title', component: 'JInput', colProps: { span: 6 } }, { label: '状态', field: 'status', component: 'JDictSelectTag', defaultValue: 'compile', componentProps: { dictCode: 'xslmes_mixer_ps_status', placeholder: '请选择状态' }, colProps: { span: 6 }, }, { label: '开始日期', field: 'issueDate_begin', component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期起' }, colProps: { span: 6 }, }, { label: '结束日期', field: 'issueDate_end', component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期止' }, colProps: { span: 6 }, }, { label: '类型', field: 'psType', component: 'JDictSelectTag', componentProps: { dictCode: 'xslmes_ps_belong' }, colProps: { span: 6 }, }, ]; export const formSchema: FormSchema[] = [ { label: '', field: 'id', component: 'Input', show: false }, sectionDivider('基本信息', 'dividerBasic'), { label: 'PS编码', field: 'psCode', component: 'Input', colProps: colHalf, componentProps: { placeholder: '请输入PS编码', allowClear: true }, }, { label: 'PS归属', field: 'psType', component: 'JDictSelectTag', componentProps: { dictCode: 'xslmes_ps_belong', placeholder: '请选择PS归属' }, colProps: colHalf, }, { label: '施工代号', field: 'constructionCode', component: 'JDictSelectTag', componentProps: { dictCode: 'xslmes_construction_code', placeholder: '请选择施工代号' }, colProps: colHalf, }, { label: '发放日期', field: 'issueDate', component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, placeholder: '请选择发放日期' }, colProps: colHalf, }, { label: '状态', field: 'status', component: 'JDictSelectTag', defaultValue: 'compile', componentProps: { dictCode: 'xslmes_mixer_ps_status', disabled: true }, colProps: colHalf, }, { label: '编制人', field: 'compileBy', component: 'Input', componentProps: { disabled: true, bordered: false, placeholder: '保存后按创建人显示' }, colProps: colHalf, }, { label: '担当', field: 'responsiblePerson', component: 'Input', colProps: colHalf, componentProps: { placeholder: '请输入担当', allowClear: true }, }, { label: '标题', field: 'title', component: 'Input', colProps: { span: 24 }, componentProps: { placeholder: '请输入标题', allowClear: true }, dynamicRules: () => [{ required: true, message: '请输入标题' }], }, sectionDivider('组织与部门', 'dividerDept'), { label: '所属工厂', field: 'factoryId', component: 'JSelectDept', componentProps: deptSelectSingleProps, colProps: colHalf, }, { label: '发送部门', field: 'sendDeptId', component: 'JSelectDept', componentProps: deptSelectSingleProps, colProps: colHalf, }, { label: '收信部门', field: 'receiveDeptId', component: 'JSelectDept', componentProps: deptSelectProps, colProps: colHalf, dynamicRules: () => [{ required: true, message: '请选择收信部门' }], }, { label: '参照部门', field: 'referenceDeptId', component: 'JSelectDept', componentProps: deptSelectProps, colProps: colHalf, dynamicRules: () => [{ required: true, message: '请选择参照部门' }], }, sectionDivider('文档内容', 'dividerContent'), { label: '目的', field: 'purpose', component: 'InputTextArea', componentProps: { rows: 3, placeholder: '请输入目的', maxlength: 500, showCount: true }, colProps: colHalf, }, { label: '依据', field: 'basis', component: 'InputTextArea', componentProps: { rows: 3, placeholder: '请输入依据', maxlength: 500, showCount: true }, colProps: colHalf, }, { label: '内容', field: 'content', component: 'InputTextArea', componentProps: { rows: 5, placeholder: '请输入内容', maxlength: 2000, showCount: true }, colProps: { span: 24 }, }, sectionDivider('审批记录', 'dividerWorkflow', hasWorkflowInfo), { label: '校对人', field: 'proofreadBy', component: 'Input', componentProps: { disabled: true, bordered: false }, colProps: colHalf, ifShow: ({ values }) => !!values.proofreadBy, }, { label: '校对时间', field: 'proofreadTime', component: 'Input', componentProps: { disabled: true, bordered: false }, colProps: colHalf, ifShow: ({ values }) => !!values.proofreadTime, }, { label: '审核人', field: 'auditBy', component: 'Input', componentProps: { disabled: true, bordered: false }, colProps: colHalf, ifShow: ({ values }) => !!values.auditBy, }, { label: '审核时间', field: 'auditTime', component: 'Input', componentProps: { disabled: true, bordered: false }, colProps: colHalf, ifShow: ({ values }) => !!values.auditTime, }, { label: '批准人', field: 'approveBy', component: 'Input', componentProps: { disabled: true, bordered: false }, colProps: colHalf, ifShow: ({ values }) => !!values.approveBy, }, { label: '批准时间', field: 'approveTime', component: 'Input', componentProps: { disabled: true, bordered: false }, colProps: colHalf, ifShow: ({ values }) => !!values.approveTime, }, ]; export const superQuerySchema = { psCode: { title: 'PS编码', order: 0, view: 'text' }, psType: { title: '类型', order: 1, view: 'list', dictCode: 'xslmes_ps_belong' }, constructionCode: { title: '施工代号', order: 2, view: 'list', dictCode: 'xslmes_construction_code' }, issueDate: { title: '发放日期', order: 3, view: 'date' }, title: { title: '标题', order: 4, view: 'text' }, status: { title: '状态', order: 5, view: 'list', dictCode: 'xslmes_mixer_ps_status' }, responsiblePerson: { title: '担当', order: 6, view: 'text' }, };