diff --git a/backend/app/services/oa_publish.py b/backend/app/services/oa_publish.py index 370343f8..2182ab1f 100644 --- a/backend/app/services/oa_publish.py +++ b/backend/app/services/oa_publish.py @@ -31,6 +31,8 @@ FILLABLE_TYPES = frozenset( "money", "dept", "person", + "ownerDept", + "ownerPerson", "post", "receiveAccount", "region", @@ -56,6 +58,8 @@ LAYOUT_TYPES = frozenset( "tabPane", "group", "object", + "leaveKit", + "confirmationKit", } ) @@ -78,6 +82,7 @@ CONDITION_ELIGIBLE_TYPES = frozenset( "datePicker", "date", "person", + "ownerPerson", "post", } ) diff --git a/web-admin/src/components/oa-approval/OaConfirmationKit.vue b/web-admin/src/components/oa-approval/OaConfirmationKit.vue new file mode 100644 index 00000000..e68291d3 --- /dev/null +++ b/web-admin/src/components/oa-approval/OaConfirmationKit.vue @@ -0,0 +1,37 @@ + + + + + + diff --git a/web-admin/src/main.ts b/web-admin/src/main.ts index 2aa53de0..7b96917d 100644 --- a/web-admin/src/main.ts +++ b/web-admin/src/main.ts @@ -20,8 +20,12 @@ import { setupOaRelatedApproval } from '@/utils/oa-form-create-related-approval' import { setupOaDeptSelect } from '@/utils/oa-form-create-dept' import { setupOaMoneyField } from '@/utils/oa-form-create-money' import { setupOaPersonSelect } from '@/utils/oa-form-create-person' +import { setupOaOwnerPersonSelect } from '@/utils/oa-form-create-owner-person' +import { setupOaOwnerDeptSelect } from '@/utils/oa-form-create-owner-dept' import { setupOaPostSelect } from '@/utils/oa-form-create-post' import { setupOaReceiveAccountSelect } from '@/utils/oa-form-create-receive-account' +import { setupOaLeaveKit } from '@/utils/oa-form-create-leave-kit' +import { setupOaConfirmationKit } from '@/utils/oa-form-create-confirmation-kit' // FormCreate 按字符串解析 el-input / fc-radio 等,主应用是按需自动导入,不会全局注册; // 必须挂上官方 auto-import,否则发起审批/详情里动态表单控件会残缺(如单选项只剩文字)。 @@ -32,8 +36,12 @@ setupOaRelatedApproval(FcDesigner.formCreate) setupOaDeptSelect(FcDesigner.formCreate) setupOaMoneyField(FcDesigner.formCreate) setupOaPersonSelect(FcDesigner.formCreate) +setupOaOwnerPersonSelect(FcDesigner.formCreate) +setupOaOwnerDeptSelect(FcDesigner.formCreate) setupOaPostSelect(FcDesigner.formCreate) setupOaReceiveAccountSelect(FcDesigner.formCreate) +setupOaLeaveKit(FcDesigner.formCreate) +setupOaConfirmationKit(FcDesigner.formCreate) function maskSecret(value?: string) { if (!value) return '(empty)' diff --git a/web-admin/src/oa-fc-host/main.ts b/web-admin/src/oa-fc-host/main.ts index 2c06b216..59c88c2d 100644 --- a/web-admin/src/oa-fc-host/main.ts +++ b/web-admin/src/oa-fc-host/main.ts @@ -17,8 +17,12 @@ import { setupOaRelatedApproval } from '@/utils/oa-form-create-related-approval' import { setupOaDeptSelect } from '@/utils/oa-form-create-dept' import { setupOaMoneyField } from '@/utils/oa-form-create-money' import { setupOaPersonSelect } from '@/utils/oa-form-create-person' +import { setupOaOwnerPersonSelect } from '@/utils/oa-form-create-owner-person' +import { setupOaOwnerDeptSelect } from '@/utils/oa-form-create-owner-dept' import { setupOaPostSelect } from '@/utils/oa-form-create-post' import { setupOaReceiveAccountSelect } from '@/utils/oa-form-create-receive-account' +import { setupOaLeaveKit } from '@/utils/oa-form-create-leave-kit' +import { setupOaConfirmationKit } from '@/utils/oa-form-create-confirmation-kit' import App from './App.vue' const app = createApp(App) @@ -39,6 +43,10 @@ setupOaRelatedApproval(FcDesigner.formCreate) setupOaDeptSelect(FcDesigner.formCreate) setupOaMoneyField(FcDesigner.formCreate) setupOaPersonSelect(FcDesigner.formCreate) +setupOaOwnerPersonSelect(FcDesigner.formCreate) +setupOaOwnerDeptSelect(FcDesigner.formCreate) setupOaPostSelect(FcDesigner.formCreate) setupOaReceiveAccountSelect(FcDesigner.formCreate) +setupOaLeaveKit(FcDesigner.formCreate) +setupOaConfirmationKit(FcDesigner.formCreate) app.mount('#app') diff --git a/web-admin/src/utils/oa-confirmation-kit-rule.ts b/web-admin/src/utils/oa-confirmation-kit-rule.ts new file mode 100644 index 00000000..703dbd22 --- /dev/null +++ b/web-admin/src/utils/oa-confirmation-kit-rule.ts @@ -0,0 +1,218 @@ +/** 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) + + 'r' + ) +} + +export const CONFIRMATION_KIT_FIELD_DEFS = [ + { key: 'hireDate', title: '入职日期', showProp: 'showHireDate' }, + { key: 'probationMonths', title: '试用期(月)', showProp: 'showProbationMonths' }, + { key: 'confirmationDate', title: '转正日期', showProp: 'showConfirmationDate' }, + { key: 'post', title: '职位', showProp: 'showPost' }, + { key: 'jobLevel', title: '岗位职级', showProp: 'showJobLevel' }, + { key: 'name', title: '姓名', showProp: 'showName' }, + { key: 'email', title: '邮箱', showProp: 'showEmail' }, + { key: 'dept', title: '部门', showProp: 'showDept' }, + { key: 'phone', title: '手机号', showProp: 'showPhone' } +] as const + +export type ConfirmationKitFieldKey = (typeof CONFIRMATION_KIT_FIELD_DEFS)[number]['key'] + +function buildConfirmationKitChildren() { + const hireDateField = uniqueId() + const probationMonthsField = uniqueId() + const confirmationDateField = uniqueId() + const postField = uniqueId() + const jobLevelField = uniqueId() + const nameField = uniqueId() + const emailField = uniqueId() + const deptField = uniqueId() + const phoneField = uniqueId() + + return { + hireDateField, + probationMonthsField, + confirmationDateField, + postField, + jobLevelField, + nameField, + emailField, + deptField, + phoneField, + 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: 'inputNumber', + field: probationMonthsField, + title: '试用期(月)', + info: '', + $required: true, + props: { + _fc_kit_field: 'probationMonths', + min: 0, + precision: 0, + controlsPosition: 'right' + } + }, + { + type: 'datePicker', + field: confirmationDateField, + title: '转正日期', + info: '可根据入职日期与试用期自动建议;手改后不再自动联动', + $required: false, + props: { + _fc_kit_field: 'confirmationDate', + type: 'date', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', + placeholder: '请选择转正日期' + } + }, + { + type: 'post', + field: postField, + title: '职位', + info: '', + $required: false, + props: { + _fc_kit_field: 'post', + multiple: true + } + }, + { + type: 'input', + field: jobLevelField, + title: '岗位职级', + info: '', + $required: false, + props: { + _fc_kit_field: 'jobLevel', + placeholder: '请输入岗位职级' + } + }, + { + type: 'input', + field: nameField, + title: '姓名', + info: '', + $required: true, + props: { + _fc_kit_field: 'name', + placeholder: '请输入姓名' + } + }, + { + type: 'input', + field: emailField, + title: '邮箱', + info: '', + $required: false, + props: { + _fc_kit_field: 'email', + placeholder: '请输入邮箱' + } + }, + { + type: 'dept', + field: deptField, + title: '部门', + info: '', + $required: true, + props: { + _fc_kit_field: 'dept', + multiple: false + } + }, + { + type: 'input', + field: phoneField, + title: '手机号', + info: '', + $required: false, + props: { + _fc_kit_field: 'phone', + placeholder: '请输入手机号' + } + } + ] + } +} + +export const confirmationKitDragRule = { + menu: 'kit' as const, + icon: 'icon-user', + label: '转正', + name: 'confirmationKit', + input: false, + drag: true, + dragBtn: true, + mask: false, + inside: true, + rule() { + const built = buildConfirmationKitChildren() + return { + type: 'confirmationKit', + props: { + showHireDate: true, + showProbationMonths: true, + showConfirmationDate: true, + showPost: true, + showJobLevel: true, + showName: true, + showEmail: true, + showDept: true, + showPhone: true, + hireDateField: built.hireDateField, + probationMonthsField: built.probationMonthsField, + confirmationDateField: built.confirmationDateField, + postField: built.postField, + jobLevelField: built.jobLevelField, + nameField: built.nameField, + emailField: built.emailField, + deptField: built.deptField, + phoneField: built.phoneField + }, + children: built.children + } + }, + props() { + const switches = CONFIRMATION_KIT_FIELD_DEFS.map((d) => ({ + type: 'switch', + field: d.showProp, + title: `显示:${d.title}`, + value: true, + props: { activeText: '显示', inactiveText: '隐藏' } + })) + return [ + ...switches, + { + type: 'input', + field: 'formCreateInfo', + title: '提示', + value: '隐藏字段仍会写入默认值;审批通过后可能回写用户主数据。', + props: { disabled: true, type: 'textarea', rows: 2 } + } + ] + } +} diff --git a/web-admin/src/utils/oa-form-create-confirmation-kit.ts b/web-admin/src/utils/oa-form-create-confirmation-kit.ts new file mode 100644 index 00000000..19f5fbe8 --- /dev/null +++ b/web-admin/src/utils/oa-form-create-confirmation-kit.ts @@ -0,0 +1,29 @@ +import FcDesigner from '@form-create/designer' +import OaConfirmationKit from '@/components/oa-approval/OaConfirmationKit.vue' +import { confirmationKitDragRule } from '@/utils/oa-confirmation-kit-rule' + +const FLAG = '__oaConfirmationKitConfigured' + +export function setupOaConfirmationKit(formCreate?: { + component?: (name: string, c: unknown) => void +}) { + if ((FcDesigner as any)[FLAG]) return + + // kit 菜单可能已由请假套件注册;幂等再调一次无妨 + if (typeof FcDesigner.addMenu === 'function') { + try { + FcDesigner.addMenu({ name: 'kit', title: '套件', list: [] }) + } catch { + /* already */ + } + } + + FcDesigner.component('confirmationKit', OaConfirmationKit) + if (typeof formCreate?.component === 'function') { + formCreate.component('confirmationKit', OaConfirmationKit) + } + if (typeof FcDesigner.addDragRule === 'function') { + FcDesigner.addDragRule(confirmationKitDragRule) + } + ;(FcDesigner as any)[FLAG] = true +}