feat: MML网元操作支持区分接口类型
This commit is contained in:
@@ -30,17 +30,19 @@ export async function getMMLByNE(neType: string) {
|
||||
* 发送网元的mml命令
|
||||
* @param neType 网元类型
|
||||
* @param neId 网元ID
|
||||
* @param objectType 接口类型
|
||||
* @param cmdStr 命令串
|
||||
* @returns
|
||||
*/
|
||||
export async function sendMMlByNE(
|
||||
neType: string,
|
||||
neId: string,
|
||||
objectType: string,
|
||||
cmdArr: string[]
|
||||
) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/operationManagement/v1/elementType/${neType}/objectType/mml?ne_id=${neId}`,
|
||||
url: `/api/rest/operationManagement/v1/elementType/${neType}/objectType/${objectType}?ne_id=${neId}`,
|
||||
method: 'post',
|
||||
data: { mml: cmdArr },
|
||||
timeout: 180_000,
|
||||
|
||||
@@ -48,6 +48,7 @@ let state: StateType = reactive({
|
||||
key: '',
|
||||
operation: '',
|
||||
object: '',
|
||||
objectType: 'mml',
|
||||
param: [],
|
||||
},
|
||||
from: {
|
||||
@@ -102,6 +103,7 @@ function fnCleanFrom() {
|
||||
key: '',
|
||||
operation: '',
|
||||
object: '',
|
||||
objectType: 'mml',
|
||||
param: [],
|
||||
};
|
||||
state.from = {};
|
||||
@@ -114,14 +116,12 @@ function fnSendMML() {
|
||||
}
|
||||
|
||||
let cmdArr: string[] = [];
|
||||
const operation = state.mmlSelect.operation;
|
||||
const object = state.mmlSelect.object;
|
||||
const { operation, object, objectType, param } = state.mmlSelect;
|
||||
// 根据参数取值
|
||||
let argsArr: string[] = [];
|
||||
const param = toRaw(state.mmlSelect.param) || [];
|
||||
if (operation && Array.isArray(param)) {
|
||||
const from = toRaw(state.from);
|
||||
for (const item of param) {
|
||||
for (const item of toRaw(param)) {
|
||||
const value = from[item.name];
|
||||
|
||||
// 是否必填项且有效值
|
||||
@@ -175,7 +175,7 @@ function fnSendMML() {
|
||||
// 发送
|
||||
state.from.sendLoading = true;
|
||||
const [neType, neId] = state.neType;
|
||||
sendMMlByNE(neType, neId, cmdArr)
|
||||
sendMMlByNE(neType, neId, objectType, cmdArr)
|
||||
.then(res => {
|
||||
state.from.sendLoading = false;
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
@@ -333,6 +333,7 @@ function fnNeChange(keys: any, _: any) {
|
||||
key: '',
|
||||
operation: '',
|
||||
object: '',
|
||||
objectType: 'mml',
|
||||
param: {},
|
||||
};
|
||||
fnGetList();
|
||||
@@ -352,6 +353,7 @@ function fnGetList() {
|
||||
for (const item of res.data) {
|
||||
const id = item['id'];
|
||||
const object = item['object'];
|
||||
const objectType = item['objectType'];
|
||||
const operation = item['operation'];
|
||||
const mmlDisplay = item['mmlDisplay'];
|
||||
// 可选属性参数
|
||||
@@ -370,20 +372,37 @@ function fnGetList() {
|
||||
key: item['category'],
|
||||
selectable: false,
|
||||
children: [
|
||||
{ key: id, title: mmlDisplay, object, operation, param },
|
||||
{
|
||||
key: id,
|
||||
title: mmlDisplay,
|
||||
object,
|
||||
objectType,
|
||||
operation,
|
||||
param,
|
||||
},
|
||||
],
|
||||
});
|
||||
autoCompleteArr.push({
|
||||
value: item['catDisplay'],
|
||||
key: item['category'],
|
||||
selectable: false,
|
||||
options: [{ key: id, value: mmlDisplay, object, operation, param }],
|
||||
options: [
|
||||
{
|
||||
key: id,
|
||||
value: mmlDisplay,
|
||||
object,
|
||||
objectType,
|
||||
operation,
|
||||
param,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
treeArr[treeItemIndex].children.push({
|
||||
key: id,
|
||||
title: mmlDisplay,
|
||||
object,
|
||||
objectType,
|
||||
operation,
|
||||
param,
|
||||
});
|
||||
@@ -391,6 +410,7 @@ function fnGetList() {
|
||||
key: id,
|
||||
value: mmlDisplay,
|
||||
object,
|
||||
objectType,
|
||||
operation,
|
||||
param,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user