仿钉钉流程设计器- 审批人设置新增发起人自己策略
This commit is contained in:
parent
4f24141689
commit
f42c6d8375
@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<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'
|
||||
defineOptions({
|
||||
name: 'NodeHandler'
|
||||
@ -64,7 +64,7 @@ const addNode = (type: number) => {
|
||||
type: NodeType.USER_TASK_NODE,
|
||||
// 审批节点配置
|
||||
attributes: {
|
||||
approveMethod: 1,
|
||||
approveMethod: ApproveMethodType.SINGLE_PERSON_APPROVE,
|
||||
candidateStrategy: CandidateStrategy.USER,
|
||||
candidateParam: undefined,
|
||||
fieldsPermission: undefined,
|
||||
|
@ -60,6 +60,28 @@ export enum ConditionConfigType {
|
||||
*/
|
||||
RULE = 2
|
||||
}
|
||||
// 审批方式类型 ( 用于审批节点 )
|
||||
export enum ApproveMethodType {
|
||||
|
||||
/**
|
||||
* 单人审批
|
||||
*/
|
||||
SINGLE_PERSON_APPROVE = 1,
|
||||
|
||||
/**
|
||||
* 多人会签(需所有审批人同意)
|
||||
*/
|
||||
ALL_APPROVE = 2,
|
||||
/**
|
||||
* 多人或签(一名审批人同意即可)
|
||||
*/
|
||||
ANY_OF_APPROVE = 3,
|
||||
/**
|
||||
* 多人依次审批
|
||||
*/
|
||||
SEQUENTIAL_APPROVE = 4
|
||||
|
||||
}
|
||||
|
||||
// 候选人策略 ( 用于审批节点。抄送节点 )
|
||||
export enum CandidateStrategy {
|
||||
@ -87,6 +109,10 @@ export enum CandidateStrategy {
|
||||
* 发起人自选
|
||||
*/
|
||||
START_USER_SELECT = 35,
|
||||
/**
|
||||
* 发起人自己
|
||||
*/
|
||||
START_USER = 36,
|
||||
/**
|
||||
* 指定用户组
|
||||
*/
|
||||
|
@ -218,10 +218,10 @@ const deptTreeOptions = inject('deptTree') // 部门树
|
||||
const formType = inject('formType') // 表单类型
|
||||
const formFields = inject<Ref<string[]>>('formFields')
|
||||
|
||||
// 抄送人策略, 去掉发起人自选
|
||||
// 抄送人策略, 去掉发起人自选 和 发起人自己
|
||||
const copyUserStrategies = computed( ()=> {
|
||||
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 );
|
||||
})
|
||||
|
||||
// 选中的参数
|
||||
|
@ -149,7 +149,7 @@
|
||||
<el-radio
|
||||
:value="item.value"
|
||||
:label="item.value"
|
||||
:disabled="item.value !== 1 && notAllowedMultiApprovers"
|
||||
:disabled="item.value !== ApproveMethodType.SINGLE_PERSON_APPROVE && notAllowedMultiApprovers"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
@ -205,7 +205,7 @@
|
||||
</template>
|
||||
|
||||
<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 { getDefaultFieldsPermission } from '../utils'
|
||||
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) {
|
||||
const candidateNames: string[] = []
|
||||
roleOptions?.value.forEach((item) => {
|
||||
@ -319,6 +319,10 @@ const getShowText = () : string => {
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER_SELECT ) {
|
||||
showText = `发起人自选`
|
||||
}
|
||||
// 发起人自己
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER ) {
|
||||
showText = `发起人自己`
|
||||
}
|
||||
|
||||
// 流程表达式
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.EXPRESSION) {
|
||||
@ -339,7 +343,7 @@ const setCurrentNode = (node:SimpleFlowNode) => {
|
||||
if(strCandidateParam) {
|
||||
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
|
||||
} else {
|
||||
notAllowedMultiApprovers.value = false
|
||||
@ -350,8 +354,9 @@ defineExpose({ open, setCurrentNode }) // 暴露方法给父组件
|
||||
|
||||
const changeCandidateStrategy = () => {
|
||||
candidateParamArray.value = []
|
||||
currentNode.value.attributes.approveMethod = 1
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER) {
|
||||
currentNode.value.attributes.approveMethod = ApproveMethodType.SINGLE_PERSON_APPROVE
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER
|
||||
|| currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER ) {
|
||||
notAllowedMultiApprovers.value = true
|
||||
} else {
|
||||
notAllowedMultiApprovers.value = false
|
||||
@ -360,7 +365,7 @@ const changeCandidateStrategy = () => {
|
||||
|
||||
const changedCandidateUsers = () => {
|
||||
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
|
||||
} else {
|
||||
notAllowedMultiApprovers.value = false
|
||||
|
Loading…
Reference in New Issue
Block a user