Commit e63e5ffe4c83e2d8c7190461523a4a7424d9b0d9
1 parent
c98965cd
fix: 树形 展开 关闭 功能 bug
Showing
2 changed files
with
10 additions
and
11 deletions
yudao-ui-admin-vue3/src/views/system/dept/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <ContentWrap> |
| 3 | 3 | <!-- 列表 --> |
| 4 | - <XTable @register="registerTable" show-overflow> | |
| 4 | + <XTable ref="xGrid" @register="registerTable" show-overflow> | |
| 5 | 5 | <template #toolbar_buttons> |
| 6 | 6 | <!-- 操作:新增 --> |
| 7 | 7 | <XButton |
| ... | ... | @@ -11,8 +11,8 @@ |
| 11 | 11 | v-hasPermi="['system:dept:create']" |
| 12 | 12 | @click="handleCreate()" |
| 13 | 13 | /> |
| 14 | - <XButton title="展开所有" @click="xGrid?.setAllTreeExpand(true)" /> | |
| 15 | - <XButton title="关闭所有" @click="xGrid?.clearTreeExpand()" /> | |
| 14 | + <XButton title="展开所有" @click="xGrid?.Ref.setAllTreeExpand(true)" /> | |
| 15 | + <XButton title="关闭所有" @click="xGrid?.Ref.clearTreeExpand()" /> | |
| 16 | 16 | </template> |
| 17 | 17 | <template #leaderUserId_default="{ row }"> |
| 18 | 18 | <span>{{ userNicknameFormat(row) }}</span> |
| ... | ... | @@ -77,7 +77,6 @@ |
| 77 | 77 | <script setup lang="ts" name="Dept"> |
| 78 | 78 | import { nextTick, onMounted, ref, unref } from 'vue' |
| 79 | 79 | import { ElSelect, ElTreeSelect, ElOption } from 'element-plus' |
| 80 | -import { VxeGridInstance } from 'vxe-table' | |
| 81 | 80 | import { handleTree, defaultProps } from '@/utils/tree' |
| 82 | 81 | import { useI18n } from '@/hooks/web/useI18n' |
| 83 | 82 | import { useMessage } from '@/hooks/web/useMessage' |
| ... | ... | @@ -90,7 +89,7 @@ import { getListSimpleUsersApi, UserVO } from '@/api/system/user' |
| 90 | 89 | const { t } = useI18n() // 国际化 |
| 91 | 90 | const message = useMessage() // 消息弹窗 |
| 92 | 91 | // 列表相关的变量 |
| 93 | -const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref | |
| 92 | +const xGrid = ref<any>() // 列表 Grid Ref | |
| 94 | 93 | const treeConfig = { |
| 95 | 94 | transform: true, |
| 96 | 95 | rowField: 'id', | ... | ... |
yudao-ui-admin-vue3/src/views/system/menu/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <ContentWrap> |
| 3 | 3 | <!-- 列表 --> |
| 4 | - <XTable @register="registerTable" show-overflow> | |
| 4 | + <XTable ref="xGrid" @register="registerTable" show-overflow> | |
| 5 | 5 | <template #toolbar_buttons> |
| 6 | 6 | <!-- 操作:新增 --> |
| 7 | 7 | <XButton |
| ... | ... | @@ -11,8 +11,8 @@ |
| 11 | 11 | v-hasPermi="['system:menu:create']" |
| 12 | 12 | @click="handleCreate()" |
| 13 | 13 | /> |
| 14 | - <XButton title="展开所有" @click="xGrid?.setAllTreeExpand(true)" /> | |
| 15 | - <XButton title="关闭所有" @click="xGrid?.clearTreeExpand()" /> | |
| 14 | + <XButton title="展开所有" @click="xGrid?.Ref.setAllTreeExpand(true)" /> | |
| 15 | + <XButton title="关闭所有" @click="xGrid?.Ref.clearTreeExpand()" /> | |
| 16 | 16 | </template> |
| 17 | 17 | <template #name_default="{ row }"> |
| 18 | 18 | <Icon :icon="row.icon" /> |
| ... | ... | @@ -194,7 +194,6 @@ import { |
| 194 | 194 | } from 'element-plus' |
| 195 | 195 | import { Tooltip } from '@/components/Tooltip' |
| 196 | 196 | import { IconSelect } from '@/components/Icon' |
| 197 | -import { VxeGridInstance } from 'vxe-table' | |
| 198 | 197 | // 业务相关的 import |
| 199 | 198 | import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
| 200 | 199 | import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants' |
| ... | ... | @@ -206,9 +205,10 @@ import { useXTable } from '@/hooks/web/useXTable' |
| 206 | 205 | const { t } = useI18n() // 国际化 |
| 207 | 206 | const message = useMessage() // 消息弹窗 |
| 208 | 207 | const { wsCache } = useCache() |
| 208 | + | |
| 209 | +const xGrid = ref<any>(null) | |
| 210 | + | |
| 209 | 211 | // 列表相关的变量 |
| 210 | -// 列表相关的变量 | |
| 211 | -const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref | |
| 212 | 212 | const treeConfig = { |
| 213 | 213 | transform: true, |
| 214 | 214 | rowField: 'id', | ... | ... |