Commit 8918bfcf57ec4c42fb2c3799f1d79ac374112355

Authored by ww
1 parent 4488b4c2

perf: 数据流转优化设备选择设备名称优化

... ... @@ -279,7 +279,6 @@
279 279 setSelectedOptions,
280 280 setSelectedTotal,
281 281 reloadPending,
282   - reloadPending,
283 282 reloadSelected,
284 283 };
285 284
... ... @@ -408,7 +407,7 @@
408 407 :key="item.value"
409 408 >
410 409 <span>
411   - {{ item.alias + '/' + item.name }}
  410 + {{ item.alias || item.name }}
412 411 </span>
413 412 </Tag>
414 413 <Tag class="!px-2 !py-1 !bg-gray-50 !border-gray-100" v-if="getSurplusOptionsLength">
... ...
... ... @@ -63,12 +63,12 @@
63 63 </div>
64 64 </template>
65 65 <template #deviceProfile="{ record }">
66   - <Tag.CheckableTag
  66 + <Button
67 67 @click="!isCustomer ? goDeviceProfile(record.deviceProfile.name) : null"
68   - style="white-space: normal; height: auto; cursor: pointer"
  68 + type="link"
69 69 >
70   - <span style="color: #377dff">{{ record.deviceProfile.name }}</span>
71   - </Tag.CheckableTag>
  70 + {{ record.deviceProfile.name }}
  71 + </Button>
72 72 </template>
73 73
74 74 <template #deviceType="{ record }">
... ...
1 1 import { FormSchema } from '/@/components/Form';
2 2 import { findDictItemByCode } from '/@/api/system/dict';
3   -import { h, ref } from 'vue';
  3 +import { h, ref, unref } from 'vue';
4 4 import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi';
5 5 import { getDeviceProfile } from '/@/api/alarm/position';
6 6 import { BasicColumn, BasicTableProps } from '/@/components/Table';
... ... @@ -8,6 +8,8 @@ import { devicePage } from '/@/api/device/deviceManager';
8 8 import { Tag } from 'ant-design-vue';
9 9 import { DeviceRecord } from '/@/api/device/model/deviceModel';
10 10 import { FETCH_SETTING } from '/@/components/Table/src/const';
  11 +import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
  12 +import { useMessage } from '/@/hooks/web/useMessage';
11 13
12 14 const typeValue = ref('');
13 15 export enum CredentialsEnum {
... ... @@ -100,7 +102,8 @@ const deviceTableFormSchema: FormSchema[] = [
100 102 },
101 103 },
102 104 ];
103   -
  105 +const { clipboardRef, isSuccessRef } = useCopyToClipboard();
  106 +const { createMessage } = useMessage();
104 107 const deviceTableColumn: BasicColumn[] = [
105 108 {
106 109 title: '状态',
... ... @@ -125,8 +128,20 @@ const deviceTableColumn: BasicColumn[] = [
125 128 dataIndex: 'name',
126 129 customRender: ({ record }) => {
127 130 return h('div', [
128   - h('div', `${record.alias}/${record.name}`),
129   - // h('div', { class: 'text-blue-400 truncate', title: record.sn }, record.sn),
  131 + h(
  132 + 'div',
  133 + {
  134 + class: 'cursor-pointer',
  135 + onClick: () => {
  136 + clipboardRef.value = record.name;
  137 + if (unref(isSuccessRef)) createMessage.success('复制成功~');
  138 + },
  139 + },
  140 + [
  141 + h('div', { class: 'text-blue-400 truncate' }, record.alias),
  142 + h('div', { class: 'text-blue-400 truncate' }, record.name),
  143 + ]
  144 + ),
130 145 ]);
131 146 },
132 147 },
... ...