Showing
1 changed file
with
16 additions
and
1 deletions
@@ -7,8 +7,10 @@ import { numberRule } from '/@/utils/rules'; | @@ -7,8 +7,10 @@ import { numberRule } from '/@/utils/rules'; | ||
7 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | 7 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; |
8 | import { FormField, FunctionType } from './step/cpns/physical/cpns/config'; | 8 | import { FormField, FunctionType } from './step/cpns/physical/cpns/config'; |
9 | import { h } from 'vue'; | 9 | import { h } from 'vue'; |
10 | -import { Tag } from 'ant-design-vue'; | 10 | +import { Tag, Tooltip } from 'ant-design-vue'; |
11 | import { EventType, EventTypeColor, EventTypeName } from '../list/cpns/tabs/EventManage/config'; | 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 | export enum Mode { | 15 | export enum Mode { |
14 | CARD = 'card', | 16 | CARD = 'card', |
@@ -37,6 +39,14 @@ export enum ModelOfMatterPermission { | @@ -37,6 +39,14 @@ export enum ModelOfMatterPermission { | ||
37 | RELEASE = 'api:yt:things_model:release', | 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 | export const steps = [ | 50 | export const steps = [ |
41 | { | 51 | { |
42 | title: '产品', | 52 | title: '产品', |
@@ -72,6 +82,11 @@ export const physicalColumn: BasicColumn[] = [ | @@ -72,6 +82,11 @@ export const physicalColumn: BasicColumn[] = [ | ||
72 | title: '标识符', | 82 | title: '标识符', |
73 | dataIndex: FormField.IDENTIFIER, | 83 | dataIndex: FormField.IDENTIFIER, |
74 | width: 90, | 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 | title: '数据类型', | 92 | title: '数据类型', |