Browse Source

平板策略优化

gzb
guozhongbo 8 months ago
parent
commit
f1c935e2c9

+ 86
- 0
src/utils/index.js View File

16
     callback();
16
     callback();
17
   }
17
   }
18
 };
18
 };
19
+export const padDevices = [
20
+  {
21
+    pdorder: 1,
22
+    pdtype: "摄像头",
23
+    enabled: 1,
24
+    icon: "ivu-icon iconfont icon-ball-camera"
25
+  },
26
+  {
27
+    pdorder: 2,
28
+    pdtype: "GPS",
29
+    enabled: 1,
30
+    icon: "ivu-icon iconfont icon-GPSxinxi"
31
+  },
32
+  {
33
+    pdorder: 3,
34
+    pdtype: "蓝牙",
35
+    enabled: 2,
36
+    icon: "ivu-icon iconfont icon-lanya"
37
+  },
38
+  {
39
+    pdorder: 4,
40
+    pdtype: "USB连接",
41
+    enabled: 2,
42
+    icon: "ivu-icon iconfont icon-USB"
43
+  },
44
+  {
45
+    pdorder: 5,
46
+    pdtype: "电话短信",
47
+    enabled: 2,
48
+    icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
49
+  },
50
+  {
51
+    pdorder: 6,
52
+    pdtype: "数据流量",
53
+    enabled: 2,
54
+    icon: "ivu-icon iconfont icon-liuliang"
55
+  },
56
+  {
57
+    pdorder: 7,
58
+    pdtype: "Wi-Fi高级选项",
59
+    enabled: 2,
60
+    icon: "ivu-icon iconfont icon-wifiguanbi"
61
+  },
62
+  {
63
+    pdorder: 8,
64
+    pdtype: "SD卡",
65
+    enabled: 2,
66
+    icon: "ivu-icon iconfont icon-sdka-09"
67
+  },
68
+  {
69
+    pdorder: 9,
70
+    pdtype: "OTG",
71
+    enabled: 2,
72
+    icon: "ivu-icon iconfont icon-icon-OTG"
73
+  }
74
+];
75
+export const padViolates = [
76
+  {
77
+    title: "已ROOT",
78
+    violateType: 1,
79
+    checked: false,
80
+    noticed: false,
81
+    handleMethod: ""
82
+  },
83
+  {
84
+    title: "安装非商店应用",
85
+    violateType: 2,
86
+    checked: false,
87
+    noticed: false,
88
+    handleMethod: ""
89
+  },
90
+  {
91
+    title: "更换SIM卡",
92
+    violateType: 3,
93
+    checked: false,
94
+    noticed: false,
95
+    handleMethod: ""
96
+  },
97
+  {
98
+    title: "USB连接电脑",
99
+    violateType: 4,
100
+    checked: false,
101
+    noticed: false,
102
+    handleMethod: ""
103
+  }
104
+];
19
 export const weekDay = [
105
 export const weekDay = [
20
   {
106
   {
21
     label: "周日",
107
     label: "周日",

+ 74
- 139
src/views/schoolSection/strategy/personalStrategy.vue View File

249
               <Checkbox
249
               <Checkbox
250
                 :disabled="strategyInfo.model === 'see'"
250
                 :disabled="strategyInfo.model === 'see'"
251
                 class="checked"
251
                 class="checked"
252
-                @on-change="checkedChange(row)"
252
+                @on-change="headleStrategy(row, 'checked')"
253
                 v-model="row.checked"
253
                 v-model="row.checked"
254
               ></Checkbox>
254
               ></Checkbox>
255
               <span
255
               <span
257
                 >{{ row.title }}</span
257
                 >{{ row.title }}</span
258
               >
258
               >
259
             </template>
259
             </template>
260
+            <template slot-scope="{ row }" slot="noticed">
261
+              <Checkbox
262
+                  :disabled="strategyInfo.model === 'see'"
263
+                  class="checked"
264
+                  v-model="row.noticed"
265
+                  @on-change="headleStrategy(row, 'noticed')"
266
+              >通知管理员</Checkbox
267
+              >
268
+            </template>
260
             <template slot-scope="{ row }" slot="violationHandling">
269
             <template slot-scope="{ row }" slot="violationHandling">
261
-              <CheckboxGroup
262
-                @on-change="checkboxChange(row)"
263
-                v-model="row.handleMethod"
270
+              <RadioGroup
271
+                  v-model="row.handleMethod"
272
+                  @on-change="headleStrategy(row, 'handleMethod')"
264
               >
273
               >
265
-                <Checkbox
266
-                  :disabled="strategyInfo.model === 'see'"
267
-                  label="通知管理员"
268
-                ></Checkbox>
269
-                <Checkbox
270
-                  :disabled="strategyInfo.model === 'see'"
271
-                  style="margin: 0 40px"
272
-                  label="锁定"
273
-                ></Checkbox>
274
-                <Checkbox
275
-                  :disabled="strategyInfo.model === 'see'"
276
-                  label="恢复出厂设置"
277
-                ></Checkbox>
278
-              </CheckboxGroup>
274
+                <Radio
275
+                    style="margin-right: 20px"
276
+                    :disabled="strategyInfo.model === 'see'"
277
+                    label="锁定"
278
+                ></Radio>
279
+                <Radio   :disabled="strategyInfo.model === 'see'" label="恢复出厂设置"></Radio>
280
+              </RadioGroup>
279
             </template>
281
             </template>
280
           </Table>
282
           </Table>
281
           <div class="nodata" v-if="!strategyInfo.hasviolate">
283
           <div class="nodata" v-if="!strategyInfo.hasviolate">
340
   stPad_list_user
342
   stPad_list_user
341
 } from "@/api/stPad";
343
 } from "@/api/stPad";
342
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
344
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
345
+import { padDevices, padViolates } from "@/utils";
343
 export default {
346
 export default {
344
   components: {
347
   components: {
345
     TimeStrategy
348
     TimeStrategy
372
         padViolates: [] //设备违规
375
         padViolates: [] //设备违规
373
       },
376
       },
374
       padApps: [],
377
       padApps: [],
375
-      padDevices: [
376
-        {
377
-          pdorder: 1,
378
-          pdtype: "摄像头",
379
-          enabled: 2,
380
-          icon: "ivu-icon iconfont icon-ball-camera"
381
-        },
382
-        {
383
-          pdorder: 2,
384
-          pdtype: "蓝牙",
385
-          enabled: 2,
386
-          icon: "ivu-icon iconfont icon-lanya"
387
-        },
388
-        {
389
-          pdorder: 3,
390
-          pdtype: "USB连接",
391
-          enabled: 2,
392
-          icon: "ivu-icon iconfont icon-USB"
393
-        },
394
-        {
395
-          pdorder: 4,
396
-          pdtype: "Wi-Fi开关",
397
-          enabled: 2,
398
-          icon: "ivu-icon iconfont icon-bx-wifi-2"
399
-        },
400
-        {
401
-          pdorder: 5,
402
-          pdtype: "电话短信",
403
-          enabled: 2,
404
-          icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
405
-        },
406
-        {
407
-          pdorder: 6,
408
-          pdtype: "数据流量",
409
-          enabled: 2,
410
-          icon: "ivu-icon iconfont icon-liuliang"
411
-        },
412
-        {
413
-          pdorder: 7,
414
-          pdtype: "GPS",
415
-          enabled: 2,
416
-          icon: "ivu-icon iconfont icon-GPSxinxi"
417
-        },
418
-        {
419
-          pdorder: 8,
420
-          pdtype: "Wi-Fi高级选项",
421
-          enabled: 2,
422
-          icon: "ivu-icon iconfont icon-wifiguanbi"
423
-        },
424
-        {
425
-          pdorder: 9,
426
-          pdtype: "SD卡",
427
-          enabled: 2,
428
-          icon: "ivu-icon iconfont icon-sdka-09"
429
-        },
430
-        {
431
-          pdorder: 10,
432
-          pdtype: "OTG",
433
-          enabled: 2,
434
-          icon: "ivu-icon iconfont icon-icon-OTG"
435
-        }
436
-      ],
437
-      padViolates: [
438
-        {
439
-          title: "已ROOT",
440
-          violateType: 1,
441
-          checked: false,
442
-          handleMethod: []
443
-        },
444
-        {
445
-          title: "安装非商店应用",
446
-          violateType: 2,
447
-          checked: false,
448
-          handleMethod: []
449
-        },
450
-        {
451
-          title: "更换SIM卡",
452
-          violateType: 3,
453
-          checked: false,
454
-          handleMethod: []
455
-        },
456
-        {
457
-          title: "USB连接电脑",
458
-          violateType: 4,
459
-          checked: false,
460
-          handleMethod: []
461
-        }
462
-      ],
378
+      padDevices,
379
+      padViolates,
463
       columns: [
380
       columns: [
464
         {
381
         {
465
           title: "违规事件",
382
           title: "违规事件",
466
           slot: "violationEvents",
383
           slot: "violationEvents",
467
-          align: "center",
468
-          width: 260
384
+          align: "center"
385
+        },
386
+        {
387
+          title: "是否通知",
388
+          slot: "noticed",
389
+          align: "center"
469
         },
390
         },
470
         {
391
         {
471
           title: "违规处理",
392
           title: "违规处理",
591
     this.init();
512
     this.init();
592
   },
513
   },
593
   methods: {
514
   methods: {
515
+    headleStrategy(row, key) {
516
+      this.padViolates.forEach((item) => {
517
+        if (item.violateType === row.violateType) {
518
+          item[key] = row[key];
519
+        }
520
+      });
521
+    },
522
+    HandleIsShowChange(show, type) {
523
+      if (!show) {
524
+        if (type === 1) {
525
+          this.strategyInfo.padTimes = []; // 平板策略时间
526
+        } else if (type === 2) {
527
+          this.padApps.forEach((item) => {
528
+            item.checked = false;
529
+          });
530
+        } else if (type === 3) {
531
+          this.padDevices.forEach((item) => {
532
+            item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
533
+          });
534
+        } else if (type === 4) {
535
+          this.strategyInfo.padWifis = []; //wifi白名单
536
+        } else if (type === 5) {
537
+          this.padViolates.forEach((item) => {
538
+            item.checked = false;
539
+            item.noticed = false;
540
+            item.handleMethod = "";
541
+          });
542
+        }
543
+      }
544
+    },
594
     stPadChange(row) {
545
     stPadChange(row) {
595
       //切换选择
546
       //切换选择
596
       this.stPadInfo.list.forEach((item) => {
547
       this.stPadInfo.list.forEach((item) => {
605
       this.strategyInfo.padWifis = []; //wifi白名单
556
       this.strategyInfo.padWifis = []; //wifi白名单
606
       this.strategyInfo.padViolates = []; //设备违规
557
       this.strategyInfo.padViolates = []; //设备违规
607
       this.padDevices.forEach((item) => {
558
       this.padDevices.forEach((item) => {
608
-        item.enabled = 2;
559
+        item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
609
       });
560
       });
610
       this.padViolates.forEach((item) => {
561
       this.padViolates.forEach((item) => {
611
         item.checked = false;
562
         item.checked = false;
612
-        item.handleMethod = [];
563
+        item.noticed = false;
564
+        item.handleMethod = "";
613
       });
565
       });
614
       this.padApps.forEach((item) => {
566
       this.padApps.forEach((item) => {
615
         item.checked = false;
567
         item.checked = false;
665
                 return v.violateType === item.violateType;
617
                 return v.violateType === item.violateType;
666
               });
618
               });
667
               item.checked = arr.length > 0 ? true : false;
619
               item.checked = arr.length > 0 ? true : false;
668
-              item.handleMethod =
669
-                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
620
+              item.noticed = arr.length > 0 && arr[0].noticed ? true : false;
621
+              item.handleMethod = arr.length > 0 ? arr[0].handleMethod : "";
670
             });
622
             });
671
           }
623
           }
672
           this.strategyInfo.padWifis = res.obj.padWifis || [];
624
           this.strategyInfo.padWifis = res.obj.padWifis || [];
763
       //获取违规处理
715
       //获取违规处理
764
       for (let item of this.padViolates) {
716
       for (let item of this.padViolates) {
765
         if (item.checked) {
717
         if (item.checked) {
766
-          let handleMethod = item.handleMethod.join(";");
767
-          padViolates.push({ violateType: item.violateType, handleMethod });
718
+          padViolates.push({
719
+            violateType: item.violateType,
720
+            handleMethod: item.handleMethod || "",
721
+            noticed: item.noticed ? 1 : 0
722
+          });
768
         }
723
         }
769
       }
724
       }
770
       if (this.strategyInfo.hastime) {
725
       if (this.strategyInfo.hastime) {
798
         }
753
         }
799
         //违规处理选项
754
         //违规处理选项
800
         for (let item of padViolates) {
755
         for (let item of padViolates) {
801
-          if (item.handleMethod.length === 0) {
756
+          if (!item.handleMethod) {
802
             this.$Message.error("请选择违规处理!");
757
             this.$Message.error("请选择违规处理!");
803
             return;
758
             return;
804
           }
759
           }
834
         }
789
         }
835
       });
790
       });
836
     },
791
     },
837
-    checkboxChange(row) {
838
-      row.checked = row.handleMethod.length > 0 ? true : false;
839
-      this.padViolates.forEach((item) => {
840
-        if (item.violateType === row.violateType) {
841
-          item.checked = row.handleMethod.length > 0 ? true : false;
842
-          item.handleMethod = row.handleMethod;
843
-        }
844
-      });
845
-    },
846
-    //违规事件
847
-    checkedChange(row) {
848
-      this.padViolates.forEach((item) => {
849
-        if (item.violateType === row.violateType) {
850
-          if (!row.checked) {
851
-            //清空违规处理
852
-            item.handleMethod = [];
853
-          }
854
-        }
855
-      });
856
-    },
857
     delWifi(val) {
792
     delWifi(val) {
858
       //删除wifi白名单
793
       //删除wifi白名单
859
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
794
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
933
                 return v.violateType === item.violateType;
868
                 return v.violateType === item.violateType;
934
               });
869
               });
935
               item.checked = arr.length > 0 ? true : false;
870
               item.checked = arr.length > 0 ? true : false;
936
-              item.handleMethod =
937
-                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
871
+              item.noticed = arr.length > 0 && arr[0].noticed ? true : false;
872
+              item.handleMethod = arr.length > 0 ? arr[0].handleMethod : "";
938
             });
873
             });
939
           }
874
           }
940
           this.strategyInfo.padWifis = res.obj.padWifis || [];
875
           this.strategyInfo.padWifis = res.obj.padWifis || [];
1014
                 return v.violateType === item.violateType;
949
                 return v.violateType === item.violateType;
1015
               });
950
               });
1016
               item.checked = arr.length > 0 ? true : false;
951
               item.checked = arr.length > 0 ? true : false;
1017
-              item.handleMethod =
1018
-                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
952
+              item.noticed = arr.length > 0 && arr[0].noticed ? true : false;
953
+              item.handleMethod = arr.length > 0 ? arr[0].handleMethod : "";
1019
             });
954
             });
1020
           }
955
           }
1021
           this.strategyInfo.show = true;
956
           this.strategyInfo.show = true;

+ 89
- 136
src/views/schoolSection/strategy/publicStrategy.vue View File

17
           >时间限制策略
17
           >时间限制策略
18
         </div>
18
         </div>
19
         <div>
19
         <div>
20
-          <Checkbox v-if="curState === 2" v-model="strategyInfo.hastime"
20
+          <Checkbox
21
+            v-if="curState === 2"
22
+            v-model="strategyInfo.hastime"
23
+            @on-change="HandleIsShowChange(strategyInfo.hastime, 1)"
21
             >启用</Checkbox
24
             >启用</Checkbox
22
           >
25
           >
23
         </div>
26
         </div>
56
           <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
59
           <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
57
         </div>
60
         </div>
58
         <div>
61
         <div>
59
-          <Checkbox v-if="curState === 2" v-model="strategyInfo.hasapp"
62
+          <Checkbox
63
+            v-if="curState === 2"
64
+            v-model="strategyInfo.hasapp"
65
+            @on-change="HandleIsShowChange(strategyInfo.hastime, 2)"
60
             >启用</Checkbox
66
             >启用</Checkbox
61
           >
67
           >
62
         </div>
68
         </div>
87
       <div class="strategy_title">
93
       <div class="strategy_title">
88
         <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
94
         <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
89
         <div>
95
         <div>
90
-          <Checkbox v-if="curState === 2" v-model="strategyInfo.hasdevice"
96
+          <Checkbox
97
+            v-if="curState === 2"
98
+            v-model="strategyInfo.hasdevice"
99
+            @on-change="HandleIsShowChange(strategyInfo.hastime, 3)"
91
             >启用</Checkbox
100
             >启用</Checkbox
92
           >
101
           >
93
         </div>
102
         </div>
131
           >Wifi白名单策略
140
           >Wifi白名单策略
132
         </div>
141
         </div>
133
         <div>
142
         <div>
134
-          <Checkbox v-if="curState === 2" v-model="strategyInfo.haswifi"
143
+          <Checkbox
144
+            v-if="curState === 2"
145
+            v-model="strategyInfo.haswifi"
146
+            @on-change="HandleIsShowChange(strategyInfo.hastime, 4)"
135
             >启用</Checkbox
147
             >启用</Checkbox
136
           >
148
           >
137
         </div>
149
         </div>
174
           <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
186
           <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
175
         </div>
187
         </div>
176
         <div>
188
         <div>
177
-          <Checkbox v-if="curState === 2" v-model="strategyInfo.hasviolate"
189
+          <Checkbox
190
+            v-if="curState === 2"
191
+            v-model="strategyInfo.hasviolate"
192
+            @on-change="HandleIsShowChange(strategyInfo.hastime, 5)"
178
             >启用</Checkbox
193
             >启用</Checkbox
179
           >
194
           >
180
         </div>
195
         </div>
189
           <Checkbox
204
           <Checkbox
190
             :disabled="curState === 1"
205
             :disabled="curState === 1"
191
             class="checked"
206
             class="checked"
192
-            @on-change="checkedChange(row)"
207
+            @on-change="headleStrategy(row, 'checked')"
193
             v-model="row.checked"
208
             v-model="row.checked"
194
           ></Checkbox>
209
           ></Checkbox>
195
           <span style="display: inline-block; width: 120px; text-align: left">{{
210
           <span style="display: inline-block; width: 120px; text-align: left">{{
196
             row.title
211
             row.title
197
           }}</span>
212
           }}</span>
198
         </template>
213
         </template>
214
+        <template slot-scope="{ row }" slot="noticed">
215
+          <Checkbox
216
+            :disabled="curState === 1"
217
+            class="checked"
218
+            v-model="row.noticed"
219
+            @on-change="headleStrategy(row, 'noticed')"
220
+            >通知管理员</Checkbox
221
+          >
222
+        </template>
199
         <template slot-scope="{ row }" slot="violationHandling">
223
         <template slot-scope="{ row }" slot="violationHandling">
200
-          <CheckboxGroup
201
-            @on-change="checkboxChange(row)"
224
+          <RadioGroup
202
             v-model="row.handleMethod"
225
             v-model="row.handleMethod"
226
+            @on-change="headleStrategy(row, 'handleMethod')"
203
           >
227
           >
204
-            <Checkbox :disabled="curState === 1" label="通知管理员"></Checkbox>
205
-            <Checkbox
228
+            <Radio
229
+              style="margin-right: 20px"
206
               :disabled="curState === 1"
230
               :disabled="curState === 1"
207
-              style="margin: 0 40px"
208
               label="锁定"
231
               label="锁定"
209
-            ></Checkbox>
210
-            <Checkbox
211
-              :disabled="curState === 1"
212
-              label="恢复出厂设置"
213
-            ></Checkbox>
214
-          </CheckboxGroup>
232
+            ></Radio>
233
+            <Radio :disabled="curState === 1" label="恢复出厂设置"></Radio>
234
+          </RadioGroup>
215
         </template>
235
         </template>
216
       </Table>
236
       </Table>
217
       <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
237
       <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
268
 } from "@/api/stPad";
288
 } from "@/api/stPad";
269
 import { app_list_sel } from "@/api/appgroup";
289
 import { app_list_sel } from "@/api/appgroup";
270
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
290
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
291
+import { padDevices, padViolates } from "@/utils";
271
 export default {
292
 export default {
272
   components: {
293
   components: {
273
     TimeStrategy
294
     TimeStrategy
298
         padViolates: [] //设备违规
319
         padViolates: [] //设备违规
299
       },
320
       },
300
       padApps: [],
321
       padApps: [],
301
-      padDevices: [
302
-        {
303
-          pdorder: 1,
304
-          pdtype: "摄像头",
305
-          enabled: 2,
306
-          icon: "ivu-icon iconfont icon-ball-camera"
307
-        },
308
-        {
309
-          pdorder: 2,
310
-          pdtype: "蓝牙",
311
-          enabled: 2,
312
-          icon: "ivu-icon iconfont icon-lanya"
313
-        },
314
-        {
315
-          pdorder: 3,
316
-          pdtype: "USB连接",
317
-          enabled: 2,
318
-          icon: "ivu-icon iconfont icon-USB"
319
-        },
320
-        {
321
-          pdorder: 4,
322
-          pdtype: "Wi-Fi开关",
323
-          enabled: 2,
324
-          icon: "ivu-icon iconfont icon-bx-wifi-2"
325
-        },
326
-        {
327
-          pdorder: 5,
328
-          pdtype: "电话短信",
329
-          enabled: 2,
330
-          icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
331
-        },
332
-        {
333
-          pdorder: 6,
334
-          pdtype: "数据流量",
335
-          enabled: 2,
336
-          icon: "ivu-icon iconfont icon-liuliang"
337
-        },
338
-        {
339
-          pdorder: 7,
340
-          pdtype: "GPS",
341
-          enabled: 2,
342
-          icon: "ivu-icon iconfont icon-GPSxinxi"
343
-        },
344
-        {
345
-          pdorder: 8,
346
-          pdtype: "Wi-Fi高级选项",
347
-          enabled: 2,
348
-          icon: "ivu-icon iconfont icon-wifiguanbi"
349
-        },
350
-        {
351
-          pdorder: 9,
352
-          pdtype: "SD卡",
353
-          enabled: 2,
354
-          icon: "ivu-icon iconfont icon-sdka-09"
355
-        },
356
-        {
357
-          pdorder: 10,
358
-          pdtype: "OTG",
359
-          enabled: 2,
360
-          icon: "ivu-icon iconfont icon-icon-OTG"
361
-        }
362
-      ],
363
-      padViolates: [
364
-        {
365
-          title: "已ROOT",
366
-          violateType: 1,
367
-          checked: false,
368
-          handleMethod: []
369
-        },
370
-        {
371
-          title: "安装非商店应用",
372
-          violateType: 2,
373
-          checked: false,
374
-          handleMethod: []
375
-        },
376
-        {
377
-          title: "更换SIM卡",
378
-          violateType: 3,
379
-          checked: false,
380
-          handleMethod: []
381
-        },
382
-        {
383
-          title: "USB连接电脑",
384
-          violateType: 4,
385
-          checked: false,
386
-          handleMethod: []
387
-        }
388
-      ],
322
+      padDevices,
323
+      padViolates,
389
       columns: [
324
       columns: [
390
         {
325
         {
391
           title: "违规事件",
326
           title: "违规事件",
392
           slot: "violationEvents",
327
           slot: "violationEvents",
393
-          align: "center",
394
-          width: 260
328
+          align: "center"
329
+        },
330
+        {
331
+          title: "是否通知",
332
+          slot: "noticed",
333
+          align: "center"
395
         },
334
         },
396
         {
335
         {
397
           title: "违规处理",
336
           title: "违规处理",
468
     this.init();
407
     this.init();
469
   },
408
   },
470
   methods: {
409
   methods: {
410
+    headleStrategy(row, key) {
411
+      this.padViolates.forEach((item) => {
412
+        if (item.violateType === row.violateType) {
413
+          item[key] = row[key];
414
+        }
415
+      });
416
+    },
417
+    HandleIsShowChange(show, type) {
418
+      if (!show) {
419
+        if (type === 1) {
420
+          this.strategyInfo.padTimes = []; // 平板策略时间
421
+        } else if (type === 2) {
422
+          this.padApps.forEach((item) => {
423
+            item.checked = false;
424
+          });
425
+        } else if (type === 3) {
426
+          this.padDevices.forEach((item) => {
427
+            item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
428
+          });
429
+        } else if (type === 4) {
430
+          this.strategyInfo.padWifis = []; //wifi白名单
431
+        } else if (type === 5) {
432
+          this.padViolates.forEach((item) => {
433
+            item.checked = false;
434
+            item.noticed = false;
435
+            item.handleMethod = "";
436
+          });
437
+        }
438
+      }
439
+    },
471
     stPadChange(row) {
440
     stPadChange(row) {
472
       //切换选择
441
       //切换选择
473
       this.stPadInfo.list.forEach((item) => {
442
       this.stPadInfo.list.forEach((item) => {
528
                 return v.violateType === item.violateType;
497
                 return v.violateType === item.violateType;
529
               });
498
               });
530
               item.checked = arr.length > 0 ? true : false;
499
               item.checked = arr.length > 0 ? true : false;
531
-              item.handleMethod =
532
-                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
500
+              item.noticed = arr.length > 0 && arr[0].noticed ? true : false;
501
+              item.handleMethod = arr.length > 0 ? arr[0].handleMethod : "";
533
             });
502
             });
534
           }
503
           }
535
           //刷新左侧树
504
           //刷新左侧树
630
       //获取违规处理
599
       //获取违规处理
631
       for (let item of this.padViolates) {
600
       for (let item of this.padViolates) {
632
         if (item.checked) {
601
         if (item.checked) {
633
-          let handleMethod = item.handleMethod.join(";");
634
-          padViolates.push({ violateType: item.violateType, handleMethod });
602
+          padViolates.push({
603
+            violateType: item.violateType,
604
+            handleMethod: item.handleMethod || "",
605
+            noticed: item.noticed ? 1 : 0
606
+          });
635
         }
607
         }
636
       }
608
       }
637
       if (this.strategyInfo.hastime) {
609
       if (this.strategyInfo.hastime) {
665
         }
637
         }
666
         //违规处理选项
638
         //违规处理选项
667
         for (let item of padViolates) {
639
         for (let item of padViolates) {
668
-          if (item.handleMethod.length === 0) {
640
+          if (!item.handleMethod) {
669
             this.$Message.error("请选择违规处理!");
641
             this.$Message.error("请选择违规处理!");
670
             return;
642
             return;
671
           }
643
           }
705
         }
677
         }
706
       });
678
       });
707
     },
679
     },
708
-    checkboxChange(row) {
709
-      row.checked = row.handleMethod.length > 0 ? true : false;
710
-      this.padViolates.forEach((item) => {
711
-        if (item.violateType === row.violateType) {
712
-          item.checked = row.handleMethod.length > 0 ? true : false;
713
-          item.handleMethod = row.handleMethod;
714
-        }
715
-      });
716
-    },
717
-    //违规事件
718
-    checkedChange(row) {
719
-      this.padViolates.forEach((item) => {
720
-        if (item.violateType === row.violateType) {
721
-          if (!row.checked) {
722
-            //清空违规处理
723
-            item.handleMethod = [];
724
-          }
725
-        }
726
-      });
727
-    },
728
     delWifi(val) {
680
     delWifi(val) {
729
       //删除wifi白名单
681
       //删除wifi白名单
730
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
682
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
792
                 return v.violateType === item.violateType;
744
                 return v.violateType === item.violateType;
793
               });
745
               });
794
               item.checked = arr.length > 0 ? true : false;
746
               item.checked = arr.length > 0 ? true : false;
795
-              item.handleMethod =
796
-                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
747
+              item.noticed = arr.length > 0 && arr[0].noticed ? true : false;
748
+              item.handleMethod = arr.length > 0 ? arr[0].handleMethod : "";
797
             });
749
             });
798
           }
750
           }
799
           this.strategyInfo.padWifis = res.obj.padWifis || [];
751
           this.strategyInfo.padWifis = res.obj.padWifis || [];
818
       this.strategyInfo.padWifis = []; //wifi白名单
770
       this.strategyInfo.padWifis = []; //wifi白名单
819
       this.strategyInfo.padViolates = []; //设备违规
771
       this.strategyInfo.padViolates = []; //设备违规
820
       this.padDevices.forEach((item) => {
772
       this.padDevices.forEach((item) => {
821
-        item.enabled = 2;
773
+        item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
822
       });
774
       });
823
       this.padViolates.forEach((item) => {
775
       this.padViolates.forEach((item) => {
824
         item.checked = false;
776
         item.checked = false;
825
-        item.handleMethod = [];
777
+        item.noticed = false;
778
+        item.handleMethod = "";
826
       });
779
       });
827
       //获取应用列表
780
       //获取应用列表
828
       this.showLoading = true;
781
       this.showLoading = true;

+ 78
- 136
src/views/schoolSection/strategy/strategyTemplate.vue View File

100
               <Checkbox
100
               <Checkbox
101
                 v-if="strategyInfo.model != '查看'"
101
                 v-if="strategyInfo.model != '查看'"
102
                 v-model="strategyInfo.hastime"
102
                 v-model="strategyInfo.hastime"
103
+                @on-change="HandleIsShowChange(strategyInfo.hastime, 1)"
103
                 >启用</Checkbox
104
                 >启用</Checkbox
104
               >
105
               >
105
             </div>
106
             </div>
145
               <Checkbox
146
               <Checkbox
146
                 v-if="strategyInfo.model != '查看'"
147
                 v-if="strategyInfo.model != '查看'"
147
                 v-model="strategyInfo.hasapp"
148
                 v-model="strategyInfo.hasapp"
149
+                @on-change="HandleIsShowChange(strategyInfo.hasapp, 2)"
148
                 >启用</Checkbox
150
                 >启用</Checkbox
149
               >
151
               >
150
             </div>
152
             </div>
180
               <Checkbox
182
               <Checkbox
181
                 v-if="strategyInfo.model != '查看'"
183
                 v-if="strategyInfo.model != '查看'"
182
                 v-model="strategyInfo.hasdevice"
184
                 v-model="strategyInfo.hasdevice"
185
+                @on-change="HandleIsShowChange(strategyInfo.hasdevice, 3)"
183
                 >启用</Checkbox
186
                 >启用</Checkbox
184
               >
187
               >
185
             </div>
188
             </div>
226
               <Checkbox
229
               <Checkbox
227
                 v-if="strategyInfo.model != '查看'"
230
                 v-if="strategyInfo.model != '查看'"
228
                 v-model="strategyInfo.haswifi"
231
                 v-model="strategyInfo.haswifi"
232
+                @on-change="HandleIsShowChange(strategyInfo.haswifi, 4)"
229
                 >启用</Checkbox
233
                 >启用</Checkbox
230
               >
234
               >
231
             </div>
235
             </div>
271
               <Checkbox
275
               <Checkbox
272
                 v-if="strategyInfo.model != '查看'"
276
                 v-if="strategyInfo.model != '查看'"
273
                 v-model="strategyInfo.hasviolate"
277
                 v-model="strategyInfo.hasviolate"
278
+                @on-change="HandleIsShowChange(strategyInfo.hasviolate, 5)"
274
                 >启用</Checkbox
279
                 >启用</Checkbox
275
               >
280
               >
276
             </div>
281
             </div>
285
               <Checkbox
290
               <Checkbox
286
                 :disabled="strategyInfo.model === '查看'"
291
                 :disabled="strategyInfo.model === '查看'"
287
                 class="checked"
292
                 class="checked"
288
-                @on-change="checkedChange(row)"
289
                 v-model="row.checked"
293
                 v-model="row.checked"
294
+                @on-change="headleStrategy(row, 'checked')"
290
               ></Checkbox>
295
               ></Checkbox>
291
               <span
296
               <span
292
                 style="display: inline-block; width: 120px; text-align: left"
297
                 style="display: inline-block; width: 120px; text-align: left"
293
                 >{{ row.title }}</span
298
                 >{{ row.title }}</span
294
               >
299
               >
295
             </template>
300
             </template>
301
+            <template slot-scope="{ row }" slot="noticed">
302
+              <Checkbox
303
+                :disabled="strategyInfo.model === '查看'"
304
+                class="checked"
305
+                v-model="row.noticed"
306
+                @on-change="headleStrategy(row, 'noticed')"
307
+                >通知管理员</Checkbox
308
+              >
309
+            </template>
296
             <template slot-scope="{ row }" slot="violationHandling">
310
             <template slot-scope="{ row }" slot="violationHandling">
297
-              <CheckboxGroup
298
-                @on-change="checkboxChange(row)"
311
+              <RadioGroup
299
                 v-model="row.handleMethod"
312
                 v-model="row.handleMethod"
313
+                @on-change="headleStrategy(row, 'handleMethod')"
300
               >
314
               >
301
-                <Checkbox
315
+                <Radio
316
+                  style="margin-right: 20px"
302
                   :disabled="strategyInfo.model === '查看'"
317
                   :disabled="strategyInfo.model === '查看'"
303
-                  label="通知管理员"
304
-                ></Checkbox>
305
-                <Checkbox
306
-                  :disabled="strategyInfo.model === '查看'"
307
-                  style="margin: 0 40px"
308
                   label="锁定"
318
                   label="锁定"
309
-                ></Checkbox>
310
-                <Checkbox
319
+                  >锁定</Radio
320
+                >
321
+                <Radio
311
                   :disabled="strategyInfo.model === '查看'"
322
                   :disabled="strategyInfo.model === '查看'"
312
                   label="恢复出厂设置"
323
                   label="恢复出厂设置"
313
-                ></Checkbox>
314
-              </CheckboxGroup>
324
+                  >恢复出厂设置</Radio
325
+                >
326
+              </RadioGroup>
315
             </template>
327
             </template>
316
           </Table>
328
           </Table>
317
           <div class="nodata" v-if="!strategyInfo.hasviolate">
329
           <div class="nodata" v-if="!strategyInfo.hasviolate">
349
   stPad_list
361
   stPad_list
350
 } from "@/api/stPad";
362
 } from "@/api/stPad";
351
 import { app_list_sel } from "@/api/appgroup";
363
 import { app_list_sel } from "@/api/appgroup";
352
-
353
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
364
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
365
+import { padDevices, padViolates } from "@/utils";
354
 export default {
366
 export default {
355
   components: {
367
   components: {
356
     TimeStrategy
368
     TimeStrategy
392
         hasviolate: false, //是否开启违规通知:0否 1是
404
         hasviolate: false, //是否开启违规通知:0否 1是
393
         padViolates: [] //设备违规
405
         padViolates: [] //设备违规
394
       },
406
       },
395
-      padApps: [],
396
-      padDevices: [
397
-        {
398
-          pdorder: 1,
399
-          pdtype: "摄像头",
400
-          enabled: 2,
401
-          icon: "ivu-icon iconfont icon-ball-camera"
402
-        },
403
-        {
404
-          pdorder: 2,
405
-          pdtype: "蓝牙",
406
-          enabled: 2,
407
-          icon: "ivu-icon iconfont icon-lanya"
408
-        },
409
-        {
410
-          pdorder: 3,
411
-          pdtype: "USB连接",
412
-          enabled: 2,
413
-          icon: "ivu-icon iconfont icon-USB"
414
-        },
415
-        {
416
-          pdorder: 4,
417
-          pdtype: "Wi-Fi开关",
418
-          enabled: 2,
419
-          icon: "ivu-icon iconfont icon-bx-wifi-2"
420
-        },
421
-        {
422
-          pdorder: 5,
423
-          pdtype: "电话短信",
424
-          enabled: 2,
425
-          icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
426
-        },
427
-        {
428
-          pdorder: 6,
429
-          pdtype: "数据流量",
430
-          enabled: 2,
431
-          icon: "ivu-icon iconfont icon-liuliang"
432
-        },
433
-        {
434
-          pdorder: 7,
435
-          pdtype: "GPS",
436
-          enabled: 2,
437
-          icon: "ivu-icon iconfont icon-GPSxinxi"
438
-        },
439
-        {
440
-          pdorder: 8,
441
-          pdtype: "Wi-Fi高级选项",
442
-          enabled: 2,
443
-          icon: "ivu-icon iconfont icon-wifiguanbi"
444
-        },
445
-        {
446
-          pdorder: 9,
447
-          pdtype: "SD卡",
448
-          enabled: 2,
449
-          icon: "ivu-icon iconfont icon-sdka-09"
450
-        },
451
-        {
452
-          pdorder: 10,
453
-          pdtype: "OTG",
454
-          enabled: 2,
455
-          icon: "ivu-icon iconfont icon-icon-OTG"
456
-        }
457
-      ],
458
-      padViolates: [
459
-        {
460
-          title: "已ROOT",
461
-          violateType: 1,
462
-          checked: false,
463
-          handleMethod: []
464
-        },
465
-        {
466
-          title: "安装非商店应用",
467
-          violateType: 2,
468
-          checked: false,
469
-          handleMethod: []
470
-        },
471
-        {
472
-          title: "更换SIM卡",
473
-          violateType: 3,
474
-          checked: false,
475
-          handleMethod: []
476
-        },
477
-        {
478
-          title: "USB连接电脑",
479
-          violateType: 4,
480
-          checked: false,
481
-          handleMethod: []
482
-        }
483
-      ],
407
+      padDevices,
408
+      padViolates,
484
       columns1: [
409
       columns1: [
485
         {
410
         {
486
           title: "违规事件",
411
           title: "违规事件",
487
           slot: "violationEvents",
412
           slot: "violationEvents",
488
-          align: "center",
489
-          width: 260
413
+          align: "center"
414
+        },
415
+        {
416
+          title: "是否通知",
417
+          slot: "noticed",
418
+          align: "center"
490
         },
419
         },
491
         {
420
         {
492
           title: "违规处理",
421
           title: "违规处理",
592
     this.searchList();
521
     this.searchList();
593
   },
522
   },
594
   methods: {
523
   methods: {
524
+    headleStrategy(row, key) {
525
+      this.padViolates.forEach((item) => {
526
+        if (item.violateType === row.violateType) {
527
+          item[key] = row[key];
528
+        }
529
+      });
530
+    },
531
+    HandleIsShowChange(show, type) {
532
+      if (!show) {
533
+        if (type === 1) {
534
+          this.strategyInfo.padTimes = []; // 平板策略时间
535
+        } else if (type === 2) {
536
+          this.padApps.forEach((item) => {
537
+            item.checked = false;
538
+          });
539
+        } else if (type === 3) {
540
+          this.padDevices.forEach((item) => {
541
+            item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
542
+          });
543
+        } else if (type === 4) {
544
+          this.strategyInfo.padWifis = []; //wifi白名单
545
+        } else if (type === 5) {
546
+          this.padViolates.forEach((item) => {
547
+            item.checked = false;
548
+            item.noticed = false;
549
+            item.handleMethod = "";
550
+          });
551
+        }
552
+      }
553
+    },
595
     stPadChange(row) {
554
     stPadChange(row) {
596
       //切换选择
555
       //切换选择
597
       this.stPadInfo.list.forEach((item) => {
556
       this.stPadInfo.list.forEach((item) => {
633
           padApps.push(item.appid);
592
           padApps.push(item.appid);
634
         }
593
         }
635
       }
594
       }
595
+
636
       //获取设备
596
       //获取设备
637
       for (let item of this.padDevices) {
597
       for (let item of this.padDevices) {
638
         padDevices.push({
598
         padDevices.push({
641
           enabled: item.enabled
601
           enabled: item.enabled
642
         });
602
         });
643
       }
603
       }
644
-
645
       //获取违规处理
604
       //获取违规处理
646
       for (let item of this.padViolates) {
605
       for (let item of this.padViolates) {
647
         if (item.checked) {
606
         if (item.checked) {
648
-          let handleMethod = item.handleMethod.join(";");
649
-          padViolates.push({ violateType: item.violateType, handleMethod });
607
+          padViolates.push({
608
+            violateType: item.violateType,
609
+            handleMethod: item.handleMethod || "",
610
+            noticed: item.noticed ? 1 : 0
611
+          });
650
         }
612
         }
651
       }
613
       }
652
       if (this.strategyInfo.hastime) {
614
       if (this.strategyInfo.hastime) {
680
         }
642
         }
681
         //违规处理选项
643
         //违规处理选项
682
         for (let item of padViolates) {
644
         for (let item of padViolates) {
683
-          if (item.handleMethod.length === 0) {
645
+          if (!item.handleMethod) {
684
             this.$Message.error("请选择违规处理!");
646
             this.$Message.error("请选择违规处理!");
685
             return;
647
             return;
686
           }
648
           }
707
         form.rversion = this.strategyInfo.rversion;
669
         form.rversion = this.strategyInfo.rversion;
708
       }
670
       }
709
       let api = this.strategyInfo.model === "编辑" ? stPad_edit : stPad_add;
671
       let api = this.strategyInfo.model === "编辑" ? stPad_edit : stPad_add;
672
+      this.showLoading = true;
710
       api(form).then((res) => {
673
       api(form).then((res) => {
674
+        this.showLoading = false;
711
         if (res.code === 0) {
675
         if (res.code === 0) {
712
           this.$Message.success(res.msg);
676
           this.$Message.success(res.msg);
713
           this.searchList();
677
           this.searchList();
717
         }
681
         }
718
       });
682
       });
719
     },
683
     },
720
-    checkboxChange(row) {
721
-      row.checked = row.handleMethod.length > 0 ? true : false;
722
-      this.padViolates.forEach((item) => {
723
-        if (item.violateType === row.violateType) {
724
-          item.checked = row.handleMethod.length > 0 ? true : false;
725
-          item.handleMethod = row.handleMethod;
726
-        }
727
-      });
728
-    },
729
-    //违规事件
730
-    checkedChange(row) {
731
-      this.padViolates.forEach((item) => {
732
-        if (item.violateType === row.violateType) {
733
-          if (!row.checked) {
734
-            //清空违规处理
735
-            item.handleMethod = [];
736
-          }
737
-        }
738
-      });
739
-    },
740
     delWifi(val) {
684
     delWifi(val) {
741
       //删除wifi白名单
685
       //删除wifi白名单
742
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
686
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
799
     initData() {
743
     initData() {
800
       //数据初始化
744
       //数据初始化
801
       this.strategyInfo.padTimes = []; // 平板策略时间
745
       this.strategyInfo.padTimes = []; // 平板策略时间
802
-      this.strategyInfo.padApps = []; //appid集合
803
-      this.strategyInfo.padDevices = []; //授权应用
804
       this.strategyInfo.padWifis = []; //wifi白名单
746
       this.strategyInfo.padWifis = []; //wifi白名单
805
-      this.strategyInfo.padViolates = []; //设备违规
806
       this.padDevices.forEach((item) => {
747
       this.padDevices.forEach((item) => {
807
-        item.enabled = 2;
748
+        item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
808
       });
749
       });
809
       this.padViolates.forEach((item) => {
750
       this.padViolates.forEach((item) => {
810
         item.checked = false;
751
         item.checked = false;
811
-        item.handleMethod = [];
752
+        item.noticed = false;
753
+        item.handleMethod = "";
812
       });
754
       });
813
       this.padApps.forEach((item) => {
755
       this.padApps.forEach((item) => {
814
         item.checked = false;
756
         item.checked = false;
923
                 return v.violateType === item.violateType;
865
                 return v.violateType === item.violateType;
924
               });
866
               });
925
               item.checked = arr.length > 0 ? true : false;
867
               item.checked = arr.length > 0 ? true : false;
926
-              item.handleMethod =
927
-                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
868
+              item.noticed = arr.length > 0 && arr[0].noticed ? true : false;
869
+              item.handleMethod = arr.length > 0 ? arr[0].handleMethod : "";
928
             });
870
             });
929
           }
871
           }
930
           this.strategyInfo.show = true;
872
           this.strategyInfo.show = true;

Loading…
Cancel
Save