仿钉钉流程设计器- 审批人设置新增发起人自己策略

This commit is contained in:
jason 2024-05-20 21:32:12 +08:00
parent 4f24141689
commit f42c6d8375
4 changed files with 42 additions and 11 deletions

View File

@ -31,7 +31,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { SimpleFlowNode, NodeType, NODE_DEFAULT_NAME, CandidateStrategy } from './consts' import { SimpleFlowNode, NodeType, NODE_DEFAULT_NAME, ApproveMethodType, CandidateStrategy } from './consts'
import { generateUUID } from '@/utils' import { generateUUID } from '@/utils'
defineOptions({ defineOptions({
name: 'NodeHandler' name: 'NodeHandler'
@ -64,7 +64,7 @@ const addNode = (type: number) => {
type: NodeType.USER_TASK_NODE, type: NodeType.USER_TASK_NODE,
// //
attributes: { attributes: {
approveMethod: 1, approveMethod: ApproveMethodType.SINGLE_PERSON_APPROVE,
candidateStrategy: CandidateStrategy.USER, candidateStrategy: CandidateStrategy.USER,
candidateParam: undefined, candidateParam: undefined,
fieldsPermission: undefined, fieldsPermission: undefined,

View File

@ -60,6 +60,28 @@ export enum ConditionConfigType {
*/ */
RULE = 2 RULE = 2
} }
// 审批方式类型 用于审批节点
export enum ApproveMethodType {
/**
*
*/
SINGLE_PERSON_APPROVE = 1,
/**
* ()
*/
ALL_APPROVE = 2,
/**
* ()
*/
ANY_OF_APPROVE = 3,
/**
*
*/
SEQUENTIAL_APPROVE = 4
}
// 候选人策略 用于审批节点。抄送节点 ) // 候选人策略 用于审批节点。抄送节点 )
export enum CandidateStrategy { export enum CandidateStrategy {
@ -87,6 +109,10 @@ export enum CandidateStrategy {
* *
*/ */
START_USER_SELECT = 35, START_USER_SELECT = 35,
/**
*
*/
START_USER = 36,
/** /**
* *
*/ */

View File

@ -218,10 +218,10 @@ const deptTreeOptions = inject('deptTree') // 部门树
const formType = inject('formType') // const formType = inject('formType') //
const formFields = inject<Ref<string[]>>('formFields') const formFields = inject<Ref<string[]>>('formFields')
// //
const copyUserStrategies = computed( ()=> { const copyUserStrategies = computed( ()=> {
return getIntDictOptions(DICT_TYPE.BPM_TASK_CANDIDATE_STRATEGY) return getIntDictOptions(DICT_TYPE.BPM_TASK_CANDIDATE_STRATEGY)
.filter(item => item.value !== CandidateStrategy.START_USER_SELECT); .filter(item => item.value !== CandidateStrategy.START_USER_SELECT && item.value !== CandidateStrategy.START_USER );
}) })
// //

View File

@ -149,7 +149,7 @@
<el-radio <el-radio
:value="item.value" :value="item.value"
:label="item.value" :label="item.value"
:disabled="item.value !== 1 && notAllowedMultiApprovers" :disabled="item.value !== ApproveMethodType.SINGLE_PERSON_APPROVE && notAllowedMultiApprovers"
> >
{{ item.label }} {{ item.label }}
</el-radio> </el-radio>
@ -205,7 +205,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { SimpleFlowNode, APPROVE_METHODS, CandidateStrategy, NodeType, NODE_DEFAULT_NAME } from '../consts' import { SimpleFlowNode, APPROVE_METHODS, CandidateStrategy, NodeType, ApproveMethodType, NODE_DEFAULT_NAME } from '../consts'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { getDefaultFieldsPermission } from '../utils' import { getDefaultFieldsPermission } from '../utils'
import { defaultProps } from '@/utils/tree' import { defaultProps } from '@/utils/tree'
@ -261,7 +261,7 @@ const getShowText = () : string => {
} }
} }
// //
if (currentNode.value.attributes.candidateStrategy === 10) { if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.ROLE) {
if (candidateParamArray.value?.length > 0) { if (candidateParamArray.value?.length > 0) {
const candidateNames: string[] = [] const candidateNames: string[] = []
roleOptions?.value.forEach((item) => { roleOptions?.value.forEach((item) => {
@ -319,6 +319,10 @@ const getShowText = () : string => {
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER_SELECT ) { if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER_SELECT ) {
showText = `发起人自选` showText = `发起人自选`
} }
//
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER ) {
showText = `发起人自己`
}
// //
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.EXPRESSION) { if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.EXPRESSION) {
@ -339,7 +343,7 @@ const setCurrentNode = (node:SimpleFlowNode) => {
if(strCandidateParam) { if(strCandidateParam) {
candidateParamArray.value = strCandidateParam.split(',').map(item=> +item) candidateParamArray.value = strCandidateParam.split(',').map(item=> +item)
} }
if (currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER && candidateParamArray.value?.length <= 1) { if (currentNode.value.attributes?.candidateStrategy === CandidateStrategy.START_USER) {
notAllowedMultiApprovers.value = true notAllowedMultiApprovers.value = true
} else { } else {
notAllowedMultiApprovers.value = false notAllowedMultiApprovers.value = false
@ -350,8 +354,9 @@ defineExpose({ open, setCurrentNode }) // 暴露方法给父组件
const changeCandidateStrategy = () => { const changeCandidateStrategy = () => {
candidateParamArray.value = [] candidateParamArray.value = []
currentNode.value.attributes.approveMethod = 1 currentNode.value.attributes.approveMethod = ApproveMethodType.SINGLE_PERSON_APPROVE
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER) { if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER
|| currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER ) {
notAllowedMultiApprovers.value = true notAllowedMultiApprovers.value = true
} else { } else {
notAllowedMultiApprovers.value = false notAllowedMultiApprovers.value = false
@ -360,7 +365,7 @@ const changeCandidateStrategy = () => {
const changedCandidateUsers = () => { const changedCandidateUsers = () => {
if (candidateParamArray.value?.length <= 1 && currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER) { if (candidateParamArray.value?.length <= 1 && currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER) {
currentNode.value.attributes.approveMethod = 1; currentNode.value.attributes.approveMethod = ApproveMethodType.SINGLE_PERSON_APPROVE
notAllowedMultiApprovers.value = true notAllowedMultiApprovers.value = true
} else { } else {
notAllowedMultiApprovers.value = false notAllowedMultiApprovers.value = false