Browse Source

学校设备管理其他操作

gzb
wangzhonglu 9 months ago
parent
commit
1e83032b69

+ 4
- 0
src/api/school.js View File

@@ -109,3 +109,7 @@ export const user_delete = (data) => setRequest("user/delete", data);
109 109
  * 3.2.5用户--导入
110 110
  */
111 111
 export const user_import = (data) => setRequest("user/import", data);
112
+/**
113
+ * 3.2.6用户--获取班级sn
114
+ */
115
+export const user_list_cs = (data) => setRequest("user/list_cs", data);

+ 3
- 3
src/utils/ControlWSMsg.js View File

@@ -24,10 +24,10 @@ class ControlWSMsg {
24 24
     this.body = body;
25 25
   }
26 26
   // 发送消息
27
-  msgContent(body) {
27
+  msgContent(msg) {
28 28
     this.code = 2001;
29
-    // {userid, username, msg}
30
-    this.body = body;
29
+    // {msg}
30
+    this.body = { msg };
31 31
   }
32 32
   // 限制使用
33 33
   limitedUse() {

+ 1
- 4
src/views/schoolSection/applicationStrategy/appStrategyManage.vue View File

@@ -35,9 +35,7 @@
35 35
     <div class="main_right">
36 36
       <div class="right_header">
37 37
         <div class="header_left">
38
-          <span v-if="appStrategyInfo.stappid"
39
-            >已引用“{{ appStrategyInfo.name }}”的应用策略</span
40
-          >
38
+          <span v-if="appStrategyInfo.stappid">{{ appStrategyInfo.name }}</span>
41 39
         </div>
42 40
         <div class="header_right">
43 41
           <div
@@ -436,7 +434,6 @@ export default {
436 434
       font-size: 16px;
437 435
       .header_left {
438 436
         font-weight: bold;
439
-        color: #f0153f;
440 437
       }
441 438
       .header_right {
442 439
         display: flex;

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

@@ -123,7 +123,7 @@ export default {
123 123
           align: "center"
124 124
         },
125 125
         {
126
-          title: "ID(IMEI/MEID/ESN)",
126
+          title: "SN",
127 127
           key: "sn",
128 128
           align: "center"
129 129
         },

+ 264
- 24
src/views/schoolSection/deviceManage/deviceManage.vue View File

@@ -78,6 +78,7 @@
78 78
       </div>
79 79
       <div class="table_wrap">
80 80
         <Table
81
+          ref="deviceTable"
81 82
           :columns="columns"
82 83
           :data="searchForm.list"
83 84
           @on-selection-change="selectionChange"
@@ -110,6 +111,44 @@
110 111
         ></Page>
111 112
       </div>
112 113
     </div>
114
+    <Modal
115
+      class="modal1"
116
+      :mask-closable="false"
117
+      v-model="controlMessageInfo.show"
118
+      :title="controlMessageInfo.classid ? '整班发送消息' : '发送消息'"
119
+    >
120
+      <Form
121
+        v-if="controlMessageInfo.show"
122
+        ref="sendMsgForm"
123
+        :model="controlMessageInfo"
124
+        :rules="rules"
125
+        :label-width="60"
126
+      >
127
+        <FormItem label="标题" prop="title">
128
+          <Input
129
+            v-model="controlMessageInfo.title"
130
+            :maxlength="32"
131
+            show-word-limit
132
+            placeholder="请输入标题,不超过32个字符"
133
+          ></Input>
134
+        </FormItem>
135
+        <FormItem label="内容" prop="content">
136
+          <Input
137
+            type="textarea"
138
+            v-model="controlMessageInfo.content"
139
+            :maxlength="255"
140
+            show-word-limit
141
+            placeholder="请输入内容"
142
+          ></Input>
143
+        </FormItem>
144
+      </Form>
145
+      <div slot="footer">
146
+        <Button @click="controlMessageInfo.show = false">取消</Button>
147
+        <Button @click="controlSendMessage()" type="primary" class="primary_btn"
148
+          >保存</Button
149
+        >
150
+      </div>
151
+    </Modal>
113 152
   </div>
114 153
 </template>
115 154
 
@@ -117,12 +156,13 @@
117 156
 import controlWs from "@/utils/ControlWs";
118 157
 import ControlWSMsg from "@/utils/ControlWSMsg";
119 158
 import { exportToExcel } from "@/utils/exportToExcel";
120
-import { class_list } from "@/api/school";
159
+import { class_list, user_list_cs } from "@/api/school";
121 160
 import {
122 161
   device_manager_list_d,
123 162
   device_manager_export_d,
124 163
   device_manager_export_id
125 164
 } from "@/api/device_manager";
165
+import { logPush_add } from "@/api/log";
126 166
 export default {
127 167
   data() {
128 168
     return {
@@ -144,6 +184,29 @@ export default {
144 184
         total: 0
145 185
       },
146 186
       tableSelection: [],
187
+      controlMessageInfo: {
188
+        show: false,
189
+        title: "",
190
+        content: "",
191
+        classid: null,
192
+        list: []
193
+      },
194
+      rules: {
195
+        title: [
196
+          {
197
+            required: true,
198
+            message: "请输入标题",
199
+            trigger: "blur"
200
+          }
201
+        ],
202
+        content: [
203
+          {
204
+            required: true,
205
+            message: "请选择内容",
206
+            trigger: "blur"
207
+          }
208
+        ]
209
+      },
147 210
       schoolInfo: {
148 211
         schoolid: null,
149 212
         schoolname: null,
@@ -189,7 +252,7 @@ export default {
189 252
           align: "center"
190 253
         },
191 254
         {
192
-          title: "ID(IMEI/MEID/ESN)",
255
+          title: "SN",
193 256
           key: "sn",
194 257
           align: "center"
195 258
         },
@@ -356,7 +419,7 @@ export default {
356 419
                         ? "离线"
357 420
                         : "",
358 421
                     设备型号: item.deviceModel,
359
-                    "ID(IMEI/MEID/ESN)": item.sn,
422
+                    SN: item.sn,
360 423
                     Rom版本: item.romVersion,
361 424
                     更新时间: item.updatetime
362 425
                   };
@@ -420,53 +483,230 @@ export default {
420 483
         this.$Message.error("推送服务不可用");
421 484
         return;
422 485
       }
423
-      let snList = this.tableSelection.map((row) => row.sn).filter(Boolean);
486
+      let snList = this.tableSelection
487
+        .filter((row) => row.sn)
488
+        .map((item) => item.sn);
424 489
       if (name === "1") {
425
-        // 恢复出厂设置
426
-        if (this.tableSelection.length === 0) {
427
-          this.$Message.error("请选择列表");
490
+        // 恢复出厂
491
+        if (snList.length === 0) {
492
+          this.$Message.error("请勾选至少一个设备。");
428 493
           return;
429 494
         }
430
-        let controlWSMsg = new ControlWSMsg(
431
-          controlWs.ws,
432
-          this.userInfo.adminid,
433
-          snList
434
-        );
435
-        controlWSMsg.restoreFactory();
436
-        controlWSMsg.send();
495
+        this.$Modal.confirm({
496
+          title: "提示",
497
+          content: "确定对所选设备进行恢复出厂设置操作吗?",
498
+          onOk: () => {
499
+            this.controlRestoreFactory(snList);
500
+          },
501
+          onCancel: () => {}
502
+        });
437 503
       } else if (name === "2") {
438 504
         // 发送消息
439
-        if (this.tableSelection.length === 0) {
440
-          this.$Message.error("请选择列表");
505
+        if (snList.length === 0) {
506
+          this.$Message.error("请勾选至少一个设备。");
441 507
           return;
442 508
         }
509
+        this.controlMessageInfo = {
510
+          show: true,
511
+          title: "",
512
+          content: "",
513
+          classid: null,
514
+          list: snList
515
+        };
443 516
       } else if (name === "3") {
444 517
         // 整班发送消息
518
+        user_list_cs({
519
+          classid: this.searchForm.classid
520
+        }).then((data) => {
521
+          if (data.code === 0) {
522
+            if (data.obj.length === 0) {
523
+              this.$Message.error("当前班级没有设备");
524
+              return;
525
+            }
526
+            this.controlMessageInfo = {
527
+              show: true,
528
+              title: "",
529
+              content: "",
530
+              classid: this.searchForm.classid,
531
+              list: data.obj
532
+            };
533
+          } else {
534
+            this.$Message.error(data.msg);
535
+          }
536
+        });
445 537
       } else if (name === "4") {
446 538
         // 解除限制
447
-        if (this.tableSelection.length === 0) {
448
-          this.$Message.error("请选择列表");
539
+        if (snList.length === 0) {
540
+          this.$Message.error("请勾选至少一个设备。");
449 541
           return;
450 542
         }
543
+        this.$Modal.confirm({
544
+          title: "提示",
545
+          content: "确定对所选设备进行解除限制操作吗?",
546
+          onOk: () => {
547
+            this.controlRemoveLimit(snList);
548
+          },
549
+          onCancel: () => {}
550
+        });
451 551
       } else if (name === "5") {
452 552
         // 限制使用
453
-        if (this.tableSelection.length === 0) {
454
-          this.$Message.error("请选择列表");
553
+        if (snList.length === 0) {
554
+          this.$Message.error("请勾选至少一个设备。");
455 555
           return;
456 556
         }
557
+        this.$Modal.confirm({
558
+          title: "提示",
559
+          content: "确定对所选设备进行限制使用操作吗?",
560
+          onOk: () => {
561
+            this.controlLimitedUse(snList);
562
+          },
563
+          onCancel: () => {}
564
+        });
457 565
       } else if (name === "6") {
458 566
         // 更新策略
459
-        if (this.tableSelection.length === 0) {
460
-          this.$Message.error("请选择列表");
567
+        if (snList.length === 0) {
568
+          this.$Message.error("请勾选至少一个设备。");
461 569
           return;
462 570
         }
571
+        this.$Modal.confirm({
572
+          title: "提示",
573
+          content: "确定对所选设备进行更新策略操作吗?",
574
+          onOk: () => {
575
+            this.controlUpdateStrategy(snList);
576
+          },
577
+          onCancel: () => {}
578
+        });
463 579
       } else if (name === "7") {
464 580
         // 重启设备
465
-        if (this.tableSelection.length === 0) {
466
-          this.$Message.error("请选择列表");
581
+        if (snList.length === 0) {
582
+          this.$Message.error("请勾选至少一个设备。");
467 583
           return;
468 584
         }
585
+        this.$Modal.confirm({
586
+          title: "提示",
587
+          content: "确定对所选设备进行重启设备操作吗?",
588
+          onOk: () => {
589
+            this.controlRebootDevice(snList);
590
+          },
591
+          onCancel: () => {}
592
+        });
469 593
       }
594
+    },
595
+    // 恢复出厂设置
596
+    controlRestoreFactory(snList) {
597
+      let controlWSMsg = new ControlWSMsg(
598
+        controlWs.ws,
599
+        this.userInfo.adminid,
600
+        snList
601
+      );
602
+      controlWSMsg.restoreFactory();
603
+      controlWSMsg.send();
604
+      let form = {
605
+        pushType: 6,
606
+        pushObj: 1,
607
+        pushObjid: snList
608
+      };
609
+      this.addPushLog(form);
610
+    },
611
+    // 发送消息
612
+    controlSendMessage() {
613
+      this.$refs.sendMsgForm.validate((valid) => {
614
+        if (valid) {
615
+          this.controlMessageInfo.show = false;
616
+          let snList = this.controlMessageInfo.list;
617
+          let controlWSMsg = new ControlWSMsg(
618
+            controlWs.ws,
619
+            this.userInfo.adminid,
620
+            snList
621
+          );
622
+          controlWSMsg.msgContent(this.controlMessageInfo.content);
623
+          controlWSMsg.send();
624
+          let form = {
625
+            pushType: 1,
626
+            pushObj: this.controlMessageInfo.classid ? 2 : 1,
627
+            pushObjid: this.controlMessageInfo.classid
628
+              ? [this.controlMessageInfo.classid]
629
+              : snList,
630
+            content: this.controlMessageInfo.content
631
+          };
632
+          this.addPushLog(form);
633
+        }
634
+      });
635
+    },
636
+    // 解除限制
637
+    controlRemoveLimit(snList) {
638
+      let controlWSMsg = new ControlWSMsg(
639
+        controlWs.ws,
640
+        this.userInfo.adminid,
641
+        snList
642
+      );
643
+      controlWSMsg.removeLimit();
644
+      controlWSMsg.send();
645
+      let form = {
646
+        pushType: 2,
647
+        pushObj: 1,
648
+        pushObjid: snList
649
+      };
650
+      this.addPushLog(form);
651
+    },
652
+    // 限制使用
653
+    controlLimitedUse(snList) {
654
+      let controlWSMsg = new ControlWSMsg(
655
+        controlWs.ws,
656
+        this.userInfo.adminid,
657
+        snList
658
+      );
659
+      controlWSMsg.limitedUse();
660
+      controlWSMsg.send();
661
+      let form = {
662
+        pushType: 3,
663
+        pushObj: 1,
664
+        pushObjid: snList
665
+      };
666
+      this.addPushLog(form);
667
+    },
668
+    // 更新策略
669
+    controlUpdateStrategy(snList) {
670
+      let controlWSMsg = new ControlWSMsg(
671
+        controlWs.ws,
672
+        this.userInfo.adminid,
673
+        snList
674
+      );
675
+      controlWSMsg.updateStrategy();
676
+      controlWSMsg.send();
677
+      let form = {
678
+        pushType: 4,
679
+        pushObj: 1,
680
+        pushObjid: snList
681
+      };
682
+      this.addPushLog(form);
683
+    },
684
+    // 重启设备
685
+    controlRebootDevice(snList) {
686
+      let controlWSMsg = new ControlWSMsg(
687
+        controlWs.ws,
688
+        this.userInfo.adminid,
689
+        snList
690
+      );
691
+      controlWSMsg.rebootDevice();
692
+      controlWSMsg.send();
693
+      let form = {
694
+        pushType: 4,
695
+        pushObj: 1,
696
+        pushObjid: snList
697
+      };
698
+      this.addPushLog(form);
699
+    },
700
+    // 添加推送日志
701
+    addPushLog(form) {
702
+      logPush_add(form).then((data) => {
703
+        if (data.code === 0) {
704
+          this.$refs.deviceTable.selectAll(false);
705
+          this.$Message.success(data.msg);
706
+        } else {
707
+          this.$Message.error(data.msg);
708
+        }
709
+      });
470 710
     }
471 711
   }
472 712
 };

+ 1
- 1
src/views/schoolSection/deviceManage/inLineDevice.vue View File

@@ -114,7 +114,7 @@ export default {
114 114
           align: "center"
115 115
         },
116 116
         {
117
-          title: "ID(IMEI/MEID/ESN)",
117
+          title: "SN",
118 118
           key: "sn",
119 119
           align: "center"
120 120
         },

+ 1
- 1
src/views/schoolSection/deviceManage/outControlDevice.vue View File

@@ -116,7 +116,7 @@ export default {
116 116
           align: "center"
117 117
         },
118 118
         {
119
-          title: "ID(IMEI/MEID/ESN)",
119
+          title: "SN",
120 120
           key: "sn",
121 121
           align: "center"
122 122
         },

+ 1
- 1
src/views/schoolSection/deviceManage/removeControlDevice.vue View File

@@ -91,7 +91,7 @@ export default {
91 91
           align: "center"
92 92
         },
93 93
         {
94
-          title: "ID(IMEI/MEID/ESN)",
94
+          title: "SN",
95 95
           key: "sn",
96 96
           align: "center"
97 97
         },

+ 2
- 2
src/views/schoolSection/log/deviceExport.vue View File

@@ -99,7 +99,7 @@ export default {
99 99
           align: "center"
100 100
         },
101 101
         {
102
-          title: "ID(IMEI/MEID/ESN)",
102
+          title: "SN",
103 103
           key: "sn",
104 104
           align: "center"
105 105
         },
@@ -193,7 +193,7 @@ export default {
193 193
                     姓名: item.username,
194 194
                     设备号码: item.deviceMac,
195 195
                     设备型号: item.deviceModel,
196
-                    "ID(IMEI/MEID/ESN)": item.sn,
196
+                    "SN": item.sn,
197 197
                     Rom版本: item.romVersion,
198 198
                     是否违规:
199 199
                       item.violated === 1

Loading…
Cancel
Save