【代码优化】BPM:流程模型->基本信息->谁可以发起,支持指定多个部门

This commit is contained in:
YunaiV
2025-03-23 17:27:50 +08:00
parent c3ad1ec30a
commit 286628d101
3 changed files with 24 additions and 13 deletions

View File

@@ -59,7 +59,7 @@ const props = defineProps({
const treeRef = ref()
const deptTree = ref<Tree[]>([]) // 部门树形结构
const selectedDeptIds = ref<number[]>([]) // 选中的部门ID列表
const selectedDeptIds = ref<number[]>([]) // 选中的部门 ID 列表
const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // 表单的加载中
@@ -78,7 +78,9 @@ const open = async (selectedList?: DeptApi.DeptVO[]) => {
// 设置已选择的部门
if (selectedList?.length) {
await nextTick()
const selectedIds = selectedList.map(dept => dept.id).filter((id): id is number => id !== undefined)
const selectedIds = selectedList
.map((dept) => dept.id)
.filter((id): id is number => id !== undefined)
selectedDeptIds.value = selectedIds
treeRef.value?.setCheckedKeys(selectedIds)
}
@@ -117,4 +119,4 @@ const resetForm = () => {
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
</script>
</script>

View File

@@ -25,7 +25,14 @@
</template>
<el-tabs type="border-card" v-model="activeTabName">
<el-tab-pane label="权限" name="user">
<el-text v-if="(!startUserIds || startUserIds.length === 0) && (!startDeptIds || startDeptIds.length === 0)"> 全部成员可以发起流程 </el-text>
<el-text
v-if="
(!startUserIds || startUserIds.length === 0) &&
(!startDeptIds || startDeptIds.length === 0)
"
>
全部成员可以发起流程
</el-text>
<div v-else-if="startUserIds && startUserIds.length > 0">
<el-text v-if="startUserIds.length == 1">
{{ getUserNicknames(startUserIds) }} 可发起流程
@@ -37,7 +44,8 @@
placement="top"
:content="getUserNicknames(startUserIds)"
>
{{ getUserNicknames(startUserIds.slice(0,2)) }} {{ startUserIds.length }} 人可发起流程
{{ getUserNicknames(startUserIds.slice(0, 2)) }} 等
{{ startUserIds.length }} 人可发起流程
</el-tooltip>
</el-text>
</div>
@@ -52,11 +60,11 @@
placement="top"
:content="getDeptNames(startDeptIds)"
>
{{ getDeptNames(startDeptIds.slice(0,2)) }} {{ startDeptIds.length }} 个部门的人可发起流程
{{ getDeptNames(startDeptIds.slice(0, 2)) }} 等
{{ startDeptIds.length }} 个部门可发起流程
</el-tooltip>
</el-text>
</div>
</el-tab-pane>
<el-tab-pane label="表单字段权限" name="fields" v-if="formType === 10">
<div class="field-setting-pane">
@@ -170,7 +178,7 @@ const getUserNicknames = (userIds: number[]): string => {
const getDeptNames = (deptIds: number[]): string => {
if (!deptIds || deptIds.length === 0) {
return ''
}
}
const deptNames: string[] = []
deptIds.forEach((deptId) => {
const found = deptOptions?.value.find((item) => item.id === deptId)