Browse Source

socket解除管控

gzb
wangzhonglu 9 months ago
parent
commit
deef025f02

+ 4
- 0
src/utils/ControlWSMsg.js View File

49
   restoreFactory() {
49
   restoreFactory() {
50
     this.code = 2006;
50
     this.code = 2006;
51
   }
51
   }
52
+  // 解除管控
53
+  removeControl() {
54
+    this.code = 2007;
55
+  }
52
   toJSONString() {
56
   toJSONString() {
53
     let tempObj = {};
57
     let tempObj = {};
54
     for (let key in this) {
58
     for (let key in this) {

+ 122
- 42
src/views/schoolSection/deviceManage/breakRuleDevice.vue View File

32
             <DropdownItem name="5">限制使用</DropdownItem>
32
             <DropdownItem name="5">限制使用</DropdownItem>
33
             <DropdownItem name="6">更新策略</DropdownItem>
33
             <DropdownItem name="6">更新策略</DropdownItem>
34
             <DropdownItem name="7">重启设备</DropdownItem>
34
             <DropdownItem name="7">重启设备</DropdownItem>
35
+            <DropdownItem name="9">解除管控</DropdownItem>
35
             <DropdownItem name="8">合规处理</DropdownItem>
36
             <DropdownItem name="8">合规处理</DropdownItem>
36
           </DropdownMenu>
37
           </DropdownMenu>
37
         </Dropdown>
38
         </Dropdown>
39
     </div>
40
     </div>
40
     <div class="table_wrap">
41
     <div class="table_wrap">
41
       <Table
42
       <Table
43
+        ref="deviceTable"
42
         :columns="columns"
44
         :columns="columns"
43
         :data="searchForm.list"
45
         :data="searchForm.list"
44
         @on-selection-change="selectionChange"
46
         @on-selection-change="selectionChange"
527
           return;
529
           return;
528
         }
530
         }
529
         this.toLogHandle(snList);
531
         this.toLogHandle(snList);
532
+      } else if (name === "9") {
533
+        // 解除管控
534
+        if (snList.length === 0) {
535
+          this.$Message.error("请勾选至少一个设备。");
536
+          return;
537
+        }
538
+        this.$Modal.confirm({
539
+          title: "提示",
540
+          content: "确定对所选设备进行解除管控操作吗?",
541
+          onOk: () => {
542
+            this.controlRemovetDevice(snList, useridList);
543
+          },
544
+          onCancel: () => {}
545
+        });
530
       }
546
       }
531
     },
547
     },
532
     // 恢复出厂设置
548
     // 恢复出厂设置
533
-    controlRestoreFactory(snList, useridList) {
549
+    controlRestoreFactory(snList) {
534
       let controlWSMsg = new ControlWSMsg(
550
       let controlWSMsg = new ControlWSMsg(
535
         controlWs.ws,
551
         controlWs.ws,
536
         this.userInfo.adminid,
552
         this.userInfo.adminid,
537
         snList
553
         snList
538
       );
554
       );
539
       controlWSMsg.restoreFactory();
555
       controlWSMsg.restoreFactory();
540
-      controlWSMsg.send();
541
-      let form = {
542
-        pushType: 6,
543
-        pushObj: 1
544
-      };
545
-      form.userids = useridList;
546
-      this.addPushLog(form);
556
+      controlWSMsg.send((isSend) => {
557
+        if (isSend) {
558
+          this.$Message.success("推送成功");
559
+        } else {
560
+          this.$Message.error("推送失败");
561
+        }
562
+      });
563
+      this.$refs.deviceTable.selectAll(false);
564
+      // let form = {
565
+      //   pushType: 6,
566
+      //   pushObj: 1
567
+      // };
568
+      // form.userids = useridList;
569
+      // this.addPushLog(form);
547
     },
570
     },
548
     // 发送消息
571
     // 发送消息
549
     controlSendMessage() {
572
     controlSendMessage() {
563
               content: this.controlMessageInfo.content
586
               content: this.controlMessageInfo.content
564
             })
587
             })
565
           );
588
           );
566
-          controlWSMsg.send();
589
+          controlWSMsg.send((isSend) => {
590
+            if (isSend) {
591
+              this.$Message.success("推送成功");
592
+            } else {
593
+              this.$Message.error("推送失败");
594
+            }
595
+          });
567
           let form = {
596
           let form = {
568
             pushType: 1,
597
             pushType: 1,
569
             pushObj: 1,
598
             pushObj: 1,
571
             content: this.controlMessageInfo.content
600
             content: this.controlMessageInfo.content
572
           };
601
           };
573
           form.userids = useridList;
602
           form.userids = useridList;
603
+          this.$refs.deviceTable.selectAll(false);
574
           this.addPushLog(form);
604
           this.addPushLog(form);
575
         }
605
         }
576
       });
606
       });
577
     },
607
     },
578
     // 解除限制
608
     // 解除限制
579
-    controlRemoveLimit(snList, useridList) {
609
+    controlRemoveLimit(snList) {
580
       let controlWSMsg = new ControlWSMsg(
610
       let controlWSMsg = new ControlWSMsg(
581
         controlWs.ws,
611
         controlWs.ws,
582
         this.userInfo.adminid,
612
         this.userInfo.adminid,
583
         snList
613
         snList
584
       );
614
       );
585
       controlWSMsg.removeLimit();
615
       controlWSMsg.removeLimit();
586
-      controlWSMsg.send();
587
-      let form = {
588
-        pushType: 2,
589
-        pushObj: 1
590
-      };
591
-      form.userids = useridList;
592
-      this.addPushLog(form);
616
+      controlWSMsg.send((isSend) => {
617
+        if (isSend) {
618
+          this.$Message.success("推送成功");
619
+        } else {
620
+          this.$Message.error("推送失败");
621
+        }
622
+      });
623
+      this.$refs.deviceTable.selectAll(false);
624
+      // let form = {
625
+      //   pushType: 2,
626
+      //   pushObj: 1
627
+      // };
628
+      // form.userids = useridList;
629
+      // this.addPushLog(form);
593
     },
630
     },
594
     // 限制使用
631
     // 限制使用
595
-    controlLimitedUse(snList, useridList) {
632
+    controlLimitedUse(snList) {
596
       let controlWSMsg = new ControlWSMsg(
633
       let controlWSMsg = new ControlWSMsg(
597
         controlWs.ws,
634
         controlWs.ws,
598
         this.userInfo.adminid,
635
         this.userInfo.adminid,
599
         snList
636
         snList
600
       );
637
       );
601
       controlWSMsg.limitedUse();
638
       controlWSMsg.limitedUse();
602
-      controlWSMsg.send();
603
-      let form = {
604
-        pushType: 3,
605
-        pushObj: 1
606
-      };
607
-      form.userids = useridList;
608
-      this.addPushLog(form);
639
+      controlWSMsg.send((isSend) => {
640
+        if (isSend) {
641
+          this.$Message.success("推送成功");
642
+        } else {
643
+          this.$Message.error("推送失败");
644
+        }
645
+      });
646
+      this.$refs.deviceTable.selectAll(false);
647
+      // let form = {
648
+      //   pushType: 3,
649
+      //   pushObj: 1
650
+      // };
651
+      // form.userids = useridList;
652
+      // this.addPushLog(form);
609
     },
653
     },
610
     // 更新策略
654
     // 更新策略
611
-    controlUpdateStrategy(snList, useridList) {
655
+    controlUpdateStrategy(snList) {
612
       let controlWSMsg = new ControlWSMsg(
656
       let controlWSMsg = new ControlWSMsg(
613
         controlWs.ws,
657
         controlWs.ws,
614
         this.userInfo.adminid,
658
         this.userInfo.adminid,
615
         snList
659
         snList
616
       );
660
       );
617
       controlWSMsg.updateStrategy();
661
       controlWSMsg.updateStrategy();
618
-      controlWSMsg.send();
619
-      let form = {
620
-        pushType: 4,
621
-        pushObj: 1
622
-      };
623
-      form.userids = useridList;
624
-      this.addPushLog(form);
662
+      controlWSMsg.send((isSend) => {
663
+        if (isSend) {
664
+          this.$Message.success("推送成功");
665
+        } else {
666
+          this.$Message.error("推送失败");
667
+        }
668
+      });
669
+      this.$refs.deviceTable.selectAll(false);
670
+      // let form = {
671
+      //   pushType: 4,
672
+      //   pushObj: 1
673
+      // };
674
+      // form.userids = useridList;
675
+      // this.addPushLog(form);
625
     },
676
     },
626
     // 重启设备
677
     // 重启设备
627
-    controlRebootDevice(snList, useridList) {
678
+    controlRebootDevice(snList) {
628
       let controlWSMsg = new ControlWSMsg(
679
       let controlWSMsg = new ControlWSMsg(
629
         controlWs.ws,
680
         controlWs.ws,
630
         this.userInfo.adminid,
681
         this.userInfo.adminid,
631
         snList
682
         snList
632
       );
683
       );
633
       controlWSMsg.rebootDevice();
684
       controlWSMsg.rebootDevice();
634
-      controlWSMsg.send();
635
-      let form = {
636
-        pushType: 4,
637
-        pushObj: 1
638
-      };
639
-      form.userids = useridList;
640
-      this.addPushLog(form);
685
+      controlWSMsg.send((isSend) => {
686
+        if (isSend) {
687
+          this.$Message.success("推送成功");
688
+        } else {
689
+          this.$Message.error("推送失败");
690
+        }
691
+      });
692
+      this.$refs.deviceTable.selectAll(false);
693
+      // let form = {
694
+      //   pushType: 4,
695
+      //   pushObj: 1
696
+      // };
697
+      // form.userids = useridList;
698
+      // this.addPushLog(form);
699
+    },
700
+    // 解除管控
701
+    controlRemovetDevice(snList) {
702
+      let controlWSMsg = new ControlWSMsg(
703
+        controlWs.ws,
704
+        this.userInfo.adminid,
705
+        snList
706
+      );
707
+      controlWSMsg.removeControl();
708
+      controlWSMsg.send((isSend) => {
709
+        if (isSend) {
710
+          this.$Message.success("推送成功");
711
+        } else {
712
+          this.$Message.error("推送失败");
713
+        }
714
+      });
715
+      this.$refs.deviceTable.selectAll(false);
716
+      // let form = {
717
+      //   pushType: 4,
718
+      //   pushObj: 1
719
+      // };
720
+      // form.userids = useridList;
721
+      // this.addPushLog(form);
641
     },
722
     },
642
     // 添加推送日志
723
     // 添加推送日志
643
     addPushLog(form) {
724
     addPushLog(form) {
644
       logPush_add(form).then((data) => {
725
       logPush_add(form).then((data) => {
645
         if (data.code === 0) {
726
         if (data.code === 0) {
646
-          this.$refs.deviceTable.selectAll(false);
647
           this.$Message.success(data.msg);
727
           this.$Message.success(data.msg);
648
         } else {
728
         } else {
649
           this.$Message.error(data.msg);
729
           this.$Message.error(data.msg);

+ 122
- 45
src/views/schoolSection/deviceManage/deviceManage.vue View File

72
               <DropdownItem name="5">限制使用</DropdownItem>
72
               <DropdownItem name="5">限制使用</DropdownItem>
73
               <DropdownItem name="6">更新策略</DropdownItem>
73
               <DropdownItem name="6">更新策略</DropdownItem>
74
               <DropdownItem name="7">重启设备</DropdownItem>
74
               <DropdownItem name="7">重启设备</DropdownItem>
75
+              <DropdownItem name="9">解除管控</DropdownItem>
75
             </DropdownMenu>
76
             </DropdownMenu>
76
           </Dropdown>
77
           </Dropdown>
77
         </div>
78
         </div>
1361
           },
1362
           },
1362
           onCancel: () => {}
1363
           onCancel: () => {}
1363
         });
1364
         });
1365
+      } else if (name === "9") {
1366
+        // 解除管控
1367
+        if (snList.length === 0) {
1368
+          this.$Message.error("请勾选至少一个设备。");
1369
+          return;
1370
+        }
1371
+        this.$Modal.confirm({
1372
+          title: "提示",
1373
+          content: "确定对所选设备进行解除管控操作吗?",
1374
+          onOk: () => {
1375
+            this.controlRemovetDevice(snList, useridList);
1376
+          },
1377
+          onCancel: () => {}
1378
+        });
1364
       }
1379
       }
1365
     },
1380
     },
1366
     // 恢复出厂设置
1381
     // 恢复出厂设置
1367
-    controlRestoreFactory(snList, useridList) {
1382
+    controlRestoreFactory(snList) {
1368
       let controlWSMsg = new ControlWSMsg(
1383
       let controlWSMsg = new ControlWSMsg(
1369
         controlWs.ws,
1384
         controlWs.ws,
1370
         this.userInfo.adminid,
1385
         this.userInfo.adminid,
1371
         snList
1386
         snList
1372
       );
1387
       );
1373
       controlWSMsg.restoreFactory();
1388
       controlWSMsg.restoreFactory();
1374
-      controlWSMsg.send();
1375
-      let form = {
1376
-        pushType: 6,
1377
-        pushObj: 1
1378
-      };
1379
-      form.userids = useridList;
1380
-      this.addPushLog(form);
1389
+      controlWSMsg.send((isSend) => {
1390
+        if (isSend) {
1391
+          this.$Message.success("推送成功");
1392
+        } else {
1393
+          this.$Message.error("推送失败");
1394
+        }
1395
+      });
1396
+      this.$refs.deviceTable.selectAll(false);
1397
+      // let form = {
1398
+      //   pushType: 6,
1399
+      //   pushObj: 1
1400
+      // };
1401
+      // form.userids = useridList;
1402
+      // this.addPushLog(form);
1381
     },
1403
     },
1382
     // 发送消息
1404
     // 发送消息
1383
     controlSendMessage() {
1405
     controlSendMessage() {
1397
               content: this.controlMessageInfo.content
1419
               content: this.controlMessageInfo.content
1398
             })
1420
             })
1399
           );
1421
           );
1400
-          controlWSMsg.send();
1422
+          controlWSMsg.send((isSend) => {
1423
+            if (isSend) {
1424
+              this.$Message.success("推送成功");
1425
+            } else {
1426
+              this.$Message.error("推送失败");
1427
+            }
1428
+          });
1401
           let form = {
1429
           let form = {
1402
             pushType: 1,
1430
             pushType: 1,
1403
             pushObj: this.controlMessageInfo.classid ? 2 : 1,
1431
             pushObj: this.controlMessageInfo.classid ? 2 : 1,
1409
           } else {
1437
           } else {
1410
             form.userids = useridList;
1438
             form.userids = useridList;
1411
           }
1439
           }
1440
+          this.$refs.deviceTable.selectAll(false);
1412
           this.addPushLog(form);
1441
           this.addPushLog(form);
1413
         }
1442
         }
1414
       });
1443
       });
1415
     },
1444
     },
1416
     // 解除限制
1445
     // 解除限制
1417
-    controlRemoveLimit(snList, useridList) {
1446
+    controlRemoveLimit(snList) {
1418
       let controlWSMsg = new ControlWSMsg(
1447
       let controlWSMsg = new ControlWSMsg(
1419
         controlWs.ws,
1448
         controlWs.ws,
1420
         this.userInfo.adminid,
1449
         this.userInfo.adminid,
1421
         snList
1450
         snList
1422
       );
1451
       );
1423
       controlWSMsg.removeLimit();
1452
       controlWSMsg.removeLimit();
1424
-      controlWSMsg.send();
1425
-      let form = {
1426
-        pushType: 2,
1427
-        pushObj: 1
1428
-      };
1429
-      form.userids = useridList;
1430
-      this.addPushLog(form);
1453
+      controlWSMsg.send((isSend) => {
1454
+        if (isSend) {
1455
+          this.$Message.success("推送成功");
1456
+        } else {
1457
+          this.$Message.error("推送失败");
1458
+        }
1459
+      });
1460
+      this.$refs.deviceTable.selectAll(false);
1461
+      // let form = {
1462
+      //   pushType: 2,
1463
+      //   pushObj: 1
1464
+      // };
1465
+      // form.userids = useridList;
1466
+      // this.addPushLog(form);
1431
     },
1467
     },
1432
     // 限制使用
1468
     // 限制使用
1433
-    controlLimitedUse(snList, useridList) {
1469
+    controlLimitedUse(snList) {
1434
       let controlWSMsg = new ControlWSMsg(
1470
       let controlWSMsg = new ControlWSMsg(
1435
         controlWs.ws,
1471
         controlWs.ws,
1436
         this.userInfo.adminid,
1472
         this.userInfo.adminid,
1437
         snList
1473
         snList
1438
       );
1474
       );
1439
       controlWSMsg.limitedUse();
1475
       controlWSMsg.limitedUse();
1440
-      controlWSMsg.send();
1441
-      let form = {
1442
-        pushType: 3,
1443
-        pushObj: 1
1444
-      };
1445
-      form.userids = useridList;
1446
-      this.addPushLog(form);
1476
+      controlWSMsg.send((isSend) => {
1477
+        if (isSend) {
1478
+          this.$Message.success("推送成功");
1479
+        } else {
1480
+          this.$Message.error("推送失败");
1481
+        }
1482
+      });
1483
+      this.$refs.deviceTable.selectAll(false);
1484
+      // let form = {
1485
+      //   pushType: 3,
1486
+      //   pushObj: 1
1487
+      // };
1488
+      // form.userids = useridList;
1489
+      // this.addPushLog(form);
1447
     },
1490
     },
1448
     // 更新策略
1491
     // 更新策略
1449
-    controlUpdateStrategy(snList, useridList) {
1492
+    controlUpdateStrategy(snList) {
1450
       let controlWSMsg = new ControlWSMsg(
1493
       let controlWSMsg = new ControlWSMsg(
1451
         controlWs.ws,
1494
         controlWs.ws,
1452
         this.userInfo.adminid,
1495
         this.userInfo.adminid,
1453
         snList
1496
         snList
1454
       );
1497
       );
1455
       controlWSMsg.updateStrategy();
1498
       controlWSMsg.updateStrategy();
1456
-      controlWSMsg.send();
1457
-      let form = {
1458
-        pushType: 4,
1459
-        pushObj: 1
1460
-      };
1461
-      form.userids = useridList;
1462
-      this.addPushLog(form);
1499
+      controlWSMsg.send((isSend) => {
1500
+        if (isSend) {
1501
+          this.$Message.success("推送成功");
1502
+        } else {
1503
+          this.$Message.error("推送失败");
1504
+        }
1505
+      });
1506
+      this.$refs.deviceTable.selectAll(false);
1507
+      // let form = {
1508
+      //   pushType: 4,
1509
+      //   pushObj: 1
1510
+      // };
1511
+      // form.userids = useridList;
1512
+      // this.addPushLog(form);
1463
     },
1513
     },
1464
     // 重启设备
1514
     // 重启设备
1465
-    controlRebootDevice(snList, useridList) {
1515
+    controlRebootDevice(snList) {
1466
       let controlWSMsg = new ControlWSMsg(
1516
       let controlWSMsg = new ControlWSMsg(
1467
         controlWs.ws,
1517
         controlWs.ws,
1468
         this.userInfo.adminid,
1518
         this.userInfo.adminid,
1469
         snList
1519
         snList
1470
       );
1520
       );
1471
       controlWSMsg.rebootDevice();
1521
       controlWSMsg.rebootDevice();
1472
-      controlWSMsg.send();
1473
-      let form = {
1474
-        pushType: 4,
1475
-        pushObj: 1
1476
-      };
1477
-      form.userids = useridList;
1478
-      this.addPushLog(form);
1522
+      controlWSMsg.send((isSend) => {
1523
+        if (isSend) {
1524
+          this.$Message.success("推送成功");
1525
+        } else {
1526
+          this.$Message.error("推送失败");
1527
+        }
1528
+      });
1529
+      this.$refs.deviceTable.selectAll(false);
1530
+      // let form = {
1531
+      //   pushType: 4,
1532
+      //   pushObj: 1
1533
+      // };
1534
+      // form.userids = useridList;
1535
+      // this.addPushLog(form);
1536
+    },
1537
+    // 解除管控
1538
+    controlRemovetDevice(snList) {
1539
+      let controlWSMsg = new ControlWSMsg(
1540
+        controlWs.ws,
1541
+        this.userInfo.adminid,
1542
+        snList
1543
+      );
1544
+      controlWSMsg.removeControl();
1545
+      controlWSMsg.send((isSend) => {
1546
+        if (isSend) {
1547
+          this.$Message.success("推送成功");
1548
+        } else {
1549
+          this.$Message.error("推送失败");
1550
+        }
1551
+      });
1552
+      this.$refs.deviceTable.selectAll(false);
1553
+      // let form = {
1554
+      //   pushType: 4,
1555
+      //   pushObj: 1
1556
+      // };
1557
+      // form.userids = useridList;
1558
+      // this.addPushLog(form);
1479
     },
1559
     },
1480
     // 添加推送日志
1560
     // 添加推送日志
1481
     addPushLog(form) {
1561
     addPushLog(form) {
1482
       logPush_add(form).then((data) => {
1562
       logPush_add(form).then((data) => {
1483
-        if (data.code === 0) {
1484
-          this.$refs.deviceTable.selectAll(false);
1485
-          this.$Message.success(data.msg);
1486
-        } else {
1563
+        if (data.code !== 0) {
1487
           this.$Message.error(data.msg);
1564
           this.$Message.error(data.msg);
1488
         }
1565
         }
1489
       });
1566
       });

Loading…
Cancel
Save