feat: 接入实训接口调试参数配置

This commit is contained in:
TsMask
2024-07-11 10:23:18 +08:00
parent f3c46976ae
commit 99140f0641
4 changed files with 185 additions and 4 deletions

View File

@@ -1,5 +1,9 @@
import { ptResetAsDefault, ptSaveAsDefault } from '@/api/pt/neConfig';
import { stuPtNeConfigApply } from '@/api/pt/neConfigApply';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useI18n from '@/hooks/useI18n';
import { regExpIPv4, regExpIPv6, validURL } from '@/utils/regular-utils';
import message from 'ant-design-vue/lib/message';
export default function useOptions() {
const { t } = useI18n();
@@ -76,7 +80,7 @@ export default function useOptions() {
break;
case 'bool':
// filter: '{"0":"false", "1":"true"}'
if (filter && filter.indexOf('{') === 1) {
let filterJson: Record<string, any> = {};
try {
@@ -161,5 +165,56 @@ export default function useOptions() {
return result;
}
return { ruleVerification };
/**保存网元下所有配置为示例配置 */
function ptSaveConfig(neType: string) {
ptSaveAsDefault(neType, '001').then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.operateOk'),
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
});
}
/**重置网元下所有配置 */
function ptResetConfig(neType: string) {
ptResetAsDefault(neType).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.operateOk'),
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
});
}
/**配置下方应用申请和撤回 */
function ptConfigApply(neType: string, status: string) {
stuPtNeConfigApply({ neType, status }).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.operateOk'),
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
});
}
return { ruleVerification, ptSaveConfig, ptResetConfig, ptConfigApply };
}

View File

@@ -1,4 +1,4 @@
import { getParamConfigInfo } from '@/api/configManage/configParam';
import { getNeConfigData } from '@/api/ne/neConfig';
import { ref } from 'vue';
export default function useSMFOptions() {
@@ -7,7 +7,11 @@ export default function useSMFOptions() {
/**初始加载upfId */
function initUPFIds() {
getParamConfigInfo('smf', 'upfConfig', '001').then(res => {
getNeConfigData({
neType: 'SMF',
neId: '001',
paramName: 'upfConfig',
}).then(res => {
optionsUPFIds.value = [];
for (const s of res.data) {
optionsUPFIds.value.push({