【功能新增】候选人策略:新增表单部门负责人
parent
756addd423
commit
2fe28af05d
|
@ -145,11 +145,14 @@ export enum CandidateStrategy {
|
||||||
* 指定用户组
|
* 指定用户组
|
||||||
*/
|
*/
|
||||||
USER_GROUP = 40,
|
USER_GROUP = 40,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单内用户字段
|
* 表单内用户字段
|
||||||
*/
|
*/
|
||||||
USER_FIELD_ON_FORM = 50,
|
USER_FIELD_ON_FORM = 50,
|
||||||
|
/**
|
||||||
|
* 表单内部门负责人
|
||||||
|
*/
|
||||||
|
DEPT_LEADER_ON_FORM = 51,
|
||||||
/**
|
/**
|
||||||
* 流程表达式
|
* 流程表达式
|
||||||
*/
|
*/
|
||||||
|
@ -430,6 +433,7 @@ export const CANDIDATE_STRATEGY: DictDataVO[] = [
|
||||||
{ label: '发起人连续部门负责人', value: CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER },
|
{ label: '发起人连续部门负责人', value: CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER },
|
||||||
{ label: '用户组', value: CandidateStrategy.USER_GROUP },
|
{ label: '用户组', value: CandidateStrategy.USER_GROUP },
|
||||||
{ label: '表单内用户字段', value: CandidateStrategy.USER_FIELD_ON_FORM },
|
{ label: '表单内用户字段', value: CandidateStrategy.USER_FIELD_ON_FORM },
|
||||||
|
{ label: '表单内部门负责人', value: CandidateStrategy.DEPT_LEADER_ON_FORM },
|
||||||
{ label: '流程表达式', value: CandidateStrategy.EXPRESSION }
|
{ label: '流程表达式', value: CandidateStrategy.EXPRESSION }
|
||||||
]
|
]
|
||||||
// 审批节点 的审批类型
|
// 审批节点 的审批类型
|
||||||
|
|
|
@ -146,6 +146,7 @@ export type UserTaskFormType = {
|
||||||
postIds?: number[] // 岗位
|
postIds?: number[] // 岗位
|
||||||
expression?: string // 流程表达式
|
expression?: string // 流程表达式
|
||||||
userFieldOnForm?: string // 表单内用户字段
|
userFieldOnForm?: string // 表单内用户字段
|
||||||
|
deptFieldOnForm?: string // 表单内部门字段
|
||||||
approveRatio?: number
|
approveRatio?: number
|
||||||
rejectHandlerType?: RejectHandlerType
|
rejectHandlerType?: RejectHandlerType
|
||||||
returnNodeId?: string
|
returnNodeId?: string
|
||||||
|
@ -169,6 +170,7 @@ export type CopyTaskFormType = {
|
||||||
userGroups?: number[] // 用户组
|
userGroups?: number[] // 用户组
|
||||||
postIds?: number[] // 岗位
|
postIds?: number[] // 岗位
|
||||||
userFieldOnForm?: string // 表单内用户字段
|
userFieldOnForm?: string // 表单内用户字段
|
||||||
|
deptFieldOnForm?: string // 表单内部门字段
|
||||||
expression?: string // 流程表达式
|
expression?: string // 流程表达式
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +287,11 @@ export function useNodeForm(nodeType: NodeType) {
|
||||||
showText = `表单用户:${item?.title}`
|
showText = `表单用户:${item?.title}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 表单内部门负责人
|
||||||
|
if (configForm.value?.candidateStrategy === CandidateStrategy.DEPT_LEADER_ON_FORM) {
|
||||||
|
showText = `表单内部门负责人`
|
||||||
|
}
|
||||||
|
|
||||||
// 发起人自选
|
// 发起人自选
|
||||||
if (configForm.value?.candidateStrategy === CandidateStrategy.START_USER_SELECT) {
|
if (configForm.value?.candidateStrategy === CandidateStrategy.START_USER_SELECT) {
|
||||||
showText = `发起人自选`
|
showText = `发起人自选`
|
||||||
|
@ -353,6 +360,13 @@ export function useNodeForm(nodeType: NodeType) {
|
||||||
candidateParam = deptIds.concat('|' + configForm.value.deptLevel + '')
|
candidateParam = deptIds.concat('|' + configForm.value.deptLevel + '')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
// 表单内部门的负责人
|
||||||
|
case CandidateStrategy.DEPT_LEADER_ON_FORM: {
|
||||||
|
// 候选人参数格式: | 分隔 。左边为表单内部门字段。 右边为部门层级
|
||||||
|
const deptFieldOnForm = configForm.value.deptFieldOnForm!
|
||||||
|
candidateParam = deptFieldOnForm.concat('|' + configForm.value.deptLevel + '')
|
||||||
|
break
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -405,6 +419,14 @@ export function useNodeForm(nodeType: NodeType) {
|
||||||
configForm.value.deptLevel = +paramArray[1]
|
configForm.value.deptLevel = +paramArray[1]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
// 表单内的部门负责人
|
||||||
|
case CandidateStrategy.DEPT_LEADER_ON_FORM: {
|
||||||
|
// 候选人参数格式: | 分隔 。左边为表单内的部门字段。 右边为部门层级
|
||||||
|
const paramArray = candidateParam.split('|')
|
||||||
|
configForm.value.deptFieldOnForm = paramArray[0]
|
||||||
|
configForm.value.deptLevel = +paramArray[1]
|
||||||
|
break
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,8 @@
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="
|
v-if="
|
||||||
configForm.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
|
configForm.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
|
||||||
configForm.candidateStrategy == CandidateStrategy.DEPT_LEADER
|
configForm.candidateStrategy == CandidateStrategy.DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER
|
||||||
"
|
"
|
||||||
label="指定部门"
|
label="指定部门"
|
||||||
prop="deptIds"
|
prop="deptIds"
|
||||||
|
@ -136,6 +137,40 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="configForm.candidateStrategy === CandidateStrategy.DEPT_LEADER_ON_FORM"
|
||||||
|
label="表单内部门字段"
|
||||||
|
prop="deptFieldOnForm"
|
||||||
|
>
|
||||||
|
<el-select v-model="configForm.deptFieldOnForm" clearable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="(item,idx) in deptFieldOnFormOptions"
|
||||||
|
:key="idx"
|
||||||
|
:label="item.title"
|
||||||
|
:value="item.field"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.START_USER_DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.DEPT_LEADER_ON_FORM
|
||||||
|
"
|
||||||
|
:label="deptLevelLabel!"
|
||||||
|
prop="deptLevel"
|
||||||
|
span="24"
|
||||||
|
>
|
||||||
|
<el-select v-model="configForm.deptLevel" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in MULTI_LEVEL_DEPT"
|
||||||
|
:key="index"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="configForm.candidateStrategy === CandidateStrategy.EXPRESSION"
|
v-if="configForm.candidateStrategy === CandidateStrategy.EXPRESSION"
|
||||||
label="流程表达式"
|
label="流程表达式"
|
||||||
|
@ -214,7 +249,8 @@ import {
|
||||||
CandidateStrategy,
|
CandidateStrategy,
|
||||||
NodeType,
|
NodeType,
|
||||||
CANDIDATE_STRATEGY,
|
CANDIDATE_STRATEGY,
|
||||||
FieldPermissionType
|
FieldPermissionType,
|
||||||
|
MULTI_LEVEL_DEPT
|
||||||
} from '../consts'
|
} from '../consts'
|
||||||
import {
|
import {
|
||||||
useWatchNode,
|
useWatchNode,
|
||||||
|
@ -234,6 +270,15 @@ const props = defineProps({
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const deptLevelLabel = computed(() => {
|
||||||
|
let label = '部门负责人来源'
|
||||||
|
if (configForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) {
|
||||||
|
label = label + '(指定部门向上)'
|
||||||
|
} else {
|
||||||
|
label = label + '(发起人部门向上)'
|
||||||
|
}
|
||||||
|
return label
|
||||||
|
})
|
||||||
// 抽屉配置
|
// 抽屉配置
|
||||||
const { settingVisible, closeDrawer, openDrawer } = useDrawer()
|
const { settingVisible, closeDrawer, openDrawer } = useDrawer()
|
||||||
// 当前节点
|
// 当前节点
|
||||||
|
@ -252,6 +297,12 @@ const userFieldOnFormOptions = computed(() => {
|
||||||
(item) => item.required && item.type === 'UserSelect'
|
(item) => item.required && item.type === 'UserSelect'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
// 表单内部门字段选项, 必须是必填和部门选择器
|
||||||
|
const deptFieldOnFormOptions = computed(() => {
|
||||||
|
return formFieldOptions.filter(
|
||||||
|
(item) => item.required && item.type === 'DeptSelect'
|
||||||
|
)
|
||||||
|
})
|
||||||
// 抄送人表单配置
|
// 抄送人表单配置
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
|
@ -263,6 +314,7 @@ const formRules = reactive({
|
||||||
userGroups: [{ required: true, message: '用户组不能为空', trigger: 'change' }],
|
userGroups: [{ required: true, message: '用户组不能为空', trigger: 'change' }],
|
||||||
postIds: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
postIds: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
||||||
userFieldOnForm: [{ required: true, message: '表单内用户字段不能为空', trigger: 'change' }],
|
userFieldOnForm: [{ required: true, message: '表单内用户字段不能为空', trigger: 'change' }],
|
||||||
|
deptFieldOnForm: [{ required: true, message: '表单内部门字段不能为空', trigger: 'change' }],
|
||||||
expression: [{ required: true, message: '流程表达式不能为空', trigger: 'blur' }]
|
expression: [{ required: true, message: '流程表达式不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="configForm.candidateStrategy == CandidateStrategy.ROLE"
|
v-if="configForm.candidateStrategy == CandidateStrategy.ROLE"
|
||||||
label="指定角色"
|
label="指定角色"
|
||||||
|
@ -94,25 +93,6 @@
|
||||||
show-checkbox
|
show-checkbox
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
|
||||||
v-if="
|
|
||||||
configForm.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER ||
|
|
||||||
configForm.candidateStrategy == CandidateStrategy.START_USER_DEPT_LEADER ||
|
|
||||||
configForm.candidateStrategy == CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER
|
|
||||||
"
|
|
||||||
:label="deptLevelLabel!"
|
|
||||||
prop="deptLevel"
|
|
||||||
span="24"
|
|
||||||
>
|
|
||||||
<el-select v-model="configForm.deptLevel" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in MULTI_LEVEL_DEPT"
|
|
||||||
:key="index"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="configForm.candidateStrategy == CandidateStrategy.POST"
|
v-if="configForm.candidateStrategy == CandidateStrategy.POST"
|
||||||
label="指定岗位"
|
label="指定岗位"
|
||||||
|
@ -171,6 +151,40 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="configForm.candidateStrategy === CandidateStrategy.DEPT_LEADER_ON_FORM"
|
||||||
|
label="表单内部门字段"
|
||||||
|
prop="deptFieldOnForm"
|
||||||
|
>
|
||||||
|
<el-select v-model="configForm.deptFieldOnForm" clearable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="(item,idx) in deptFieldOnFormOptions"
|
||||||
|
:key="idx"
|
||||||
|
:label="item.title"
|
||||||
|
:value="item.field"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.START_USER_DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER ||
|
||||||
|
configForm.candidateStrategy == CandidateStrategy.DEPT_LEADER_ON_FORM
|
||||||
|
"
|
||||||
|
:label="deptLevelLabel!"
|
||||||
|
prop="deptLevel"
|
||||||
|
span="24"
|
||||||
|
>
|
||||||
|
<el-select v-model="configForm.deptLevel" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in MULTI_LEVEL_DEPT"
|
||||||
|
:key="index"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<!-- TODO @jason:后续要支持选择已经存好的表达式 -->
|
<!-- TODO @jason:后续要支持选择已经存好的表达式 -->
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="configForm.candidateStrategy === CandidateStrategy.EXPRESSION"
|
v-if="configForm.candidateStrategy === CandidateStrategy.EXPRESSION"
|
||||||
|
@ -482,6 +496,8 @@ const deptLevelLabel = computed(() => {
|
||||||
let label = '部门负责人来源'
|
let label = '部门负责人来源'
|
||||||
if (configForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) {
|
if (configForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) {
|
||||||
label = label + '(指定部门向上)'
|
label = label + '(指定部门向上)'
|
||||||
|
} else if (configForm.value.candidateStrategy == CandidateStrategy.DEPT_LEADER_ON_FORM) {
|
||||||
|
label = label + '(表单内部门向上)'
|
||||||
} else {
|
} else {
|
||||||
label = label + '(发起人部门向上)'
|
label = label + '(发起人部门向上)'
|
||||||
}
|
}
|
||||||
|
@ -505,6 +521,12 @@ const userFieldOnFormOptions = computed(() => {
|
||||||
(item) => item.required && item.type === 'UserSelect'
|
(item) => item.required && item.type === 'UserSelect'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
// 表单内部门字段选项, 必须是必填和部门选择器
|
||||||
|
const deptFieldOnFormOptions = computed(() => {
|
||||||
|
return formFieldOptions.filter(
|
||||||
|
(item) => item.required && item.type === 'DeptSelect'
|
||||||
|
)
|
||||||
|
})
|
||||||
// 操作按钮设置
|
// 操作按钮设置
|
||||||
const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayNameBlurEvent } =
|
const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayNameBlurEvent } =
|
||||||
useButtonsSetting()
|
useButtonsSetting()
|
||||||
|
@ -519,6 +541,7 @@ const formRules = reactive({
|
||||||
deptIds: [{ required: true, message: '部门不能为空', trigger: 'change' }],
|
deptIds: [{ required: true, message: '部门不能为空', trigger: 'change' }],
|
||||||
userGroups: [{ required: true, message: '用户组不能为空', trigger: 'change' }],
|
userGroups: [{ required: true, message: '用户组不能为空', trigger: 'change' }],
|
||||||
userFieldOnForm: [{ required: true, message: '表单内用户字段不能为空', trigger: 'change' }],
|
userFieldOnForm: [{ required: true, message: '表单内用户字段不能为空', trigger: 'change' }],
|
||||||
|
deptFieldOnForm: [{ required: true, message: '表单内部门字段不能为空', trigger: 'change' }],
|
||||||
postIds: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
postIds: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
||||||
expression: [{ required: true, message: '流程表达式不能为空', trigger: 'blur' }],
|
expression: [{ required: true, message: '流程表达式不能为空', trigger: 'blur' }],
|
||||||
approveMethod: [{ required: true, message: '多人审批方式不能为空', trigger: 'change' }],
|
approveMethod: [{ required: true, message: '多人审批方式不能为空', trigger: 'change' }],
|
||||||
|
@ -555,6 +578,7 @@ const changeCandidateStrategy = () => {
|
||||||
configForm.value.userGroups = []
|
configForm.value.userGroups = []
|
||||||
configForm.value.deptLevel = 1
|
configForm.value.deptLevel = 1
|
||||||
configForm.value.userFieldOnForm = ''
|
configForm.value.userFieldOnForm = ''
|
||||||
|
configForm.value.deptFieldOnForm = ''
|
||||||
configForm.value.approveMethod = ApproveMethodType.SEQUENTIAL_APPROVE
|
configForm.value.approveMethod = ApproveMethodType.SEQUENTIAL_APPROVE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue