From 25a33678f25467a9707eb100cf0163571d080c91 Mon Sep 17 00:00:00 2001
From: TsMask <340112800@qq.com>
Date: Wed, 18 Jun 2025 11:11:15 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BF=AB=E9=80=9F=E4=BF=AE=E6=94=B9PLM?=
=?UTF-8?q?N=E6=8E=A5=E5=85=A5=E6=95=B0=E6=8D=AE=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/ne/neConfig/components/Base.vue | 143 ++++++++++++++--------
1 file changed, 92 insertions(+), 51 deletions(-)
diff --git a/src/views/ne/neConfig/components/Base.vue b/src/views/ne/neConfig/components/Base.vue
index 93ddfc79..fde7775e 100644
--- a/src/views/ne/neConfig/components/Base.vue
+++ b/src/views/ne/neConfig/components/Base.vue
@@ -9,7 +9,6 @@ import { addNeHost, updateNeHost } from '@/api/ne/neHost';
import {
getNeConfigData,
addNeConfigData,
- delNeConfigData,
editNeConfigData,
} from '@/api/ne/neConfig';
const { t } = useI18n();
@@ -71,7 +70,6 @@ let modalState: ModalStateType = reactive({
toNe: [],
msg: '',
confirmLoading: false,
- uploadFiles: [],
});
/**对话框内表单属性和校验规则 */
@@ -132,7 +130,7 @@ function fnModalOk() {
return;
}
const form = toRaw(modalState.from);
- console.log(form);
+ // console.log(form);
modalStateFrom
.validate()
@@ -148,29 +146,8 @@ function fnModalOk() {
}
modalState.msg = errArr.join('\n');
modalState.confirmLoading = false;
+ emit('ok', JSON.parse(JSON.stringify(form)));
hide();
-
- // const neHost = form.hostId ? updateNeHost(form) : addNeHost(form);
- // neHost
- // .then(res => {
- // if (res.code === RESULT_CODE_SUCCESS) {
- // message.success({
- // content: t('common.operateOk'),
- // duration: 2,
- // });
- // // 返回无引用信息
- // emit('ok', JSON.parse(JSON.stringify(form)));
- // fnModalCancel();
- // } else {
- // message.error({
- // content: `${res.msg}`,
- // duration: 2,
- // });
- // }
- // })
- // .finally(() => {
-
- // });
})
.catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
@@ -187,6 +164,23 @@ function fnModalCancel() {
modalStateFrom.resetFields();
emit('cancel');
emit('update:open', false);
+ // 还原默认值
+ modalState.from = {
+ plmnId: {
+ mcc: '001',
+ mnc: '01',
+ },
+ tac: '4388',
+ snssai: {
+ sst: '1',
+ sd: '000001',
+ },
+ dnn_data: 'internet',
+ dnn_ims: 'ims',
+ };
+ modalState.neType = [];
+ modalState.toNe = [];
+ modalState.msg = '';
}
/**监听是否显示,初始数据 */
@@ -301,9 +295,9 @@ const supportMapper = {
const plmn = `${param.plmnId.mcc}${param.plmnId.mnc}`;
return {
index: index,
- code: 1,
- groupId: 1,
plmnId: plmn,
+ groupId: 1,
+ code: 1,
};
},
},
@@ -370,13 +364,13 @@ async function toConfig(
paramName: rule.name,
});
if (res.code != RESULT_CODE_SUCCESS) {
- console.log('获取数据失败', rule);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 获取数据失败`);
+ // console.log('获取数据失败', rule);
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} get data failed`);
continue;
}
if (res.data.length === 0) {
- console.log('数据为空', rule);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 数据为空`);
+ // console.log('数据为空', rule);
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} data empty`);
continue;
}
@@ -388,22 +382,46 @@ async function toConfig(
vArr.push(data[k]);
}
if (vArr.includes(plmn)) {
- console.log('存在跳过', rule.name, vArr, plmn);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 已存在${plmn}`);
+ // console.log('存在跳过', rule.name, vArr, plmn);
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} already exists`);
continue;
}
if (vArr.includes('')) {
const index = vArr.findIndex(s => s == '');
- console.log('空白新增', rule.name, rule.key[index], plmn);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 空白项新增${plmn}`);
+ // console.log('空白新增', rule.name, rule.key[index], plmn);
+ const resList = await editNeConfigData({
+ neType: ntType,
+ neId: neId,
+ paramName: rule.name,
+ paramData: {
+ [rule.key[index]]: plmn,
+ },
+ });
+ const state =
+ resList.code != RESULT_CODE_SUCCESS ? 'failed' : 'success';
+ errMsgArr.push(
+ `${ntType}_${neId} ${rule.display} blank items added ${state}`
+ );
} else {
- console.log(
- '不存在替换最后的',
- rule.name,
- rule.key[rule.key.length - 1],
- plmn
+ // console.log(
+ // '不存在替换最后的',
+ // rule.name,
+ // rule.key[rule.key.length - 1],
+ // plmn
+ // );
+ const resList = await editNeConfigData({
+ neType: ntType,
+ neId: neId,
+ paramName: rule.name,
+ paramData: {
+ [rule.key[rule.key.length - 1]]: plmn,
+ },
+ });
+ const state =
+ resList.code != RESULT_CODE_SUCCESS ? 'failed' : 'success';
+ errMsgArr.push(
+ `${ntType}_${neId} ${rule.display} replace the final ${state}`
);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 替换最后的`);
}
}
@@ -416,25 +434,43 @@ async function toConfig(
if (vArr.includes(plmn)) {
const item = res.data.find(s => s[rule.key] == plmn);
if (!item) {
- console.log('没有找到', rule.name, index);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 没有找到`);
+ // console.log('没有找到', rule.name, index);
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} not found`);
continue;
}
const index = item.index;
const updateItem = rule.item(index, param);
- console.log('存在修改', rule.name, index, updateItem);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 修改成功`);
+ // console.log('存在修改', rule.name, index, updateItem);
+ const resList = await editNeConfigData({
+ neType: ntType,
+ neId: neId,
+ paramName: rule.name,
+ paramData: updateItem,
+ loc: `${index}`,
+ });
+ const state =
+ resList.code != RESULT_CODE_SUCCESS ? 'failed' : 'success';
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} modify ${state}`);
} else {
const item = res.data.sort((a, b) => b.index - a.index);
if (!item) {
- console.log('没有找到', rule.name, index);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 没有找到`);
+ // console.log('没有找到', rule.name, index);
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} not found`);
continue;
}
const lastIndex = item[0].index + 1;
const addItem = rule.item(lastIndex, param);
- console.log('不存在新增', rule.name, lastIndex, addItem);
- errMsgArr.push(`${ntType}_${neId} ${rule.display} 新增成功`);
+ // console.log('不存在新增', rule.name, lastIndex, addItem);
+ const resList = await addNeConfigData({
+ neType: ntType,
+ neId: neId,
+ paramName: rule.name,
+ paramData: addItem,
+ loc: `${lastIndex}`,
+ });
+ const state =
+ resList.code != RESULT_CODE_SUCCESS ? 'failed' : 'success';
+ errMsgArr.push(`${ntType}_${neId} ${rule.display} added ${state}`);
}
}
}
@@ -536,7 +572,12 @@ async function toConfig(
To NE
-
+