style: 字段调整
This commit is contained in:
@@ -33,117 +33,31 @@ export async function getParamConfigTopTab(neType : string ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询网元列表
|
||||
* @param query 查询参数
|
||||
* 查询配置参数标签栏
|
||||
* @param neType 网元类型
|
||||
* @returns object
|
||||
*/
|
||||
export async function listNeInfo(query: Record<string, any>) {
|
||||
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<string, any>) {
|
||||
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<string, any>) {
|
||||
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<string, any>) {
|
||||
return request({
|
||||
url: `/systemManagement/v1/elementType/${data.neType}/objectType/neInfo?ne_id=${data.neId}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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(() => {
|
||||
<template #icon><PlusOutlined /></template>
|
||||
{{ t('common.addText') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click.prevent="fnModalVisible('edit')">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
获取
|
||||
</a-button>
|
||||
<a-button type="primary" @click.prevent="fnModalVisible('edit')">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
修改
|
||||
</a-button>
|
||||
<a-button type="primary" @click.prevent="fnModalVisible('update')">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
提交
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<CodemirrorEdite
|
||||
v-model:value="paramState.newArea"
|
||||
:disabled="!paramState.visibleByEdit"
|
||||
></CodemirrorEdite>
|
||||
|
||||
<CodemirrorEditeDiff
|
||||
v-model:visible="paramState.visibleByUpdate"
|
||||
:title="paramState.title"
|
||||
:new-area="paramState.newArea"
|
||||
:old-area="paramState.oldArea"
|
||||
></CodemirrorEditeDiff>
|
||||
|
||||
<a-tabs
|
||||
v-model:activeKey="tabState.tabActiveKey"
|
||||
:tab-position="tabState.tabPosition"
|
||||
|
||||
@@ -229,7 +229,7 @@ type ModalStateType = {
|
||||
/**新增框或修改框是否显示 */
|
||||
visibleByEdit: boolean;
|
||||
/**网元版本历史框是否显示 */
|
||||
visibleByhistory: boolean;
|
||||
visibleByHistory: boolean;
|
||||
/**标题 */
|
||||
title: string;
|
||||
/**表单数据 */
|
||||
@@ -241,7 +241,7 @@ type ModalStateType = {
|
||||
/**对话框对象信息状态 */
|
||||
let modalState: ModalStateType = reactive({
|
||||
visibleByEdit: false,
|
||||
visibleByhistory: false,
|
||||
visibleByHistory: false,
|
||||
title: '任务设置',
|
||||
from: {
|
||||
neType: '',
|
||||
@@ -331,7 +331,7 @@ function fnModalCancel() {
|
||||
* 对话框弹出显示为 网元版本信息
|
||||
*/
|
||||
function fnModalVisibleByHistory() {
|
||||
modalState.visibleByhistory = true;
|
||||
modalState.visibleByHistory = true;
|
||||
}
|
||||
|
||||
/**上传前检查或转换压缩 */
|
||||
@@ -649,7 +649,7 @@ onMounted(() => {
|
||||
<!-- 分配用户选择框 -->
|
||||
<SoftwareHistory
|
||||
title="查询网元版本信息"
|
||||
v-model:visible="modalState.visibleByhistory"
|
||||
v-model:visible="modalState.visibleByHistory"
|
||||
@ok="fnModalOk"
|
||||
/>
|
||||
</PageContainer>
|
||||
|
||||
Reference in New Issue
Block a user