diff --git a/src/api/configManage/configParam.ts b/src/api/configManage/configParam.ts index cd2fee16..22735f9a 100644 --- a/src/api/configManage/configParam.ts +++ b/src/api/configManage/configParam.ts @@ -33,117 +33,31 @@ export async function getParamConfigTopTab(neType : string ) { } /** - * 查询网元列表 - * @param query 查询参数 + * 查询配置参数标签栏 + * @param neType 网元类型 * @returns object */ -export async function listNeInfo(query: Record) { - let totalSQL = 'select count(*) as total from ne_info where status=0 '; - let rowsSQL = 'select * from ne_info where status=0 '; - - // 查询 - let querySQL = ''; - if (query.neType) { - querySQL += ` and ne_type = '${query.neType}' `; - } - - // 分页 - const pageNum = query.pageNum - 1; - const limtSql = ` limit ${pageNum},${query.pageSize} `; - +export async function getParamConfigInfo(neType : string ) { // 发起请求 const result = await request({ - url: `/databaseManagement/v1/select/omc_db/ne_info`, + url: `/databaseManagement/v1/elementType/omc_db/objectType/param_config`, method: 'get', params: { - totalSQL: totalSQL + querySQL, - rowsSQL: rowsSQL + querySQL + limtSql, - }, - }); - - // 解析数据 - if (result.code === RESULT_CODE_SUCCESS) { - const data: DataList = { - total: 0, - rows: [], - code: result.code, - msg: result.msg, - }; - result.data.data.forEach((item: any) => { - const itemData = item['ne_info']; - if (Array.isArray(itemData)) { - if (itemData.length === 1 && itemData[0]['total']) { - data.total = itemData[0]['total']; - } else { - data.rows = itemData.map(v => parseObjLineToHump(v)); - } - } - }); - return data; - } - return result; -} - -/** - * 查询网元详细 - * @param menuId 网元ID - * @returns object - */ -export async function getNeInfo(id: string | number) { - // 发起请求 - const result = await request({ - url: `/databaseManagement/v1/select/omc_db/ne_info`, - method: 'get', - params: { - SQL: `select * from ne_info where status=0 and id = ${id}`, + SQL: `SELECT top_display,top_tag FROM param_config WHERE ne_type = '${neType}'`, }, }); // 解析数据 if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) { let data = result.data.data[0]; + data = data['param_config'] + if(Array.isArray(data)){ + return Object.assign(result, { + data: parseObjLineToHump(data), + }); + } return Object.assign(result, { - data: parseObjLineToHump(data['ne_info'][0]), + data: [], }); } return result; } - -/** - * 新增网元 - * @param data 网元对象 - * @returns object - */ -export function addNeInfo(data: Record) { - data.port = `${data.port}`; - return request({ - url: `/systemManagement/v1/elementType/${data.neType}/objectType/neInfo`, - method: 'post', - data: data, - }); -} - -/** - * 修改网元 - * @param data 网元对象 - * @returns object - */ -export function updateNeInfo(data: Record) { - data.port = `${data.port}`; - return request({ - url: `/systemManagement/v1/elementType/${data.neType}/objectType/neInfo`, - method: 'put', - data: data, - }); -} - -/** - * 删除网元 - * @param noticeId 网元ID - * @returns object - */ -export async function delNeInfo(data: Record) { - return request({ - url: `/systemManagement/v1/elementType/${data.neType}/objectType/neInfo?ne_id=${data.neId}`, - method: 'delete', - }); -} diff --git a/src/views/configManage/configParam/index.vue b/src/views/configManage/configParam/index.vue index af36ff81..c0d3cda5 100644 --- a/src/views/configManage/configParam/index.vue +++ b/src/views/configManage/configParam/index.vue @@ -8,6 +8,8 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { getParamConfigTopTab } from '@/api/configManage/configParam'; import { TabPosition } from 'ant-design-vue/lib/tabs/src/interface'; import useNeInfoStore from '@/store/modules/neinfo'; +import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue'; +import CodemirrorEditeDiff from '@/components/CodemirrorEditeDiff/index.vue'; const { t } = useI18n(); const route = useRoute(); @@ -20,6 +22,57 @@ let queryParams = reactive({ neType: [''], }); +/**参数对象信息状态类型 */ +type ParamStateType = { + /**进入编辑视图 */ + visibleByEdit: boolean; + /**更新比较视图 */ + visibleByUpdate: boolean; + /**标题 */ + title: string; + /**新内容 */ + newArea: string; + /**旧内容 */ + oldArea: string; +}; + +/**参数对象信息状态 */ +let paramState: ParamStateType = reactive({ + visibleByEdit: false, + visibleByUpdate: false, + title: '参数设置', + newArea: `database: + type: mysql + user: root + password: "root@1234" + host: "192.168.2.170" + port: 3306 + name: omc_db + backup: d:/local.git/ems.agt/restagent/database`, + oldArea: `database: + type: mysql + user: root + password: "root@1234" + host: "192.168.2.170" + port: 3306 + name: omc_db + backup: d:/local.git/ems.agt/restagent/database`, +}); + +/** + * 视图是否可编辑或更新 + * @param noticeId 网元id, 不传为新增 + */ +function fnModalVisible(type: 'edit' | 'update') { + if (type === 'edit') { + paramState.visibleByEdit = !paramState.visibleByEdit; + } + if (type === 'update') { + paramState.title = '比较参数'; + paramState.visibleByUpdate = true; + } +} + /**tab标签栏类型 */ type TabStateType = { /**标签项 */ @@ -127,9 +180,33 @@ onMounted(() => { {{ t('common.addText') }} + + + 获取 + + + + 修改 + + + + 提交 + + + + + {