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 { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
/** /**
* 查询网元可用cmd命令 * 查询网元可用cmd命令
@@ -8,22 +6,17 @@ import { parseObjLineToHump } from '@/utils/parse-utils';
* @returns object * @returns object
*/ */
export async function getMMLByNE(neType: string) { export async function getMMLByNE(neType: string) {
// 发起请求 return request({
const result = await request({ url: '/tool/mml/system/list',
url: `/api/rest/databaseManagement/v1/elementType/omc_db/objectType/mml_system`,
method: 'GET', method: 'GET',
params: { 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, objectType: string,
cmdArr: string[] cmdArr: string[]
) { ) {
// 发起请求 return request({
const result = await request({ url: '/tool/mml/command',
url: `/api/rest/operationManagement/v1/elementType/${neType}/objectType/${objectType}?ne_id=${neId}`,
method: 'POST', method: 'POST',
data: { mml: cmdArr }, data: {
neType: neType,
neId: neId,
type: objectType,
command: cmdArr,
},
timeout: 180_000, 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 { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
/** /**
* 查询UDM可用cmd命令 * 查询UDM可用cmd命令
* @returns object * @returns object
*/ */
export async function getMMLByUDM() { export async function getMMLByUDM() {
// 发起请求 return request({
const result = await request({ url: '/tool/mml/subscriber/list',
url: `/api/rest/databaseManagement/v1/elementType/omc_db/objectType/mml_subscriber`,
method: 'GET', method: 'GET',
params: { 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 * @returns
*/ */
export async function sendMMlByUDM(neId: string, cmdArr: string[]) { export async function sendMMlByUDM(neId: string, cmdArr: string[]) {
// 发起请求 return request({
const result = await request({ url: '/tool/mml/command',
url: `/api/rest/operationManagement/v1/elementType/UDM/objectType/mml?ne_id=${neId}`,
method: 'POST', method: 'POST',
data: { mml: cmdArr }, data: {
neType: 'UDM',
neId: neId,
type: 'General',
command: cmdArr,
},
timeout: 180_000, 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: '', key: '',
operation: '', operation: '',
object: '', object: '',
objectType: 'mml', objectType: 'General',
param: [], param: [],
}, },
from: { from: {
@@ -103,7 +103,7 @@ function fnCleanFrom() {
key: '', key: '',
operation: '', operation: '',
object: '', object: '',
objectType: 'mml', objectType: 'General',
param: [], param: [],
}; };
state.from = {}; state.from = {};
@@ -342,7 +342,7 @@ function fnNeChange(keys: any, _: any) {
key: '', key: '',
operation: '', operation: '',
object: '', object: '',
objectType: 'mml', objectType: 'General',
param: {}, param: {},
}; };
fnGetList(); fnGetList();
@@ -354,12 +354,12 @@ function fnGetList() {
const neType = state.neType[0]; const neType = state.neType[0];
state.mmlNeType = neType; state.mmlNeType = neType;
getMMLByNE(neType).then(res => { getMMLByNE(neType).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
// 构建自动完成筛选结构 // 构建自动完成筛选结构
const autoCompleteArr: Record<string, any>[] = []; const autoCompleteArr: Record<string, any>[] = [];
// 构建树结构 // 构建树结构
const treeArr: 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 id = item['id'];
const object = item['object']; const object = item['object'];
const objectType = item['objectType']; const objectType = item['objectType'];
@@ -680,10 +680,10 @@ onMounted(() => {
v-model:value="state.mmlSelect.objectType" v-model:value="state.mmlSelect.objectType"
style="width: 20%" style="width: 20%"
> >
<a-select-option value="mml"> <a-select-option value="General">
{{ t('views.mmlManage.neOperate.mml') }} {{ t('views.mmlManage.neOperate.mml') }}
</a-select-option> </a-select-option>
<a-select-option value="mml2"> <a-select-option value="Standard">
{{ t('views.mmlManage.neOperate.mml2') }} {{ t('views.mmlManage.neOperate.mml2') }}
</a-select-option> </a-select-option>
</a-select> </a-select>

View File

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