...
|
...
|
@@ -34,6 +34,11 @@ |
34
|
34
|
批量分配
|
35
|
35
|
</a-button>
|
36
|
36
|
</Authority>
|
|
37
|
+ <!-- <Authority>
|
|
38
|
+ <a-button type="primary" @click="handelCollect()" :disabled="!isExistOption">
|
|
39
|
+ 批量收藏
|
|
40
|
+ </a-button>
|
|
41
|
+ </Authority> -->
|
37
|
42
|
</template>
|
38
|
43
|
<template #img="{ record }">
|
39
|
44
|
<TableImg
|
...
|
...
|
@@ -85,7 +90,13 @@ |
85
|
90
|
</Tag>
|
86
|
91
|
</template>
|
87
|
92
|
<template #deviceState="{ record }">
|
|
93
|
+ <!-- <HeartOutlined v-if="!record.isCollect" class="mr-1" style="color: red" /> -->
|
|
94
|
+ <Tooltip>
|
|
95
|
+ <template #title> 我的收藏</template>
|
|
96
|
+ <HeartTwoTone v-if="record.isCollect" class="mr-1" twoToneColor="#3B82F6" />
|
|
97
|
+ </Tooltip>
|
88
|
98
|
<Tag
|
|
99
|
+ :style="{ marginLeft: !record.isCollect ? '17px' : '' }"
|
89
|
100
|
:color="
|
90
|
101
|
record.deviceState == DeviceState.INACTIVE
|
91
|
102
|
? 'warning'
|
...
|
...
|
@@ -154,6 +165,18 @@ |
154
|
165
|
icon: 'ant-design:rise-outlined',
|
155
|
166
|
onClick: handleUpAndDownRecord.bind(null, record),
|
156
|
167
|
},
|
|
168
|
+ !record.isCollect
|
|
169
|
+ ? {
|
|
170
|
+ label: '收藏',
|
|
171
|
+ icon: 'ant-design:heart-outlined',
|
|
172
|
+ onClick: handelCollect.bind(null, record),
|
|
173
|
+ }
|
|
174
|
+ : {
|
|
175
|
+ label: '取消收藏',
|
|
176
|
+ auth: 'api:yt:device:online:record',
|
|
177
|
+ icon: 'ant-design:heart-outlined',
|
|
178
|
+ onClick: handelCollect.bind(null, record),
|
|
179
|
+ },
|
157
|
180
|
{
|
158
|
181
|
label: '删除',
|
159
|
182
|
auth: 'api:yt:device:delete',
|
...
|
...
|
@@ -195,10 +218,12 @@ |
195
|
218
|
} from '/@/api/device/model/deviceModel';
|
196
|
219
|
import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table';
|
197
|
220
|
import { columns, searchFormSchema } from './config/device.data';
|
198
|
|
- import { Tag, Popover, Popconfirm, Button } from 'ant-design-vue';
|
|
221
|
+ import { Tag, Popover, Popconfirm, Button, Tooltip } from 'ant-design-vue';
|
|
222
|
+ import { HeartTwoTone } from '@ant-design/icons-vue';
|
199
|
223
|
import {
|
200
|
224
|
deleteDevice,
|
201
|
225
|
devicePage,
|
|
226
|
+ deviceCollect,
|
202
|
227
|
cancelDispatchCustomer,
|
203
|
228
|
getGATEWAY,
|
204
|
229
|
privateDevice,
|
...
|
...
|
@@ -244,6 +269,9 @@ |
244
|
269
|
Popconfirm,
|
245
|
270
|
BatchImportModal,
|
246
|
271
|
Button,
|
|
272
|
+ // HeartOutlined,
|
|
273
|
+ HeartTwoTone,
|
|
274
|
+ Tooltip,
|
247
|
275
|
},
|
248
|
276
|
setup(_) {
|
249
|
277
|
const { isCustomer } = useAuthDeviceDetail();
|
...
|
...
|
@@ -462,6 +490,26 @@ |
462
|
490
|
} catch (error) {}
|
463
|
491
|
};
|
464
|
492
|
|
|
493
|
+ // 收藏 && 批量收藏
|
|
494
|
+ const handelCollect = async (record?: Recordable) => {
|
|
495
|
+ let ids: string[] = [];
|
|
496
|
+ if (record) {
|
|
497
|
+ ids.push(record.id);
|
|
498
|
+ } else {
|
|
499
|
+ ids = await getSelectRowKeys();
|
|
500
|
+ }
|
|
501
|
+ try {
|
|
502
|
+ setLoading(true);
|
|
503
|
+ await deviceCollect(ids);
|
|
504
|
+ createMessage.success('操作成功');
|
|
505
|
+ handleReload();
|
|
506
|
+ } catch (error) {
|
|
507
|
+ throw error;
|
|
508
|
+ } finally {
|
|
509
|
+ setLoading(false);
|
|
510
|
+ }
|
|
511
|
+ };
|
|
512
|
+
|
465
|
513
|
onMounted(() => {
|
466
|
514
|
const queryParams = ROUTE.query as Record<'deviceProfileId', undefined | string>;
|
467
|
515
|
const { setFieldsValue } = getForm();
|
...
|
...
|
@@ -489,6 +537,7 @@ |
489
|
537
|
copySN,
|
490
|
538
|
isExistOption,
|
491
|
539
|
handleDelete,
|
|
540
|
+ handelCollect,
|
492
|
541
|
// hasBatchDelete,
|
493
|
542
|
// handleDeleteOrBatchDelete,
|
494
|
543
|
handleReload,
|
...
|
...
|
|