17 changed files with 174 additions and 39 deletions
@ -1,3 +1,43 @@
|
||||
<template> |
||||
<div>开发中</div> |
||||
<div> |
||||
<BasicTable @register="registerTable"> |
||||
<template #toolbar> |
||||
<a-button type="warning" @click="handleExport"> 导出 </a-button> |
||||
</template> |
||||
</BasicTable> |
||||
</div> |
||||
</template> |
||||
<script lang="ts" setup name="OperateLog"> |
||||
import { BasicTable, useTable } from '@/components/Table' |
||||
import { OperateLogPageReqVO, exportOperateLogApi, getOperateLogPageApi } from '@/api/system/operatelog' |
||||
import { columns, searchFormSchema } from './operateLog.data' |
||||
import { useI18n } from '@/hooks/web/useI18n' |
||||
import { useMessage } from '@/hooks/web/useMessage' |
||||
|
||||
const { t } = useI18n() |
||||
const { createConfirm, createMessage } = useMessage() |
||||
const [registerTable, { getForm }] = useTable({ |
||||
title: '操作日志列表', |
||||
api: getOperateLogPageApi, |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema |
||||
}, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
showIndexColumn: false |
||||
}) |
||||
|
||||
async function handleExport() { |
||||
createConfirm({ |
||||
title: '导出', |
||||
iconType: 'warning', |
||||
content: '是否要导出数据?', |
||||
async onOk() { |
||||
await exportOperateLogApi(getForm().getFieldsValue() as OperateLogPageReqVO) |
||||
createMessage.success(t('common.exportSuccessText')) |
||||
} |
||||
}) |
||||
} |
||||
</script> |
||||
|
@ -0,0 +1,106 @@
|
||||
import { getIntDictOptions } from './../../../utils/dict' |
||||
import { BasicColumn, FormSchema, useRender } from '@/components/Table' |
||||
import { DICT_TYPE } from '@/utils/dict' |
||||
import { h } from 'vue' |
||||
|
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '日志编号', |
||||
dataIndex: 'id', |
||||
width: 100 |
||||
}, |
||||
{ |
||||
title: '操作模块', |
||||
dataIndex: 'module', |
||||
width: 120 |
||||
}, |
||||
{ |
||||
title: '操作名', |
||||
dataIndex: 'name', |
||||
width: 180 |
||||
}, |
||||
{ |
||||
title: '操作类型', |
||||
dataIndex: 'type', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDict(text, DICT_TYPE.SYSTEM_OPERATE_TYPE) |
||||
} |
||||
}, |
||||
{ |
||||
title: '操作人', |
||||
dataIndex: 'userNickname', |
||||
width: 120 |
||||
}, |
||||
{ |
||||
title: 'userAgent', |
||||
dataIndex: 'userAgent', |
||||
width: 400 |
||||
}, |
||||
{ |
||||
title: '操作结果', |
||||
dataIndex: 'resultCode', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return h('span', text === 0 ? '成功' : '失败') |
||||
} |
||||
}, |
||||
{ |
||||
title: '操作日期', |
||||
dataIndex: 'startTime', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDate(text) |
||||
} |
||||
}, |
||||
{ |
||||
title: '执行时长', |
||||
dataIndex: 'duration', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return h('span', text + 'ms') |
||||
} |
||||
} |
||||
] |
||||
|
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
label: '系统模块', |
||||
field: 'title', |
||||
component: 'Input', |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '操作人员', |
||||
field: 'operName', |
||||
component: 'Input', |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '类型', |
||||
field: 'type', |
||||
component: 'Select', |
||||
componentProps: { |
||||
options: getIntDictOptions(DICT_TYPE.SYSTEM_OPERATE_TYPE) |
||||
}, |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '状态', |
||||
field: 'success', |
||||
component: 'Select', |
||||
componentProps: { |
||||
options: [ |
||||
{ value: true, key: true, label: '成功' }, |
||||
{ value: false, key: false, label: '失败' } |
||||
] |
||||
}, |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '操作时间', |
||||
field: 'startTime', |
||||
component: 'RangePicker', |
||||
colProps: { span: 8 } |
||||
} |
||||
] |
Reference in new issue