fix: 修复oss设为默认功能bug,修复重置时没有对部门树选中状态重置问题

This commit is contained in:
AN 2025-05-16 11:11:01 +08:00
parent c125bd8c79
commit 3b709f1e0a
3 changed files with 28 additions and 8 deletions

View File

@ -204,6 +204,7 @@ async function handleStatusChange(
callback: (flag: boolean) => void
) {
const { error } = await fetchUpdateOssConfigStatus({
configKey: row.configKey,
ossConfigId: row.ossConfigId,
status: value
});

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 { useLoading } from '@sa/hooks';
import { fetchBatchDeletePost, fetchGetPostList } from '@/service/api/system/post';
@ -43,7 +43,8 @@ const {
// the value can not be undefined, otherwise the property in Form will not be reactive
postCode: null,
postName: null,
status: null
status: null,
belongDeptId: null
},
columns: () => [
{
@ -180,10 +181,16 @@ async function handleExport() {
download('/system/post/export', searchParams, `岗位信息_${new Date().getTime()}.xlsx`);
}
const expandedKeys = ref<CommonType.IdType[]>([100]);
const selectable = computed(() => {
return !loading.value;
});
const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTreeLoading } = useLoading();
const deptPattern = ref<string>();
const deptData = ref<Api.Common.CommonTreeRecord>([]);
const selectedKeys = ref<string[]>([]);
async function getTreeData() {
startTreeLoading();
const { data: tree, error } = await fetchGetDeptTree();
@ -203,9 +210,12 @@ function handleClickTree(keys: string[]) {
function handleResetTreeData() {
deptPattern.value = undefined;
searchParams.belongDeptId = null;
getTreeData();
getDataByPage();
}
function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
</script>
@ -222,10 +232,11 @@ function handleResetTreeData() {
<NInput v-model:value="deptPattern" clearable :placeholder="$t('common.keywordSearch')" />
<NSpin class="dept-tree" :show="treeLoading">
<NTree
v-model:expanded-keys="expandedKeys"
v-model:selected-keys="selectedKeys"
block-node
show-line
:data="deptData as []"
:default-expanded-keys="deptData?.length ? [deptData[0].id!] : []"
:show-irrelevant-nodes="false"
:pattern="deptPattern"
block-line
@ -233,6 +244,7 @@ function handleResetTreeData() {
key-field="id"
label-field="label"
virtual-scroll
:selectable="selectable"
@update:selected-keys="handleClickTree"
>
<template #empty>
@ -242,7 +254,7 @@ function handleResetTreeData() {
</NSpin>
</template>
<div class="h-full flex-col-stretch gap-12px overflow-hidden lt-sm:overflow-auto">
<PostSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
<PostSearch v-model:model="searchParams" @reset="handleResetSearch" @search="getDataByPage" />
<NCard title="岗位信息列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>
<TableHeaderOperation

View File

@ -212,6 +212,7 @@ async function handleResetPwd(userId: CommonType.IdType) {
const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTreeLoading } = useLoading();
const deptPattern = ref<string>();
const deptData = ref<Api.Common.CommonTreeRecord>([]);
const selectedKeys = ref<string[]>([]);
async function getTreeData() {
startTreeLoading();
@ -267,6 +268,11 @@ const expandedKeys = ref<CommonType.IdType[]>([100]);
const selectable = computed(() => {
return !loading.value;
});
function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
</script>
<template>
@ -283,6 +289,7 @@ const selectable = computed(() => {
<NSpin class="dept-tree" :show="treeLoading">
<NTree
v-model:expanded-keys="expandedKeys"
v-model:selected-keys="selectedKeys"
block-node
show-line
:data="deptData as []"
@ -302,7 +309,7 @@ const selectable = computed(() => {
</NSpin>
</template>
<div class="h-full flex-col-stretch gap-12px overflow-hidden lt-sm:overflow-auto">
<UserSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
<UserSearch v-model:model="searchParams" @reset="handleResetSearch" @search="getDataByPage" />
<TableRowCheckAlert v-model:checked-row-keys="checkedRowKeys" />
<NCard :title="$t('page.system.user.title')" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
<template #header-extra>