Skip to content

Commit fd13eb7

Browse files
committed
【代码评审】工作流:快搭部分的 code review
1 parent 5376eb4 commit fd13eb7

File tree

8 files changed

+48
-42
lines changed

8 files changed

+48
-42
lines changed

src/components/SimpleProcessDesigner/src/addNode.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ let props = defineProps({
6767
type: Object,
6868
default: () => ({})
6969
},
70-
showAddButton:{
71-
type:Boolean,
72-
default:true
73-
},
70+
showAddButton: {
71+
type: Boolean,
72+
default: true
73+
}
7474
})
7575
let emits = defineEmits(['update:childNodeP'])
7676
let visible = ref(false)
@@ -89,7 +89,7 @@ const addType = (type: number) => {
8989
approveMethod: undefined,
9090
candidateStrategy: undefined,
9191
candidateParam: undefined,
92-
fieldsPermission: defaultFieldsPermission,
92+
fieldsPermission: defaultFieldsPermission
9393
},
9494
childNode: props.childNodeP
9595
}
@@ -99,7 +99,7 @@ const addType = (type: number) => {
9999
if (type === NodeType.CC_USER_NODE) {
100100
const data = {
101101
name: '抄送人',
102-
type: 2,
102+
type: 2, // TODO @jason:这个要不要搞成枚举?NodeType 里貌似有枚举
103103
error: true,
104104
// 抄送节点配置
105105
attributes: {
@@ -161,7 +161,7 @@ const addType = (type: number) => {
161161
name: '并行分支_JOIN',
162162
type: 6,
163163
error: true,
164-
childNode: props.childNodeP,
164+
childNode: props.childNodeP
165165
}
166166
}
167167
emits('update:childNodeP', data)
@@ -190,7 +190,7 @@ const addType = (type: number) => {
190190
name: '包容分支_JOIN',
191191
type: 8,
192192
error: true,
193-
childNode: props.childNodeP,
193+
childNode: props.childNodeP
194194
}
195195
}
196196
emits('update:childNodeP', data)

src/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
</el-form>
163163
</div>
164164
</el-tab-pane>
165-
<el-tab-pane label="设置字段权限" v-if ="formType === 10">
165+
<el-tab-pane label="设置字段权限" v-if="formType === 10">
166166
<div class="field-setting-pane h-full w-full flex flex-col">
167167
<div class="field-setting-content mr-2 overflow-auto py-4 pr-2">
168168
<div class="field-container flex flex-col flex-items-start">
@@ -324,12 +324,12 @@ const changecandidateStrategy = () => {
324324
candidateConfig.value.candidateParam = []
325325
}
326326
const handleAllCheck = (event, type) => {
327-
console.log('event', event);
328-
console.log('type', type);
329-
event.target.checked = true;
327+
console.log('event', event)
328+
console.log('type', type)
329+
event.target.checked = true
330330
let permission = '1'
331331
if (type === 'edit' && editAllChecked.value) {
332-
permission = '1'
332+
permission = '1' // TODO @jaosn:这个要不要用枚举里的哈
333333
}
334334
if (type === 'read' && readAllChecked.value) {
335335
permission = '2'
@@ -344,7 +344,7 @@ const handleAllCheck = (event, type) => {
344344
onMounted(async () => {
345345
// 获得角色列表
346346
roleOptions.value = await RoleApi.getSimpleRoleList()
347-
347+
// 获得岗位列表
348348
postOptions.value = await PostApi.getSimplePostList()
349349
// 获得用户列表
350350
userOptions.value = await UserApi.getSimpleUserList()

src/components/SimpleProcessDesigner/src/drawer/copyerDrawer.vue

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
<div>
1313
<el-form label-position="top" label-width="100px">
1414
<el-form-item label="选择抄送人" prop="candidateStrategy">
15-
<el-select v-model="candidateConfig.candidateStrategy" style="width: 100%" clearable @change="changecandidateStrategy">
15+
<el-select
16+
v-model="candidateConfig.candidateStrategy"
17+
style="width: 100%"
18+
clearable
19+
@change="changecandidateStrategy"
20+
>
1621
<el-option
1722
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_TASK_CANDIDATE_STRATEGY)"
1823
:key="dict.value"
@@ -160,7 +165,7 @@ const deptTreeOptions = ref() // 部门树
160165
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) // 用户组列表
161166
const candidateConfig = ref({
162167
candidateStrategy: undefined,
163-
candidateParam: [],
168+
candidateParam: []
164169
})
165170
const store = useWorkFlowStoreWithOut()
166171
const { setCopyerDrawer, setCopyerConfig } = store
@@ -178,30 +183,29 @@ const visible = computed({
178183
})
179184
watch(copyerConfig, (val) => {
180185
if (val.value.attributes) {
181-
console.log('val.value.attributes', val.value.attributes);
186+
console.log('val.value.attributes', val.value.attributes)
182187
candidateConfig.value.candidateStrategy = val.value.attributes.candidateStrategy
183-
const candidateParamStr = val.value.attributes.candidateParam;
184-
if(val.value.attributes.candidateStrategy === 60) {
188+
const candidateParamStr = val.value.attributes.candidateParam
189+
if (val.value.attributes.candidateStrategy === 60) {
185190
candidateConfig.value.candidateParam = [candidateParamStr]
186191
} else {
187-
if(candidateParamStr){
188-
candidateConfig.value.candidateParam = candidateParamStr.split(',').map((item) => +item)
192+
if (candidateParamStr) {
193+
candidateConfig.value.candidateParam = candidateParamStr.split(',').map((item) => +item)
189194
}
190195
}
191-
196+
192197
// candidateConfig.value = val.value.attributes
193198
}
194199
})
195200
196-
197201
const saveConfig = () => {
198202
const rawConfig = toRaw(copyerConfig.value)
199-
const { candidateStrategy , candidateParam} = toRaw(candidateConfig.value);
203+
const { candidateStrategy, candidateParam } = toRaw(candidateConfig.value)
200204
const candidateParamStr = candidateParam.join(',')
201205
rawConfig.value.attributes = {
202206
candidateStrategy,
203207
candidateParam: candidateParamStr
204-
}
208+
}
205209
rawConfig.flag = true
206210
// TODO 进行校验
207211
// setApproverConfig({
@@ -213,7 +217,7 @@ const saveConfig = () => {
213217
setCopyerConfig({
214218
value: rawConfig.value,
215219
flag: true,
216-
id: copyerConfig.value.id,
220+
id: copyerConfig.value.id
217221
})
218222
console.log('after is copyerConfig', copyerConfig.value)
219223
closeDrawer()
@@ -228,7 +232,7 @@ const changecandidateStrategy = () => {
228232
onMounted(async () => {
229233
// 获得角色列表
230234
roleOptions.value = await RoleApi.getSimpleRoleList()
231-
235+
// 获得岗位列表
232236
postOptions.value = await PostApi.getSimplePostList()
233237
// 获得用户列表
234238
userOptions.value = await UserApi.getSimpleUserList()

src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ onMounted(async () => {
146146
processNodeTree.value = {
147147
name: '开始',
148148
type: NodeType.START_EVENT_NODE,
149-
id: 'StartEvent_1',
149+
id: 'StartEvent_1', // TODO @jason:这个我们要不要 StartEvent 哈?
150150
childNode: {
151151
id: 'EndEvent_1',
152152
name: '结束',

src/components/SimpleProcessDesignerV2/src/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export type ButtonSetting = {
213213
enable: boolean
214214
}
215215

216-
// 操作按钮类型枚举 (用于审批节点)
216+
// 操作按钮类型枚举 (用于审批节点) // TODO @jason:建议不缩写哈
217217
export enum OpsButtonType {
218218
/**
219219
* 通过

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import '@/plugins/animate.css'
2828
// 路由
2929
import router, { setupRouter } from '@/router'
3030

31-
// 其它指令
31+
// 指令
3232
import { setupAuth, setupMountedFocus } from '@/directives'
3333

3434
import { createApp } from 'vue'
@@ -58,8 +58,8 @@ const setupAll = async () => {
5858

5959
setupRouter(app)
6060

61+
// directives 指令
6162
setupAuth(app)
62-
6363
setupMountedFocus(app)
6464

6565
await router.isReady()

src/views/bpm/processInstance/detail/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@
5656
</el-form-item>
5757
</el-form>
5858
<div style="margin-bottom: 20px; margin-left: 10%; font-size: 14px">
59+
<!-- TODO @jason:建议搞个 if 来判断,替代现有的 !item.buttonsSetting || item.buttonsSetting[OpsButtonType.APPROVE]?.enable -->
5960
<el-button
6061
type="success"
6162
v-if="!item.buttonsSetting || item.buttonsSetting[OpsButtonType.APPROVE]?.enable"
6263
@click="handleAudit(item, true)"
6364
>
6465
<Icon icon="ep:select" />
66+
<!-- TODO @jason:这个也是类似哈,搞个方法来生成名字 -->
6567
{{
6668
item.buttonsSetting?.[OpsButtonType.APPROVE]?.displayName ||
6769
OPERATION_BUTTON_NAME.get(OpsButtonType.APPROVE)

src/views/bpm/simpleWorkflow/index.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
2-
<SimpleProcessDesigner :model-id="modelId"/>
2+
<SimpleProcessDesigner :model-id="modelId" />
33
</template>
4-
<script setup lang='ts'>
5-
import { SimpleProcessDesigner } from '@/components/SimpleProcessDesignerV2/src/';
4+
<script setup lang="ts">
5+
import { SimpleProcessDesigner } from '@/components/SimpleProcessDesignerV2/src/'
66
import { getModel } from '@/api/bpm/model'
77
import { getForm, FormVO } from '@/api/bpm/form'
88
import { handleTree } from '@/utils/tree'
@@ -15,9 +15,9 @@ defineOptions({
1515
name: 'SimpleWorkflowDesignEditor'
1616
})
1717
const { query } = useRoute() // 路由的查询
18-
const modelId : string | undefined = query.modelId as string;
18+
const modelId: string | undefined = query.modelId as string
1919
const formFields = ref<string[]>([])
20-
const formType = ref(20);
20+
const formType = ref(20)
2121
const roleOptions = ref<RoleApi.RoleVO[]>([]) // 角色列表
2222
const postOptions = ref<PostApi.PostVO[]>([]) // 岗位列表
2323
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
@@ -32,28 +32,28 @@ provide('userList', userOptions)
3232
provide('deptList', deptOptions)
3333
provide('userGroupList', userGroupOptions)
3434
provide('deptTree', deptTreeOptions)
35-
onMounted( async () => {
36-
const bpmnModel = await getModel(modelId);
35+
onMounted(async () => {
36+
const bpmnModel = await getModel(modelId)
3737
if (bpmnModel) {
3838
formType.value = bpmnModel.formType
3939
if (formType.value === 10) {
40-
const bpmnForm = await getForm(bpmnModel.formId) as unknown as FormVO
40+
const bpmnForm = (await getForm(bpmnModel.formId)) as unknown as FormVO
4141
formFields.value = bpmnForm?.fields
4242
}
4343
}
4444
// 获得角色列表
4545
roleOptions.value = await RoleApi.getSimpleRoleList()
46+
// 获得岗位列表
4647
postOptions.value = await PostApi.getSimplePostList()
4748
// 获得用户列表
4849
userOptions.value = await UserApi.getSimpleUserList()
4950
// 获得部门列表
5051
deptOptions.value = await DeptApi.getSimpleDeptList()
5152
52-
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id');
53+
deptTreeOptions.value = handleTree(deptOptions.value as DeptApi.DeptVO[], 'id')
5354
5455
// 用户组列表
5556
userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList()
5657
})
5758
</script>
58-
<style lang='scss' scoped>
59-
</style>
59+
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)