diff --git a/src/api/log.ts b/src/api/log.ts deleted file mode 100644 index b5dea7f7..00000000 --- a/src/api/log.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { request } from '@/plugins/http-fetch'; - -type OperationLogType = { - account_name: string; - account_type: string; //type:int - op_ip: string; - subsys_tag: string; - op_type: string; - op_content: string; - op_result: string; - begin_time: string; - end_time: string; - vnf_flag: string; //0-物理设备 1-虚拟化设备 -}; - -/** - * 操作日志 - * @returns object - */ -export function operationLog(opt: OperationLogType) { - return request({ - url: '/databaseManagement/v1/insert/omc_db/operation_log', - method: 'post', - data: [opt], - }); -} diff --git a/src/api/mmlManage/mmlSet.ts b/src/api/mmlManage/mmlSet.ts new file mode 100644 index 00000000..2e0ccc07 --- /dev/null +++ b/src/api/mmlManage/mmlSet.ts @@ -0,0 +1,63 @@ +import { + RESULT_CODE_ERROR, + RESULT_CODE_SUCCESS, + RESULT_MSG_ERROR, + RESULT_MSG_SUCCESS, +} from '@/constants/result-constants'; +import { request } from '@/plugins/http-fetch'; +import { parseObjLineToHump } from '@/utils/parse-utils'; + +/** + * 查询操作维护接口设置 + * @param tag 配置ID + * @returns object + */ +export async function getOperationSet() { + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/omc_db/config`, + method: 'get', + params: { + SQL: `SELECT * FROM config WHERE config_tag = 'operationSet'`, + }, + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) { + let data = result.data.data[0]; + const v = parseObjLineToHump(data['config'][0]); + let vJSON = {}; + try { + vJSON = JSON.parse(v.valueJson); + } catch (error) { + console.error(error); + } + return Object.assign(result, { + data: vJSON, + }); + } + return result; +} + +/** + * 修改操作维护接口设置 + * @param data 配置对象 + * @returns object + */ +export async function updateOperationSet(data: Record) { + const result = await request({ + url: `/databaseManagement/v1/omc_db/config?WHERE=config_tag='operationSet'`, + method: 'put', + data: { data: { value_json: JSON.stringify(data) } }, + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; +} diff --git a/src/views/mmlManage/mmlSet/index.vue b/src/views/mmlManage/mmlSet/index.vue index d62c2c8f..18cec0a0 100644 --- a/src/views/mmlManage/mmlSet/index.vue +++ b/src/views/mmlManage/mmlSet/index.vue @@ -1,536 +1,153 @@