Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发起流程页面-修复右侧分类名称都为null的bug #100

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/views/bpm/processInstance/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
<el-scrollbar ref="scrollWrapper" height="700">
<div
class="mb-20px pl-10px"
v-for="(definitions, title) in processDefinitionGroup"
:key="title"
:ref="`category-${title}`"
v-for="(definitions, categoryCode) in processDefinitionGroup"
:key="categoryCode"
:ref="`category-${categoryCode}`"
>
<h3 class="text-18px font-bold mb-10px mt-5px">{{ title }}</h3>
<h3 class="text-18px font-bold mb-10px mt-5px">
{{ getCategoryName(categoryCode) }}
</h3>
<div class="grid grid-cols-3 gap3">
<el-tooltip
v-for="definition in definitions"
Expand Down Expand Up @@ -170,7 +172,7 @@ const handleQuery = () => {
// 流程定义的分组
const processDefinitionGroup: any = computed(() => {
if (!processDefinitionList.value?.length) return {}
return groupBy(filteredProcessDefinitionList.value, 'categoryName')
return groupBy(filteredProcessDefinitionList.value, 'category')
})

// ========== 表单相关 ==========
Expand All @@ -188,7 +190,7 @@ const handleSelect = async (row, formVariables?) => {
// 左侧分类切换
const handleCategoryClick = (category) => {
categoryActive.value = category
const categoryRef = proxy.$refs[`category-${category.name}`] // 获取点击分类对应的 DOM 元素
const categoryRef = proxy.$refs[`category-${category.code}`] // 获取点击分类对应的 DOM 元素
if (categoryRef?.length) {
const scrollWrapper = proxy.$refs.scrollWrapper // 获取右侧滚动容器
const categoryOffsetTop = categoryRef[0].offsetTop
Expand All @@ -198,6 +200,11 @@ const handleCategoryClick = (category) => {
}
}

// 通过分类code获取对应的名称
const getCategoryName = (categoryCode) => {
return categoryList.value?.find((ctg) => ctg.code === categoryCode)?.name
}

/** 初始化 */
onMounted(() => {
getList()
Expand Down