diff --git a/src/api/pt/neConfig.ts b/src/api/pt/neConfig.ts new file mode 100644 index 00000000..a43a8016 --- /dev/null +++ b/src/api/pt/neConfig.ts @@ -0,0 +1,79 @@ +import { request } from '@/plugins/http-fetch'; + +/** + * 保存为示例配置 (仅管理员操作) + * @param query 查询参数 + * @returns object + */ +export function ptSaveAsDefault(neType: string, neid: string) { + return request({ + url: `/pt/neConfigData/saveAsDefault`, + method: 'post', + data: { neType, neid }, + }); +} + +/** + * 重置为示例配置 (仅学生/教师操作) + * @param query 查询参数 + * @returns object + */ +export function ptResetAsDefault(neType: string) { + return request({ + url: `/pt/neConfigData/resetAsDefault`, + method: 'post', + data: { neType }, + }); +} + +/** + * 网元参数配置信息 + * @param params 数据 {neType,paramName} + * @returns object + */ +export function getPtNeConfigData(params: Record) { + return request({ + url: `/pt/neConfigData`, + params, + method: 'get', + }); +} + +/** + * 网元参数配置数据更新 + * @param data 数据 {neType,paramName:"参数名",paramData:{参数},loc:"层级index仅array"} + * @returns object + */ +export function editPtNeConfigData(data: Record) { + return request({ + url: `/pt/neConfigData`, + method: 'put', + data: data, + }); +} + +/** + * 网元参数配置新增(array) + * @param data 数据 {neType,paramName:"参数名",paramData:{参数},loc:"层级index"} + * @returns object + */ +export function addPtNeConfigData(data: Record) { + return request({ + url: `/pt/neConfigData`, + method: 'post', + data: data, + }); +} + +/** + * 网元参数配置删除(array) + * @param params 数据 {neType,paramName:"参数名",loc:"层级index"} + * @returns object + */ +export function delPtNeConfigData(params: Record) { + return request({ + url: `/pt/neConfigData`, + method: 'delete', + params, + }); +} diff --git a/src/api/pt/neConfigApply.ts b/src/api/pt/neConfigApply.ts new file mode 100644 index 00000000..6abf7368 --- /dev/null +++ b/src/api/pt/neConfigApply.ts @@ -0,0 +1,43 @@ +import { request } from '@/plugins/http-fetch'; + + +/** + * 网元参数配置应用申请信息 + * @param params 数据 {neType,paramName} + * @returns object + */ +export function getPtNeConfigApply(params: Record) { + return request({ + url: `/pt/neConfigApply`, + params, + method: 'get', + }); +} + +/** + * 网元参数配置应用申请提交(仅学生操作) + * @param data 数据 { "neType": "MME", "status": "1" } + * @returns object + */ +export function stuPtNeConfigApply(data: Record) { + return request({ + url: `/pt/neConfigApply`, + method: 'post', + data: data, + }); +} + +/** + * 网元参数配置应用申请状态变更(仅管理员/教师操作) + * @param data 数据 { "applyId": "1", "neType": "MME", "status": "3", "backInfo": "sgw参数错误" } + * @returns object + */ +export function updatePtNeConfigApply(data: Record) { + return request({ + url: `/pt/neConfigApply`, + method: 'put', + data: data, + }); +} + + \ No newline at end of file diff --git a/src/views/configManage/configParamTreeTable/hooks/useOptions.ts b/src/views/configManage/configParamTreeTable/hooks/useOptions.ts index 3c5fce98..cc3ab5b0 100644 --- a/src/views/configManage/configParamTreeTable/hooks/useOptions.ts +++ b/src/views/configManage/configParamTreeTable/hooks/useOptions.ts @@ -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 = {}; 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 }; } diff --git a/src/views/configManage/configParamTreeTable/hooks/useSMFOptions.ts b/src/views/configManage/configParamTreeTable/hooks/useSMFOptions.ts index 2a020cfe..e10cc9e3 100644 --- a/src/views/configManage/configParamTreeTable/hooks/useSMFOptions.ts +++ b/src/views/configManage/configParamTreeTable/hooks/useSMFOptions.ts @@ -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({