Skip to content

Commit

Permalink
filter invalid group
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 committed Jan 10, 2025
1 parent faab411 commit 4b3be6b
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<template>
<plugin-setting
v-if="panel.created"
v-show="panel.show"
:title="selectedGroup.groupName"
@cancel="closeGroupPanel"
@save="addBlocks"
>
<plugin-setting v-if="panel.show" :title="validGroup.groupName" @cancel="closeGroupPanel" @save="addBlocks">
<template #content>
<div class="block-add-content">
<div class="block-add-content-title">区块列表</div>
<block-group-filters
v-if="panel.show"
:key="selectedGroupId"
:key="validGroup.groupId"
:filters="state.filters"
@search="searchBlocks"
></block-group-filters>
Expand Down Expand Up @@ -82,7 +76,15 @@ export default {
TinyIconSearch: iconSearch()
},
setup() {
const { isDefaultGroupId, isRefresh, selectedGroup, selectedBlockArray, getGroupList, cancelCheckAll } = useBlock()
const {
isAllGroupId,
isDefaultGroupId,
isRefresh,
selectedGroup,
selectedBlockArray,
getGroupList,
cancelCheckAll
} = useBlock()
const { panel, closePanel } = useGroupPanel()
const { message } = useModal()
const getAppId = () => getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id
Expand Down Expand Up @@ -115,13 +117,13 @@ export default {
filterValues: {}
})
const selectedGroupId = ref(selectedGroup.value.groupId)
const validGroup = ref({ ...selectedGroup.value })
watch(
() => selectedGroup.value.groupId,
(groupId) => {
if (groupId && !isDefaultGroupId(groupId)) {
selectedGroupId.value = groupId
if (groupId && !isAllGroupId(groupId) && !isDefaultGroupId(groupId)) {
validGroup.value = { ...selectedGroup.value }
}
}
)
Expand All @@ -132,7 +134,7 @@ export default {
}
const addBlocks = () => {
const groupId = selectedGroupId.value
const groupId = validGroup.value.groupId
fetchGroupBlocksById({ groupId })
.then((data) => {
const resData =
Expand Down Expand Up @@ -206,7 +208,7 @@ export default {
state.filterValues = filters
const params = {
groupId: selectedGroupId.value,
groupId: validGroup.value.groupId,
label_contains: state.searchValue.trim(),
tag: filters?.tag,
publicType: filters?.publicType,
Expand Down Expand Up @@ -263,7 +265,7 @@ export default {
})
}
watch([() => panel.show, selectedGroupId], ([show, groupId]) => {
watch([() => panel.show, () => validGroup.value.groupId], ([show, groupId]) => {
if (!show) {
return
}
Expand All @@ -275,8 +277,7 @@ export default {
})
return {
selectedGroup,
selectedGroupId,
validGroup,
state,
panel,
closeGroupPanel,
Expand Down

0 comments on commit 4b3be6b

Please sign in to comment.