【代码评审】工作流:快搭部分的 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

@ -67,10 +67,10 @@ let props = defineProps({
type: Object,
default: () => ({})
},
showAddButton:{
type:Boolean,
default:true
},
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 @jason这个要不要搞成枚举NodeType 里貌似有枚举
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

@ -162,7 +162,7 @@
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="设置字段权限" v-if ="formType === 10">
<el-tab-pane label="设置字段权限" v-if="formType === 10">
<div class="field-setting-pane h-full w-full flex flex-col">
<div class="field-setting-content mr-2 overflow-auto py-4 pr-2">
<div class="field-container flex flex-col flex-items-start">
@ -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,30 +183,29 @@ 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;
if(val.value.attributes.candidateStrategy === 60) {
const candidateParamStr = val.value.attributes.candidateParam
if (val.value.attributes.candidateStrategy === 60) {
candidateConfig.value.candidateParam = [candidateParamStr]
} else {
if(candidateParamStr){
candidateConfig.value.candidateParam = candidateParamStr.split(',').map((item) => +item)
if (candidateParamStr) {
candidateConfig.value.candidateParam = candidateParamStr.split(',').map((item) => +item)
}
}
// candidateConfig.value = val.value.attributes
}
})
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,
candidateParam: candidateParamStr
}
}
rawConfig.flag = true
// TODO 进行校验
// setApproverConfig({
@ -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 {
/**
* 通过