feat: 新增参数配置Tree/调整参数配置Form

This commit is contained in:
TsMask
2023-11-15 14:59:43 +08:00
parent 4f18fe2552
commit de6271df00
5 changed files with 1800 additions and 37 deletions

View File

@@ -57,6 +57,7 @@ async function getParamConfigInfo(
params: { params: {
SQL: `SELECT param_json FROM param_config WHERE ne_type = '${neType}' AND top_tag='${topTag}'`, SQL: `SELECT param_json FROM param_config WHERE ne_type = '${neType}' AND top_tag='${topTag}'`,
}, },
timeout: 1_000,
}), }),
// 获取对应信息 // 获取对应信息
request({ request({
@@ -65,6 +66,7 @@ async function getParamConfigInfo(
params: { params: {
ne_id: neId, ne_id: neId,
}, },
timeout: 1_000,
}), }),
]).then(resArr => { ]).then(resArr => {
let wrRule: Record<string, any> = {}; let wrRule: Record<string, any> = {};
@@ -333,7 +335,7 @@ export async function getParamConfigInfoForm(
result.data.data = dataArray; result.data.data = dataArray;
// 无数据时,用于新增 // 无数据时,用于新增
result.data.dataRule = { title: `Index-0`, key: 0, record : [ruleArr]} ; result.data.dataRule = { title: `Index-0`, key: 0, record : ruleArr} ;
} }
return result; return result;
} }

View File

@@ -429,6 +429,8 @@ export default {
addSure:'Are you sure to submit the new record of Index: [{value}]? ' addSure:'Are you sure to submit the new record of Index: [{value}]? '
}, },
configParamForm: { configParamForm: {
treeTitle: "Navigation Configuration",
treeSelectTip: "Sélectionnez les informations sur les éléments de configuration dans la navigation de configuration de gauche !",
neType: 'NE Type', neType: 'NE Type',
neTypePleace: "Please select the network element type", neTypePleace: "Please select the network element type",
noConfigData: "No data on configuration items", noConfigData: "No data on configuration items",

View File

@@ -429,6 +429,8 @@ export default {
addSure:'确认提交新增 Index :【{value}】 的记录吗?', addSure:'确认提交新增 Index :【{value}】 的记录吗?',
}, },
configParamForm: { configParamForm: {
treeTitle: "配置导航",
treeSelectTip: "左侧配置导航中选择配置项信息!",
neType: "网元类型", neType: "网元类型",
neTypePleace: "请选择网元类型", neTypePleace: "请选择网元类型",
noConfigData: "暂无配置项数据", noConfigData: "暂无配置项数据",

View File

@@ -61,32 +61,28 @@ function fnTabActiveTopTag(key: string | number) {
const neType = neTypeSelect.value[0]; const neType = neTypeSelect.value[0];
const neId = neTypeSelect.value[1]; const neId = neTypeSelect.value[1];
const topTag = tabState.tabActiveTopTag; const topTag = tabState.tabActiveTopTag;
getParamConfigInfoForm(neType, topTag, neId) getParamConfigInfoForm(neType, topTag, neId).then(res => {
.then(res => { if (res.code === RESULT_CODE_SUCCESS && res.data.type) {
if (res.code === RESULT_CODE_SUCCESS && res.data.type) { tabState.tabActiveTopTag = topTag; // 激活当前数据项
tabState.tabActiveTopTag = topTag; // 激活当前数据项 tabState.loading = false;
tabState.loading = false; tabState.tabType = res.data.type;
tabState.tabType = res.data.type; if (res.data.type === 'list') {
if (res.data.type === 'list') { listState.data = res.data.data;
listState.data = res.data.data; listEditClose();
listEditClose();
}
if (res.data.type === 'array') {
arrayState.data = res.data.data;
arrayState.dataRule = res.data.dataRule;
arrayState.collapseActiveKey = [];
arrayEditClose();
}
} else {
message.warning({
content: t('common.noData'),
duration: 3,
});
} }
}) if (res.data.type === 'array') {
.catch(err => { arrayState.data = res.data.data;
console.log(err); arrayState.dataRule = res.data.dataRule;
}); arrayState.collapseActiveKey = [];
arrayEditClose();
}
} else {
message.warning({
content: t('common.noData'),
duration: 3,
});
}
});
} }
/**查询配置Tag标签 */ /**查询配置Tag标签 */
@@ -506,7 +502,7 @@ function arrayChildExpand(key: number | string, row: Record<string, any>) {
arrayChildState.dataRule = { arrayChildState.dataRule = {
title: `Index-0`, title: `Index-0`,
key: 0, key: 0,
record: [ruleArr], record: ruleArr,
}; };
arrayChildState.loc = `${loc}/${from['name']}`; arrayChildState.loc = `${loc}/${from['name']}`;
@@ -826,7 +822,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (valueInt < minInt || valueInt > maxInt) { if (valueInt < minInt || valueInt > maxInt) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireInt', { t('views.configManage.configParamForm.requireInt', {
display, display,
filter, filter,
}), }),
@@ -838,7 +834,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (!regExpIPv4.test(value)) { if (!regExpIPv4.test(value)) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireIpv4', { display }), t('views.configManage.configParamForm.requireIpv4', { display }),
]; ];
} }
break; break;
@@ -846,7 +842,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (!regExpIPv6.test(value)) { if (!regExpIPv6.test(value)) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireIpv6', { display }), t('views.configManage.configParamForm.requireIpv6', { display }),
]; ];
} }
break; break;
@@ -862,7 +858,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (!Object.keys(filterJson).includes(`${value}`)) { if (!Object.keys(filterJson).includes(`${value}`)) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireEnum', { display }), t('views.configManage.configParamForm.requireEnum', { display }),
]; ];
} }
} }
@@ -879,7 +875,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (!Object.values(filterJson).includes(`${value}`)) { if (!Object.values(filterJson).includes(`${value}`)) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireBool', { display }), t('views.configManage.configParamForm.requireBool', { display }),
]; ];
} }
} }
@@ -894,7 +890,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (!rule.test(value)) { if (!rule.test(value)) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireString', { display }), t('views.configManage.configParamForm.requireString', { display }),
]; ];
} }
} catch (error) { } catch (error) {
@@ -910,7 +906,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (!regex.test(value)) { if (!regex.test(value)) {
return [ return [
false, false,
t('views.configParam.configParamForm.requireString', { display }), t('views.configManage.configParamForm.requireString', { display }),
]; ];
} }
} catch (error) { } catch (error) {
@@ -922,7 +918,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
default: default:
return [ return [
false, false,
t('views.configParam.configParamForm.requireUn', { display }), t('views.configManage.configParamForm.requireUn', { display }),
]; ];
} }
return result; return result;
@@ -997,10 +993,13 @@ onMounted(() => {
} }
); );
// 默认选择AMF // 默认选择AMF
const item = neCascaderOtions.value.find(s => s.value === 'UPF'); const item = neCascaderOtions.value.find(s => s.value === 'AMF');
if (item) { if (item && item.children) {
const info = item.children[0]; const info = item.children[0];
neTypeSelect.value = [info.neType, info.neId]; neTypeSelect.value = [info.neType, info.neId];
} else {
const info = neCascaderOtions.value[0].children[0];
neTypeSelect.value = [info.neType, info.neId];
} }
fnGetParamConfigTopTab(); fnGetParamConfigTopTab();
} }
@@ -1286,6 +1285,7 @@ onMounted(() => {
:label="item.display" :label="item.display"
:name="item.name" :name="item.name"
:required="item.optional === 'false'" :required="item.optional === 'false'"
style="margin-bottom: 2px"
> >
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
<template #title v-if="item.comment"> <template #title v-if="item.comment">
@@ -1493,6 +1493,7 @@ onMounted(() => {
:label="item.display" :label="item.display"
:name="item.name" :name="item.name"
:required="item.optional === 'false'" :required="item.optional === 'false'"
style="margin-bottom: 2px"
> >
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
<template #title v-if="item.comment"> <template #title v-if="item.comment">
@@ -1631,6 +1632,7 @@ onMounted(() => {
:label="item.display" :label="item.display"
:name="item.name" :name="item.name"
:required="item.optional === 'false'" :required="item.optional === 'false'"
style="margin-bottom: 2px"
> >
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
<template #title v-if="item.comment"> <template #title v-if="item.comment">

File diff suppressed because it is too large Load Diff