From cb510d9fdbeb9f0eb9596ce7928f47642dfe00be Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Sat, 23 Nov 2024 15:16:52 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configManage/configParamApply/index.vue | 1 + .../hooks/useConfigArray.ts | 85 ++++++++++++++++--- .../hooks/useConfigArrayChild.ts | 19 ++--- .../hooks/useConfigList.ts | 13 ++- .../configParamTreeTable/hooks/useOptions.ts | 30 +++---- .../configParamTreeTable/index.vue | 43 +++++----- .../hooks/useConfigArray.ts | 85 ++++++++++++++++--- .../hooks/useConfigArrayChild.ts | 19 ++--- .../hooks/useConfigList.ts | 13 ++- .../configParamTreeTable/hooks/useOptions.ts | 30 +++---- .../configParamTreeTable/index.vue | 43 +++++----- 11 files changed, 259 insertions(+), 122 deletions(-) diff --git a/practical_training/views/configManage/configParamApply/index.vue b/practical_training/views/configManage/configParamApply/index.vue index 891bdcb6..c09143a6 100644 --- a/practical_training/views/configManage/configParamApply/index.vue +++ b/practical_training/views/configManage/configParamApply/index.vue @@ -353,6 +353,7 @@ function fnRecordBack(row?: Record) { }); } result.then((res: any) => { + fnGetList(); if (res.code === RESULT_CODE_SUCCESS) { message.success({ content: t('common.operateOk'), diff --git a/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArray.ts b/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArray.ts index 037ff139..97fcf83f 100644 --- a/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArray.ts +++ b/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArray.ts @@ -4,9 +4,8 @@ import { editPtNeConfigData, } from '@/api/pt/neConfig'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; -import { Modal } from 'ant-design-vue/lib'; -import { SizeType } from 'ant-design-vue/lib/config-provider'; -import message from 'ant-design-vue/lib/message'; +import { Modal, message } from 'ant-design-vue/es'; +import { SizeType } from 'ant-design-vue/es/config-provider'; import { reactive, watch } from 'vue'; /** @@ -66,6 +65,22 @@ export default function useConfigArray({ row[v.name] = Object.assign({}, v); } + // 特殊SMF-upfid选择 + if (treeState.neType === 'SMF' && Reflect.has(row, 'upfId')) { + const v = row.upfId.value; + if (typeof v === 'string') { + if (v === '') { + row.upfId.value = []; + } else if (v.includes(';')) { + row.upfId.value = v.split(';'); + } else if (v.includes(',')) { + row.upfId.value = v.split(','); + } else { + row.upfId.value = [v]; + } + } + } + modalState.from = row; modalState.type = 'arrayEdit'; modalState.title = `${treeState.selectNode.paramDisplay} ${from.title}`; @@ -85,6 +100,16 @@ export default function useConfigArray({ /**多列表编辑确认 */ function arrayEditOk(from: Record) { + const loc = `${from['index']['value']}`; + + // 特殊SMF-upfid选择 + if (treeState.neType === 'SMF' && Reflect.has(from, 'upfId')) { + const v = from.upfId.value; + if (Array.isArray(v)) { + from.upfId.value = v.join(';'); + } + } + // 遍历提取属性和值 let data: Record = {}; for (const key in from) { @@ -110,12 +135,12 @@ export default function useConfigArray({ neType: treeState.neType, paramName: treeState.selectNode.paramName, paramData: data, - loc: `${from['index']['value']}`, + loc: loc, }) .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.updateItem', { + content: t('views.ne.neConfig.updateItem', { num: modalState.title, }), duration: 3, @@ -123,7 +148,7 @@ export default function useConfigArray({ fnActiveConfigNode('#'); } else { message.warning({ - content: t('views.configManage.configParamForm.updateItemErr'), + content: t('views.ne.neConfig.updateItemErr'), duration: 3, }); } @@ -141,7 +166,7 @@ export default function useConfigArray({ Modal.confirm({ title: t('common.tipTitle'), - content: t('views.configManage.configParamForm.delItemTip', { + content: t('views.ne.neConfig.delItemTip', { num: title, }), onOk() { @@ -152,7 +177,7 @@ export default function useConfigArray({ }).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.delItemOk', { + content: t('views.ne.neConfig.delItemOk', { num: title, }), duration: 2, @@ -183,6 +208,22 @@ export default function useConfigArray({ row[v.name] = Object.assign({}, v); } + // 特殊SMF-upfid选择 + if (treeState.neType === 'SMF' && Reflect.has(row, 'upfId')) { + const v = row.upfId.value; + if (typeof v === 'string') { + if (v === '') { + row.upfId.value = []; + } else if (v.includes(';')) { + row.upfId.value = v.split(';'); + } else if (v.includes(',')) { + row.upfId.value = v.split(','); + } else { + row.upfId.value = [v]; + } + } + } + modalState.from = row; modalState.type = 'arrayAdd'; modalState.title = `${treeState.selectNode.paramDisplay} ${from.title}`; @@ -193,6 +234,14 @@ export default function useConfigArray({ /**多列表新增单行确认 */ function arrayAddOk(from: Record) { + // 特殊SMF-upfid选择 + if (treeState.neType === 'SMF' && Reflect.has(from, 'upfId')) { + const v = from.upfId.value; + if (Array.isArray(v)) { + from.upfId.value = v.join(';'); + } + } + // 遍历提取属性和值 let data: Record = {}; for (const key in from) { @@ -223,7 +272,7 @@ export default function useConfigArray({ .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.addItemOk', { + content: t('views.ne.neConfig.addItemOk', { num: modalState.title, }), duration: 3, @@ -231,7 +280,7 @@ export default function useConfigArray({ fnActiveConfigNode('#'); } else { message.warning({ - content: t('views.configManage.configParamForm.addItemErr'), + content: t('views.ne.neConfig.addItemErr'), duration: 3, }); } @@ -316,6 +365,22 @@ export default function useConfigArray({ if ('bool' === row.type) { row.value = Boolean(row.value); } + + // 特殊SMF-upfid选择 + if (treeState.neType === 'SMF' && row.name === 'upfId') { + const v = row.value; + if (typeof v === 'string') { + if (v === '') { + row.value = []; + } else if (v.includes(';')) { + row.value = v.split(';'); + } else if (v.includes(',')) { + row.value = v.split(','); + } else { + row.value = [v]; + } + } + } } return ruleFrom; } diff --git a/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArrayChild.ts b/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArrayChild.ts index ba61b9a9..b902e52d 100644 --- a/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArrayChild.ts +++ b/practical_training/views/configManage/configParamTreeTable/hooks/useConfigArrayChild.ts @@ -4,9 +4,8 @@ import { editPtNeConfigData, } from '@/api/pt/neConfig'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; -import { Modal } from 'ant-design-vue/lib'; -import { SizeType } from 'ant-design-vue/lib/config-provider'; -import message from 'ant-design-vue/lib/message'; +import { Modal, message } from 'ant-design-vue/es'; +import { SizeType } from 'ant-design-vue/es/config-provider'; import { nextTick, reactive } from 'vue'; /** @@ -16,7 +15,7 @@ import { nextTick, reactive } from 'vue'; */ export default function useConfigArrayChild({ t, - treeState, + treeState, fnActiveConfigNode, ruleVerification, modalState, @@ -209,7 +208,7 @@ export default function useConfigArrayChild({ .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.updateItem', { + content: t('views.ne.neConfig.updateItem', { num: modalState.title, }), duration: 3, @@ -217,7 +216,7 @@ export default function useConfigArrayChild({ fnActiveConfigNode('#'); } else { message.warning({ - content: t('views.configManage.configParamForm.updateItemErr'), + content: t('views.ne.neConfig.updateItemErr'), duration: 3, }); } @@ -236,7 +235,7 @@ export default function useConfigArrayChild({ Modal.confirm({ title: t('common.tipTitle'), - content: t('views.configManage.configParamForm.delItemTip', { + content: t('views.ne.neConfig.delItemTip', { num: title, }), onOk() { @@ -247,7 +246,7 @@ export default function useConfigArrayChild({ }).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.delItemOk', { + content: t('views.ne.neConfig.delItemOk', { num: title, }), duration: 2, @@ -318,7 +317,7 @@ export default function useConfigArrayChild({ .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.addItemOk', { + content: t('views.ne.neConfig.addItemOk', { num: modalState.title, }), duration: 3, @@ -326,7 +325,7 @@ export default function useConfigArrayChild({ fnActiveConfigNode('#'); } else { message.warning({ - content: t('views.configManage.configParamForm.addItemErr'), + content: t('views.ne.neConfig.addItemErr'), duration: 3, }); } diff --git a/practical_training/views/configManage/configParamTreeTable/hooks/useConfigList.ts b/practical_training/views/configManage/configParamTreeTable/hooks/useConfigList.ts index ba198f68..6369a9ff 100644 --- a/practical_training/views/configManage/configParamTreeTable/hooks/useConfigList.ts +++ b/practical_training/views/configManage/configParamTreeTable/hooks/useConfigList.ts @@ -1,7 +1,7 @@ import { editPtNeConfigData } from '@/api/pt/neConfig'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { SizeType } from 'ant-design-vue/es/config-provider'; -import message from 'ant-design-vue/es/message'; +import { message } from 'ant-design-vue/es'; import { reactive, toRaw } from 'vue'; /** @@ -48,6 +48,13 @@ export default function useConfigList({ t, treeState, ruleVerification }: any) { /**单列表编辑 */ function listEdit(row: Record) { + if ( + listState.confirmLoading || + ['read-only', 'read', 'ro'].includes(row.access) + ) { + return; + } + listState.editRecord = Object.assign({}, row); } @@ -84,7 +91,7 @@ export default function useConfigList({ t, treeState, ruleVerification }: any) { .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('views.configManage.configParamForm.updateValue', { + content: t('views.ne.neConfig.updateValue', { num: from['display'], }), duration: 3, @@ -98,7 +105,7 @@ export default function useConfigList({ t, treeState, ruleVerification }: any) { } } else { message.warning({ - content: t('views.configManage.configParamForm.updateValueErr'), + content: t('views.ne.neConfig.updateValueErr'), duration: 3, }); } diff --git a/practical_training/views/configManage/configParamTreeTable/hooks/useOptions.ts b/practical_training/views/configManage/configParamTreeTable/hooks/useOptions.ts index b7220371..8c88fde8 100644 --- a/practical_training/views/configManage/configParamTreeTable/hooks/useOptions.ts +++ b/practical_training/views/configManage/configParamTreeTable/hooks/useOptions.ts @@ -37,7 +37,7 @@ export default function useOptions({ t }: any) { if (valueInt < minInt || valueInt > maxInt) { return [ false, - t('views.configManage.configParamForm.requireInt', { + t('views.ne.neConfig.requireInt', { display, filter, }), @@ -49,7 +49,7 @@ export default function useOptions({ t }: any) { if (!regExpIPv4.test(value)) { return [ false, - t('views.configManage.configParamForm.requireIpv4', { display }), + t('views.ne.neConfig.requireIpv4', { display }), ]; } break; @@ -57,7 +57,7 @@ export default function useOptions({ t }: any) { if (!regExpIPv6.test(value)) { return [ false, - t('views.configManage.configParamForm.requireIpv6', { display }), + t('views.ne.neConfig.requireIpv6', { display }), ]; } break; @@ -73,7 +73,7 @@ export default function useOptions({ t }: any) { if (!Object.keys(filterJson).includes(`${value}`)) { return [ false, - t('views.configManage.configParamForm.requireEnum', { display }), + t('views.ne.neConfig.requireEnum', { display }), ]; } } @@ -92,7 +92,7 @@ export default function useOptions({ t }: any) { if (!Object.values(filterJson).includes(`${value}`)) { return [ false, - t('views.configManage.configParamForm.requireBool', { display }), + t('views.ne.neConfig.requireBool', { display }), ]; } } @@ -110,7 +110,7 @@ export default function useOptions({ t }: any) { if (!rule.test(value)) { return [ false, - t('views.configManage.configParamForm.requireString', { + t('views.ne.neConfig.requireString', { display, }), ]; @@ -125,7 +125,7 @@ export default function useOptions({ t }: any) { if (!validURL(value)) { return [ false, - t('views.configManage.configParamForm.requireString', { + t('views.ne.neConfig.requireString', { display, }), ]; @@ -145,7 +145,7 @@ export default function useOptions({ t }: any) { if (!regex.test(value)) { return [ false, - t('views.configManage.configParamForm.requireString', { + t('views.ne.neConfig.requireString', { display, }), ]; @@ -159,24 +159,24 @@ export default function useOptions({ t }: any) { default: return [ false, - t('views.configManage.configParamForm.requireUn', { display }), + t('views.ne.neConfig.requireUn', { display }), ]; } return result; } /**upfId可选择 */ - const SMFByUPFIdOptions = ref<{ value: string; label: string }[]>([]); + const smfByUPFIdOptions = ref<{ value: string; label: string }[]>([]); /**加载smf配置的upfId */ - function getConfigSMFByUPFIds(neId: string) { + function smfByUPFIdLoadData(neId: string) { getNeConfigData({ neType: 'SMF', neId: neId, paramName: 'upfConfig', }).then(res => { - SMFByUPFIdOptions.value = []; + smfByUPFIdOptions.value = []; for (const s of res.data) { - SMFByUPFIdOptions.value.push({ + smfByUPFIdOptions.value.push({ value: s.id, label: s.id, }); @@ -186,7 +186,7 @@ export default function useOptions({ t }: any) { return { ruleVerification, - getConfigSMFByUPFIds, - SMFByUPFIdOptions, + smfByUPFIdLoadData, + smfByUPFIdOptions, }; } diff --git a/practical_training/views/configManage/configParamTreeTable/index.vue b/practical_training/views/configManage/configParamTreeTable/index.vue index 50bac0b9..5f96c062 100644 --- a/practical_training/views/configManage/configParamTreeTable/index.vue +++ b/practical_training/views/configManage/configParamTreeTable/index.vue @@ -1,15 +1,8 @@