仿钉钉流程设计器- 简化多人审批方式

This commit is contained in:
jason 2024-06-14 11:10:25 +08:00
parent cab9553235
commit d5a7ae1865
3 changed files with 21 additions and 34 deletions

View File

@ -75,7 +75,7 @@ const addNode = (type: number) => {
type: NodeType.USER_TASK_NODE,
//
attributes: {
approveMethod: ApproveMethodType.SINGLE_PERSON_APPROVE,
approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE,
candidateStrategy: CandidateStrategy.USER,
candidateParam: undefined,
fieldsPermission: undefined,

View File

@ -95,35 +95,27 @@ export enum ConditionConfigType {
*/
RULE = 2
}
// 审批方式类型 用于审批节点
// 多人审批方式类型 用于审批节点
export enum ApproveMethodType {
/**
*
*
*/
SINGLE_PERSON_APPROVE = 1,
RRANDOM_SELECT_ONE_APPROVE = 1,
/**
* ()
*/
ALL_APPROVE = 2,
/**
* ()
*/
APPROVE_BY_RATIO = 3,
APPROVE_BY_RATIO = 2,
/**
* ()
* ()
*/
ANY_APPROVE_ALL_REJECT = 4,
/**
* ()
*/
ANY_APPROVE = 5,
ANY_APPROVE = 3,
/**
*
*/
SEQUENTIAL_APPROVE = 6
SEQUENTIAL_APPROVE = 4
}
@ -216,11 +208,9 @@ NODE_DEFAULT_NAME.set(NodeType.COPY_TASK_NODE, '抄送人')
NODE_DEFAULT_NAME.set(NodeType.CONDITION_NODE, '条件')
export const APPROVE_METHODS: DictDataVO [] = [
{ label: '单人审批', value: ApproveMethodType.SINGLE_PERSON_APPROVE },
{ label: '多人会签(需所有审批人同意)', value: ApproveMethodType.ALL_APPROVE },
{ label: '随机挑选一人审批', value: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE },
{ label: '多人会签(按通过比例%)', value: ApproveMethodType.APPROVE_BY_RATIO },
{ label: '多人会签(通过只需一人,拒绝需要全员)', value: ApproveMethodType.ANY_APPROVE_ALL_REJECT },
{ label: '多人或签(一名审批人通过即可)', value: ApproveMethodType.ANY_APPROVE },
{ label: '多人或签(一人通过或拒绝)', value: ApproveMethodType.ANY_APPROVE },
{ label: '依次审批(按顺序依次审批)', value: ApproveMethodType.SEQUENTIAL_APPROVE }
]

View File

@ -143,7 +143,7 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="审批方式" prop="approveMethod">
<el-form-item label="多人审批方式" prop="approveMethod">
<el-radio-group
v-model="currentNode.attributes.approveMethod"
@change="approveMethodChanged"
@ -154,7 +154,7 @@
:value="item.value"
:label="item.value"
:disabled="
item.value !== ApproveMethodType.SINGLE_PERSON_APPROVE &&
item.value !== ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE &&
notAllowedMultiApprovers
"
>
@ -163,7 +163,7 @@
<el-input-number
v-model="currentNode.attributes.approveRatio"
:min="10"
:max="99"
:max="100"
:step="10"
size="small"
v-if="item.value === ApproveMethodType.APPROVE_BY_RATIO && currentNode.attributes.approveMethod === ApproveMethodType.APPROVE_BY_RATIO"
@ -504,7 +504,7 @@ defineExpose({ open, setCurrentNode }) // 暴露方法给父组件
const changeCandidateStrategy = () => {
candidateParamArray.value = []
currentNode.value.attributes.approveMethod = ApproveMethodType.SINGLE_PERSON_APPROVE
currentNode.value.attributes.approveMethod = ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE
if (
currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER ||
currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER
@ -520,7 +520,7 @@ const changedCandidateUsers = () => {
candidateParamArray.value?.length <= 1 &&
currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER
) {
currentNode.value.attributes.approveMethod = ApproveMethodType.SINGLE_PERSON_APPROVE
currentNode.value.attributes.approveMethod = ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE
currentNode.value.attributes.rejectHandler.type = RejectHandlerType.FINISH_PROCESS
notAllowedMultiApprovers.value = true
} else {
@ -541,7 +541,7 @@ const blurEvent = () => {
}
const approveMethodChanged = () => {
const approveMethod = currentNode.value.attributes?.approveMethod
if ( approveMethod === ApproveMethodType.ANY_APPROVE_ALL_REJECT || approveMethod === ApproveMethodType.APPROVE_BY_RATIO) {
if ( approveMethod === ApproveMethodType.APPROVE_BY_RATIO) {
currentNode.value.attributes.rejectHandler.type =
RejectHandlerType.FINISH_PROCESS_BY_REJECT_RATIO
} else {
@ -549,7 +549,7 @@ const approveMethodChanged = () => {
}
if (approveMethod === ApproveMethodType.APPROVE_BY_RATIO) {
currentNode.value.attributes.approveRatio = 50;
currentNode.value.attributes.approveRatio = 100;
}
}
const rejectHandlerOptionDisabled = computed(() => {
@ -557,15 +557,12 @@ const rejectHandlerOptionDisabled = computed(() => {
const approveMethod = currentNode.value.attributes?.approveMethod
if (
val === RejectHandlerType.FINISH_PROCESS_BY_REJECT_RATIO &&
approveMethod !== ApproveMethodType.APPROVE_BY_RATIO &&
approveMethod !== ApproveMethodType.ANY_APPROVE_ALL_REJECT
approveMethod !== ApproveMethodType.APPROVE_BY_RATIO
) {
return true
}
if (
approveMethod === ApproveMethodType.ANY_APPROVE_ALL_REJECT &&
val === RejectHandlerType.FINISH_PROCESS
) {
if ( approveMethod === ApproveMethodType.APPROVE_BY_RATIO
&& val !== RejectHandlerType.FINISH_PROCESS_BY_REJECT_RATIO) {
return true
}