feat: 调整MML命令请求接口

This commit is contained in:
TsMask
2025-07-15 19:50:09 +08:00
parent 3eae546aa4
commit 27b2cfb449
4 changed files with 39 additions and 55 deletions

View File

@@ -1,6 +1,4 @@
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
/**
* 查询网元可用cmd命令
@@ -8,22 +6,17 @@ import { parseObjLineToHump } from '@/utils/parse-utils';
* @returns object
*/
export async function getMMLByNE(neType: string) {
// 发起请求
const result = await request({
url: `/api/rest/databaseManagement/v1/elementType/omc_db/objectType/mml_system`,
return request({
url: '/tool/mml/system/list',
method: 'GET',
params: {
SQL: `select * from mml_system where ne_type = '${neType}' and status = 'Active'`,
neType: neType,
status: 'Active',
pageNum: 1,
pageSize: 1000,
},
timeout: 60_000,
});
// 解析数据
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
let data = result.data.data[0];
return Object.assign(result, {
data: parseObjLineToHump(data['mml_system']),
});
}
return result;
}
/**
@@ -40,16 +33,15 @@ export async function sendMMlByNE(
objectType: string,
cmdArr: string[]
) {
// 发起请求
const result = await request({
url: `/api/rest/operationManagement/v1/elementType/${neType}/objectType/${objectType}?ne_id=${neId}`,
return request({
url: '/tool/mml/command',
method: 'POST',
data: { mml: cmdArr },
data: {
neType: neType,
neId: neId,
type: objectType,
command: cmdArr,
},
timeout: 180_000,
});
// 解析数据
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
result.data = result.data.data;
}
return result;
}

View File

@@ -1,28 +1,21 @@
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
/**
* 查询UDM可用cmd命令
* @returns object
*/
export async function getMMLByUDM() {
// 发起请求
const result = await request({
url: `/api/rest/databaseManagement/v1/elementType/omc_db/objectType/mml_subscriber`,
return request({
url: '/tool/mml/subscriber/list',
method: 'GET',
params: {
SQL: `select * from mml_subscriber where ne_type = 'UDM' and status = 'Active'`,
neType: 'UDM',
status: 'Active',
pageNum: 1,
pageSize: 1000,
},
timeout: 60_000,
});
// 解析数据
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
let data = result.data.data[0];
return Object.assign(result, {
data: parseObjLineToHump(data['mml_subscriber']),
});
}
return result;
}
/**
@@ -32,16 +25,15 @@ export async function getMMLByUDM() {
* @returns
*/
export async function sendMMlByUDM(neId: string, cmdArr: string[]) {
// 发起请求
const result = await request({
url: `/api/rest/operationManagement/v1/elementType/UDM/objectType/mml?ne_id=${neId}`,
return request({
url: '/tool/mml/command',
method: 'POST',
data: { mml: cmdArr },
data: {
neType: 'UDM',
neId: neId,
type: 'General',
command: cmdArr,
},
timeout: 180_000,
});
// 解析数据
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
result.data = result.data.data;
}
return result;
}

View File

@@ -48,7 +48,7 @@ let state: StateType = reactive({
key: '',
operation: '',
object: '',
objectType: 'mml',
objectType: 'General',
param: [],
},
from: {
@@ -103,7 +103,7 @@ function fnCleanFrom() {
key: '',
operation: '',
object: '',
objectType: 'mml',
objectType: 'General',
param: [],
};
state.from = {};
@@ -342,7 +342,7 @@ function fnNeChange(keys: any, _: any) {
key: '',
operation: '',
object: '',
objectType: 'mml',
objectType: 'General',
param: {},
};
fnGetList();
@@ -354,12 +354,12 @@ function fnGetList() {
const neType = state.neType[0];
state.mmlNeType = neType;
getMMLByNE(neType).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
// 构建自动完成筛选结构
const autoCompleteArr: Record<string, any>[] = [];
// 构建树结构
const treeArr: Record<string, any>[] = [];
for (const item of res.data) {
for (const item of res.data.rows) {
const id = item['id'];
const object = item['object'];
const objectType = item['objectType'];
@@ -680,10 +680,10 @@ onMounted(() => {
v-model:value="state.mmlSelect.objectType"
style="width: 20%"
>
<a-select-option value="mml">
<a-select-option value="General">
{{ t('views.mmlManage.neOperate.mml') }}
</a-select-option>
<a-select-option value="mml2">
<a-select-option value="Standard">
{{ t('views.mmlManage.neOperate.mml2') }}
</a-select-option>
</a-select>

View File

@@ -342,12 +342,12 @@ function ruleVerification(
/**查询可选命令列表 */
function fnGetList() {
getMMLByUDM().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
// 构建自动完成筛选结构
const autoCompleteArr: Record<string, any>[] = [];
// 构建树结构
const treeArr: Record<string, any>[] = [];
for (const item of res.data) {
for (const item of res.data.rows) {
const id = item['id'];
const object = item['object'];
const operation = item['operation'];