update src/views/infra/apiAccessLog/index.vue.

Signed-off-by: yanchangshan <5333290+yanchangshan@user.noreply.gitee.com>
pull/2/head
yanchangshan 2023-03-23 23:55:05 +00:00 committed by Gitee
parent 4115d7f7ba
commit 54f97dcbc3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 53 additions and 73 deletions

View File

@ -1,40 +1,34 @@
<template> <template>
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button> <a-button type="warning" @click="handleExport"> </a-button>
<a-button type="warning" @click="handleExport"> </a-button> </template>
</template> <template #bodyCell="{ column, record }">
<template #bodyCell="{ column, record }"> <template v-if="column.key === 'action'">
<template v-if="column.key === 'action'"> <TableAction
<TableAction :actions="[
:actions="[ {
{ icon: 'ant-design:delete-outlined',
icon: 'clarity:note-edit-line', color: 'error',
label: '修改', label: '删除',
onClick: handleEdit.bind(null, record) popConfirm: {
}, title: '是否确认删除',
{ placement: 'left',
icon: 'ant-design:delete-outlined', confirm: handleDelete.bind(null, record)
color: 'error', }
label: '删除', }
popConfirm: { ]"
title: '是否确认删除', />
placement: 'left', </template>
confirm: handleDelete.bind(null, record) </template>
} </BasicTable>
} <ApiAccessLogModel @register="registerModal" @success="reload()" />
]" </div>
/>
</template>
</template>
</BasicTable>
<ApiAccessLogModel @register="registerModal" @success="reload()" />
</div>
</template> </template>
<script lang="ts" setup name="ApiAccessLog"> <script lang="ts" setup name="ApiAccessLog">
import { BasicTable, useTable, TableAction } from '@/components/Table' import { BasicTable, useTable, TableAction } from '@/components/Table'
import { ApiAccessLogExportReqVO, exportApiAccessLogApi, getApiAccessLogPageApi,deleteApiAccessLogApi} from '@/api/infra/apiAccessLog' import { ApiAccessLogExportReqVO, exportApiAccessLogApi, getApiAccessLogPageApi, deleteApiAccessLogApi } from '@/api/infra/apiAccessLog'
import { useModal } from '@/components/Modal' import { useModal } from '@/components/Modal'
import ApiAccessLogModel from './ApiAccessLogModel.vue' import ApiAccessLogModel from './ApiAccessLogModel.vue'
import { columns, searchFormSchema } from './ApiAccessLog.data' import { columns, searchFormSchema } from './ApiAccessLog.data'
@ -45,47 +39,34 @@ const { t } = useI18n()
const { createConfirm, createMessage } = useMessage() const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal() const [registerModal, { openModal }] = useModal()
const [registerTable, { getForm, reload }] = useTable({ const [registerTable, { getForm, reload }] = useTable({
title: 'API 访问日志表列表', title: 'API访问日志列表',
api: getApiAccessLogPageApi, api: getApiAccessLogPageApi,
columns, columns,
formConfig: { formConfig: {
labelWidth: 120, labelWidth: 120,
schemas: searchFormSchema schemas: searchFormSchema
}, },
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
actionColumn: { actionColumn: {
width: 160, width: 160,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
fixed: 'right' fixed: 'right'
} }
}) })
function handleCreate() {
openModal(true, {
isUpdate: false
})
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true
})
}
async function handleExport() { async function handleExport() {
createConfirm({ createConfirm({
title: '导出', title: '导出',
iconType: 'warning', iconType: 'warning',
content: '是否要导出数据?', content: '是否要导出数据?',
async onOk() { async onOk() {
await exportApiAccessLogApi(getForm().getFieldsValue() as ApiAccessLogExportReqVO) await exportApiAccessLogApi(getForm().getFieldsValue() as ApiAccessLogExportReqVO)
createMessage.success(t('common.exportSuccessText')) createMessage.success(t('common.exportSuccessText'))
} }
}) })
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {
@ -93,5 +74,4 @@ async function handleDelete(record: Recordable) {
createMessage.success(t('common.delSuccessText')) createMessage.success(t('common.delSuccessText'))
reload() reload()
} }
</script>
</script>