refactor: 系统日志默认查询近 7 天日志数据

This commit is contained in:
2024-04-22 20:57:26 +08:00
parent 81194dbb52
commit 2ddd900121
5 changed files with 22 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ export interface LogQuery {
module?: string
ip?: string
createUserString?: string
createTime?: string
createTime: Array<string>
status?: number
sort: Array<string>
}

View File

@@ -13,6 +13,8 @@
import type { ShortcutType } from '@arco-design/web-vue'
import dayjs from 'dayjs'
defineOptions({ name: 'DateRangePicker' })
defineProps({
format: {
type: String,
@@ -57,10 +59,4 @@ const shortcuts = computed<ShortcutType[]>(() => {
})
</script>
<script lang="ts">
export default {
name: 'DateRangePicker'
}
</script>
<style scoped lang="less"></style>

View File

@@ -49,6 +49,7 @@ import { exportLoginLog, listLog } from '@/apis'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import DateRangePicker from '@/components/DateRangePicker/index.vue'
import { useTable, useDownload } from '@/hooks'
import dayjs from 'dayjs'
defineOptions({ name: 'LoginLog' })
@@ -93,7 +94,10 @@ const queryForm = reactive({
module: '登录',
ip: undefined,
createUserString: undefined,
createTime: undefined,
createTime: [
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
],
status: undefined,
sort: ['createTime,desc']
})
@@ -109,7 +113,10 @@ const {
const reset = () => {
queryForm.ip = undefined
queryForm.createUserString = undefined
queryForm.createTime = undefined
queryForm.createTime = [
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
]
queryForm.status = undefined
search()
}

View File

@@ -61,6 +61,7 @@ import type { TableInstanceColumns } from '@/components/GiTable/type'
import DateRangePicker from '@/components/DateRangePicker/index.vue'
import OperationLogDetailDrawer from './OperationLogDetailDrawer.vue'
import { useTable, useDownload } from '@/hooks'
import dayjs from 'dayjs'
defineOptions({ name: 'OperationLog' })
@@ -105,7 +106,10 @@ const queryForm = reactive({
description: undefined,
ip: undefined,
createUserString: undefined,
createTime: undefined,
createTime: [
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
],
status: undefined,
sort: ['createTime,desc']
})
@@ -122,7 +126,10 @@ const reset = () => {
queryForm.description = undefined
queryForm.ip = undefined
queryForm.createUserString = undefined
queryForm.createTime = undefined
queryForm.createTime = [
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
]
queryForm.status = undefined
search()
}

View File

@@ -21,7 +21,7 @@
<a-input v-model="form.moduleName" placeholder="项目模块名称例如continew-admin-system" />
</a-form-item>
<a-form-item label="模块包名" field="packageName">
<a-input v-model="form.packageName" placeholder="项目模块包名例如top.charles7c.continew.admin.system" />
<a-input v-model="form.packageName" placeholder="项目模块包名例如top.continew.admin.system" />
</a-form-item>
<a-form-item label="去表前缀" field="tablePrefix">
<a-input v-model="form.tablePrefix" placeholder="数据库表前缀例如sys_" />