fix: 限制用户与字典在数据未请求完成前无法点击

This commit is contained in:
xlsea 2025-05-13 22:35:44 +08:00
parent ffe674a88f
commit 6c3c22a2b3
2 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script setup lang="tsx">
import { ref } from 'vue';
import { computed, ref } from 'vue';
import type { TreeOption } from 'naive-ui';
import { NDivider, NTooltip } from 'naive-ui';
import { useBoolean, useLoading } from '@sa/hooks';
@ -301,6 +301,10 @@ async function handleDeleteType(dictType: Api.System.DictType) {
async function handleExportType() {
download('/system/dict/type/export', searchParams, `字典类型_${new Date().getTime()}.xlsx`);
}
const selectable = computed(() => {
return !loading.value;
});
</script>
<template>
@ -337,7 +341,6 @@ async function handleExportType() {
block-node
show-line
:data="dictData as []"
:default-expanded-keys="dictData?.length ? [dictData[0].dictType!] : []"
:show-irrelevant-nodes="false"
:pattern="dictPattern"
:filter="dictFilter"
@ -345,6 +348,7 @@ async function handleExportType() {
key-field="dictType"
label-field="dictName"
virtual-scroll
:selectable="selectable"
:render-label="renderLabel"
:render-suffix="renderSuffix"
@update:selected-keys="handleClickTree"

View File

@ -1,5 +1,5 @@
<script setup lang="tsx">
import { ref } from 'vue';
import { computed, ref } from 'vue';
import { NButton, NDivider } from 'naive-ui';
import { useBoolean, useLoading } from '@sa/hooks';
import { fetchBatchDeleteUser, fetchGetDeptTree, fetchGetUserList, fetchUpdateUserStatus } from '@/service/api/system';
@ -243,6 +243,12 @@ async function handleStatusChange(
function handleExport() {
download('/system/user/export', searchParams, `${$t('page.system.user.title')}_${new Date().getTime()}.xlsx`);
}
const expandedKeys = ref<CommonType.IdType[]>([100]);
const selectable = computed(() => {
return !loading.value;
});
</script>
<template>
@ -258,16 +264,17 @@ function handleExport() {
<NInput v-model:value="deptPattern" clearable :placeholder="$t('common.keywordSearch')" />
<NSpin class="dept-tree" :show="treeLoading">
<NTree
v-model:expanded-keys="expandedKeys"
block-node
show-line
:data="deptData as []"
:default-expanded-keys="deptData?.length ? [deptData[0].id!] : []"
:show-irrelevant-nodes="false"
:pattern="deptPattern"
class="infinite-scroll h-full min-h-200px py-3"
key-field="id"
label-field="label"
virtual-scroll
:selectable="selectable"
@update:selected-keys="handleClickTree"
>
<template #empty>