feat(oa): add person select control with contains conditions and print

Register FormCreate person field (dept-aligned UI), enable contains-only
workflow conditions, and format person values in print/related summary.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-30 12:18:19 +08:00
1 parent 85322c39e4
commit cf069c74ec
13 files changed
+618 -15

No files matched your search

+7
View File
@@ -13,6 +13,7 @@ import {
} from '@/utils/oa-approval-print-related'
import { formatProgressPersonLines } from '@/utils/oa-progress-person-lines'
import { formatDeptDisplay } from '@/utils/oa-dept-value'
import { formatPersonDisplay } from '@/utils/oa-person-value'
import { formatMoneyDisplay } from '@/utils/money-format'
import { toRmbUpper } from '@/utils/rmb-upper'
@@ -246,6 +247,12 @@ async function walkRules(
continue
}
if (type === 'person') {
const text = formatPersonDisplay(value)
out.push({ label, text: text || '-' })
continue
}
if (type === 'money') {
const showUpper = rule.props?.showUpper !== false
const n =
@@ -0,0 +1,17 @@
import FcDesigner from '@form-create/designer'
import OaPersonSelect from '@/components/oa-approval/OaPersonSelect.vue'
import { personSelectDragRule } from '@/utils/oa-person-select-rule'
const FLAG = '__oaPersonSelectConfigured'
export function setupOaPersonSelect(formCreate?: { component?: (name: string, c: unknown) => void }) {
if ((FcDesigner as any)[FLAG]) return
FcDesigner.component('person', OaPersonSelect)
if (typeof formCreate?.component === 'function') {
formCreate.component('person', OaPersonSelect)
}
if (typeof FcDesigner.addDragRule === 'function') {
FcDesigner.addDragRule(personSelectDragRule)
}
;(FcDesigner as any)[FLAG] = true
}
@@ -0,0 +1,60 @@
/** 与 FormCreate 官方 unique 同类:生成不重复 field */
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) +
'p'
)
}
/** FormCreate Designer DragRule:人员选择 */
export const personSelectDragRule = {
menu: 'main' as const,
icon: 'icon-input',
label: '人员',
name: 'person',
input: true,
mask: true,
validate: ['string', 'array', 'object'],
event: ['change'],
rule() {
return {
type: 'person',
field: uniqueId(),
title: '人员',
info: '',
$required: false,
props: {
multiple: true,
max: undefined as number | undefined
}
}
},
props() {
return [
{
type: 'switch',
field: 'multiple',
title: '允许多选',
value: true,
props: { activeText: '是', inactiveText: '否' }
},
{
type: 'inputNumber',
field: 'max',
title: '最大可选数',
value: undefined,
props: { min: 1, precision: 0, placeholder: '不填则不限制' }
},
{
type: 'input',
field: 'formCreateInfo',
title: '提示信息'
}
]
}
}