import type { IDynamicFormOptions } from '@/components/dynamic'; import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue'; import type { FieldProps } from '@/components/form/Field.vue'; import type { SignatureFieldProps } from '@/components/form/SignatureField.vue'; import { useImageSimpleUploadCo } from '@/common/components/upload/ImageUploadCo'; /** 与 `evaluation-form` 页一致的动态表单配置(供编辑页与只读展示复用) */ export function buildSelfAssessmentFormOptions( signUpload: ReturnType, type: 'start' | 'end', ): IDynamicFormOptions { return { formAdditionaProps: { labelFlex: 4, inputFlex: 8, }, formItems: [ type === 'start' ? { type: 'flat-group', label: '传承人自查评估', name: 'selfAssessmentGroup', childrenColProps: { span: 24 }, children: [ { label: '传承人名称', name: 'inheritor', type: 'text', additionalProps: { placeholder: '请输入传承人名称' }, }, { label: '项目保护单位', name: 'unit', type: 'text', additionalProps: { placeholder: '请输入项目保护单位' }, }, { label: '项目名称', name: 'ichName', type: 'text', additionalProps: { placeholder: '请输入项目名称' }, }, { label: '联系电话', name: 'mobile', type: 'text', additionalProps: { placeholder: '请输入联系电话' }, }, { label: '身份证号', name: 'idCard', type: 'text', additionalProps: { placeholder: '请输入身份证号' }, }, { label: '级别', name: 'level', type: 'select-id', additionalProps: { placeholder: '请选择级别', loadData: async () => [ { text: '国家级', value: 23 }, { text: '省级', value: 24 }, { text: '市级', value: 25 }, ], }, formProps: { showRightArrow: true, }, }, { label: '家庭住址', name: 'address', type: 'text', additionalProps: { placeholder: '请输入家庭住址' }, }, { label: '获评时间', name: 'awardTime', type: 'date', additionalProps: { placeholder: '请选择获评时间', shouldUpdateValueImmediately: true, }, formProps: { showRightArrow: true, }, }, { label: '自评报告', name: 'content', type: 'object', children: [ { label: '', name: 'title', type: 'static-text', }, { label: '(一)开展传承活动,培养后继人才情况;', name: 'item0', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, { label: '(二)妥善保存相关实物、资料情况;', name: 'item1', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, { label: '(三)配合进行非物质文化遗产调查情况;', name: 'item2', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, { label: '(四)参加非物质文化遗产公益性宣传情况;', name: 'item3', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, { label: '(五)补助经费使用情况;', name: 'item4', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, { label: '(六)参加培训情况', name: 'item5', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, { label: '(七)其他相关情况;', name: 'item6', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, } as FieldProps, }, { label: '(八)存在的问题及原因分析。', name: 'item7', type: 'textarea', formProps: { labelPosition: 'top' }, additionalProps: { placeholder: '请填写', maxLength: 1000, colon: false, showWordLimit: true, }, }, ], }, ], } : { type: 'flat-group', label: '传承人自查评估', name: 'selfAssessmentGroup2', childrenColProps: { span: 24 }, children: [ { label: '其他相关情况(扣分内容)', name: 'deductContent', type: 'text', additionalProps: { showWordLimit: true, maxlength: 260, placeholder: '请输入其他相关情况(扣分内容)', } as FieldProps, }, { label: '其他相关情况(扣分分值)', name: 'deductPoints', type: 'number', additionalProps: { placeholder: '请输入其他相关情况(扣分分值)', min: 0, max: 100, }, }, { label: '自我评估', name: 'self', type: 'radio-value', additionalProps: { options: [ { text: '优秀', value: 1 }, { text: '合格', value: 2 }, { text: '不合格', value: 3 }, { text: '丧失传承能力', value: 4 }, { text: '取消资格', value: 5 }, ], vertical: true, } as RadioValueProps, }, { label: '传承人签名', name: 'inheritorSign', type: 'sign', formProps: { showRightArrow: true, }, additionalProps: { upload: signUpload, previewImageProps: { width: '400rpx', }, } as SignatureFieldProps, }, { label: '填报人联系方式', name: 'contactMobile', type: 'text', formProps: { extraMessage: '用于消息通知,若有审核回退或通过,会以短信方式通知您', }, additionalProps: { placeholder: '请填写手机号', }, }, ], }, ], formRules: { inheritor: [{ required: true, message: '请输入传承人名称' }], unit: [{ required: true, message: '请输入项目保护单位' }], ichName: [{ required: true, message: '请输入项目名称' }], mobile: [{ required: true, message: '请输入联系电话' }], idCard: [{ required: true, message: '请输入身份证号' }], level: [{ required: true, message: '请选择级别' }], address: [{ required: true, message: '请输入家庭住址' }], content: [{ required: true, message: '请填写自评报告' }], self: [{ required: true, message: '请选择自我评估' }], sign: [{ required: true, message: '请传承人签名' }], awardTime: [{ required: true, message: '请选择获评时间' }], }, }; }