From de6271df004ef20af3682c44a94fa0440f7fdc72 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 15 Nov 2023 14:59:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AETree/=E8=B0=83=E6=95=B4=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AEForm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configManage/configParam.ts | 4 +- src/i18n/locales/en-US.ts | 2 + src/i18n/locales/zh-CN.ts | 2 + .../configManage/configParamForm/index.vue | 74 +- .../configManage/configParamTree/index.vue | 1755 +++++++++++++++++ 5 files changed, 1800 insertions(+), 37 deletions(-) create mode 100644 src/views/configManage/configParamTree/index.vue diff --git a/src/api/configManage/configParam.ts b/src/api/configManage/configParam.ts index 3a69d7e3..70ac43ca 100644 --- a/src/api/configManage/configParam.ts +++ b/src/api/configManage/configParam.ts @@ -57,6 +57,7 @@ async function getParamConfigInfo( params: { SQL: `SELECT param_json FROM param_config WHERE ne_type = '${neType}' AND top_tag='${topTag}'`, }, + timeout: 1_000, }), // 获取对应信息 request({ @@ -65,6 +66,7 @@ async function getParamConfigInfo( params: { ne_id: neId, }, + timeout: 1_000, }), ]).then(resArr => { let wrRule: Record = {}; @@ -333,7 +335,7 @@ export async function getParamConfigInfoForm( 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; } diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 092df028..88295d58 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -429,6 +429,8 @@ export default { addSure:'Are you sure to submit the new record of Index: [{value}]? ' }, 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', neTypePleace: "Please select the network element type", noConfigData: "No data on configuration items", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index b55f22ca..aacb9890 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -429,6 +429,8 @@ export default { addSure:'确认提交新增 Index :【{value}】 的记录吗?', }, configParamForm: { + treeTitle: "配置导航", + treeSelectTip: "左侧配置导航中选择配置项信息!", neType: "网元类型", neTypePleace: "请选择网元类型", noConfigData: "暂无配置项数据", diff --git a/src/views/configManage/configParamForm/index.vue b/src/views/configManage/configParamForm/index.vue index 6d714a72..60931955 100644 --- a/src/views/configManage/configParamForm/index.vue +++ b/src/views/configManage/configParamForm/index.vue @@ -61,32 +61,28 @@ function fnTabActiveTopTag(key: string | number) { const neType = neTypeSelect.value[0]; const neId = neTypeSelect.value[1]; const topTag = tabState.tabActiveTopTag; - getParamConfigInfoForm(neType, topTag, neId) - .then(res => { - if (res.code === RESULT_CODE_SUCCESS && res.data.type) { - tabState.tabActiveTopTag = topTag; // 激活当前数据项 - tabState.loading = false; - tabState.tabType = res.data.type; - if (res.data.type === 'list') { - listState.data = res.data.data; - 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, - }); + getParamConfigInfoForm(neType, topTag, neId).then(res => { + if (res.code === RESULT_CODE_SUCCESS && res.data.type) { + tabState.tabActiveTopTag = topTag; // 激活当前数据项 + tabState.loading = false; + tabState.tabType = res.data.type; + if (res.data.type === 'list') { + listState.data = res.data.data; + listEditClose(); } - }) - .catch(err => { - console.log(err); - }); + 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, + }); + } + }); } /**查询配置Tag标签 */ @@ -506,7 +502,7 @@ function arrayChildExpand(key: number | string, row: Record) { arrayChildState.dataRule = { title: `Index-0`, key: 0, - record: [ruleArr], + record: ruleArr, }; arrayChildState.loc = `${loc}/${from['name']}`; @@ -826,7 +822,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (valueInt < minInt || valueInt > maxInt) { return [ false, - t('views.configParam.configParamForm.requireInt', { + t('views.configManage.configParamForm.requireInt', { display, filter, }), @@ -838,7 +834,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (!regExpIPv4.test(value)) { return [ false, - t('views.configParam.configParamForm.requireIpv4', { display }), + t('views.configManage.configParamForm.requireIpv4', { display }), ]; } break; @@ -846,7 +842,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (!regExpIPv6.test(value)) { return [ false, - t('views.configParam.configParamForm.requireIpv6', { display }), + t('views.configManage.configParamForm.requireIpv6', { display }), ]; } break; @@ -862,7 +858,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (!Object.keys(filterJson).includes(`${value}`)) { return [ false, - t('views.configParam.configParamForm.requireEnum', { display }), + t('views.configManage.configParamForm.requireEnum', { display }), ]; } } @@ -879,7 +875,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (!Object.values(filterJson).includes(`${value}`)) { return [ false, - t('views.configParam.configParamForm.requireBool', { display }), + t('views.configManage.configParamForm.requireBool', { display }), ]; } } @@ -894,7 +890,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (!rule.test(value)) { return [ false, - t('views.configParam.configParamForm.requireString', { display }), + t('views.configManage.configParamForm.requireString', { display }), ]; } } catch (error) { @@ -910,7 +906,7 @@ function ruleVerification(row: Record): (string | boolean)[] { if (!regex.test(value)) { return [ false, - t('views.configParam.configParamForm.requireString', { display }), + t('views.configManage.configParamForm.requireString', { display }), ]; } } catch (error) { @@ -922,7 +918,7 @@ function ruleVerification(row: Record): (string | boolean)[] { default: return [ false, - t('views.configParam.configParamForm.requireUn', { display }), + t('views.configManage.configParamForm.requireUn', { display }), ]; } return result; @@ -997,10 +993,13 @@ onMounted(() => { } ); // 默认选择AMF - const item = neCascaderOtions.value.find(s => s.value === 'UPF'); - if (item) { + const item = neCascaderOtions.value.find(s => s.value === 'AMF'); + if (item && item.children) { const info = item.children[0]; neTypeSelect.value = [info.neType, info.neId]; + } else { + const info = neCascaderOtions.value[0].children[0]; + neTypeSelect.value = [info.neType, info.neId]; } fnGetParamConfigTopTab(); } @@ -1286,6 +1285,7 @@ onMounted(() => { :label="item.display" :name="item.name" :required="item.optional === 'false'" + style="margin-bottom: 2px" >