fix: 网元更新删除,刷新缓存的网元信息

This commit is contained in:
TsMask
2023-10-19 17:38:54 +08:00
parent cdae43d46a
commit 4b1c2c4024

View File

@@ -24,6 +24,7 @@ import useI18n from '@/hooks/useI18n';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useNeInfoStore from '@/store/modules/neinfo';
const { t } = useI18n();
const route = useRoute();
@@ -336,6 +337,8 @@ function fnModalOk() {
.finally(() => {
hide();
modalState.confirmLoading = false;
// 刷新缓存的网元信息
useNeInfoStore().fnRefreshNelist();
});
})
.catch(e => {
@@ -361,15 +364,6 @@ function fnImportModalOk() {
.then(e => {
modalState.confirmLoading = true;
const hide = message.loading({ content: t('common.loading') });
// let result = importFile(from);
// if (from.importType === 'local') {
// let formData = new FormData();
// formData.append('nfType', from.neType);
// formData.append('nfId', from.neId);
// formData.append('file', from.file);
// result = importFile(formData);
// }
importFile(from)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
@@ -394,7 +388,6 @@ function fnImportModalOk() {
});
})
.catch(e => {
console.error(e)
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
});
}
@@ -438,6 +431,8 @@ function fnRecordDelete(row: Record<string, any>) {
duration: 2,
});
fnGetList();
// 刷新缓存的网元信息
useNeInfoStore().fnRefreshNelist();
} else {
message.error({
content: `${res.msg}`,
@@ -627,13 +622,6 @@ function typeChange(value: any) {
});
});
}
// else if (res.code === RESULT_CODE_SUCCESS && !res.data) {
// message.error({
// content: `当前网元没有远程服务器备份文件`,
// key: 'importServer',
// duration: 2,
// });
// }
});
}
}
@@ -641,13 +629,8 @@ function typeChange(value: any) {
/**上传前检查或转换压缩 */
function fnBeforeUploadFile(file: FileType) {
if (modalState.confirmLoading) return false;
const fileName = file.name;
const suff = fileName.substring(fileName.lastIndexOf('.'));
const isLt60M = file.size / 1024 / 1024 > 60;
if (isLt60M) {
message.error('有效软件文件大小应不小于 60MB', 3);
return false;
}
// const fileName = file.name;
// const suff = fileName.substring(fileName.lastIndexOf('.'));
return true;
}
@@ -664,6 +647,8 @@ function fnUploadFile(up: UploadRequestOption) {
onMounted(() => {
// 获取列表数据
fnGetList();
// 刷新缓存的网元信息
useNeInfoStore().fnRefreshNelist();
});
</script>