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,
}); });
fnQueryReset(); // 延迟3s后关闭loading刷新列表
setTimeout(() => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
fnQueryReset();
}, 3000);
} else { } else {
message.error({ message.error({
content: `获取数据失败`, content: `获取数据失败`,

View File

@@ -253,9 +253,9 @@ let modalState: ModalStateType = reactive({
apnContext: '', apnContext: '',
staticIp: '', staticIp: '',
}, },
BatchDelForm:{ BatchDelForm: {
num:'', num: '',
imsi:'', imsi: '',
}, },
confirmLoading: false, confirmLoading: false,
loadDataLoading: false, loadDataLoading: false,
@@ -549,7 +549,7 @@ function fnBatchModalOk() {
* 对话框弹出 批量删除确认执行函数 * 对话框弹出 批量删除确认执行函数
* 进行表达规则校验 * 进行表达规则校验
*/ */
function fnBatchDelModalOk() { function fnBatchDelModalOk() {
modalStateBatchDelFrom modalStateBatchDelFrom
.validate() .validate()
.then(e => { .then(e => {
@@ -612,7 +612,7 @@ function fnBatchModalCancel() {
* 批量删除对话框弹出关闭执行函数 * 批量删除对话框弹出关闭执行函数
* 进行表达规则校验 * 进行表达规则校验
*/ */
function fnBatchDelModalCancel() { function fnBatchDelModalCancel() {
modalState.visibleByBatchDel = false; modalState.visibleByBatchDel = false;
modalState.visibleByView = false; modalState.visibleByView = false;
modalStateBatchDelFrom.resetFields(); modalStateBatchDelFrom.resetFields();
@@ -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,
}); });
fnQueryReset(); // 延迟3s后关闭loading刷新列表
setTimeout(() => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
fnQueryReset();
}, 3000);
} else { } else {
message.error({ message.error({
content: `获取数据失败`, content: `获取数据失败`,
@@ -1695,8 +1700,8 @@ onMounted(() => {
</a-form> </a-form>
</a-modal> </a-modal>
<!-- 批量删除框 --> <!-- 批量删除框 -->
<a-modal <a-modal
width="1000px" width="1000px"
:keyboard="false" :keyboard="false"
:mask-closable="false" :mask-closable="false"
@@ -1751,8 +1756,7 @@ onMounted(() => {
</a-input> </a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</a-modal> </a-modal>