diff --git a/src/views/neData/udm-voip/index.vue b/src/views/neData/udm-voip/index.vue index c7778986..98ddb348 100644 --- a/src/views/neData/udm-voip/index.vue +++ b/src/views/neData/udm-voip/index.vue @@ -26,7 +26,8 @@ import useNeListStore from '@/store/modules/ne_list'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { saveAs } from 'file-saver'; -import { uploadFileToNE } from '@/api/tool/file'; +import { uploadFile } from '@/api/tool/file'; +import { getNeViewFile } from '@/api/tool/neFile'; const { t } = useI18n(); const neListStore = useNeListStore(); /**网元参数 */ @@ -489,15 +490,27 @@ function fnModalUploadImportUpload(file: File) { } const hide = message.loading(t('common.loading'), 0); uploadImportState.loading = true; - uploadFileToNE('UDM', neID, file, 5) + // 上传文件 + let formData = new FormData(); + formData.append('file', file); + formData.append('subPath', 'import'); + uploadFile(formData) .then(res => { if (res.code === RESULT_CODE_SUCCESS) { - return importUDMVOIP({ - neId: neID, - uploadPath: res.data, - }); + return res.data.filePath; + } else { + uploadImportState.msg = res.msg; + uploadImportState.loading = false; + return ''; } - return res; + }) + .then((filePath: string) => { + if (!filePath) return; + // 文件导入 + return importUDMVOIP({ + neId: neID, + uploadPath: filePath, + }); }) .then(res => { if (!res) return; @@ -517,6 +530,33 @@ function fnModalUploadImportUpload(file: File) { }); } +/**对话框表格信息导入失败原因 */ +function fnModalUploadImportFailReason() { + const neId = queryParams.neId; + if (!neId) return; + const hide = message.loading(t('common.loading'), 0); + getNeViewFile({ + neType: 'UDM', + neId: neId, + path: '/tmp', + fileName: 'import_imsuser_err_records.txt', + }) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success(t('common.operateOk'), 3); + const blob = new Blob([res.data], { + type: 'text/plain', + }); + saveAs(blob, `import_udmvoip_err_records_${Date.now()}.txt`); + } else { + message.error(`${res.msg}`, 3); + } + }) + .finally(() => { + hide(); + }); +} + /**对话框表格信息导入模板 */ function fnModalDownloadImportTemplate() { const hide = message.loading(t('common.loading'), 0); @@ -554,7 +594,7 @@ onMounted(() => { if (neOtions.value.length > 0) { queryParams.neId = neOtions.value[0].value; } - + // 获取列表数据 fnGetList(); }); @@ -868,14 +908,13 @@ onMounted(() => { name="username" v-bind="modalStateFrom.validateInfos.username" > - - + { - + + + diff --git a/src/views/neData/udm-volte/index.vue b/src/views/neData/udm-volte/index.vue index 296591d2..fd75450e 100644 --- a/src/views/neData/udm-volte/index.vue +++ b/src/views/neData/udm-volte/index.vue @@ -16,7 +16,8 @@ import useNeListStore from '@/store/modules/ne_list'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { saveAs } from 'file-saver'; -import { uploadFileToNE } from '@/api/tool/file'; +import { uploadFile } from '@/api/tool/file'; +import { getNeViewFile } from '@/api/tool/neFile'; import { addUDMVolteIMS, batchAddUDMVolteIMS, @@ -541,15 +542,27 @@ function fnModalUploadImportUpload(file: File) { } const hide = message.loading(t('common.loading'), 0); uploadImportState.loading = true; - uploadFileToNE('UDM', neID, file, 5) + // 上传文件 + let formData = new FormData(); + formData.append('file', file); + formData.append('subPath', 'import'); + uploadFile(formData) .then(res => { if (res.code === RESULT_CODE_SUCCESS) { - return importUDMVolteIMS({ - neId: neID, - uploadPath: res.data, - }); + return res.data.filePath; + } else { + uploadImportState.msg = res.msg; + uploadImportState.loading = false; + return ''; } - return res; + }) + .then((filePath: string) => { + if (!filePath) return; + // 文件导入 + return importUDMVolteIMS({ + neId: neID, + uploadPath: filePath, + }); }) .then(res => { if (!res) return; @@ -569,6 +582,33 @@ function fnModalUploadImportUpload(file: File) { }); } +/**对话框表格信息导入失败原因 */ +function fnModalUploadImportFailReason() { + const neId = queryParams.neId; + if (!neId) return; + const hide = message.loading(t('common.loading'), 0); + getNeViewFile({ + neType: 'UDM', + neId: neId, + path: '/tmp', + fileName: 'import_imsuser_err_records.txt', + }) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success(t('common.operateOk'), 3); + const blob = new Blob([res.data], { + type: 'text/plain', + }); + saveAs(blob, `import_udmvolte_err_records_${Date.now()}.txt`); + } else { + message.error(`${res.msg}`, 3); + } + }) + .finally(() => { + hide(); + }); +} + /**对话框表格信息导入模板 */ function fnModalDownloadImportTemplate() { const hide = message.loading(t('common.loading'), 0); @@ -1089,13 +1129,23 @@ onMounted(() => { - + + +