fix: 延迟刷新获取更新的数据

This commit is contained in:
TsMask
2023-10-12 16:55:39 +08:00
parent 168d2cd590
commit 771320a839
2 changed files with 25 additions and 16 deletions

View File

@@ -514,17 +514,22 @@ function fnLoadData() {
const neID = queryParams.neId; const neID = queryParams.neId;
if (tableState.loading || !neID) return; if (tableState.loading || !neID) return;
modalState.loadDataLoading = true; modalState.loadDataLoading = true;
tablePagination.total = 0;
tableState.data = [];
tableState.loading = true; // 表格loading tableState.loading = true; // 表格loading
loadAuth(neID).then(res => { loadAuth(neID).then(res => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
notification.success({ notification.success({
message: t('views.neUser.auth.loadData'), message: t('views.neUser.auth.loadData'),
description: t('views.neUser.auth.loadDataTip', { num: res.data }), description: t('views.neUser.auth.loadDataTip', { num: res.data }),
duration: 10, duration: 10,
}); });
// 延迟3s后关闭loading刷新列表
setTimeout(() => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
fnQueryReset(); fnQueryReset();
}, 3000);
} else { } else {
message.error({ message.error({
content: `获取数据失败`, content: `获取数据失败`,

View File

@@ -683,17 +683,22 @@ function fnLoadData() {
const neID = queryParams.neId; const neID = queryParams.neId;
if (tableState.loading || !neID) return; if (tableState.loading || !neID) return;
modalState.loadDataLoading = true; modalState.loadDataLoading = true;
tablePagination.total = 0;
tableState.data = [];
tableState.loading = true; // 表格loading tableState.loading = true; // 表格loading
loadSub(neID).then(res => { loadSub(neID).then(res => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
notification.success({ notification.success({
message: t('views.neUser.sub.loadData'), message: t('views.neUser.sub.loadData'),
description: t('views.neUser.sub.loadDataTip', { num: res.data }), description: t('views.neUser.sub.loadDataTip', { num: res.data }),
duration: 10, duration: 10,
}); });
// 延迟3s后关闭loading刷新列表
setTimeout(() => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
fnQueryReset(); fnQueryReset();
}, 3000);
} else { } else {
message.error({ message.error({
content: `获取数据失败`, content: `获取数据失败`,
@@ -1752,7 +1757,6 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</a-modal> </a-modal>