|
@@ -23,13 +23,14 @@ |
|
@@ -23,13 +23,14 @@ |
|
23
|
>
|
23
|
>
|
|
24
|
<AuthDropDown
|
24
|
<AuthDropDown
|
|
25
|
v-if="authBtn(role)"
|
25
|
v-if="authBtn(role)"
|
|
26
|
- :disabled="!isExistOption"
|
26
|
+ :disabled="isPublicAndPrivateFlag || !isExistOption"
|
|
27
|
:dropMenuList="[
|
27
|
:dropMenuList="[
|
|
28
|
{
|
28
|
{
|
|
29
|
text: '删除设备',
|
29
|
text: '删除设备',
|
|
30
|
auth: DeviceListAuthEnum.DELETE,
|
30
|
auth: DeviceListAuthEnum.DELETE,
|
|
31
|
icon: 'ant-design:delete-outlined',
|
31
|
icon: 'ant-design:delete-outlined',
|
|
32
|
event: '',
|
32
|
event: '',
|
|
|
|
33
|
+ disabled: !batchPrivateFlag,
|
|
33
|
popconfirm: {
|
34
|
popconfirm: {
|
|
34
|
title: '您确定要批量删除数据',
|
35
|
title: '您确定要批量删除数据',
|
|
35
|
onConfirm: () => handleDelete(),
|
36
|
onConfirm: () => handleDelete(),
|
|
@@ -40,6 +41,7 @@ |
|
@@ -40,6 +41,7 @@ |
|
40
|
auth: DeviceListAuthEnum.ASSIGN,
|
41
|
auth: DeviceListAuthEnum.ASSIGN,
|
|
41
|
icon: 'mdi:account-arrow-left',
|
42
|
icon: 'mdi:account-arrow-left',
|
|
42
|
event: '',
|
43
|
event: '',
|
|
|
|
44
|
+ disabled: !batchPrivateFlag,
|
|
43
|
onClick: handleBatchAssign.bind(null),
|
45
|
onClick: handleBatchAssign.bind(null),
|
|
44
|
},
|
46
|
},
|
|
45
|
{
|
47
|
{
|
|
@@ -47,12 +49,35 @@ |
|
@@ -47,12 +49,35 @@ |
|
47
|
auth: DeviceListAuthEnum.UPDATE_PRODUCT,
|
49
|
auth: DeviceListAuthEnum.UPDATE_PRODUCT,
|
|
48
|
icon: 'clarity:note-edit-line',
|
50
|
icon: 'clarity:note-edit-line',
|
|
49
|
event: '',
|
51
|
event: '',
|
|
50
|
- disabled: batchUpdateProductFlag,
|
52
|
+ disabled: !batchPrivateFlag || batchUpdateProductFlag,
|
|
51
|
onClick: handelOpenBatchUpdateProductModal,
|
53
|
onClick: handelOpenBatchUpdateProductModal,
|
|
52
|
},
|
54
|
},
|
|
|
|
55
|
+ {
|
|
|
|
56
|
+ text: '批量公开',
|
|
|
|
57
|
+ icon: 'ant-design:wallet-outlined',
|
|
|
|
58
|
+ event: '',
|
|
|
|
59
|
+ disabled: !batchPrivateFlag,
|
|
|
|
60
|
+ onClick: handleBatchPublic.bind(null),
|
|
|
|
61
|
+ },
|
|
|
|
62
|
+ {
|
|
|
|
63
|
+ text: '批量私有',
|
|
|
|
64
|
+ icon: 'ant-design:wallet-outlined',
|
|
|
|
65
|
+ event: '',
|
|
|
|
66
|
+ disabled: batchPrivateFlag,
|
|
|
|
67
|
+ onClick: handleBatchPrivate.bind(null),
|
|
|
|
68
|
+ },
|
|
|
|
69
|
+ {
|
|
|
|
70
|
+ text: '批量修改组织',
|
|
|
|
71
|
+ icon: 'ant-design:wallet-outlined',
|
|
|
|
72
|
+ event: '',
|
|
|
|
73
|
+ disabled: !batchPrivateFlag,
|
|
|
|
74
|
+ onClick: handleBatchOrg.bind(null),
|
|
|
|
75
|
+ },
|
|
53
|
]"
|
76
|
]"
|
|
54
|
>
|
77
|
>
|
|
55
|
- <Button type="primary" :disabled="!isExistOption">批量操作</Button>
|
78
|
+ <Button type="primary" :disabled="isPublicAndPrivateFlag || !isExistOption"
|
|
|
|
79
|
+ >批量操作</Button
|
|
|
|
80
|
+ >
|
|
56
|
</AuthDropDown>
|
81
|
</AuthDropDown>
|
|
57
|
</Authority>
|
82
|
</Authority>
|
|
58
|
</template>
|
83
|
</template>
|
|
@@ -225,6 +250,7 @@ |
|
@@ -225,6 +250,7 @@ |
|
225
|
|
250
|
|
|
226
|
<DeviceModal @register="registerModal" @success="handleSuccess" @reload="handleSuccess" />
|
251
|
<DeviceModal @register="registerModal" @success="handleSuccess" @reload="handleSuccess" />
|
|
227
|
<CustomerModal @register="registerCustomerModal" @reload="handleReload" />
|
252
|
<CustomerModal @register="registerCustomerModal" @reload="handleReload" />
|
|
|
|
253
|
+ <OrgModal @register="registerOrgModal" @reload="handleReload" />
|
|
228
|
|
254
|
|
|
229
|
<BatchImportModal @register="registerImportModal" @import-finally="handleImportFinally" />
|
255
|
<BatchImportModal @register="registerImportModal" @import-finally="handleImportFinally" />
|
|
230
|
|
256
|
|
|
@@ -254,6 +280,8 @@ |
|
@@ -254,6 +280,8 @@ |
|
254
|
getGATEWAY,
|
280
|
getGATEWAY,
|
|
255
|
privateDevice,
|
281
|
privateDevice,
|
|
256
|
publicDevice,
|
282
|
publicDevice,
|
|
|
|
283
|
+ doBatchPublicDevice,
|
|
|
|
284
|
+ doBatchPrivateDevice,
|
|
257
|
} from '/@/api/device/deviceManager';
|
285
|
} from '/@/api/device/deviceManager';
|
|
258
|
import { PageEnum } from '/@/enums/pageEnum';
|
286
|
import { PageEnum } from '/@/enums/pageEnum';
|
|
259
|
import { useGo } from '/@/hooks/web/usePage';
|
287
|
import { useGo } from '/@/hooks/web/usePage';
|
|
@@ -264,6 +292,7 @@ |
|
@@ -264,6 +292,7 @@ |
|
264
|
import { useDrawer } from '/@/components/Drawer';
|
292
|
import { useDrawer } from '/@/components/Drawer';
|
|
265
|
import DeviceDetailDrawer from './cpns/modal/DeviceDetailDrawer.vue';
|
293
|
import DeviceDetailDrawer from './cpns/modal/DeviceDetailDrawer.vue';
|
|
266
|
import CustomerModal from './cpns/modal/CustomerModal.vue';
|
294
|
import CustomerModal from './cpns/modal/CustomerModal.vue';
|
|
|
|
295
|
+ import OrgModal from './cpns/modal/OrgModal.vue';
|
|
267
|
import BatchImportModal from './cpns/modal/BatchImportModal/index.vue';
|
296
|
import BatchImportModal from './cpns/modal/BatchImportModal/index.vue';
|
|
268
|
import { useMessage } from '/@/hooks/web/useMessage';
|
297
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
269
|
import { USER_INFO_KEY } from '/@/enums/cacheEnum';
|
298
|
import { USER_INFO_KEY } from '/@/enums/cacheEnum';
|
|
@@ -292,6 +321,7 @@ |
|
@@ -292,6 +321,7 @@ |
|
292
|
const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
|
321
|
const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
|
|
293
|
const [registerModal, { openModal }] = useModal();
|
322
|
const [registerModal, { openModal }] = useModal();
|
|
294
|
const [registerCustomerModal, { openModal: openCustomerModal }] = useModal();
|
323
|
const [registerCustomerModal, { openModal: openCustomerModal }] = useModal();
|
|
|
|
324
|
+ const [registerOrgModal, { openModal: openOrgodal }] = useModal();
|
|
295
|
const [registerDetailDrawer, { openDrawer }] = useDrawer();
|
325
|
const [registerDetailDrawer, { openDrawer }] = useDrawer();
|
|
296
|
const [registerTbDetailDrawer, { openDrawer: openTbDeviceDrawer }] = useDrawer();
|
326
|
const [registerTbDetailDrawer, { openDrawer: openTbDeviceDrawer }] = useDrawer();
|
|
297
|
const [registerGatewayDetailDrawer, { openDrawer: openGatewayDetailDrawer }] = useDrawer();
|
327
|
const [registerGatewayDetailDrawer, { openDrawer: openGatewayDetailDrawer }] = useDrawer();
|
|
@@ -326,6 +356,10 @@ |
|
@@ -326,6 +356,10 @@ |
|
326
|
|
356
|
|
|
327
|
const batchUpdateProductFlag = ref(true);
|
357
|
const batchUpdateProductFlag = ref(true);
|
|
328
|
|
358
|
|
|
|
|
359
|
+ const isPublicAndPrivateFlag = ref(false);
|
|
|
|
360
|
+
|
|
|
|
361
|
+ const batchPrivateFlag = ref(true);
|
|
|
|
362
|
+
|
|
329
|
const [
|
363
|
const [
|
|
330
|
registerTable,
|
364
|
registerTable,
|
|
331
|
{
|
365
|
{
|
|
@@ -376,7 +410,7 @@ |
|
@@ -376,7 +410,7 @@ |
|
376
|
rowSelection: {
|
410
|
rowSelection: {
|
|
377
|
type: 'checkbox',
|
411
|
type: 'checkbox',
|
|
378
|
getCheckboxProps: (record: DeviceModel) => {
|
412
|
getCheckboxProps: (record: DeviceModel) => {
|
|
379
|
- return { disabled: !!record.customerId };
|
413
|
+ return { disabled: !!record.customerId && record.customerName !== 'Public' };
|
|
380
|
},
|
414
|
},
|
|
381
|
onSelect(_record, _selected, selectedRows) {
|
415
|
onSelect(_record, _selected, selectedRows) {
|
|
382
|
const [firstItem] = selectedRows as DeviceRecord[];
|
416
|
const [firstItem] = selectedRows as DeviceRecord[];
|
|
@@ -384,6 +418,11 @@ |
|
@@ -384,6 +418,11 @@ |
|
384
|
batchUpdateProductFlag.value =
|
418
|
batchUpdateProductFlag.value =
|
|
385
|
!selectedRows.length ||
|
419
|
!selectedRows.length ||
|
|
386
|
!selectedRows.every((item) => (item as DeviceRecord).deviceType === deviceType);
|
420
|
!selectedRows.every((item) => (item as DeviceRecord).deviceType === deviceType);
|
|
|
|
421
|
+
|
|
|
|
422
|
+ batchPrivateFlag.value = selectedRows.some((item: DeviceRecord) => !item?.customerId);
|
|
|
|
423
|
+ isPublicAndPrivateFlag.value =
|
|
|
|
424
|
+ selectedRows.some((item: DeviceRecord) => !item?.customerId) &&
|
|
|
|
425
|
+ selectedRows.some((item: DeviceRecord) => item?.customerAdditionalInfo?.isPublic);
|
|
387
|
},
|
426
|
},
|
|
388
|
onSelectAll(_selected, selectedRows) {
|
427
|
onSelectAll(_selected, selectedRows) {
|
|
389
|
const [firstItem] = selectedRows as DeviceRecord[];
|
428
|
const [firstItem] = selectedRows as DeviceRecord[];
|
|
@@ -391,6 +430,11 @@ |
|
@@ -391,6 +430,11 @@ |
|
391
|
batchUpdateProductFlag.value =
|
430
|
batchUpdateProductFlag.value =
|
|
392
|
!selectedRows.length ||
|
431
|
!selectedRows.length ||
|
|
393
|
!selectedRows.every((item) => (item as DeviceRecord).deviceType === deviceType);
|
432
|
!selectedRows.every((item) => (item as DeviceRecord).deviceType === deviceType);
|
|
|
|
433
|
+
|
|
|
|
434
|
+ batchPrivateFlag.value = selectedRows.some((item) => !item?.customerId);
|
|
|
|
435
|
+ isPublicAndPrivateFlag.value =
|
|
|
|
436
|
+ selectedRows.some((item) => !item?.customerId) &&
|
|
|
|
437
|
+ selectedRows.some((item) => item?.customerAdditionalInfo?.isPublic);
|
|
394
|
},
|
438
|
},
|
|
395
|
},
|
439
|
},
|
|
396
|
});
|
440
|
});
|
|
@@ -492,6 +536,29 @@ |
|
@@ -492,6 +536,29 @@ |
|
492
|
openCustomerModal(true, options);
|
536
|
openCustomerModal(true, options);
|
|
493
|
};
|
537
|
};
|
|
494
|
|
538
|
|
|
|
|
539
|
+ const handleBatchOrg = () => {
|
|
|
|
540
|
+ const options = getSelectRows();
|
|
|
|
541
|
+ openOrgodal(true, options);
|
|
|
|
542
|
+ };
|
|
|
|
543
|
+
|
|
|
|
544
|
+ // 批量公开设备
|
|
|
|
545
|
+ const handleBatchPublic = async () => {
|
|
|
|
546
|
+ const options = getSelectRows();
|
|
|
|
547
|
+ const tbDeviceIdJoinStr = options.map((item) => item.tbDeviceId).join(',');
|
|
|
|
548
|
+ const res = await doBatchPublicDevice(tbDeviceIdJoinStr);
|
|
|
|
549
|
+ createMessage.success(res);
|
|
|
|
550
|
+ handleReload();
|
|
|
|
551
|
+ };
|
|
|
|
552
|
+
|
|
|
|
553
|
+ // 批量私有设备
|
|
|
|
554
|
+ const handleBatchPrivate = async () => {
|
|
|
|
555
|
+ const options = getSelectRows();
|
|
|
|
556
|
+ const tbDeviceIdJoinStr = options.map((item) => item.tbDeviceId).join(',');
|
|
|
|
557
|
+ const res = await doBatchPrivateDevice(tbDeviceIdJoinStr);
|
|
|
|
558
|
+ createMessage.success(res);
|
|
|
|
559
|
+ handleReload();
|
|
|
|
560
|
+ };
|
|
|
|
561
|
+
|
|
495
|
const handleDelete = async (record?: DeviceRecord) => {
|
562
|
const handleDelete = async (record?: DeviceRecord) => {
|
|
496
|
let ids: string[] = [];
|
563
|
let ids: string[] = [];
|
|
497
|
if (record) {
|
564
|
if (record) {
|