Files
zkxw/web-admin/src/utils/oa-dept-select-rule.ts
T
zlwuandCursor 2e6e1f47d6 feat(oa): add dept select FormCreate control with print formatting
Register type=dept on main app and oa-fc-host, with PC tree-select and
narrow drawer pickers storing {id,name} path snapshots; format dept values
in print and related-summary flatten.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 18:32:44 +08:00

61 lines
1.3 KiB
TypeScript

/** 与 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) +
'c'
)
}
/** FormCreate Designer DragRule:部门选择 */
export const deptSelectDragRule = {
menu: 'main' as const,
icon: 'icon-tree',
label: '部门',
name: 'dept',
input: true,
mask: true,
validate: ['string', 'array', 'object'],
event: ['change'],
rule() {
return {
type: 'dept',
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: '提示信息'
}
]
}
}