Skip to content

Commit 286628d

Browse files
committed
【代码优化】BPM:流程模型->基本信息->谁可以发起,支持指定多个部门
1 parent c3ad1ec commit 286628d

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

src/components/DeptSelectForm/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const props = defineProps({
5959
6060
const treeRef = ref()
6161
const deptTree = ref<Tree[]>([]) // 部门树形结构
62-
const selectedDeptIds = ref<number[]>([]) // 选中的部门ID列表
62+
const selectedDeptIds = ref<number[]>([]) // 选中的部门 ID 列表
6363
const dialogVisible = ref(false) // 弹窗的是否展示
6464
const formLoading = ref(false) // 表单的加载中
6565
@@ -78,7 +78,9 @@ const open = async (selectedList?: DeptApi.DeptVO[]) => {
7878
// 设置已选择的部门
7979
if (selectedList?.length) {
8080
await nextTick()
81-
const selectedIds = selectedList.map(dept => dept.id).filter((id): id is number => id !== undefined)
81+
const selectedIds = selectedList
82+
.map((dept) => dept.id)
83+
.filter((id): id is number => id !== undefined)
8284
selectedDeptIds.value = selectedIds
8385
treeRef.value?.setCheckedKeys(selectedIds)
8486
}
@@ -117,4 +119,4 @@ const resetForm = () => {
117119
}
118120
119121
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
120-
</script>
122+
</script>

src/components/SimpleProcessDesignerV2/src/nodes-config/StartUserNodeConfig.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@
2525
</template>
2626
<el-tabs type="border-card" v-model="activeTabName">
2727
<el-tab-pane label="权限" name="user">
28-
<el-text v-if="(!startUserIds || startUserIds.length === 0) && (!startDeptIds || startDeptIds.length === 0)"> 全部成员可以发起流程 </el-text>
28+
<el-text
29+
v-if="
30+
(!startUserIds || startUserIds.length === 0) &&
31+
(!startDeptIds || startDeptIds.length === 0)
32+
"
33+
>
34+
全部成员可以发起流程
35+
</el-text>
2936
<div v-else-if="startUserIds && startUserIds.length > 0">
3037
<el-text v-if="startUserIds.length == 1">
3138
{{ getUserNicknames(startUserIds) }} 可发起流程
@@ -37,7 +44,8 @@
3744
placement="top"
3845
:content="getUserNicknames(startUserIds)"
3946
>
40-
{{ getUserNicknames(startUserIds.slice(0,2)) }} 等 {{ startUserIds.length }} 人可发起流程
47+
{{ getUserNicknames(startUserIds.slice(0, 2)) }} 等
48+
{{ startUserIds.length }} 人可发起流程
4149
</el-tooltip>
4250
</el-text>
4351
</div>
@@ -52,11 +60,11 @@
5260
placement="top"
5361
:content="getDeptNames(startDeptIds)"
5462
>
55-
{{ getDeptNames(startDeptIds.slice(0,2)) }} 等 {{ startDeptIds.length }} 个部门的人可发起流程
63+
{{ getDeptNames(startDeptIds.slice(0, 2)) }} 等
64+
{{ startDeptIds.length }} 个部门可发起流程
5665
</el-tooltip>
5766
</el-text>
5867
</div>
59-
6068
</el-tab-pane>
6169
<el-tab-pane label="表单字段权限" name="fields" v-if="formType === 10">
6270
<div class="field-setting-pane">
@@ -170,7 +178,7 @@ const getUserNicknames = (userIds: number[]): string => {
170178
const getDeptNames = (deptIds: number[]): string => {
171179
if (!deptIds || deptIds.length === 0) {
172180
return ''
173-
}
181+
}
174182
const deptNames: string[] = []
175183
deptIds.forEach((deptId) => {
176184
const found = deptOptions?.value.find((item) => item.id === deptId)

src/views/bpm/model/form/index.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ import * as FormApi from '@/api/bpm/form'
9494
import { CategoryApi, CategoryVO } from '@/api/bpm/category'
9595
import * as UserApi from '@/api/system/user'
9696
import * as DeptApi from '@/api/system/dept'
97-
import { useUserStoreWithOut } from '@/store/modules/user'
9897
import * as DefinitionApi from '@/api/bpm/definition'
9998
import { BpmModelFormType, BpmModelType, BpmAutoApproveType } from '@/utils/constants'
10099
import BasicInfo from './BasicInfo.vue'
@@ -205,14 +204,16 @@ const initData = async () => {
205204
data.simpleModel = JSON.parse(data.simpleModel)
206205
}
207206
formData.value = data
208-
formData.value.startUserType = formData.value.startUserIds?.length > 0 ? 1 : formData.value?.startDeptIds?.length > 0 ? 2 : 0
207+
formData.value.startUserType =
208+
formData.value.startUserIds?.length > 0 ? 1 : formData.value?.startDeptIds?.length > 0 ? 2 : 0
209209
} else if (['update', 'copy'].includes(actionType)) {
210210
// 情况二:修改场景/复制场景
211211
const modelId = route.params.id as string
212212
formData.value = await ModelApi.getModel(modelId)
213-
formData.value.startUserType = formData.value.startUserIds?.length > 0 ? 1 : formData.value?.startDeptIds?.length > 0 ? 2 : 0
213+
formData.value.startUserType =
214+
formData.value.startUserIds?.length > 0 ? 1 : formData.value?.startDeptIds?.length > 0 ? 2 : 0
214215
215-
// 复制场景
216+
// 特殊:复制场景
216217
if (route.params.type === 'copy') {
217218
delete formData.value.id
218219
formData.value.name += '副本'
@@ -233,7 +234,7 @@ const initData = async () => {
233234
userList.value = await UserApi.getSimpleUserList()
234235
// 获取部门列表
235236
deptList.value = await DeptApi.getSimpleDeptList()
236-
237+
237238
// 最终,设置 currentStep 切换到第一步
238239
currentStep.value = 0
239240

0 commit comments

Comments
 (0)