diff --git a/src/views/neUser/auth/index.vue b/src/views/neUser/auth/index.vue index 4a343c4c..09aceb4c 100644 --- a/src/views/neUser/auth/index.vue +++ b/src/views/neUser/auth/index.vue @@ -488,35 +488,27 @@ function fnRecordDelete(imsi: string) { function fnRecordExport(type: string = 'txt') { const selectLen = tableState.selectedRowKeys.length; if (selectLen <= 0) return; - const rows: Record[] = tableState.data.filter( - (row: Record) => - tableState.selectedRowKeys.indexOf(row.imsi) >= 0 - ); - - let content = ''; - if (type == 'txt') { - for (const row of rows) { - const opc = row.opc === '-' ? '' : `,${row.opc}`; - content += `${row.imsi},${row.ki},${row.algoIndex},${row.amf}${opc}\r\n`; - } - } - if (type == 'csv') { - content = `IMSI,ki,Algo Index,AMF,OPC\r\n`; - for (const row of rows) { - const opc = row.opc === '-' ? '' : `,${row.opc}`; - content += `${row.imsi},${row.ki},${row.algoIndex},${row.amf}${opc}\r\n`; - } - } - - const blob = new Blob([content], { type: 'text/plain;charset=utf-8' }); - saveAs(blob, `UDMAuth_${Date.now()}.${type}`); + const neId = queryParams.neId; + if (!neId) return; + const hide = message.loading(t('common.loading'), 0); + exportUDMAuth({ type: type, neId: neId, imsis: tableState.selectedRowKeys }) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success(t('common.msgSuccess', { msg: t('common.export') }), 3); + saveAs(res.data, `UDMAuth_select_${Date.now()}.${type}`); + } else { + message.error(`${res.msg}`, 3); + } + }) + .finally(() => { + hide(); + }); } /**列表导出全部数据 */ function fnExportList(type: string) { const neId = queryParams.neId; if (!neId) return; - const hide = message.loading(t('common.loading'), 0); exportUDMAuth(Object.assign({ type: type }, queryParams)) .then(res => { diff --git a/src/views/neUser/sub/index.vue b/src/views/neUser/sub/index.vue index d495a7c9..9a445ffc 100644 --- a/src/views/neUser/sub/index.vue +++ b/src/views/neUser/sub/index.vue @@ -835,70 +835,52 @@ function fnRecordDelete(imsi: string) { function fnRecordExport(type: string = 'txt') { const selectLen = tableState.selectedRowKeys.length; if (selectLen <= 0) return; - const rows: Record[] = tableState.data.filter( - (row: Record) => - tableState.selectedRowKeys.indexOf(row.imsi) >= 0 - ); - - let content = ''; - if (type == 'txt') { - for (const row of rows) { - const epsDat = [ - row.epsFlag, - row.epsOdb, - row.hplmnOdb, - row.ard, - row.epstpl, - row.contextId, - row.apnContext, - row.staticIp, - ].join(','); - content += `${row.imsi},${row.msisdn},${row.ambr},${row.nssai},${row.arfb},${row.sar},${row.rat},${row.cn},${row.smfSel},${row.smData},${epsDat}\r\n`; - } - } - if (type == 'csv') { - content = `imsi,msisdn,ambr,nssai,arfb,sar,rat,cn,smf_sel,sm_dat,eps_dat\r\n`; - for (const row of rows) { - const epsDat = [ - row.epsFlag, - row.epsOdb, - row.hplmnOdb, - row.ard, - row.epstpl, - row.contextId, - row.apnContext, - row.staticIp, - ].join(','); - content += `${row.imsi},${row.msisdn},${row.ambr},${row.nssai},${row.arfb},${row.sar},${row.rat},${row.cn},${row.smfSel},${row.smData},${epsDat}\r\n`; - } - } - - const blob = new Blob([content], { type: 'text/plain;charset=utf-8' }); - saveAs(blob, `UDMSub_${Date.now()}.${type}`); + const neId = queryParams.neId; + if (!neId) return; + const hide = message.loading(t('common.loading'), 0); + exportUDMSub({ type: type, neId: neId, imsis: tableState.selectedRowKeys }) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { msg: t('common.export') }), + duration: 2, + }); + saveAs(res.data, `UDMSub_select_${Date.now()}.${type}`); + } else { + message.error({ + content: `${res.msg}`, + duration: 2, + }); + } + }) + .finally(() => { + hide(); + }); } /**列表导出 */ function fnExportList(type: string) { const neId = queryParams.neId; if (!neId) return; - const key = 'exportSub'; - message.loading({ content: t('common.loading'), key }); - exportUDMSub(Object.assign({ type: type }, queryParams)).then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.msgSuccess', { msg: t('common.export') }), - key, - duration: 2, - }); - saveAs(res.data, `UDMSub_${Date.now()}.${type}`); - } else { - message.error({ - content: `${res.msg}`, - key, - duration: 2, - }); - } - }); + const hide = message.loading(t('common.loading'), 0); + exportUDMSub(Object.assign({ type: type }, queryParams)) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { msg: t('common.export') }), + duration: 2, + }); + saveAs(res.data, `UDMSub_${Date.now()}.${type}`); + } else { + message.error({ + content: `${res.msg}`, + duration: 2, + }); + } + }) + .finally(() => { + hide(); + }); } /**重新加载数据 */