style: 修复样式

This commit is contained in:
TsMask
2024-11-23 15:16:52 +08:00
parent f310ae4f38
commit cb510d9fdb
11 changed files with 259 additions and 122 deletions

View File

@@ -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<string, any>) {
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<string, any> = {};
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<string, any>) {
// 特殊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<string, any> = {};
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;
}

View File

@@ -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,
});
}

View File

@@ -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<string, any>) {
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,
});
}

View File

@@ -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,
};
}