【代码评审】工作流:快搭部分的 code review

This commit is contained in:
YunaiV 2024-08-11 00:48:07 +08:00
parent 5376eb4051
commit fd13eb7f8f
8 changed files with 48 additions and 42 deletions

View File

@ -70,7 +70,7 @@ let props = defineProps({
showAddButton: {
type: Boolean,
default: true
},
}
})
let emits = defineEmits(['update:childNodeP'])
let visible = ref(false)
@ -89,7 +89,7 @@ const addType = (type: number) => {
approveMethod: undefined,
candidateStrategy: undefined,
candidateParam: undefined,
fieldsPermission: defaultFieldsPermission,
fieldsPermission: defaultFieldsPermission
},
childNode: props.childNodeP
}
@ -99,7 +99,7 @@ const addType = (type: number) => {
if (type === NodeType.CC_USER_NODE) {
const data = {
name: '抄送人',
type: 2,
type: 2, // TODO @jasonNodeType
error: true,
//
attributes: {
@ -161,7 +161,7 @@ const addType = (type: number) => {
name: '并行分支_JOIN',
type: 6,
error: true,
childNode: props.childNodeP,
childNode: props.childNodeP
}
}
emits('update:childNodeP', data)
@ -190,7 +190,7 @@ const addType = (type: number) => {
name: '包容分支_JOIN',
type: 8,
error: true,
childNode: props.childNodeP,
childNode: props.childNodeP
}
}
emits('update:childNodeP', data)

View File

@ -324,12 +324,12 @@ const changecandidateStrategy = () => {
candidateConfig.value.candidateParam = []
}
const handleAllCheck = (event, type) => {
console.log('event', event);
console.log('type', type);
event.target.checked = true;
console.log('event', event)
console.log('type', type)
event.target.checked = true
let permission = '1'
if (type === 'edit' && editAllChecked.value) {
permission = '1'
permission = '1' // TODO @jaosn
}
if (type === 'read' && readAllChecked.value) {
permission = '2'
@ -344,7 +344,7 @@ const handleAllCheck = (event, type) => {
onMounted(async () => {
//
roleOptions.value = await RoleApi.getSimpleRoleList()
//
postOptions.value = await PostApi.getSimplePostList()
//
userOptions.value = await UserApi.getSimpleUserList()

View File

@ -12,7 +12,12 @@
<div>
<el-form label-position="top" label-width="100px">
<el-form-item label="选择抄送人" prop="candidateStrategy">
<el-select v-model="candidateConfig.candidateStrategy" style="width: 100%" clearable @change="changecandidateStrategy">
<el-select
v-model="candidateConfig.candidateStrategy"
style="width: 100%"
clearable
@change="changecandidateStrategy"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_TASK_CANDIDATE_STRATEGY)"
:key="dict.value"
@ -160,7 +165,7 @@ const deptTreeOptions = ref() // 部门树
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) //
const candidateConfig = ref({
candidateStrategy: undefined,
candidateParam: [],
candidateParam: []
})
const store = useWorkFlowStoreWithOut()
const { setCopyerDrawer, setCopyerConfig } = store
@ -178,9 +183,9 @@ const visible = computed({
})
watch(copyerConfig, (val) => {
if (val.value.attributes) {
console.log('val.value.attributes', val.value.attributes);
console.log('val.value.attributes', val.value.attributes)
candidateConfig.value.candidateStrategy = val.value.attributes.candidateStrategy
const candidateParamStr = val.value.attributes.candidateParam;
const candidateParamStr = val.value.attributes.candidateParam
if (val.value.attributes.candidateStrategy === 60) {
candidateConfig.value.candidateParam = [candidateParamStr]
} else {
@ -193,10 +198,9 @@ watch(copyerConfig, (val) => {
}
})
const saveConfig = () => {
const rawConfig = toRaw(copyerConfig.value)
const { candidateStrategy , candidateParam} = toRaw(candidateConfig.value);
const { candidateStrategy, candidateParam } = toRaw(candidateConfig.value)
const candidateParamStr = candidateParam.join(',')
rawConfig.value.attributes = {
candidateStrategy,
@ -213,7 +217,7 @@ const saveConfig = () => {
setCopyerConfig({
value: rawConfig.value,
flag: true,
id: copyerConfig.value.id,
id: copyerConfig.value.id
})
console.log('after is copyerConfig', copyerConfig.value)
closeDrawer()
@ -228,7 +232,7 @@ const changecandidateStrategy = () => {
onMounted(async () => {
//
roleOptions.value = await RoleApi.getSimpleRoleList()
//
postOptions.value = await PostApi.getSimplePostList()
//
userOptions.value = await UserApi.getSimpleUserList()

View File

@ -146,7 +146,7 @@ onMounted(async () => {
processNodeTree.value = {
name: '开始',
type: NodeType.START_EVENT_NODE,
id: 'StartEvent_1',
id: 'StartEvent_1', // TODO @jason StartEvent
childNode: {
id: 'EndEvent_1',
name: '结束',

View File

@ -213,7 +213,7 @@ export type ButtonSetting = {
enable: boolean
}
// 操作按钮类型枚举 (用于审批节点)
// 操作按钮类型枚举 (用于审批节点) // TODO @jason建议不缩写哈
export enum OpsButtonType {
/**
*

View File

@ -28,7 +28,7 @@ import '@/plugins/animate.css'
// 路由
import router, { setupRouter } from '@/router'
// 其它指令
// 指令
import { setupAuth, setupMountedFocus } from '@/directives'
import { createApp } from 'vue'
@ -58,8 +58,8 @@ const setupAll = async () => {
setupRouter(app)
// directives 指令
setupAuth(app)
setupMountedFocus(app)
await router.isReady()

View File

@ -56,12 +56,14 @@
</el-form-item>
</el-form>
<div style="margin-bottom: 20px; margin-left: 10%; font-size: 14px">
<!-- TODO @jason建议搞个 if 来判断替代现有的 !item.buttonsSetting || item.buttonsSetting[OpsButtonType.APPROVE]?.enable -->
<el-button
type="success"
v-if="!item.buttonsSetting || item.buttonsSetting[OpsButtonType.APPROVE]?.enable"
@click="handleAudit(item, true)"
>
<Icon icon="ep:select" />
<!-- TODO @jason这个也是类似哈搞个方法来生成名字 -->
{{
item.buttonsSetting?.[OpsButtonType.APPROVE]?.displayName ||
OPERATION_BUTTON_NAME.get(OpsButtonType.APPROVE)

View File

@ -1,8 +1,8 @@
<template>
<SimpleProcessDesigner :model-id="modelId" />
</template>
<script setup lang='ts'>
import { SimpleProcessDesigner } from '@/components/SimpleProcessDesignerV2/src/';
<script setup lang="ts">
import { SimpleProcessDesigner } from '@/components/SimpleProcessDesignerV2/src/'
import { getModel } from '@/api/bpm/model'
import { getForm, FormVO } from '@/api/bpm/form'
import { handleTree } from '@/utils/tree'
@ -15,9 +15,9 @@ defineOptions({
name: 'SimpleWorkflowDesignEditor'
})
const { query } = useRoute() //
const modelId : string | undefined = query.modelId as string;
const modelId: string | undefined = query.modelId as string
const formFields = ref<string[]>([])
const formType = ref(20);
const formType = ref(20)
const roleOptions = ref<RoleApi.RoleVO[]>([]) //
const postOptions = ref<PostApi.PostVO[]>([]) //
const userOptions = ref<UserApi.UserVO[]>([]) //
@ -33,27 +33,27 @@ provide('deptList', deptOptions)
provide('userGroupList', userGroupOptions)
provide('deptTree', deptTreeOptions)
onMounted(async () => {
const bpmnModel = await getModel(modelId);
const bpmnModel = await getModel(modelId)
if (bpmnModel) {
formType.value = bpmnModel.formType
if (formType.value === 10) {
const bpmnForm = await getForm(bpmnModel.formId) as unknown as FormVO
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
formFields.value = bpmnForm?.fields
}
}
//
roleOptions.value = await RoleApi.getSimpleRoleList()
//
postOptions.value = await PostApi.getSimplePostList()
//
userOptions.value = await UserApi.getSimpleUserList()
//
deptOptions.value = await DeptApi.getSimpleDeptList()
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id');
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id')
//
userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList()
})
</script>
<style lang='scss' scoped>
</style>
<style lang="scss" scoped></style>