diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 5024ad86..fc96d0b2 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -603,7 +603,8 @@ export default { epsOdbTip: 'ODB (Operator-Determined Barring) Operator-determined blocking, i.e. the ability of a subscriber to access the EPS network is determined by the operator.', hplmnOdbTip: 'HPLMN-ODB homing operator-determined blocking, i.e., the ability of a subscriber to access services in the EPS network is determined by the subscriber is homing operator', ardTip:'Access-Restriction-Data (Access-Restriction-Data), can be used to distinguish between 2G/3G/LTE users, to facilitate the coexistence of 2G/3G/LTE network for different types of users to distinguish between the service', - smDataTip:'The IP in sm_data=1-000001&internet-1.2.3.4&ims-1.2.3.5: 1.2.3.4 is the static IP assigned to the APN of 5G user internet, and 1.2.3.5 is the static IP assigned to the APN of 5G user ims. If it is dynamic allocation, just remove the IP and the previous connector. Need to support multiple dnn uses & connections' + smDataTip:'The IP in sm_data=1-000001&internet-1.2.3.4&ims-1.2.3.5: 1.2.3.4 is the static IP assigned to the APN of 5G user internet, and 1.2.3.5 is the static IP assigned to the APN of 5G user ims. If it is dynamic allocation, just remove the IP and the previous connector. Need to support multiple dnn uses & connections', + smDataArrTip:'SST-SD,DNN/APN is required', }, pcf: { neType: 'PCF Object', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 34df1276..2abda499 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -603,7 +603,8 @@ export default { epsOdbTip: 'ODB(Operator-Determined Barring)运营商决定的闭锁,即用户接入EPS网络的业务能力由运营商决定.选中 ---对应服务被允许 未选 --- 对应服务被禁止', hplmnOdbTip: 'HPLMN-ODB归属运营商决定的闭锁,即用户接入EPS网络的业务能力由用户归宿运营商决定.选中 --- 对应服务被允许 未选 -- 对应服务被禁止', ardTip:'接入控制标志(Access-Restriction-Data),可用于区分2G/3G/LTE用户,便于为2G/3G/LTE网络共存时,对不同类型用户进行区分服务', - smDataTip:'sm_data=1-000001&internet-1.2.3.4&ims-1.2.3.5中的IP:1.2.3.4为5G用户internet这个APN分配的静态IP,1.2.3.5为5G用户ims这个APN分配的静态IP。如果是动态分配,把IP以及前面一个连接符去掉即可。需支持多个dnn用&连接' + smDataTip:'sm_data=1-000001&internet-1.2.3.4&ims-1.2.3.5中的IP:1.2.3.4为5G用户internet这个APN分配的静态IP,1.2.3.5为5G用户ims这个APN分配的静态IP。如果是动态分配,把IP以及前面一个连接符去掉即可。需支持多个dnn用&连接', + smDataArrTip:'SST-SD,DNN/APN为必填项', }, pcf: { neType: 'PCF网元对象', diff --git a/src/views/neUser/sub/index.vue b/src/views/neUser/sub/index.vue index 56a4f75a..293578c6 100644 --- a/src/views/neUser/sub/index.vue +++ b/src/views/neUser/sub/index.vue @@ -362,6 +362,32 @@ const modalStateFromOption = reactive({ ], }); +//新增时初始SM Data +const bigRows = ref([ + { + id: 0, + sst: '', + sd: '', + smallRows: [ + { + id: 0, + dnn: '', + smStaticIp: '', + msIp: '', + }, + { + id: 1, + dnn: 'ims', + smStaticIp: '', + msIp: '', + }, + ], + }, +]); + +//小数组的index +let smallRowIndexCounter = 0; + /** * 针对修改框的截取每位数值 * @param num 二进制值: 10001 n:长度有几位 @@ -405,6 +431,7 @@ function fnModalVisibleByEdit(imsi?: string) { getSub(neID, imsi) .then(res => { if (res.code === RESULT_CODE_SUCCESS) { + transformFormData(res.data.smData); let ardAll = parseInt(res.data.ard).toString(2).padStart(8, '0'); let hplAll = parseInt(res.data.hplmnOdb).toString(2).padStart(8, '0'); let odbAll = parseInt(res.data.epsOdb).toString(2).padStart(9, '0'); @@ -475,13 +502,130 @@ const modalStateFrom = Form.useForm( }) ); +/** + * 封装为SM Data + */ +function transformData(data: any) { + let transformedData = data.map((item: any) => { + if ( + !item.sst || + !item.sd || + !item.smallRows.every((smallRow: any) => smallRow.dnn) + ) { + message.error({ + content: `${t('views.neUser.sub.smDataArrTip')}`, + duration: 3, + }); + throw new Error('sst, sd, and all dnn are required fields'); + } + + let sstSd = item.sst + '-' + item.sd; + let smallRowData = item.smallRows + .map((smallRow: any) => { + let parts = [smallRow.dnn]; + if (smallRow.smStaticIp) { + parts.push(smallRow.smStaticIp); + } + if (smallRow.msIp) { + parts.push(smallRow.msIp); + } + return parts.join('-'); + }) + .join('&'); + + return sstSd + '&' + smallRowData; + }); + + return transformedData; +} + +/** + * 拆解SM Data成表单数据 + */ +function transformFormData(data: any) { + let allData = data ? data.split(';') : []; + let bigIDFlag = 0; + let smallIDFlag = 0; + + let transformedData = allData.map((item: any) => { + let json: any = { + id: bigIDFlag++, + sst: item.split('&')[0].split('-')[0], + sd: item.split('&')[0].split('-')[1], + smallRows: [], + }; + item + .split('&') + .slice(1) + .forEach((single: any) => { + let smallRowJson: any = { + id: smallIDFlag++, + dnn: single.split('-')[0], + smStaticIp: '', + msIp: '', + }; + let smStaticIpArr: any = []; + single + .split('-') + .slice(1) + .forEach((dnnParts: any) => { + if (dnnParts.includes('/') && dnnParts.includes(':')) { + //IPV6 + smStaticIpArr.push(dnnParts); + } + if (!dnnParts.includes('/') && !dnnParts.includes(':')) { + //IPV4 + smStaticIpArr.push(dnnParts); + } + + if (dnnParts.includes('/') && !dnnParts.includes(':')) { + //msIp + smallRowJson.msIp = dnnParts; + } + }); + smallRowJson.smStaticIp = smStaticIpArr.join('-'); + json.smallRows.push(smallRowJson); + }); + return json; + }); + if (transformedData.length > 0) { + bigRows.value = transformedData; + } else { + bigRows.value = [ + { + id: 0, + sst: '', + sd: '', + smallRows: [ + { + id: 0, + dnn: '', + smStaticIp: '', + msIp: '', + }, + { + id: 1, + dnn: 'ims', + smStaticIp: '', + msIp: '', + }, + ], + }, + ]; + } +} /** * 对话框弹出确认执行函数 * 进行表达规则校验 */ function fnModalOk() { const from = Object.assign({}, toRaw(modalState.from)); - + try { + from.smData = transformData(bigRows.value).join(';'); + } catch (error: any) { + console.error(error.message); + return false; + } let validateNames = ['imsi', 'msisdn', 'staticIp']; if (from.id === '') { @@ -575,7 +719,12 @@ const modalStateBatchFrom = Form.useForm( */ function fnBatchModalOk() { const from = Object.assign({}, toRaw(modalState.BatchForm)); - + try { + from.smData = transformData(bigRows.value).join(';'); + } catch (error: any) { + console.error(error.message); + return false; + } modalStateBatchFrom .validate() .then(e => { @@ -695,6 +844,28 @@ function fnModalCancel() { modalState.visibleByEdit = false; modalState.visibleByView = false; modalStateFrom.resetFields(); + bigRows.value = [ + { + id: 0, + sst: '', + sd: '', + smallRows: [ + { + id: 0, + dnn: '', + smStaticIp: '', + msIp: '', + }, + { + id: 1, + dnn: 'ims', + smStaticIp: '', + msIp: '', + }, + ], + }, + ]; + smallRowIndexCounter = 0; } /** @@ -705,6 +876,28 @@ function fnBatchModalCancel() { modalState.visibleByBatch = false; modalState.visibleByView = false; modalStateBatchFrom.resetFields(); + bigRows.value = [ + { + id: 0, + sst: '', + sd: '', + smallRows: [ + { + id: 0, + dnn: '', + smStaticIp: '', + msIp: '', + }, + { + id: 1, + dnn: 'ims', + smStaticIp: '', + msIp: '', + }, + ], + }, + ]; + smallRowIndexCounter = 0; } /** @@ -961,6 +1154,41 @@ function fnModalUploadImportUpload(file: File) { }); } +function addSmallRow(bigIndex: any) { + const newSmallRow = { + id: ++smallRowIndexCounter, + dnn: '', + smStaticIp: '', + msIp: '', + }; + bigRows.value[bigIndex].smallRows.push(newSmallRow); +} + +function addBigRow() { + const newBigRow = { + id: bigRows.value.length, + sst: '', + sd: '', + smallRows: [ + { + id: 0, + dnn: '', + smStaticIp: '', + msIp: '', + }, + ], + }; + bigRows.value.push(newBigRow); +} + +function delDNN(sonIndex: any, bigIndex: any) { + bigRows.value[bigIndex].smallRows.splice(sonIndex, 1); +} + +function delBigRow(bigIndex: any) { + bigRows.value.splice(bigIndex, 1); +} + onMounted(() => { // 获取网元网元列表 useNeInfoStore() @@ -1284,6 +1512,7 @@ onMounted(() => { @@ -1324,52 +1553,105 @@ onMounted(() => { + Subscribed SM Data + + + + + +
+ + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - +
- - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + - - - - - + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+