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