【代码评审】BPM:触发器,修改节点的评审

This commit is contained in:
YunaiV 2025-02-19 12:55:05 +08:00
parent 78d8782b5d
commit 1de17cadb5
4 changed files with 16 additions and 19 deletions

View File

@ -551,21 +551,21 @@ export function useTaskStatusClass(taskStatus: TaskStatusEnum | undefined): stri
/** 条件组件文字展示 */ /** 条件组件文字展示 */
export function getConditionShowText( export function getConditionShowText(
conditonType: ConditionType | undefined, conditionType: ConditionType | undefined,
conditionExpression: string | undefined, conditionExpression: string | undefined,
conditionGroups: ConditionGroup | undefined, conditionGroups: ConditionGroup | undefined,
fieldOptions: Array<Record<string, any>> fieldOptions: Array<Record<string, any>>
) { ) {
let showText = '' let showText = ''
if (conditonType === ConditionType.EXPRESSION) { if (conditionType === ConditionType.EXPRESSION) {
if (conditionExpression) { if (conditionExpression) {
showText = `表达式:${conditionExpression}` showText = `表达式:${conditionExpression}`
} }
} }
if (conditonType === ConditionType.RULE) { if (conditionType === ConditionType.RULE) {
// 条件组是否为与关系 // 条件组是否为与关系
const groupAnd = conditionGroups?.and const groupAnd = conditionGroups?.and
let warningMesg: undefined | string = undefined let warningMessage: undefined | string = undefined
const conditionGroup = conditionGroups?.conditions.map((item) => { const conditionGroup = conditionGroups?.conditions.map((item) => {
return ( return (
'(' + '(' +
@ -581,7 +581,7 @@ export function getConditionShowText(
) )
} else { } else {
// 有一条规则不完善。提示错误 // 有一条规则不完善。提示错误
warningMesg = '请完善条件规则' warningMessage = '请完善条件规则'
return '' return ''
} }
}) })
@ -589,7 +589,7 @@ export function getConditionShowText(
' ) ' ' ) '
) )
}) })
if (warningMesg) { if (warningMessage) {
showText = '' showText = ''
} else { } else {
showText = conditionGroup!.join(groupAnd ? ' 且 ' : ' 或 ') showText = conditionGroup!.join(groupAnd ? ' 且 ' : ' 或 ')

View File

@ -104,11 +104,10 @@ const handleClose = async (done: (cancel?: boolean) => void) => {
done() done()
} }
} }
//
const fieldOptions = useFormFieldsAndStartUser()
/** 保存配置 */
const fieldOptions = useFormFieldsAndStartUser() //
const conditionRef = ref() const conditionRef = ref()
//
const saveConfig = async () => { const saveConfig = async () => {
if (!currentNode.value.conditionSetting?.defaultFlow) { if (!currentNode.value.conditionSetting?.defaultFlow) {
// //

View File

@ -252,17 +252,11 @@ import {
FormTriggerSetting, FormTriggerSetting,
DEFAULT_CONDITION_GROUP_VALUE DEFAULT_CONDITION_GROUP_VALUE
} from '../consts' } from '../consts'
import { import { useWatchNode, useDrawer, useNodeName, useFormFields, getConditionShowText } from '../node'
useWatchNode,
useDrawer,
useNodeName,
useFormFields,
useFormFieldsAndStartUser,
getConditionShowText
} from '../node'
import HttpRequestParamSetting from './components/HttpRequestParamSetting.vue' import HttpRequestParamSetting from './components/HttpRequestParamSetting.vue'
import ConditionDialog from './components/ConditionDialog.vue' import ConditionDialog from './components/ConditionDialog.vue'
const { proxy } = getCurrentInstance() as any const { proxy } = getCurrentInstance() as any
defineOptions({ defineOptions({
name: 'TriggerNodeConfig' name: 'TriggerNodeConfig'
}) })
@ -314,7 +308,7 @@ const optionalUpdateFormFields = computed(() => {
})) }))
}) })
/** 添加 HTTP 请求返回值设置项*/ /** 添加 HTTP 请求返回值设置项 */
const addHttpResponseSetting = (responseSetting: Record<string, string>[]) => { const addHttpResponseSetting = (responseSetting: Record<string, string>[]) => {
responseSetting.push({ responseSetting.push({
key: '', key: '',

View File

@ -1,3 +1,4 @@
<!-- TODO @jason有可能它里面套 Condition -->
<template> <template>
<Dialog v-model="dialogVisible" title="条件配置" width="600px" :fullscreen="false"> <Dialog v-model="dialogVisible" title="条件配置" width="600px" :fullscreen="false">
<div class="h-410px"> <div class="h-410px">
@ -106,7 +107,10 @@
<el-input v-model="rule.rightSide" style="width: 160px" /> <el-input v-model="rule.rightSide" style="width: 160px" />
</el-form-item> </el-form-item>
</div> </div>
<div class="cursor-pointer mr-1 flex items-center" v-if="equation.rules.length > 1"> <div
class="cursor-pointer mr-1 flex items-center"
v-if="equation.rules.length > 1"
>
<Icon <Icon
icon="ep:delete" icon="ep:delete"
:size="18" :size="18"