| | |
| | | <template> |
| | | <el-collapse v-model="activeName" accordion> |
| | | <!-- <el-collapse v-model="activeName" accordion> |
| | | <el-collapse-item |
| | | v-for="item in dbAuditLogs" |
| | | :key="item.createdTime" |
| | |
| | | > |
| | | </ProForm> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | | </el-collapse> --> |
| | | <AppContainer> |
| | | <ProTableV2 |
| | | :columns="columns" |
| | | :show-pagination="false" |
| | | :table-data="dbAuditLogs" |
| | | :column-render-map="columnsRenderProps" |
| | | > |
| | | <template #oldValues="{ row }"> |
| | | <el-button type="primary" link @click="handleAdd({ json: JSON.stringify(row.oldValues) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | <template #newValues="{ row }"> |
| | | <el-button type="primary" link @click="handleAdd({ json: JSON.stringify(row.newValues) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | <template #createdUser="{ row }"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="handleAdd({ json: JSON.parse(JSON.stringify(row.createdUser)) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | </ProTableV2> |
| | | <JsonViewerDialog v-bind="dialogProps" /> |
| | | </AppContainer> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { ProForm, ProFormItemV2 } from '@bole-core/components'; |
| | | import { EnumDbAuditOperateText } from '@/constants'; |
| | | import JsonViewer from 'vue-json-viewer'; |
| | | |
| | | import { format } from '@/utils'; |
| | | import { |
| | | AppContainer, |
| | | ProTableV2, |
| | | defineColumns, |
| | | ProTableV2Props, |
| | | useFormDialog, |
| | | } from '@bole-core/components'; |
| | | import JsonViewerDialog from './JsonViewerDialog.vue'; |
| | | |
| | | defineOptions({ |
| | | name: 'DbAuditLogsView', |
| | |
| | | const props = withDefaults(defineProps<Props>(), { |
| | | dbAuditLogs: () => [] as API.GetDbAuditLogsQueryResultItem[], |
| | | }); |
| | | |
| | | const columns = defineColumns( |
| | | [ |
| | | 'tableName', |
| | | 'primaryKey', |
| | | 'operate', |
| | | 'oldValues', |
| | | 'newValues', |
| | | 'createdUser', |
| | | 'createdTime', |
| | | ].map((x, index) => ({ |
| | | id: index + '', |
| | | enCode: x, |
| | | name: x, |
| | | })) |
| | | ); |
| | | |
| | | const columnsRenderProps: ProTableV2Props['columnRenderMap'] = { |
| | | operate: { type: 'enum', valueEnum: EnumDbAuditOperateText }, |
| | | createdTime: { type: 'date', format: 'YYYY-MM-DD HH:mm:ss' }, |
| | | }; |
| | | |
| | | const { dialogProps, handleAdd } = useFormDialog({ |
| | | defaultFormParams: { |
| | | json: null, |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |