Showing
2 changed files
with
33 additions
and
4 deletions
| 1 | -import { h } from 'vue'; | |
| 1 | +import { h, unref } from 'vue'; | |
| 2 | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | 3 | import { dateUtil } from '/@/utils/dateUtil'; |
| 4 | 4 | import Icon from '/@/components/Icon'; |
| 5 | 5 | import { Modal } from 'ant-design-vue'; |
| 6 | 6 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 7 | +import { CopyOutlined } from '@ant-design/icons-vue'; | |
| 8 | +import { useClipboard } from '@vueuse/core'; | |
| 9 | +import { useMessage } from '/@/hooks/web/useMessage'; | |
| 7 | 10 | |
| 8 | 11 | const handleOpenJsonPreviewModal = (title: string, content: string) => { |
| 9 | 12 | Modal.info({ |
| ... | ... | @@ -13,6 +16,15 @@ const handleOpenJsonPreviewModal = (title: string, content: string) => { |
| 13 | 16 | }); |
| 14 | 17 | }; |
| 15 | 18 | |
| 19 | +const { copy, copied } = useClipboard({ legacy: true }); | |
| 20 | +const { createMessage } = useMessage(); | |
| 21 | + | |
| 22 | +async function copyText(text: string) { | |
| 23 | + await copy(text); | |
| 24 | + | |
| 25 | + unref(copied) ? createMessage.success('复制成功') : createMessage.error('复制失败'); | |
| 26 | +} | |
| 27 | + | |
| 16 | 28 | export const columns: BasicColumn[] = [ |
| 17 | 29 | { |
| 18 | 30 | title: '事件时间', |
| ... | ... | @@ -34,13 +46,30 @@ export const columns: BasicColumn[] = [ |
| 34 | 46 | }, |
| 35 | 47 | { |
| 36 | 48 | title: '实体类型', |
| 37 | - dataIndex: 'body.entityName', | |
| 49 | + dataIndex: 'body.entityType', | |
| 38 | 50 | ellipsis: true, |
| 39 | 51 | }, |
| 40 | 52 | { |
| 41 | - title: '消息ID', | |
| 53 | + title: '实体ID', | |
| 42 | 54 | dataIndex: 'body.entityId', |
| 43 | 55 | ellipsis: true, |
| 56 | + customRender: ({ text }: { text: string }) => { | |
| 57 | + return h('span', { class: 'flex items-center' }, [ | |
| 58 | + h('span', { class: 'truncate' }, text), | |
| 59 | + h(CopyOutlined, { class: 'flex-shrink cursor-pointer', onClick: () => copyText(text) }), | |
| 60 | + ]); | |
| 61 | + }, | |
| 62 | + }, | |
| 63 | + { | |
| 64 | + title: '消息ID', | |
| 65 | + dataIndex: 'body.msgId', | |
| 66 | + ellipsis: true, | |
| 67 | + customRender: ({ text }: { text: string }) => { | |
| 68 | + return h('span', { class: 'flex items-center' }, [ | |
| 69 | + h('span', { class: 'truncate' }, text), | |
| 70 | + h(CopyOutlined, { class: 'flex-shrink cursor-pointer', onClick: () => copyText(text) }), | |
| 71 | + ]); | |
| 72 | + }, | |
| 44 | 73 | }, |
| 45 | 74 | { |
| 46 | 75 | title: '消息类型', | ... | ... |