Files
zkxw/web-admin/src/utils/oa-owner-dept-select-rule.ts
T

53 lines
1.1 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) +
'od'
)
}
/** FormCreate Designer DragRule:归属部门(默认当前登录人主部门) */
export const ownerDeptSelectDragRule = {
menu: 'main' as const,
icon: 'icon-tree',
label: '归属部门',
name: 'ownerDept',
input: true,
mask: true,
validate: ['string', 'array', 'object'],
event: ['change'],
rule() {
return {
type: 'ownerDept',
field: uniqueId(),
title: '归属部门',
info: '',
$required: false,
props: {
allowModify: false
}
}
},
props() {
return [
{
type: 'switch',
field: 'allowModify',
title: '允许修改',
value: false,
props: { activeText: '是', inactiveText: '否' }
},
{
type: 'input',
field: 'formCreateInfo',
title: '提示信息'
}
]
}
}