feat: 快速修改PLMN接入数据操作
This commit is contained in:
@@ -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}`);
|
||||
} else {
|
||||
console.log(
|
||||
'不存在替换最后的',
|
||||
rule.name,
|
||||
rule.key[rule.key.length - 1],
|
||||
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
|
||||
// );
|
||||
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(
|
||||
|
||||
<a-divider orientation="left">To NE</a-divider>
|
||||
|
||||
<a-form-item :label="t('views.ne.common.neType')" name="neType">
|
||||
<a-form-item
|
||||
:label="t('views.ne.common.neType')"
|
||||
name="neType"
|
||||
:label-col="{ span: 3 }"
|
||||
:label-wrap="true"
|
||||
>
|
||||
<a-cascader
|
||||
v-model:value="modalState.neType"
|
||||
:options="neCascaderOptions"
|
||||
@@ -550,7 +591,7 @@ async function toConfig(
|
||||
:hidden="!modalState.msg"
|
||||
:value="modalState.msg"
|
||||
:auto-size="{ minRows: 2, maxRows: 8 }"
|
||||
style="margin-top: 8px;"
|
||||
style="margin-top: 8px"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
Reference in New Issue
Block a user