mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-09 17:02:43 +08:00
fix: 代码评审修改
This commit is contained in:
parent
de35fd0a7c
commit
2ff1bccbaf
@ -824,17 +824,48 @@ export type ChildProcessSetting = {
|
|||||||
}
|
}
|
||||||
export type IOParameter = {
|
export type IOParameter = {
|
||||||
source: string
|
source: string
|
||||||
sourceExpression: string
|
|
||||||
target: string
|
target: string
|
||||||
targetExpression: string
|
|
||||||
}
|
}
|
||||||
export type StartUserSetting = {
|
export type StartUserSetting = {
|
||||||
type: number
|
type: ChildProcessStartUserTypeEnum
|
||||||
formField?: string
|
formField?: string
|
||||||
emptyType?: number
|
emptyType?: ChildProcessStartUserEmptyTypeEnum
|
||||||
}
|
}
|
||||||
export type TimeoutSetting = {
|
export type TimeoutSetting = {
|
||||||
enable: boolean,
|
enable: boolean,
|
||||||
type?: DelayTypeEnum,
|
type?: DelayTypeEnum,
|
||||||
timeExpression?: string,
|
timeExpression?: string,
|
||||||
}
|
}
|
||||||
|
export enum ChildProcessStartUserTypeEnum {
|
||||||
|
/**
|
||||||
|
* 同主流程发起人
|
||||||
|
*/
|
||||||
|
MAIN_PROCESS_START_USER = 1,
|
||||||
|
/**
|
||||||
|
* 表单
|
||||||
|
*/
|
||||||
|
FROM_FORM = 2,
|
||||||
|
}
|
||||||
|
export const CHILD_PROCESS_START_USER_TYPE = [
|
||||||
|
{ label: '同主流程发起人', value: ChildProcessStartUserTypeEnum.MAIN_PROCESS_START_USER },
|
||||||
|
{ label: '表单', value: ChildProcessStartUserTypeEnum.FROM_FORM }
|
||||||
|
]
|
||||||
|
export enum ChildProcessStartUserEmptyTypeEnum {
|
||||||
|
/**
|
||||||
|
* 同主流程发起人
|
||||||
|
*/
|
||||||
|
MAIN_PROCESS_START_USER = 1,
|
||||||
|
/**
|
||||||
|
* 子流程管理员
|
||||||
|
*/
|
||||||
|
CHILD_PROCESS_ADMIN = 2,
|
||||||
|
/**
|
||||||
|
* 主流程管理员
|
||||||
|
*/
|
||||||
|
MAIN_PROCESS_ADMIN = 3,
|
||||||
|
}
|
||||||
|
export const CHILD_PROCESS_START_USER_EMPTY_TYPE = [
|
||||||
|
{ label: '同主流程发起人', value: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER },
|
||||||
|
{ label: '子流程管理员', value: ChildProcessStartUserEmptyTypeEnum.CHILD_PROCESS_ADMIN },
|
||||||
|
{ label: '主流程管理员', value: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_ADMIN }
|
||||||
|
]
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
<Icon
|
<Icon
|
||||||
icon="ep:delete"
|
icon="ep:delete"
|
||||||
:size="18"
|
:size="18"
|
||||||
@click="deleteVariable(configForm.inVariables, index)"
|
@click="deleteVariable(index, configForm.inVariables)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -103,7 +103,6 @@
|
|||||||
<Icon icon="ep:plus" class="mr-5px" />添加一行
|
<Icon icon="ep:plus" class="mr-5px" />添加一行
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- TODO @lesan:async、source、target 几个字段,会告警 -->
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="configForm.async === false"
|
v-if="configForm.async === false"
|
||||||
label="子→主变量传递"
|
label="子→主变量传递"
|
||||||
@ -152,7 +151,7 @@
|
|||||||
<Icon
|
<Icon
|
||||||
icon="ep:delete"
|
icon="ep:delete"
|
||||||
:size="18"
|
:size="18"
|
||||||
@click="deleteVariable(configForm.outVariables, index)"
|
@click="deleteVariable(index, configForm.outVariables)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -160,11 +159,13 @@
|
|||||||
<Icon icon="ep:plus" class="mr-5px" />添加一行
|
<Icon icon="ep:plus" class="mr-5px" />添加一行
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- TODO @lesan:startUserType、startUserEmptyType 要不走写下枚举类? -->
|
|
||||||
<el-form-item label="子流程发起人" prop="startUserType">
|
<el-form-item label="子流程发起人" prop="startUserType">
|
||||||
<el-radio-group v-model="configForm.startUserType">
|
<el-radio-group v-model="configForm.startUserType">
|
||||||
<el-radio :value="1">同主流程发起人</el-radio>
|
<el-radio
|
||||||
<el-radio :value="2">表单</el-radio>
|
v-for="item in CHILD_PROCESS_START_USER_TYPE"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value">
|
||||||
|
{{ item.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -173,9 +174,11 @@
|
|||||||
prop="startUserType"
|
prop="startUserType"
|
||||||
>
|
>
|
||||||
<el-radio-group v-model="configForm.startUserEmptyType">
|
<el-radio-group v-model="configForm.startUserEmptyType">
|
||||||
<el-radio :value="1">同主流程发起人</el-radio>
|
<el-radio
|
||||||
<el-radio :value="2">子流程管理员</el-radio>
|
v-for="item in CHILD_PROCESS_START_USER_EMPTY_TYPE"
|
||||||
<el-radio :value="3">主流程管理员</el-radio>
|
:key="item.value"
|
||||||
|
:value="item.value">
|
||||||
|
{{ item.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -268,7 +271,12 @@ import {
|
|||||||
TIME_UNIT_TYPES,
|
TIME_UNIT_TYPES,
|
||||||
TimeUnitType,
|
TimeUnitType,
|
||||||
DelayTypeEnum,
|
DelayTypeEnum,
|
||||||
DELAY_TYPE
|
DELAY_TYPE,
|
||||||
|
IOParameter,
|
||||||
|
ChildProcessStartUserTypeEnum,
|
||||||
|
CHILD_PROCESS_START_USER_TYPE,
|
||||||
|
ChildProcessStartUserEmptyTypeEnum,
|
||||||
|
CHILD_PROCESS_START_USER_EMPTY_TYPE
|
||||||
} from '../consts'
|
} from '../consts'
|
||||||
import { useWatchNode, useDrawer, useNodeName, useFormFieldsAndStartUser } from '../node'
|
import { useWatchNode, useDrawer, useNodeName, useFormFieldsAndStartUser } from '../node'
|
||||||
import { parseFormFields } from '@/components/FormCreate/src/utils'
|
import { parseFormFields } from '@/components/FormCreate/src/utils'
|
||||||
@ -309,14 +317,29 @@ const formRules = reactive({
|
|||||||
timeDuration: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }],
|
timeDuration: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }],
|
||||||
dateTime: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }]
|
dateTime: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }]
|
||||||
})
|
})
|
||||||
const configForm = ref({
|
type ChildProcessFormType = {
|
||||||
|
async: boolean
|
||||||
|
calledProcessDefinitionKey: string
|
||||||
|
skipStartUserNode: boolean
|
||||||
|
inVariables?: IOParameter[]
|
||||||
|
outVariables?: IOParameter[]
|
||||||
|
startUserType: ChildProcessStartUserTypeEnum
|
||||||
|
startUserEmptyType: ChildProcessStartUserEmptyTypeEnum
|
||||||
|
startUserFormField: string
|
||||||
|
timeoutEnable: boolean
|
||||||
|
timeoutType: DelayTypeEnum
|
||||||
|
timeDuration: number
|
||||||
|
timeUnit: TimeUnitType
|
||||||
|
dateTime: string
|
||||||
|
}
|
||||||
|
const configForm = ref<ChildProcessFormType>({
|
||||||
async: false,
|
async: false,
|
||||||
calledProcessDefinitionKey: '',
|
calledProcessDefinitionKey: '',
|
||||||
skipStartUserNode: false,
|
skipStartUserNode: false,
|
||||||
inVariables: [],
|
inVariables: [],
|
||||||
outVariables: [],
|
outVariables: [],
|
||||||
startUserType: 1,
|
startUserType: ChildProcessStartUserTypeEnum.MAIN_PROCESS_START_USER,
|
||||||
startUserEmptyType: 1,
|
startUserEmptyType: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER,
|
||||||
startUserFormField: '',
|
startUserFormField: '',
|
||||||
timeoutEnable: false,
|
timeoutEnable: false,
|
||||||
timeoutType: DelayTypeEnum.FIXED_TIME_DURATION,
|
timeoutType: DelayTypeEnum.FIXED_TIME_DURATION,
|
||||||
@ -334,9 +357,8 @@ const saveConfig = async () => {
|
|||||||
if (!formRef) return false
|
if (!formRef) return false
|
||||||
const valid = await formRef.value.validate()
|
const valid = await formRef.value.validate()
|
||||||
if (!valid) return false
|
if (!valid) return false
|
||||||
// TODO @lesan:这里的 option 黄色告警,也处理下哈
|
|
||||||
const childInfo = childProcessOptions.value.find(
|
const childInfo = childProcessOptions.value.find(
|
||||||
(option) => option.key === configForm.value.calledProcessDefinitionKey
|
(option: any) => option.key === configForm.value.calledProcessDefinitionKey
|
||||||
)
|
)
|
||||||
currentNode.value.name = nodeName.value!
|
currentNode.value.name = nodeName.value!
|
||||||
if (currentNode.value.childProcessSetting) {
|
if (currentNode.value.childProcessSetting) {
|
||||||
@ -378,7 +400,6 @@ const saveConfig = async () => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// 显示子流程节点配置, 由父组件传过来
|
// 显示子流程节点配置, 由父组件传过来
|
||||||
// TODO @lesan:inVariables、outVariables 红色告警
|
|
||||||
const showChildProcessNodeConfig = (node: SimpleFlowNode) => {
|
const showChildProcessNodeConfig = (node: SimpleFlowNode) => {
|
||||||
nodeName.value = node.name
|
nodeName.value = node.name
|
||||||
if (node.childProcessSetting) {
|
if (node.childProcessSetting) {
|
||||||
@ -421,15 +442,14 @@ const showChildProcessNodeConfig = (node: SimpleFlowNode) => {
|
|||||||
|
|
||||||
defineExpose({ openDrawer, showChildProcessNodeConfig }) // 暴露方法给父组件
|
defineExpose({ openDrawer, showChildProcessNodeConfig }) // 暴露方法给父组件
|
||||||
|
|
||||||
// TODO @lesan:这里的 arr 黄色告警,也处理下哈,可以用 cursor quick fix 哈
|
const addVariable = (arr?: IOParameter[]) => {
|
||||||
const addVariable = (arr) => {
|
arr?.push({
|
||||||
arr.push({
|
|
||||||
source: '',
|
source: '',
|
||||||
target: ''
|
target: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const deleteVariable = (arr, index: number) => {
|
const deleteVariable = (index: number, arr?: IOParameter[]) => {
|
||||||
arr.splice(index, 1)
|
arr?.splice(index, 1)
|
||||||
}
|
}
|
||||||
const handleCalledElementChange = () => {
|
const handleCalledElementChange = () => {
|
||||||
configForm.value.inVariables = []
|
configForm.value.inVariables = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user