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,
|
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 { ColumnsType } from 'ant-design-vue/es/table';
|
||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
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';
|
import useI18n from '@/hooks/useI18n';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ let queryRangePicker = ref<[string, string]>(['', '']);
|
|||||||
/**查询参数 */
|
/**查询参数 */
|
||||||
let queryParams = reactive({
|
let queryParams = reactive({
|
||||||
/**登录账号 */
|
/**登录账号 */
|
||||||
accountName: '',
|
user: '',
|
||||||
/**记录时间 */
|
/**记录时间 */
|
||||||
beginTime: '',
|
beginTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
@@ -105,8 +105,8 @@ let tableColumns: ColumnsType = reactive([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.logManage.mml.MML'),
|
title: t('views.logManage.mml.MML'),
|
||||||
dataIndex: 'mml',
|
dataIndex: 'command',
|
||||||
key: 'mml',
|
key: 'command',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
},
|
},
|
||||||
@@ -157,8 +157,8 @@ function fnGetList(pageNum?: number) {
|
|||||||
}
|
}
|
||||||
queryParams.beginTime = queryRangePicker.value[0];
|
queryParams.beginTime = queryRangePicker.value[0];
|
||||||
queryParams.endTime = queryRangePicker.value[1];
|
queryParams.endTime = queryRangePicker.value[1];
|
||||||
listMML(toRaw(queryParams)).then(res => {
|
mmlLogList(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
const { total, rows } = res.data;
|
const { total, rows } = res.data;
|
||||||
tablePagination.total = total;
|
tablePagination.total = total;
|
||||||
tableState.data = rows;
|
tableState.data = rows;
|
||||||
@@ -192,13 +192,11 @@ onMounted(() => {
|
|||||||
<a-form :model="queryParams" name="queryParams" layout="horizontal">
|
<a-form :model="queryParams" name="queryParams" layout="horizontal">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :lg="6" :md="12" :xs="24">
|
<a-col :lg="6" :md="12" :xs="24">
|
||||||
<a-form-item
|
<a-form-item :label="t('views.logManage.mml.account')" name="user">
|
||||||
:label="t('views.logManage.mml.account')"
|
|
||||||
name="accountName"
|
|
||||||
>
|
|
||||||
<a-input
|
<a-input
|
||||||
v-model:value="queryParams.accountName"
|
v-model:value="queryParams.user"
|
||||||
:allow-clear="true"
|
:allow-clear="true"
|
||||||
|
:placeholder="t('common.inputPlease')"
|
||||||
></a-input>
|
></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|||||||
Reference in New Issue
Block a user