Showing
1 changed file
with
16 additions
and
1 deletions
... | ... | @@ -7,8 +7,10 @@ import { numberRule } from '/@/utils/rules'; |
7 | 7 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; |
8 | 8 | import { FormField, FunctionType } from './step/cpns/physical/cpns/config'; |
9 | 9 | import { h } from 'vue'; |
10 | -import { Tag } from 'ant-design-vue'; | |
10 | +import { Tag, Tooltip } from 'ant-design-vue'; | |
11 | 11 | import { EventType, EventTypeColor, EventTypeName } from '../list/cpns/tabs/EventManage/config'; |
12 | +import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | |
13 | +import { useMessage } from '/@/hooks/web/useMessage'; | |
12 | 14 | |
13 | 15 | export enum Mode { |
14 | 16 | CARD = 'card', |
... | ... | @@ -37,6 +39,14 @@ export enum ModelOfMatterPermission { |
37 | 39 | RELEASE = 'api:yt:things_model:release', |
38 | 40 | } |
39 | 41 | |
42 | +const handleCopy = (value: string) => { | |
43 | + const { createMessage } = useMessage(); | |
44 | + const { clipboardRef, isSuccessRef } = useCopyToClipboard(value); | |
45 | + clipboardRef.value = value; | |
46 | + if (isSuccessRef.value) createMessage.success('复制成功~'); | |
47 | + else createMessage.error('复制失败~'); | |
48 | +}; | |
49 | + | |
40 | 50 | export const steps = [ |
41 | 51 | { |
42 | 52 | title: '产品', |
... | ... | @@ -72,6 +82,11 @@ export const physicalColumn: BasicColumn[] = [ |
72 | 82 | title: '标识符', |
73 | 83 | dataIndex: FormField.IDENTIFIER, |
74 | 84 | width: 90, |
85 | + customRender: ({ text }: Record<'text', string>) => { | |
86 | + return h(Tooltip, { title: text }, () => | |
87 | + h('span', { class: 'cursor-pointer', onClick: () => handleCopy(text) }, text) | |
88 | + ); | |
89 | + }, | |
75 | 90 | }, |
76 | 91 | { |
77 | 92 | title: '数据类型', | ... | ... |