fix: 操作日志查询类型
This commit is contained in:
@@ -16,6 +16,9 @@ export async function listOperationLog(query: Record<string, any>) {
|
||||
if (query.accountName) {
|
||||
querySQL += ` and account_name like '%${query.accountName}%' `;
|
||||
}
|
||||
if (query.opType) {
|
||||
querySQL += ` and op_type = '${query.opType}' `;
|
||||
}
|
||||
if (query.beginTime) {
|
||||
querySQL += ` and begin_time >= '${query.beginTime}' `;
|
||||
}
|
||||
|
||||
@@ -8,17 +8,29 @@ import { ColumnsType } from 'ant-design-vue/lib/table';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { listOperationLog } from '@/api/logManage/operation';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { getDict } = useDictStore();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
/**路由标题 */
|
||||
let title = ref<string>((route.meta.title as string) ?? '标题');
|
||||
|
||||
/**字典数据 */
|
||||
let dict: {
|
||||
/**操作日志操作类型 */
|
||||
operationLogType: DictType[];
|
||||
} = reactive({
|
||||
operationLogType: [],
|
||||
});
|
||||
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
/**登录账号 */
|
||||
accountName: '',
|
||||
/**操作类型 */
|
||||
opType: undefined,
|
||||
/**记录时间 */
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
@@ -32,8 +44,9 @@ let queryParams = reactive({
|
||||
function fnQueryReset() {
|
||||
queryParams = Object.assign(queryParams, {
|
||||
accountName: '',
|
||||
opType: undefined,
|
||||
beginTime: '',
|
||||
endTime: undefined,
|
||||
endTime: '',
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
});
|
||||
@@ -92,6 +105,7 @@ let tableColumns: ColumnsType = [
|
||||
{
|
||||
title: '操作类型',
|
||||
dataIndex: 'opType',
|
||||
key: 'opType',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
@@ -181,6 +195,12 @@ function fnGetList() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 初始字典数据
|
||||
Promise.allSettled([getDict('operation_log_type')]).then(resArr => {
|
||||
if (resArr[0].status === 'fulfilled') {
|
||||
dict.operationLogType = resArr[0].value;
|
||||
}
|
||||
});
|
||||
// 获取列表数据
|
||||
fnGetList();
|
||||
});
|
||||
@@ -205,6 +225,17 @@ onMounted(() => {
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item label="操作类型" name="opType">
|
||||
<a-select
|
||||
v-model:value="queryParams.opType"
|
||||
allow-clear
|
||||
placeholder="请选择操作类型"
|
||||
:options="dict.operationLogType"
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item label="开始时间" name="beginTime">
|
||||
<a-date-picker
|
||||
@@ -213,6 +244,7 @@ onMounted(() => {
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="查询结束时间"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -224,6 +256,7 @@ onMounted(() => {
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="查询结束时间"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -306,6 +339,11 @@ onMounted(() => {
|
||||
:pagination="tablePagination"
|
||||
:scroll="{ x: true }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'opType'">
|
||||
<DictTag :options="dict.operationLogType" :value="record.opType" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</PageContainer>
|
||||
|
||||
Reference in New Issue
Block a user