Pārlūkot izejas kodu

socket解除管控

gzb
wangzhonglu pirms 9 mēnešiem
vecāks
revīzija
deef025f02

+ 4
- 0
src/utils/ControlWSMsg.js Parādīt failu

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

+ 122
- 42
src/views/schoolSection/deviceManage/breakRuleDevice.vue Parādīt failu

@@ -32,6 +32,7 @@
32 32
             <DropdownItem name="5">限制使用</DropdownItem>
33 33
             <DropdownItem name="6">更新策略</DropdownItem>
34 34
             <DropdownItem name="7">重启设备</DropdownItem>
35
+            <DropdownItem name="9">解除管控</DropdownItem>
35 36
             <DropdownItem name="8">合规处理</DropdownItem>
36 37
           </DropdownMenu>
37 38
         </Dropdown>
@@ -39,6 +40,7 @@
39 40
     </div>
40 41
     <div class="table_wrap">
41 42
       <Table
43
+        ref="deviceTable"
42 44
         :columns="columns"
43 45
         :data="searchForm.list"
44 46
         @on-selection-change="selectionChange"
@@ -527,23 +529,44 @@ export default {
527 529
           return;
528 530
         }
529 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 550
       let controlWSMsg = new ControlWSMsg(
535 551
         controlWs.ws,
536 552
         this.userInfo.adminid,
537 553
         snList
538 554
       );
539 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 572
     controlSendMessage() {
@@ -563,7 +586,13 @@ export default {
563 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 596
           let form = {
568 597
             pushType: 1,
569 598
             pushObj: 1,
@@ -571,79 +600,130 @@ export default {
571 600
             content: this.controlMessageInfo.content
572 601
           };
573 602
           form.userids = useridList;
603
+          this.$refs.deviceTable.selectAll(false);
574 604
           this.addPushLog(form);
575 605
         }
576 606
       });
577 607
     },
578 608
     // 解除限制
579
-    controlRemoveLimit(snList, useridList) {
609
+    controlRemoveLimit(snList) {
580 610
       let controlWSMsg = new ControlWSMsg(
581 611
         controlWs.ws,
582 612
         this.userInfo.adminid,
583 613
         snList
584 614
       );
585 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 633
       let controlWSMsg = new ControlWSMsg(
597 634
         controlWs.ws,
598 635
         this.userInfo.adminid,
599 636
         snList
600 637
       );
601 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 656
       let controlWSMsg = new ControlWSMsg(
613 657
         controlWs.ws,
614 658
         this.userInfo.adminid,
615 659
         snList
616 660
       );
617 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 679
       let controlWSMsg = new ControlWSMsg(
629 680
         controlWs.ws,
630 681
         this.userInfo.adminid,
631 682
         snList
632 683
       );
633 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 724
     addPushLog(form) {
644 725
       logPush_add(form).then((data) => {
645 726
         if (data.code === 0) {
646
-          this.$refs.deviceTable.selectAll(false);
647 727
           this.$Message.success(data.msg);
648 728
         } else {
649 729
           this.$Message.error(data.msg);

+ 122
- 45
src/views/schoolSection/deviceManage/deviceManage.vue Parādīt failu

@@ -72,6 +72,7 @@
72 72
               <DropdownItem name="5">限制使用</DropdownItem>
73 73
               <DropdownItem name="6">更新策略</DropdownItem>
74 74
               <DropdownItem name="7">重启设备</DropdownItem>
75
+              <DropdownItem name="9">解除管控</DropdownItem>
75 76
             </DropdownMenu>
76 77
           </Dropdown>
77 78
         </div>
@@ -1361,23 +1362,44 @@ export default {
1361 1362
           },
1362 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 1383
       let controlWSMsg = new ControlWSMsg(
1369 1384
         controlWs.ws,
1370 1385
         this.userInfo.adminid,
1371 1386
         snList
1372 1387
       );
1373 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 1405
     controlSendMessage() {
@@ -1397,7 +1419,13 @@ export default {
1397 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 1429
           let form = {
1402 1430
             pushType: 1,
1403 1431
             pushObj: this.controlMessageInfo.classid ? 2 : 1,
@@ -1409,81 +1437,130 @@ export default {
1409 1437
           } else {
1410 1438
             form.userids = useridList;
1411 1439
           }
1440
+          this.$refs.deviceTable.selectAll(false);
1412 1441
           this.addPushLog(form);
1413 1442
         }
1414 1443
       });
1415 1444
     },
1416 1445
     // 解除限制
1417
-    controlRemoveLimit(snList, useridList) {
1446
+    controlRemoveLimit(snList) {
1418 1447
       let controlWSMsg = new ControlWSMsg(
1419 1448
         controlWs.ws,
1420 1449
         this.userInfo.adminid,
1421 1450
         snList
1422 1451
       );
1423 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 1470
       let controlWSMsg = new ControlWSMsg(
1435 1471
         controlWs.ws,
1436 1472
         this.userInfo.adminid,
1437 1473
         snList
1438 1474
       );
1439 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 1493
       let controlWSMsg = new ControlWSMsg(
1451 1494
         controlWs.ws,
1452 1495
         this.userInfo.adminid,
1453 1496
         snList
1454 1497
       );
1455 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 1516
       let controlWSMsg = new ControlWSMsg(
1467 1517
         controlWs.ws,
1468 1518
         this.userInfo.adminid,
1469 1519
         snList
1470 1520
       );
1471 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 1561
     addPushLog(form) {
1482 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 1564
           this.$Message.error(data.msg);
1488 1565
         }
1489 1566
       });

Notiek ielāde…
Atcelt
Saglabāt