diff --git a/src/api/neData/ims_sub.ts b/src/api/neData/ims_sub.ts index d4372652..8f7e3cff 100644 --- a/src/api/neData/ims_sub.ts +++ b/src/api/neData/ims_sub.ts @@ -88,10 +88,11 @@ export function batchAddIMSSub(data: Record, num: number) { * @param data 签约对象 * @returns object */ -export function delIMSSub(neId: string, imsi: string) { +export function delIMSSub(neId: string, imsi_msisdn: string, tag: string) { return request({ - url: `/ue/udm/imsuser/${neId}/${imsi}`, + url: `/ue/udm/imsuser/${neId}/${imsi_msisdn}`, method: 'delete', + params: { volte: tag }, timeout: 180_000, }); } @@ -103,10 +104,16 @@ export function delIMSSub(neId: string, imsi: string) { * @param num 数量 * @returns object */ -export function batchDelIMSSub(neId: string, imsi: string, num: number) { +export function batchDelIMSSub( + neId: string, + imsi: string, + num: number, + tag: string +) { return request({ url: `/ue/udm/imsuser/${neId}/${imsi}/${num}`, method: 'delete', + params: { volte: tag }, timeout: 180_000, }); } diff --git a/src/views/neUser/imsUDM/index.vue b/src/views/neUser/imsUDM/index.vue index d365dfec..5598c9fb 100644 --- a/src/views/neUser/imsUDM/index.vue +++ b/src/views/neUser/imsUDM/index.vue @@ -80,6 +80,7 @@ type TabeStateType = { data: object[]; /**勾选记录 */ selectedRowKeys: (string | number)[]; + selectedRowIMSIs: Record[]; }; /**表格状态 */ @@ -89,6 +90,7 @@ let tableState: TabeStateType = reactive({ seached: true, data: [], selectedRowKeys: [], + selectedRowIMSIs: [], }); /**表格字段列 */ @@ -236,8 +238,15 @@ function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) { } /**表格多选 */ -function fnTableSelectedRowKeys(keys: (string | number)[]) { +function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) { tableState.selectedRowKeys = keys; + tableState.selectedRowIMSIs = rows.map(item => { + return { + imsi: item.imsi, + msisdn: item.msisdn, + tag: item.tag, + }; + }); } /**对话框对象信息状态类型 */ @@ -269,13 +278,15 @@ let modalState: ModalStateType = reactive({ from: { imsi: '', msisdn: '', - tag: undefined, + tag: 1, vni: '', num: 1, }, BatchDelForm: { num: 1, imsi: '', + msisdn: '', + tag: 1, }, confirmLoading: false, loadDataLoading: false, @@ -318,6 +329,8 @@ const modalStateBatchDelFrom = Form.useForm( }, ], imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }], + msisdn: [{ required: true, message: 'MSISDN' + t('common.unableNull') }], + tag: [{ required: true, message: t('common.selectPlease') }], }) ); @@ -375,6 +388,10 @@ function fnModalOk() { const from = Object.assign({}, toRaw(modalState.from)); modalState.confirmLoading = true; from.neId = queryParams.neId || '-'; + // 如果是VoIP, 则MSISDN和IMSI相同 + if (from.tag === 0) { + from.imsi = from.msisdn; + } const result = from.num === 1 ? addIMSSub(from) : batchAddIMSSub(from, from.num); const hide = message.loading(t('common.loading'), 0); @@ -434,13 +451,30 @@ function fnModalOk() { * 进行表达规则校验 */ function fnBatchDelModalOk() { + const from = toRaw(modalState.BatchDelForm); + const neId = queryParams.neId || '-'; + // 校验规则 + let validateArr = ['num', 'tag']; + // 如果是VoIP, 则MSISDN和IMSI相同 + if (from.tag === 0) { + modalState.BatchDelForm.imsi = from.msisdn; + from.imsi = from.msisdn; + validateArr.push('msisdn'); + } else { + validateArr.push('imsi'); + validateArr.push('msisdn'); + } + modalStateBatchDelFrom - .validate() + .validate(validateArr) .then(e => { modalState.confirmLoading = true; - const from = toRaw(modalState.BatchDelForm); - const neId = queryParams.neId || '-'; - batchDelIMSSub(neId, from.imsi, from.num).then(res => { + batchDelIMSSub( + neId, + `${from.imsi}_${from.msisdn}`, + from.num, + from.tag + ).then(res => { if (res.code === RESULT_CODE_SUCCESS) { const timerS = Math.ceil(+from.num / 1500) + 1; notification.success({ @@ -491,39 +525,48 @@ function fnModalCancel() { * UDM鉴权用户删除 * @param imsi 编号imsi */ -function fnRecordDelete(imsi: string) { +function fnRecordDelete(id: string) { const neId = queryParams.neId; if (!neId) return; - let imsiMsg = imsi; - if (imsi === '0') { - imsiMsg = `${tableState.selectedRowKeys[0]}... ${t( - 'views.neUser.auth.numDel' - )} ${tableState.selectedRowKeys.length}`; - imsi = tableState.selectedRowKeys.join(','); + let msg = id; + if (id === '0') { + msg = `${tableState.selectedRowIMSIs[0].imsi}... ${tableState.selectedRowIMSIs.length}`; } Modal.confirm({ title: t('common.tipTitle'), - content: t('views.neUser.auth.delSure', { imsi: imsiMsg }), + content: t('views.neUser.auth.delSure', { imsi: msg }), onOk() { modalState.loadDataLoading = true; const hide = message.loading(t('common.loading'), 0); - delIMSSub(neId, imsi) - .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - const msgContent = t('common.msgSuccess', { - msg: t('common.deleteText'), - }); - message.success({ - content: `${msgContent} : ${imsiMsg}`, - duration: 3, - }); - } else { - message.error({ - content: `${res.msg}`, - duration: 3, - }); - } + let reqArr: any[] = []; + if (id === '0') { + const volteArr = tableState.selectedRowIMSIs + .filter(item => item.tag == '1') + .map(item => `${item.imsi}_${item.msisdn}`) + .join(','); + if (volteArr.length > 0) { + reqArr.push(delIMSSub(neId, volteArr, '1')); + } + const voipArr = tableState.selectedRowIMSIs + .filter(item => item.tag == '0') + .map(item => `${item.imsi}_${item.msisdn}`) + .join(','); + if (voipArr.length > 0) { + reqArr.push(delIMSSub(neId, voipArr, '0')); + } + } else { + const record: any = tableState.data.find((item: any) => item.id === id); + if (record) { + reqArr = [ + delIMSSub(neId, `${record.imsi}_${record.msisdn}`, record.tag), + ]; + } + } + Promise.all(reqArr) + .then(() => { + message.success(t('common.operateOk'), 3); + fnGetList(); }) .finally(() => { hide(); @@ -1039,7 +1082,7 @@ onMounted(() => { { + + + + + + + + + +