fix: MML日志列表显示
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { request } from '@/plugins/http-fetch';
|
||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
||||
|
||||
/**
|
||||
* 查询日志列表
|
||||
* @param query 查询参数
|
||||
* @returns object
|
||||
*/
|
||||
export async function listMML(query: Record<string, any>) {
|
||||
let totalSQL = 'select count(*) as total from mml_log where 1=1 ';
|
||||
let rowsSQL = 'select * from mml_log where 1=1 ';
|
||||
|
||||
// 查询
|
||||
let querySQL = '';
|
||||
if (query.accountName) {
|
||||
querySQL += ` and user like '%${query.accountName}%' `;
|
||||
}
|
||||
if (query.beginTime) {
|
||||
querySQL += ` and log_time >= '${query.beginTime}' `;
|
||||
}
|
||||
if (query.endTime) {
|
||||
querySQL += ` and log_time <= '${query.endTime}' `;
|
||||
}
|
||||
|
||||
// 排序
|
||||
let sortSql = ' order by log_time ';
|
||||
if (query.sortOrder === 'asc') {
|
||||
sortSql += ' asc ';
|
||||
} else {
|
||||
sortSql += ' desc ';
|
||||
}
|
||||
|
||||
// 分页
|
||||
const pageNum = (query.pageNum - 1) * query.pageSize;
|
||||
const limtSql = ` limit ${pageNum},${query.pageSize} `;
|
||||
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/mml_log`,
|
||||
method: 'GET',
|
||||
params: {
|
||||
totalSQL: totalSQL + querySQL,
|
||||
rowsSQL: rowsSQL + querySQL + sortSql + limtSql,
|
||||
},
|
||||
});
|
||||
|
||||
// 解析数据
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data = {
|
||||
data: { total: 0, rows: [] as any },
|
||||
code: result.code,
|
||||
msg: result.msg,
|
||||
};
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['mml_log'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.data.total = itemData[0]['total'];
|
||||
} else {
|
||||
data.data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
}
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -14,3 +14,12 @@ export function updateNeConfigReload(neType: string, neId: string) {
|
||||
timeout: 180_000,
|
||||
});
|
||||
}
|
||||
|
||||
// MMML日志列表
|
||||
export function mmlLogList(query: Record<string, any>) {
|
||||
return request({
|
||||
url: '/tool/mml/log/list',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MenuInfo } from 'ant-design-vue/es/menu/src/interface';
|
||||
import { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { listMML } from '@/api/logManage/mml';
|
||||
import { mmlLogList } from '@/api/tool/mml';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -16,7 +16,7 @@ let queryRangePicker = ref<[string, string]>(['', '']);
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
/**登录账号 */
|
||||
accountName: '',
|
||||
user: '',
|
||||
/**记录时间 */
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
@@ -105,8 +105,8 @@ let tableColumns: ColumnsType = reactive([
|
||||
},
|
||||
{
|
||||
title: t('views.logManage.mml.MML'),
|
||||
dataIndex: 'mml',
|
||||
key: 'mml',
|
||||
dataIndex: 'command',
|
||||
key: 'command',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
},
|
||||
@@ -157,8 +157,8 @@ function fnGetList(pageNum?: number) {
|
||||
}
|
||||
queryParams.beginTime = queryRangePicker.value[0];
|
||||
queryParams.endTime = queryRangePicker.value[1];
|
||||
listMML(toRaw(queryParams)).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
mmlLogList(toRaw(queryParams)).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const { total, rows } = res.data;
|
||||
tablePagination.total = total;
|
||||
tableState.data = rows;
|
||||
@@ -192,13 +192,11 @@ onMounted(() => {
|
||||
<a-form :model="queryParams" name="queryParams" layout="horizontal">
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
:label="t('views.logManage.mml.account')"
|
||||
name="accountName"
|
||||
>
|
||||
<a-form-item :label="t('views.logManage.mml.account')" name="user">
|
||||
<a-input
|
||||
v-model:value="queryParams.accountName"
|
||||
v-model:value="queryParams.user"
|
||||
:allow-clear="true"
|
||||
:placeholder="t('common.inputPlease')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -294,7 +292,7 @@ onMounted(() => {
|
||||
:loading="tableState.loading"
|
||||
:data-source="tableState.data"
|
||||
:size="tableState.size"
|
||||
:pagination="tablePagination"
|
||||
:pagination="tablePagination"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<!-- <template v-if="column.key === 'mml'">
|
||||
|
||||
Reference in New Issue
Block a user