仿钉钉设计器- 审批节点配置结构调整
This commit is contained in:
parent
58fc91b810
commit
ea1e51a655
@ -42,7 +42,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { SimpleFlowNode, NodeType, NODE_DEFAULT_NAME, ApproveMethodType, RejectHandlerType, CandidateStrategy } from './consts'
|
||||
import {
|
||||
SimpleFlowNode,
|
||||
NodeType,
|
||||
NODE_DEFAULT_NAME,
|
||||
ApproveMethodType,
|
||||
RejectHandlerType,
|
||||
CandidateStrategy
|
||||
} from './consts'
|
||||
import { generateUUID } from '@/utils'
|
||||
defineOptions({
|
||||
name: 'NodeHandler'
|
||||
@ -63,37 +70,47 @@ const props = defineProps({
|
||||
|
||||
const emits = defineEmits(['update:childNode'])
|
||||
|
||||
|
||||
const addNode = (type: number) => {
|
||||
popoverShow.value = false
|
||||
if (type === NodeType.USER_TASK_NODE) {
|
||||
const id = 'Activity_'+ generateUUID();
|
||||
const id = 'Activity_' + generateUUID()
|
||||
const data: SimpleFlowNode = {
|
||||
id: id,
|
||||
id: id,
|
||||
name: NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string,
|
||||
showText: '',
|
||||
type: NodeType.USER_TASK_NODE,
|
||||
// 审批节点配置
|
||||
attributes: {
|
||||
approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE,
|
||||
candidateStrategy: CandidateStrategy.USER,
|
||||
candidateParam: undefined,
|
||||
fieldsPermission: undefined,
|
||||
// 超时处理
|
||||
timeoutHandler: {
|
||||
enable: false
|
||||
},
|
||||
rejectHandler: {
|
||||
type: RejectHandlerType.FINISH_PROCESS
|
||||
}
|
||||
approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE,
|
||||
candidateStrategy: CandidateStrategy.USER,
|
||||
candidateParam: undefined,
|
||||
fieldsPermission: undefined,
|
||||
// 超时处理
|
||||
timeoutHandler: {
|
||||
enable: false
|
||||
},
|
||||
rejectHandler: {
|
||||
type: RejectHandlerType.FINISH_PROCESS
|
||||
},
|
||||
childNode: props.childNode
|
||||
// 审批节点配置
|
||||
// attributes: {
|
||||
// approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE,
|
||||
// candidateStrategy: CandidateStrategy.USER,
|
||||
// candidateParam: undefined,
|
||||
// fieldsPermission: undefined,
|
||||
// // 超时处理
|
||||
// timeoutHandler: {
|
||||
// enable: false
|
||||
// },
|
||||
// rejectHandler: {
|
||||
// type: RejectHandlerType.FINISH_PROCESS
|
||||
// }
|
||||
// },
|
||||
}
|
||||
emits('update:childNode', data);
|
||||
emits('update:childNode', data)
|
||||
}
|
||||
if (type === NodeType.COPY_TASK_NODE) {
|
||||
const data: SimpleFlowNode = {
|
||||
id: 'Activity_'+ generateUUID(),
|
||||
id: 'Activity_' + generateUUID(),
|
||||
name: NODE_DEFAULT_NAME.get(NodeType.COPY_TASK_NODE) as string,
|
||||
showText: '',
|
||||
type: NodeType.COPY_TASK_NODE,
|
||||
@ -108,14 +125,14 @@ const addNode = (type: number) => {
|
||||
emits('update:childNode', data)
|
||||
}
|
||||
if (type === NodeType.EXCLUSIVE_NODE) {
|
||||
const data : SimpleFlowNode = {
|
||||
const data: SimpleFlowNode = {
|
||||
name: '条件分支',
|
||||
type: NodeType.EXCLUSIVE_NODE,
|
||||
id: 'GateWay_' + generateUUID(),
|
||||
childNode: props.childNode,
|
||||
conditionNodes: [
|
||||
{
|
||||
id: 'Flow_'+ generateUUID(),
|
||||
id: 'Flow_' + generateUUID(),
|
||||
name: '条件1',
|
||||
showText: '',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
@ -126,7 +143,7 @@ const addNode = (type: number) => {
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Flow_'+ generateUUID(),
|
||||
id: 'Flow_' + generateUUID(),
|
||||
name: '其它情况',
|
||||
showText: '其它情况进入此流程',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
@ -141,25 +158,25 @@ const addNode = (type: number) => {
|
||||
emits('update:childNode', data)
|
||||
}
|
||||
if (type === NodeType.PARALLEL_NODE_FORK) {
|
||||
const data : SimpleFlowNode = {
|
||||
const data: SimpleFlowNode = {
|
||||
name: '并行分支',
|
||||
type: NodeType.PARALLEL_NODE_FORK,
|
||||
id: 'GateWay_' + generateUUID(),
|
||||
childNode: props.childNode,
|
||||
conditionNodes: [
|
||||
{
|
||||
id: 'Flow_'+ generateUUID(),
|
||||
id: 'Flow_' + generateUUID(),
|
||||
name: '并行1',
|
||||
showText: '无需配置条件同时执行',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
childNode: undefined,
|
||||
childNode: undefined
|
||||
},
|
||||
{
|
||||
id: 'Flow_'+ generateUUID(),
|
||||
id: 'Flow_' + generateUUID(),
|
||||
name: '并行2',
|
||||
showText: '无需配置条件同时执行',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
childNode: undefined,
|
||||
childNode: undefined
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -71,44 +71,40 @@ export enum RejectHandlerType {
|
||||
* 驳回到指定节点
|
||||
*/
|
||||
RETURN_USER_TASK = 2
|
||||
|
||||
}
|
||||
|
||||
// 条件配置类型 ( 用于条件节点配置 )
|
||||
export enum ConditionConfigType {
|
||||
|
||||
/**
|
||||
export enum ConditionConfigType {
|
||||
/**
|
||||
* 条件表达式
|
||||
*/
|
||||
EXPRESSION = 1,
|
||||
|
||||
/**
|
||||
/**
|
||||
* 条件规则
|
||||
*/
|
||||
RULE = 2
|
||||
}
|
||||
// 多人审批方式类型 ( 用于审批节点 )
|
||||
export enum ApproveMethodType {
|
||||
|
||||
export enum ApproveMethodType {
|
||||
/**
|
||||
* 随机挑选一人审批
|
||||
*/
|
||||
* 随机挑选一人审批
|
||||
*/
|
||||
RRANDOM_SELECT_ONE_APPROVE = 1,
|
||||
|
||||
/**
|
||||
* 多人会签(按通过比例)
|
||||
*/
|
||||
* 多人会签(按通过比例)
|
||||
*/
|
||||
APPROVE_BY_RATIO = 2,
|
||||
|
||||
/**
|
||||
* 多人或签(通过只需一人,拒绝只需一人)
|
||||
*/
|
||||
* 多人或签(通过只需一人,拒绝只需一人)
|
||||
*/
|
||||
ANY_APPROVE = 3,
|
||||
/**
|
||||
* 多人依次审批
|
||||
*/
|
||||
/**
|
||||
* 多人依次审批
|
||||
*/
|
||||
SEQUENTIAL_APPROVE = 4
|
||||
|
||||
}
|
||||
|
||||
// 候选人策略 ( 用于审批节点。抄送节点 )
|
||||
@ -137,37 +133,67 @@ export enum CandidateStrategy {
|
||||
* 发起人自选
|
||||
*/
|
||||
START_USER_SELECT = 35,
|
||||
/**
|
||||
/**
|
||||
* 发起人自己
|
||||
*/
|
||||
START_USER = 36,
|
||||
/**
|
||||
/**
|
||||
* 指定用户组
|
||||
*/
|
||||
USER_GROUP = 40,
|
||||
/**
|
||||
USER_GROUP = 40,
|
||||
/**
|
||||
* 流程表达式
|
||||
*/
|
||||
EXPRESSION = 60
|
||||
EXPRESSION = 60
|
||||
}
|
||||
|
||||
export type RejectHandler = {
|
||||
type: RejectHandlerType
|
||||
|
||||
returnNodeId?: string
|
||||
}
|
||||
|
||||
export type TimeoutHandler = {
|
||||
//是否开启超时处理
|
||||
enable: boolean
|
||||
// 超时执行的动作
|
||||
action?: number
|
||||
// 超时时间设置
|
||||
timeDuration?: string
|
||||
// 执行动作是自动提醒, 最大提醒次数
|
||||
maxRemindCount?: number
|
||||
}
|
||||
|
||||
export type SimpleFlowNode = {
|
||||
id: string,
|
||||
type: NodeType,
|
||||
name: string,
|
||||
showText?: string,
|
||||
attributes?: any,
|
||||
id: string
|
||||
type: NodeType
|
||||
name: string
|
||||
showText?: string
|
||||
attributes?: any
|
||||
// 孩子节点
|
||||
childNode?: SimpleFlowNode,
|
||||
childNode?: SimpleFlowNode
|
||||
// 条件节点
|
||||
conditionNodes?: SimpleFlowNode[]
|
||||
// 候选人策略
|
||||
candidateStrategy?: number
|
||||
// 候选人参数
|
||||
candidateParam?: string
|
||||
// 多人审批方式
|
||||
approveMethod?: ApproveMethodType
|
||||
//通过比例
|
||||
approveRatio: number
|
||||
// 表单权限
|
||||
fieldsPermission?: any[]
|
||||
// 审批任务超时处理
|
||||
timeoutHandler?: TimeoutHandler
|
||||
// 审批任务拒绝处理
|
||||
rejectHandler?: RejectHandler
|
||||
}
|
||||
|
||||
// 条件组
|
||||
export type ConditionGroup = {
|
||||
export type ConditionGroup = {
|
||||
// 条件组的逻辑关系是否为且
|
||||
and : boolean,
|
||||
and: boolean
|
||||
// 条件数组
|
||||
conditions: Condition[]
|
||||
}
|
||||
@ -175,84 +201,83 @@ export type ConditionGroup = {
|
||||
// 条件
|
||||
export type Condition = {
|
||||
// 条件规则的逻辑关系是否为且
|
||||
and : boolean,
|
||||
and: boolean
|
||||
rules: ConditionRule[]
|
||||
}
|
||||
|
||||
// 条件规则
|
||||
export type ConditionRule = {
|
||||
type : number,
|
||||
opName: string,
|
||||
opCode: string,
|
||||
leftSide: string,
|
||||
type: number
|
||||
opName: string
|
||||
opCode: string
|
||||
leftSide: string
|
||||
rightSide: string
|
||||
}
|
||||
|
||||
|
||||
export const NODE_DEFAULT_TEXT = new Map<number,string>()
|
||||
export const NODE_DEFAULT_TEXT = new Map<number, string>()
|
||||
NODE_DEFAULT_TEXT.set(NodeType.USER_TASK_NODE, '请配置审批人')
|
||||
NODE_DEFAULT_TEXT.set(NodeType.COPY_TASK_NODE, '请配置抄送人')
|
||||
NODE_DEFAULT_TEXT.set(NodeType.CONDITION_NODE, '请设置条件')
|
||||
|
||||
export const NODE_DEFAULT_NAME = new Map<number,string>()
|
||||
export const NODE_DEFAULT_NAME = new Map<number, string>()
|
||||
NODE_DEFAULT_NAME.set(NodeType.USER_TASK_NODE, '审批人')
|
||||
NODE_DEFAULT_NAME.set(NodeType.COPY_TASK_NODE, '抄送人')
|
||||
NODE_DEFAULT_NAME.set(NodeType.CONDITION_NODE, '条件')
|
||||
|
||||
export const APPROVE_METHODS: DictDataVO [] = [
|
||||
export const APPROVE_METHODS: DictDataVO[] = [
|
||||
{ label: '随机挑选一人审批', value: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE },
|
||||
{ label: '多人会签(按通过比例%)', value: ApproveMethodType.APPROVE_BY_RATIO },
|
||||
{ label: '多人或签(一人通过或拒绝)', value: ApproveMethodType.ANY_APPROVE },
|
||||
{ label: '依次审批(按顺序依次审批)', value: ApproveMethodType.SEQUENTIAL_APPROVE }
|
||||
]
|
||||
|
||||
export const CONDITION_CONFIG_TYPES: DictDataVO [] = [
|
||||
export const CONDITION_CONFIG_TYPES: DictDataVO[] = [
|
||||
{ label: '条件表达式', value: 1 },
|
||||
{ label: '条件规则', value: 2 }
|
||||
]
|
||||
|
||||
// 时间单位类型
|
||||
export const TIME_UNIT_TYPES: DictDataVO [] = [
|
||||
export const TIME_UNIT_TYPES: DictDataVO[] = [
|
||||
{ label: '分钟', value: TimeUnitType.MINUTE },
|
||||
{ label: '小时', value: TimeUnitType.HOUR },
|
||||
{ label: '天', value: TimeUnitType.DAY },
|
||||
{ label: '天', value: TimeUnitType.DAY }
|
||||
]
|
||||
// 超时处理执行动作类型
|
||||
export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO [] = [
|
||||
export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO[] = [
|
||||
{ label: '自动提醒', value: 1 },
|
||||
{ label: '自动同意', value: 2 },
|
||||
{ label: '自动拒绝', value: 3 },
|
||||
{ label: '自动拒绝', value: 3 }
|
||||
]
|
||||
export const REJECT_HANDLER_TYPES: DictDataVO [] = [
|
||||
export const REJECT_HANDLER_TYPES: DictDataVO[] = [
|
||||
{ label: '终止流程', value: RejectHandlerType.FINISH_PROCESS },
|
||||
{ label: '驳回到指定节点', value: RejectHandlerType.RETURN_USER_TASK }
|
||||
// { label: '结束任务', value: RejectHandlerType.FINISH_TASK }
|
||||
]
|
||||
|
||||
// 比较运算符
|
||||
export const COMPARISON_OPERATORS : DictDataVO = [
|
||||
export const COMPARISON_OPERATORS: DictDataVO = [
|
||||
{
|
||||
value: '==',
|
||||
label: '等于',
|
||||
label: '等于'
|
||||
},
|
||||
{
|
||||
value: '!=',
|
||||
label: '不等于',
|
||||
label: '不等于'
|
||||
},
|
||||
{
|
||||
value: '>',
|
||||
label: '大于',
|
||||
label: '大于'
|
||||
},
|
||||
{
|
||||
value: '>=',
|
||||
label: '大于等于',
|
||||
label: '大于等于'
|
||||
},
|
||||
{
|
||||
value: '<',
|
||||
label: '小于',
|
||||
label: '小于'
|
||||
},
|
||||
{
|
||||
value: '<=',
|
||||
label: '小于等于',
|
||||
label: '小于等于'
|
||||
}
|
||||
]
|
||||
|
@ -32,7 +32,7 @@
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="审批人设置" prop="candidateStrategy">
|
||||
<el-radio-group
|
||||
v-model="currentNode.attributes.candidateStrategy"
|
||||
v-model="currentNode.candidateStrategy"
|
||||
@change="changeCandidateStrategy"
|
||||
>
|
||||
<el-radio
|
||||
@ -47,7 +47,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
v-if="currentNode.attributes.candidateStrategy == CandidateStrategy.ROLE"
|
||||
v-if="currentNode.candidateStrategy == CandidateStrategy.ROLE"
|
||||
label="指定角色"
|
||||
prop="candidateParam"
|
||||
>
|
||||
@ -62,8 +62,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="
|
||||
currentNode.attributes.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
|
||||
currentNode.attributes.candidateStrategy == CandidateStrategy.DEPT_LEADER
|
||||
currentNode.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
|
||||
currentNode.candidateStrategy == CandidateStrategy.DEPT_LEADER
|
||||
"
|
||||
label="指定部门"
|
||||
prop="candidateParam"
|
||||
@ -82,7 +82,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="currentNode.attributes.candidateStrategy == CandidateStrategy.POST"
|
||||
v-if="currentNode.candidateStrategy == CandidateStrategy.POST"
|
||||
label="指定岗位"
|
||||
prop="candidateParam"
|
||||
span="24"
|
||||
@ -97,7 +97,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="currentNode.attributes.candidateStrategy == CandidateStrategy.USER"
|
||||
v-if="currentNode.candidateStrategy == CandidateStrategy.USER"
|
||||
label="指定用户"
|
||||
prop="candidateParam"
|
||||
span="24"
|
||||
@ -118,7 +118,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="currentNode.attributes.candidateStrategy === CandidateStrategy.USER_GROUP"
|
||||
v-if="currentNode.candidateStrategy === CandidateStrategy.USER_GROUP"
|
||||
label="指定用户组"
|
||||
prop="candidateParam"
|
||||
>
|
||||
@ -132,7 +132,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="currentNode.attributes.candidateStrategy === CandidateStrategy.EXPRESSION"
|
||||
v-if="currentNode.candidateStrategy === CandidateStrategy.EXPRESSION"
|
||||
label="流程表达式"
|
||||
prop="candidateParam"
|
||||
>
|
||||
@ -144,10 +144,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="多人审批方式" prop="approveMethod">
|
||||
<el-radio-group
|
||||
v-model="currentNode.attributes.approveMethod"
|
||||
@change="approveMethodChanged"
|
||||
>
|
||||
<el-radio-group v-model="currentNode.approveMethod" @change="approveMethodChanged">
|
||||
<div class="flex-col">
|
||||
<div
|
||||
v-for="(item, index) in APPROVE_METHODS"
|
||||
@ -165,14 +162,14 @@
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
<el-input-number
|
||||
v-model="currentNode.attributes.approveRatio"
|
||||
v-model="currentNode.approveRatio"
|
||||
:min="10"
|
||||
:max="100"
|
||||
:step="10"
|
||||
size="small"
|
||||
v-if="
|
||||
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
||||
currentNode.attributes.approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
||||
currentNode.approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
@ -181,7 +178,7 @@
|
||||
</el-form-item>
|
||||
<el-divider content-position="left">审批人拒绝时</el-divider>
|
||||
<el-form-item prop="rejectHandler">
|
||||
<el-radio-group v-model="currentNode.attributes.rejectHandler.type">
|
||||
<el-radio-group v-model="currentNode.rejectHandler!.type">
|
||||
<div class="flex-col">
|
||||
<div v-for="(item, index) in REJECT_HANDLER_TYPES" :key="index">
|
||||
<el-radio :key="item.value" :value="item.value" :label="item.label" />
|
||||
@ -191,12 +188,12 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
v-if="currentNode.attributes.rejectHandler.type == RejectHandlerType.RETURN_USER_TASK"
|
||||
v-if="currentNode.rejectHandler!.type == RejectHandlerType.RETURN_USER_TASK"
|
||||
label="驳回节点"
|
||||
prop="rejectHandlerNode"
|
||||
>
|
||||
<el-select
|
||||
v-model="currentNode.attributes.rejectHandler.returnNodeId"
|
||||
v-model="currentNode.rejectHandler!.returnNodeId"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
@ -211,7 +208,7 @@
|
||||
<el-divider content-position="left">审批人超时未处理时</el-divider>
|
||||
<el-form-item label="启用开关" prop="timeoutHandlerEnable">
|
||||
<el-switch
|
||||
v-model="currentNode.attributes.timeoutHandler.enable"
|
||||
v-model="currentNode.timeoutHandler!.enable"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
@change="timeoutHandlerChange"
|
||||
@ -220,9 +217,9 @@
|
||||
<el-form-item
|
||||
label="执行动作"
|
||||
prop="timeoutHandlerAction"
|
||||
v-if="currentNode.attributes.timeoutHandler.enable"
|
||||
v-if="currentNode.timeoutHandler?.enable"
|
||||
>
|
||||
<el-radio-group v-model="currentNode.attributes.timeoutHandler.action">
|
||||
<el-radio-group v-model="currentNode.timeoutHandler!.action">
|
||||
<el-radio-button
|
||||
v-for="item in TIMEOUT_HANDLER_ACTION_TYPES"
|
||||
:key="item.value"
|
||||
@ -234,7 +231,7 @@
|
||||
<el-form-item
|
||||
label="超时时间设置"
|
||||
prop="timeoutHandlerTimeDuration"
|
||||
v-if="currentNode.attributes.timeoutHandler.enable"
|
||||
v-if="currentNode.timeoutHandler?.enable"
|
||||
>
|
||||
<span class="mr-2">当超过</span>
|
||||
<el-input-number
|
||||
@ -262,13 +259,10 @@
|
||||
<el-form-item
|
||||
label="最大提醒次数"
|
||||
prop="timeoutHandlerMaxRemindCount"
|
||||
v-if="
|
||||
currentNode.attributes.timeoutHandler.enable &&
|
||||
currentNode.attributes.timeoutHandler.action === 1
|
||||
"
|
||||
v-if="currentNode.timeoutHandler?.enable && currentNode.timeoutHandler?.action === 1"
|
||||
>
|
||||
<el-input-number
|
||||
v-model="currentNode.attributes.timeoutHandler.maxRemindCount"
|
||||
v-model="currentNode.timeoutHandler!.maxRemindCount"
|
||||
:min="1"
|
||||
:max="10"
|
||||
/>
|
||||
@ -289,7 +283,7 @@
|
||||
</div>
|
||||
<div
|
||||
class="field-setting-item"
|
||||
v-for="(item, index) in currentNode.attributes.fieldsPermission"
|
||||
v-for="(item, index) in currentNode.fieldsPermission"
|
||||
:key="index"
|
||||
>
|
||||
<div class="field-setting-item-label"> {{ item.title }} </div>
|
||||
@ -371,9 +365,9 @@ const closeDrawer = () => {
|
||||
settingVisible.value = false
|
||||
}
|
||||
const saveConfig = () => {
|
||||
currentNode.value.attributes.candidateParam = candidateParamArray.value?.join(',')
|
||||
if (currentNode.value.attributes.timeoutHandler.enable) {
|
||||
currentNode.value.attributes.timeoutHandler.timeDuration = isoTimeDuration.value
|
||||
currentNode.value.candidateParam = candidateParamArray.value?.join(',')
|
||||
if (currentNode.value.timeoutHandler?.enable) {
|
||||
currentNode.value.timeoutHandler.timeDuration = isoTimeDuration.value
|
||||
}
|
||||
currentNode.value.showText = getShowText()
|
||||
settingVisible.value = false
|
||||
@ -381,7 +375,7 @@ const saveConfig = () => {
|
||||
const getShowText = (): string => {
|
||||
let showText = ''
|
||||
// 指定成员
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.USER) {
|
||||
if (candidateParamArray.value?.length > 0) {
|
||||
const candidateNames: string[] = []
|
||||
userOptions?.value.forEach((item) => {
|
||||
@ -393,7 +387,7 @@ const getShowText = (): string => {
|
||||
}
|
||||
}
|
||||
// 指定角色
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.ROLE) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.ROLE) {
|
||||
if (candidateParamArray.value?.length > 0) {
|
||||
const candidateNames: string[] = []
|
||||
roleOptions?.value.forEach((item) => {
|
||||
@ -406,8 +400,8 @@ const getShowText = (): string => {
|
||||
}
|
||||
// 指定部门
|
||||
if (
|
||||
currentNode.value.attributes.candidateStrategy === CandidateStrategy.DEPT_MEMBER ||
|
||||
currentNode.value.attributes.candidateStrategy === CandidateStrategy.DEPT_LEADER
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.DEPT_MEMBER ||
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.DEPT_LEADER
|
||||
) {
|
||||
if (candidateParamArray.value?.length > 0) {
|
||||
const candidateNames: string[] = []
|
||||
@ -416,7 +410,7 @@ const getShowText = (): string => {
|
||||
candidateNames.push(item.name)
|
||||
}
|
||||
})
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.DEPT_MEMBER) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.DEPT_MEMBER) {
|
||||
showText = `部门成员:${candidateNames.join(',')}`
|
||||
} else {
|
||||
showText = `部门的负责人:${candidateNames.join(',')}`
|
||||
@ -425,7 +419,7 @@ const getShowText = (): string => {
|
||||
}
|
||||
|
||||
// 指定岗位
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.POST) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.POST) {
|
||||
if (candidateParamArray.value?.length > 0) {
|
||||
const candidateNames: string[] = []
|
||||
postOptions?.value.forEach((item) => {
|
||||
@ -437,7 +431,7 @@ const getShowText = (): string => {
|
||||
}
|
||||
}
|
||||
// 指定用户组
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER_GROUP) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.USER_GROUP) {
|
||||
if (candidateParamArray.value?.length > 0) {
|
||||
const candidateNames: string[] = []
|
||||
userGroupOptions?.value.forEach((item) => {
|
||||
@ -450,16 +444,16 @@ const getShowText = (): string => {
|
||||
}
|
||||
|
||||
// 发起人自选
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER_SELECT) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.START_USER_SELECT) {
|
||||
showText = `发起人自选`
|
||||
}
|
||||
// 发起人自己
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.START_USER) {
|
||||
showText = `发起人自己`
|
||||
}
|
||||
|
||||
// 流程表达式
|
||||
if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.EXPRESSION) {
|
||||
if (currentNode.value.candidateStrategy === CandidateStrategy.EXPRESSION) {
|
||||
if (candidateParamArray.value?.length > 0) {
|
||||
showText = `流程表达式:${candidateParamArray.value[0]}`
|
||||
}
|
||||
@ -472,22 +466,23 @@ const open = () => {
|
||||
// 修改当前编辑的节点, 由父组件传过来
|
||||
const setCurrentNode = (node: SimpleFlowNode) => {
|
||||
currentNode.value = node
|
||||
currentNode.value.attributes.fieldsPermission =
|
||||
node.attributes.fieldsPermission || getDefaultFieldsPermission(formFields?.value)
|
||||
const strCandidateParam = node.attributes?.candidateParam
|
||||
currentNode.value.fieldsPermission =
|
||||
node.fieldsPermission || getDefaultFieldsPermission(formFields?.value)
|
||||
const strCandidateParam = node?.candidateParam
|
||||
if (strCandidateParam) {
|
||||
candidateParamArray.value = strCandidateParam.split(',').map((item) => +item)
|
||||
}
|
||||
if (currentNode.value.attributes?.candidateStrategy === CandidateStrategy.START_USER) {
|
||||
if (
|
||||
(candidateParamArray.value.length <= 1 &&
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.USER) ||
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.START_USER
|
||||
) {
|
||||
notAllowedMultiApprovers.value = true
|
||||
} else {
|
||||
notAllowedMultiApprovers.value = false
|
||||
}
|
||||
if (
|
||||
currentNode.value.attributes?.timeoutHandler?.enable &&
|
||||
currentNode.value.attributes?.timeoutHandler?.timeDuration
|
||||
) {
|
||||
const strTimeDuration = currentNode.value.attributes.timeoutHandler.timeDuration
|
||||
if (currentNode.value.timeoutHandler?.enable && currentNode.value.timeoutHandler?.timeDuration) {
|
||||
const strTimeDuration = currentNode.value.timeoutHandler.timeDuration
|
||||
let parseTime = strTimeDuration.slice(2, strTimeDuration.length - 1)
|
||||
let parseTimeUnit = strTimeDuration.slice(strTimeDuration.length - 1)
|
||||
timeDuration.value = parseInt(parseTime)
|
||||
@ -503,10 +498,10 @@ defineExpose({ open, setCurrentNode }) // 暴露方法给父组件
|
||||
|
||||
const changeCandidateStrategy = () => {
|
||||
candidateParamArray.value = []
|
||||
currentNode.value.attributes.approveMethod = ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE
|
||||
currentNode.value.approveMethod = ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE
|
||||
if (
|
||||
currentNode.value.attributes.candidateStrategy === CandidateStrategy.START_USER ||
|
||||
currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.START_USER ||
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.USER
|
||||
) {
|
||||
notAllowedMultiApprovers.value = true
|
||||
} else {
|
||||
@ -517,10 +512,10 @@ const changeCandidateStrategy = () => {
|
||||
const changedCandidateUsers = () => {
|
||||
if (
|
||||
candidateParamArray.value?.length <= 1 &&
|
||||
currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER
|
||||
currentNode.value.candidateStrategy === CandidateStrategy.USER
|
||||
) {
|
||||
currentNode.value.attributes.approveMethod = ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE
|
||||
currentNode.value.attributes.rejectHandler.type = RejectHandlerType.FINISH_PROCESS
|
||||
currentNode.value.approveMethod = ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE
|
||||
currentNode.value.rejectHandler!.type = RejectHandlerType.FINISH_PROCESS
|
||||
notAllowedMultiApprovers.value = true
|
||||
} else {
|
||||
notAllowedMultiApprovers.value = false
|
||||
@ -539,10 +534,10 @@ const blurEvent = () => {
|
||||
currentNode.value.name || (NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string)
|
||||
}
|
||||
const approveMethodChanged = () => {
|
||||
currentNode.value.attributes.rejectHandler.type = RejectHandlerType.FINISH_PROCESS
|
||||
const approveMethod = currentNode.value.attributes?.approveMethod
|
||||
currentNode.value.rejectHandler!.type = RejectHandlerType.FINISH_PROCESS
|
||||
const approveMethod = currentNode.value?.approveMethod
|
||||
if (approveMethod === ApproveMethodType.APPROVE_BY_RATIO) {
|
||||
currentNode.value.attributes.approveRatio = 100
|
||||
currentNode.value.approveRatio = 100
|
||||
}
|
||||
}
|
||||
// 默认 6小时
|
||||
@ -565,11 +560,11 @@ const isoTimeDuration = computed(() => {
|
||||
|
||||
// 超时开关改变
|
||||
const timeoutHandlerChange = () => {
|
||||
if (currentNode.value.attributes.timeoutHandler.enable) {
|
||||
if (currentNode.value.timeoutHandler?.enable) {
|
||||
timeUnit.value = 2
|
||||
timeDuration.value = 6
|
||||
currentNode.value.attributes.timeoutHandler.action = 1
|
||||
currentNode.value.attributes.timeoutHandler.maxRemindCount = 1
|
||||
currentNode.value.timeoutHandler.action = 1
|
||||
currentNode.value.timeoutHandler.maxRemindCount = 1
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user