From fd82d710b6a34d03cf9e1437bf4dac736420b459 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 7 Feb 2025 16:00:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20UDM=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=BE=93=E5=87=BA=E5=A4=B1=E8=B4=A5=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=EF=BC=8CUDM2.2502.58?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/en-US.ts | 2 + src/i18n/locales/zh-CN.ts | 2 + src/views/neUser/auth/index.vue | 78 ++-- src/views/neUser/sub/index.vue | 643 +++++++++++++++++++++++++------- 4 files changed, 579 insertions(+), 146 deletions(-) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 98eda231..3a43b73e 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -737,6 +737,7 @@ export default { checkExport : 'Check Export', checkExportConfirm: 'Confirm exporting the checked authenticated user data?', import: 'Import', + importFail: 'Failure Record', loadDataConfirm: 'Are you sure you want to reload the data?', loadData: 'Load Data', loadDataTip: 'Successfully fetched loaded data: {num} items, the system is internally updating the data, it will take about {timer} seconds, please wait!!!!!.', @@ -765,6 +766,7 @@ export default { checkExport : 'Check Export', checkExportConfirm: 'Are you sure to export the data of the checked subscribers?', import: 'Import', + importFail: 'Failure Record', loadDataConfirm: 'Are you sure you want to reload the data?', loadData: 'Load Data', loadDataTip: 'Successfully fetched loaded data: {num} items, the system is internally updating the data, it will take about {timer} seconds, please wait!!!!!.', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 586b3b99..0611fd9c 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -737,6 +737,7 @@ export default { checkExport : '勾选导出', checkExportConfirm: '确认导出已勾选的鉴权用户数据吗?', import: '导入', + importFail: '失败记录', loadDataConfirm: '确认要重新加载数据吗?', loadData: '加载数据', loadDataTip: '成功获取加载数据:{num}条,系统内部正在进行数据更新,大约需要{timer}秒,请稍候!!!', @@ -765,6 +766,7 @@ export default { checkExport : '勾选导出', checkExportConfirm: '确认导出已勾选的签约用户数据吗?', import: '导入', + importFail: '失败记录', loadDataConfirm: '确认要重新加载数据吗?', loadData: '加载数据', loadDataTip: '成功获取加载数据:{num}条,系统内部正在进行数据更新,大约需要{timer}秒,请稍候!!!', diff --git a/src/views/neUser/auth/index.vue b/src/views/neUser/auth/index.vue index 293dce91..fdaaf641 100644 --- a/src/views/neUser/auth/index.vue +++ b/src/views/neUser/auth/index.vue @@ -25,6 +25,7 @@ import { listUDMAuth, } from '@/api/neData/udm_auth'; import { uploadFile } from '@/api/tool/file'; +import { getNeViewFile } from '@/api/tool/neFile'; const { t } = useI18n(); /**网元参数 */ @@ -98,12 +99,6 @@ let tableColumns = ref([ align: 'center', width: 80, }, - { - title: 'Status', - dataIndex: 'status', - align: 'center', - width: 80, - }, // { // title: 'KI', // dataIndex: 'ki', @@ -598,6 +593,8 @@ type ModalUploadImportStateType = { loading: boolean; /**上传结果信息 */ msg: string; + /**含失败信息 */ + hasFail: boolean; /**导入类型 */ typeOptions: { label: string; value: string }[]; /**表单 */ @@ -610,6 +607,7 @@ let uploadImportState: ModalUploadImportStateType = reactive({ title: t('components.UploadModal.uploadTitle'), loading: false, msg: '', + hasFail: false, typeOptions: [ { label: 'Default', value: 'default' }, { label: 'K4', value: 'k4' }, @@ -626,9 +624,37 @@ function fnModalUploadImportTypeChange() { uploadImportState.msg = ''; } +/**对话框表格信息导入失败原因 */ +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_authdata_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_authdata_err_records_${Date.now()}.txt`); + } else { + message.error(`${res.msg}`, 3); + } + }) + .finally(() => { + hide(); + }); +} + /**对话框表格信息导入弹出窗口 */ function fnModalUploadImportOpen() { uploadImportState.msg = ''; + uploadImportState.hasFail = false; uploadImportState.from.typeVal = 'default'; uploadImportState.from.typeData = undefined; uploadImportState.loading = false; @@ -675,6 +701,14 @@ function fnModalUploadImportUpload(file: File) { .then(res => { if (!res) return; uploadImportState.msg = res.msg; + const regex = /fail num: (\d+)/; + const match = res.msg.match(regex); + if (match) { + const failNum = Number(match[1]); + uploadImportState.hasFail = failNum > 0; + } else { + uploadImportState.hasFail = false; + } }) .finally(() => { hide(); @@ -1018,14 +1052,6 @@ onMounted(() => { - - - - Active - Inactive - - - @@ -1210,13 +1236,23 @@ onMounted(() => { v-model:value="uploadImportState.from.typeData" :placeholder="t('common.inputPlease')" /> - + + + diff --git a/src/views/neUser/sub/index.vue b/src/views/neUser/sub/index.vue index 3611fbfe..4473c87e 100644 --- a/src/views/neUser/sub/index.vue +++ b/src/views/neUser/sub/index.vue @@ -25,6 +25,7 @@ import { updateUDMSub, } from '@/api/neData/udm_sub'; import { uploadFile } from '@/api/tool/file'; +import { getNeViewFile } from '@/api/tool/neFile'; const { t } = useI18n(); /**网元参数 */ @@ -556,7 +557,8 @@ function transformFormData(data: any) { if (isValid) { smStaticIpArr.push(dnnParts); } - } else {//无/ 无:也有可能为dnn的字符串 + } else { + //无/ 无:也有可能为dnn的字符串 smallRowJson.dnn += '-' + dnnParts; } } @@ -647,8 +649,8 @@ function fnModalOk() { const result = from.id ? updateUDMSub(from) : from.num === 1 - ? addUDMSub(from) - : batchAddUDMSub(from, from.num); + ? addUDMSub(from) + : batchAddUDMSub(from, from.num); const hide = message.loading(t('common.loading'), 0); result .then(res => { @@ -950,7 +952,7 @@ function fnGetList(pageNum?: number) { tableState.data = res.rows; if ( tablePagination.total <= - (queryParams.pageNum - 1) * tablePagination.pageSize && + (queryParams.pageNum - 1) * tablePagination.pageSize && queryParams.pageNum !== 1 ) { tableState.loading = false; @@ -971,6 +973,8 @@ type ModalUploadImportStateType = { loading: boolean; /**上传结果信息 */ msg: string; + /**含失败信息 */ + hasFail: boolean; }; /**对话框表格信息导入对象信息状态 */ @@ -979,11 +983,40 @@ let uploadImportState: ModalUploadImportStateType = reactive({ title: t('components.UploadModal.uploadTitle'), loading: false, msg: '', + hasFail: false, }); +/**对话框表格信息导入失败原因 */ +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_udmuser_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_udmuser_err_records_${Date.now()}.txt`); + } else { + message.error(`${res.msg}`, 3); + } + }) + .finally(() => { + hide(); + }); +} + /**对话框表格信息导入弹出窗口 */ function fnModalUploadImportOpen() { uploadImportState.msg = ''; + uploadImportState.hasFail = false; uploadImportState.loading = false; uploadImportState.open = true; } @@ -1027,6 +1060,14 @@ function fnModalUploadImportUpload(file: File) { .then(res => { if (!res) return; uploadImportState.msg = res.msg; + const regex = /fail num: (\d+)/; + const match = res.msg.match(regex); + if (match) { + const failNum = Number(match[1]); + uploadImportState.hasFail = failNum > 0; + } else { + uploadImportState.hasFail = false; + } }) .finally(() => { hide(); @@ -1103,26 +1144,42 @@ onMounted(() => { - + }" + >