/** FormCreate Designer DragRule:离职套件 */ let _uidSeq = 0 function uniqueId() { const num = 370 + ++_uidSeq return ( 'F' + Math.random().toString(36).slice(3, 6) + Number(`${Date.now()}`).toString(36) + num.toString(36) + 'g' ) } export const RESIGN_REASON_OPTIONS = [ { label: '家庭原因', value: '家庭原因' }, { label: '个人原因', value: '个人原因' }, { label: '发展原因', value: '发展原因' }, { label: '合同到期不续签', value: '合同到期不续签' }, { label: '其他', value: '其他' } ] function buildResignationKitChildren() { const hireDateField = uniqueId() const lastWorkDayField = uniqueId() const resignReasonField = uniqueId() const resignRemarkField = uniqueId() return { hireDateField, lastWorkDayField, resignReasonField, resignRemarkField, children: [ { type: 'datePicker', field: hireDateField, title: '入职日期', info: '', $required: true, props: { _fc_kit_field: 'hireDate', type: 'date', format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', placeholder: '请选择入职日期' } }, { type: 'datePicker', field: lastWorkDayField, title: '最后工作日', info: '', $required: true, props: { _fc_kit_field: 'lastWorkDay', type: 'date', format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', placeholder: '请选择最后工作日' } }, { type: 'select', field: resignReasonField, title: '离职原因', info: '', $required: true, options: RESIGN_REASON_OPTIONS.map((o) => ({ ...o })), props: { _fc_kit_field: 'resignReason', placeholder: '请选择离职原因', clearable: true } }, { type: 'textarea', field: resignRemarkField, title: '离职原因备注', info: '', $required: false, props: { _fc_kit_field: 'resignRemark', rows: 3, placeholder: '可选' } } ] } } export const resignationKitDragRule = { menu: 'kit' as const, icon: 'icon-transfer', label: '离职', name: 'resignationKit', input: false, drag: true, dragBtn: true, mask: false, inside: true, rule() { const built = buildResignationKitChildren() return { type: 'resignationKit', props: { hireDateField: built.hireDateField, lastWorkDayField: built.lastWorkDayField, resignReasonField: built.resignReasonField, resignRemarkField: built.resignRemarkField }, children: built.children } }, props() { return [] } }