feat: 快速修改PLMN接入数据操作
This commit is contained in:
@@ -9,7 +9,6 @@ import { addNeHost, updateNeHost } from '@/api/ne/neHost';
|
|||||||
import {
|
import {
|
||||||
getNeConfigData,
|
getNeConfigData,
|
||||||
addNeConfigData,
|
addNeConfigData,
|
||||||
delNeConfigData,
|
|
||||||
editNeConfigData,
|
editNeConfigData,
|
||||||
} from '@/api/ne/neConfig';
|
} from '@/api/ne/neConfig';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -71,7 +70,6 @@ let modalState: ModalStateType = reactive({
|
|||||||
toNe: [],
|
toNe: [],
|
||||||
msg: '',
|
msg: '',
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
uploadFiles: [],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**对话框内表单属性和校验规则 */
|
/**对话框内表单属性和校验规则 */
|
||||||
@@ -132,7 +130,7 @@ function fnModalOk() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const form = toRaw(modalState.from);
|
const form = toRaw(modalState.from);
|
||||||
console.log(form);
|
// console.log(form);
|
||||||
|
|
||||||
modalStateFrom
|
modalStateFrom
|
||||||
.validate()
|
.validate()
|
||||||
@@ -148,29 +146,8 @@ function fnModalOk() {
|
|||||||
}
|
}
|
||||||
modalState.msg = errArr.join('\n');
|
modalState.msg = errArr.join('\n');
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
|
emit('ok', JSON.parse(JSON.stringify(form)));
|
||||||
hide();
|
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 => {
|
.catch(e => {
|
||||||
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
|
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
|
||||||
@@ -187,6 +164,23 @@ function fnModalCancel() {
|
|||||||
modalStateFrom.resetFields();
|
modalStateFrom.resetFields();
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
emit('update:open', false);
|
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}`;
|
const plmn = `${param.plmnId.mcc}${param.plmnId.mnc}`;
|
||||||
return {
|
return {
|
||||||
index: index,
|
index: index,
|
||||||
code: 1,
|
|
||||||
groupId: 1,
|
|
||||||
plmnId: plmn,
|
plmnId: plmn,
|
||||||
|
groupId: 1,
|
||||||
|
code: 1,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -370,13 +364,13 @@ async function toConfig(
|
|||||||
paramName: rule.name,
|
paramName: rule.name,
|
||||||
});
|
});
|
||||||
if (res.code != RESULT_CODE_SUCCESS) {
|
if (res.code != RESULT_CODE_SUCCESS) {
|
||||||
console.log('获取数据失败', rule);
|
// console.log('获取数据失败', rule);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 获取数据失败`);
|
errMsgArr.push(`${ntType}_${neId} ${rule.display} get data failed`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (res.data.length === 0) {
|
if (res.data.length === 0) {
|
||||||
console.log('数据为空', rule);
|
// console.log('数据为空', rule);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 数据为空`);
|
errMsgArr.push(`${ntType}_${neId} ${rule.display} data empty`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,22 +382,46 @@ async function toConfig(
|
|||||||
vArr.push(data[k]);
|
vArr.push(data[k]);
|
||||||
}
|
}
|
||||||
if (vArr.includes(plmn)) {
|
if (vArr.includes(plmn)) {
|
||||||
console.log('存在跳过', rule.name, vArr, plmn);
|
// console.log('存在跳过', rule.name, vArr, plmn);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 已存在${plmn}`);
|
errMsgArr.push(`${ntType}_${neId} ${rule.display} already exists`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (vArr.includes('')) {
|
if (vArr.includes('')) {
|
||||||
const index = vArr.findIndex(s => s == '');
|
const index = vArr.findIndex(s => s == '');
|
||||||
console.log('空白新增', rule.name, rule.key[index], plmn);
|
// console.log('空白新增', rule.name, rule.key[index], plmn);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 空白项新增${plmn}`);
|
const resList = await editNeConfigData({
|
||||||
} else {
|
neType: ntType,
|
||||||
console.log(
|
neId: neId,
|
||||||
'不存在替换最后的',
|
paramName: rule.name,
|
||||||
rule.name,
|
paramData: {
|
||||||
rule.key[rule.key.length - 1],
|
[rule.key[index]]: plmn,
|
||||||
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)) {
|
if (vArr.includes(plmn)) {
|
||||||
const item = res.data.find(s => s[rule.key] == plmn);
|
const item = res.data.find(s => s[rule.key] == plmn);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.log('没有找到', rule.name, index);
|
// console.log('没有找到', rule.name, index);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 没有找到`);
|
errMsgArr.push(`${ntType}_${neId} ${rule.display} not found`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const index = item.index;
|
const index = item.index;
|
||||||
const updateItem = rule.item(index, param);
|
const updateItem = rule.item(index, param);
|
||||||
console.log('存在修改', rule.name, index, updateItem);
|
// console.log('存在修改', rule.name, index, updateItem);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 修改成功`);
|
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 {
|
} else {
|
||||||
const item = res.data.sort((a, b) => b.index - a.index);
|
const item = res.data.sort((a, b) => b.index - a.index);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.log('没有找到', rule.name, index);
|
// console.log('没有找到', rule.name, index);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 没有找到`);
|
errMsgArr.push(`${ntType}_${neId} ${rule.display} not found`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const lastIndex = item[0].index + 1;
|
const lastIndex = item[0].index + 1;
|
||||||
const addItem = rule.item(lastIndex, param);
|
const addItem = rule.item(lastIndex, param);
|
||||||
console.log('不存在新增', rule.name, lastIndex, addItem);
|
// console.log('不存在新增', rule.name, lastIndex, addItem);
|
||||||
errMsgArr.push(`${ntType}_${neId} ${rule.display} 新增成功`);
|
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-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
|
<a-cascader
|
||||||
v-model:value="modalState.neType"
|
v-model:value="modalState.neType"
|
||||||
:options="neCascaderOptions"
|
:options="neCascaderOptions"
|
||||||
@@ -550,7 +591,7 @@ async function toConfig(
|
|||||||
:hidden="!modalState.msg"
|
:hidden="!modalState.msg"
|
||||||
:value="modalState.msg"
|
:value="modalState.msg"
|
||||||
:auto-size="{ minRows: 2, maxRows: 8 }"
|
:auto-size="{ minRows: 2, maxRows: 8 }"
|
||||||
style="margin-top: 8px;"
|
style="margin-top: 8px"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
|||||||
Reference in New Issue
Block a user