【功能优化】条件节点设置优化
parent
baa4116697
commit
42de3d9127
|
@ -163,8 +163,10 @@ const addNode = (type: number) => {
|
|||
showText: '',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
childNode: undefined,
|
||||
conditionType: 1,
|
||||
defaultFlow: false
|
||||
conditionSetting: {
|
||||
defaultFlow: false
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
id: 'Flow_' + generateUUID(),
|
||||
|
@ -172,8 +174,9 @@ const addNode = (type: number) => {
|
|||
showText: '未满足其它条件时,将进入此分支',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
childNode: undefined,
|
||||
conditionType: undefined,
|
||||
defaultFlow: true
|
||||
conditionSetting: {
|
||||
defaultFlow: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -217,7 +220,10 @@ const addNode = (type: number) => {
|
|||
showText: '',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
childNode: undefined,
|
||||
defaultFlow: false
|
||||
conditionSetting: {
|
||||
defaultFlow: false
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
id: 'Flow_' + generateUUID(),
|
||||
|
@ -225,7 +231,9 @@ const addNode = (type: number) => {
|
|||
showText: '未满足其它条件时,将进入此分支',
|
||||
type: NodeType.CONDITION_NODE,
|
||||
childNode: undefined,
|
||||
defaultFlow: true
|
||||
conditionSetting: {
|
||||
defaultFlow: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -103,14 +103,8 @@ export interface SimpleFlowNode {
|
|||
taskAssignListener?: ListenerHandler
|
||||
// 创建任务监听器
|
||||
taskCompleteListener?: ListenerHandler
|
||||
// 条件类型
|
||||
conditionType?: ConditionType
|
||||
// 条件表达式
|
||||
conditionExpression?: string
|
||||
// 条件组
|
||||
conditionGroups?: ConditionGroup
|
||||
// 是否默认的条件
|
||||
defaultFlow?: boolean
|
||||
// 条件设置
|
||||
conditionSetting?: ConditionSetting
|
||||
// 活动的状态,用于前端节点状态展示
|
||||
activityStatus?: TaskStatusEnum
|
||||
// 延迟设置
|
||||
|
@ -365,6 +359,20 @@ export enum TimeUnitType {
|
|||
DAY = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件节点设置结构定义,用于条件节点
|
||||
*/
|
||||
export type ConditionSetting = {
|
||||
// 条件类型
|
||||
conditionType?: ConditionType,
|
||||
// 条件表达式
|
||||
conditionExpression?: string,
|
||||
// 条件组
|
||||
conditionGroups?: ConditionGroup,
|
||||
// 是否默认的条件
|
||||
defaultFlow?: boolean
|
||||
}
|
||||
|
||||
// 条件配置类型 ( 用于条件节点配置 )
|
||||
export enum ConditionType {
|
||||
/**
|
||||
|
|
|
@ -113,7 +113,6 @@ export function useFormFields() {
|
|||
}
|
||||
|
||||
export type UserTaskFormType = {
|
||||
//candidateParamArray: any[]
|
||||
candidateStrategy: CandidateStrategy
|
||||
approveMethod: ApproveMethodType
|
||||
roleIds?: number[] // 角色
|
||||
|
@ -152,7 +151,6 @@ export type UserTaskFormType = {
|
|||
}
|
||||
|
||||
export type CopyTaskFormType = {
|
||||
// candidateParamArray: any[]
|
||||
candidateStrategy: CandidateStrategy
|
||||
roleIds?: number[] // 角色
|
||||
deptIds?: number[] // 部门
|
||||
|
|
|
@ -26,13 +26,16 @@
|
|||
</div>
|
||||
</template>
|
||||
<div>
|
||||
<div class="mb-3 font-size-16px" v-if="currentNode.defaultFlow"
|
||||
>未满足其它条件时,将进入此分支(该分支不可编辑和删除)</div
|
||||
>
|
||||
<div class="mb-3 font-size-16px" v-if="currentNode.conditionSetting?.defaultFlow">
|
||||
未满足其它条件时,将进入此分支(该分支不可编辑和删除)
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-form ref="formRef" :model="currentNode" :rules="formRules" label-position="top">
|
||||
<el-form ref="formRef" :model="currentNode.conditionSetting" :rules="formRules" label-position="top">
|
||||
<el-form-item label="配置方式" prop="conditionType">
|
||||
<el-radio-group v-model="currentNode.conditionType" @change="changeConditionType">
|
||||
<el-radio-group
|
||||
v-model="currentNode.conditionSetting!.conditionType"
|
||||
@change="changeConditionType"
|
||||
>
|
||||
<el-radio
|
||||
v-for="(dict, index) in conditionConfigTypes"
|
||||
:key="index"
|
||||
|
@ -45,18 +48,21 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
v-if="currentNode.conditionType === 1"
|
||||
v-if="currentNode.conditionSetting?.conditionType === ConditionType.EXPRESSION"
|
||||
label="条件表达式"
|
||||
prop="conditionExpression"
|
||||
>
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="currentNode.conditionExpression"
|
||||
v-model="currentNode.conditionSetting.conditionExpression"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currentNode.conditionType === 2" label="条件规则">
|
||||
<el-form-item
|
||||
v-if="currentNode.conditionSetting?.conditionType === ConditionType.RULE"
|
||||
label="条件规则"
|
||||
>
|
||||
<div class="condition-group-tool">
|
||||
<div class="flex items-center">
|
||||
<div class="mr-4">条件组关系</div>
|
||||
|
@ -194,9 +200,9 @@ const props = defineProps({
|
|||
})
|
||||
const settingVisible = ref(false)
|
||||
const open = () => {
|
||||
if (currentNode.value.conditionType === ConditionType.RULE) {
|
||||
if (currentNode.value.conditionGroups) {
|
||||
conditionGroups.value = currentNode.value.conditionGroups
|
||||
if (currentNode.value.conditionSetting?.conditionType === ConditionType.RULE) {
|
||||
if (currentNode.value.conditionSetting?.conditionGroups) {
|
||||
conditionGroups.value = currentNode.value.conditionSetting.conditionGroups
|
||||
}
|
||||
}
|
||||
settingVisible.value = true
|
||||
|
@ -219,7 +225,7 @@ const blurEvent = () => {
|
|||
showInput.value = false
|
||||
currentNode.value.name =
|
||||
currentNode.value.name ||
|
||||
getDefaultConditionNodeName(props.nodeIndex, currentNode.value?.defaultFlow)
|
||||
getDefaultConditionNodeName(props.nodeIndex, currentNode.value?.conditionSetting?.defaultFlow)
|
||||
}
|
||||
|
||||
const currentNode = ref<SimpleFlowNode>(props.conditionNode)
|
||||
|
@ -248,7 +254,7 @@ const formRef = ref() // 表单 Ref
|
|||
|
||||
// 保存配置
|
||||
const saveConfig = async () => {
|
||||
if (!currentNode.value.defaultFlow) {
|
||||
if (!currentNode.value.conditionSetting?.defaultFlow) {
|
||||
// 校验表单
|
||||
if (!formRef) return false
|
||||
const valid = await formRef.value.validate()
|
||||
|
@ -258,12 +264,12 @@ const saveConfig = async () => {
|
|||
return false
|
||||
}
|
||||
currentNode.value.showText = showText
|
||||
if (currentNode.value.conditionType === ConditionType.EXPRESSION) {
|
||||
currentNode.value.conditionGroups = undefined
|
||||
if (currentNode.value.conditionSetting?.conditionType === ConditionType.EXPRESSION) {
|
||||
currentNode.value.conditionSetting.conditionGroups = undefined
|
||||
}
|
||||
if (currentNode.value.conditionType === ConditionType.RULE) {
|
||||
currentNode.value.conditionExpression = undefined
|
||||
currentNode.value.conditionGroups = conditionGroups.value
|
||||
if (currentNode.value.conditionSetting?.conditionType === ConditionType.RULE) {
|
||||
currentNode.value.conditionSetting.conditionExpression = undefined
|
||||
currentNode.value.conditionSetting.conditionGroups = conditionGroups.value
|
||||
}
|
||||
}
|
||||
settingVisible.value = false
|
||||
|
@ -271,12 +277,12 @@ const saveConfig = async () => {
|
|||
}
|
||||
const getShowText = (): string => {
|
||||
let showText = ''
|
||||
if (currentNode.value.conditionType === ConditionType.EXPRESSION) {
|
||||
if (currentNode.value.conditionExpression) {
|
||||
showText = `表达式:${currentNode.value.conditionExpression}`
|
||||
if (currentNode.value.conditionSetting?.conditionType === ConditionType.EXPRESSION) {
|
||||
if (currentNode.value.conditionSetting.conditionExpression) {
|
||||
showText = `表达式:${currentNode.value.conditionSetting.conditionExpression}`
|
||||
}
|
||||
}
|
||||
if (currentNode.value.conditionType === ConditionType.RULE) {
|
||||
if (currentNode.value.conditionSetting?.conditionType === ConditionType.RULE) {
|
||||
// 条件组是否为与关系
|
||||
const groupAnd = conditionGroups.value.and
|
||||
let warningMesg: undefined | string = undefined
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
]"
|
||||
>
|
||||
<div class="branch-node-title-container">
|
||||
<div v-if="showInputs[index]">
|
||||
<div v-if="!readonly && showInputs[index]">
|
||||
<input
|
||||
type="text"
|
||||
class="editable-title-input"
|
||||
|
|
Loading…
Reference in New Issue