guozhongbo 8 місяці тому
джерело
коміт
f1c935e2c9

+ 86
- 0
src/utils/index.js Переглянути файл

@@ -16,6 +16,92 @@ export const pwdCheck = (rule, value, callback) => {
16 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 105
 export const weekDay = [
20 106
   {
21 107
     label: "周日",

+ 74
- 139
src/views/schoolSection/strategy/personalStrategy.vue Переглянути файл

@@ -249,7 +249,7 @@
249 249
               <Checkbox
250 250
                 :disabled="strategyInfo.model === 'see'"
251 251
                 class="checked"
252
-                @on-change="checkedChange(row)"
252
+                @on-change="headleStrategy(row, 'checked')"
253 253
                 v-model="row.checked"
254 254
               ></Checkbox>
255 255
               <span
@@ -257,25 +257,27 @@
257 257
                 >{{ row.title }}</span
258 258
               >
259 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 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 281
             </template>
280 282
           </Table>
281 283
           <div class="nodata" v-if="!strategyInfo.hasviolate">
@@ -340,6 +342,7 @@ import {
340 342
   stPad_list_user
341 343
 } from "@/api/stPad";
342 344
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
345
+import { padDevices, padViolates } from "@/utils";
343 346
 export default {
344 347
   components: {
345 348
     TimeStrategy
@@ -372,100 +375,18 @@ export default {
372 375
         padViolates: [] //设备违规
373 376
       },
374 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 380
       columns: [
464 381
         {
465 382
           title: "违规事件",
466 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 392
           title: "违规处理",
@@ -591,6 +512,36 @@ export default {
591 512
     this.init();
592 513
   },
593 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 545
     stPadChange(row) {
595 546
       //切换选择
596 547
       this.stPadInfo.list.forEach((item) => {
@@ -605,11 +556,12 @@ export default {
605 556
       this.strategyInfo.padWifis = []; //wifi白名单
606 557
       this.strategyInfo.padViolates = []; //设备违规
607 558
       this.padDevices.forEach((item) => {
608
-        item.enabled = 2;
559
+        item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
609 560
       });
610 561
       this.padViolates.forEach((item) => {
611 562
         item.checked = false;
612
-        item.handleMethod = [];
563
+        item.noticed = false;
564
+        item.handleMethod = "";
613 565
       });
614 566
       this.padApps.forEach((item) => {
615 567
         item.checked = false;
@@ -665,8 +617,8 @@ export default {
665 617
                 return v.violateType === item.violateType;
666 618
               });
667 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 624
           this.strategyInfo.padWifis = res.obj.padWifis || [];
@@ -763,8 +715,11 @@ export default {
763 715
       //获取违规处理
764 716
       for (let item of this.padViolates) {
765 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 725
       if (this.strategyInfo.hastime) {
@@ -798,7 +753,7 @@ export default {
798 753
         }
799 754
         //违规处理选项
800 755
         for (let item of padViolates) {
801
-          if (item.handleMethod.length === 0) {
756
+          if (!item.handleMethod) {
802 757
             this.$Message.error("请选择违规处理!");
803 758
             return;
804 759
           }
@@ -834,26 +789,6 @@ export default {
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 792
     delWifi(val) {
858 793
       //删除wifi白名单
859 794
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
@@ -933,8 +868,8 @@ export default {
933 868
                 return v.violateType === item.violateType;
934 869
               });
935 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 875
           this.strategyInfo.padWifis = res.obj.padWifis || [];
@@ -1014,8 +949,8 @@ export default {
1014 949
                 return v.violateType === item.violateType;
1015 950
               });
1016 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 956
           this.strategyInfo.show = true;

+ 89
- 136
src/views/schoolSection/strategy/publicStrategy.vue Переглянути файл

@@ -17,7 +17,10 @@
17 17
           >时间限制策略
18 18
         </div>
19 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 24
             >启用</Checkbox
22 25
           >
23 26
         </div>
@@ -56,7 +59,10 @@
56 59
           <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
57 60
         </div>
58 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 66
             >启用</Checkbox
61 67
           >
62 68
         </div>
@@ -87,7 +93,10 @@
87 93
       <div class="strategy_title">
88 94
         <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
89 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 100
             >启用</Checkbox
92 101
           >
93 102
         </div>
@@ -131,7 +140,10 @@
131 140
           >Wifi白名单策略
132 141
         </div>
133 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 147
             >启用</Checkbox
136 148
           >
137 149
         </div>
@@ -174,7 +186,10 @@
174 186
           <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
175 187
         </div>
176 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 193
             >启用</Checkbox
179 194
           >
180 195
         </div>
@@ -189,29 +204,34 @@
189 204
           <Checkbox
190 205
             :disabled="curState === 1"
191 206
             class="checked"
192
-            @on-change="checkedChange(row)"
207
+            @on-change="headleStrategy(row, 'checked')"
193 208
             v-model="row.checked"
194 209
           ></Checkbox>
195 210
           <span style="display: inline-block; width: 120px; text-align: left">{{
196 211
             row.title
197 212
           }}</span>
198 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 223
         <template slot-scope="{ row }" slot="violationHandling">
200
-          <CheckboxGroup
201
-            @on-change="checkboxChange(row)"
224
+          <RadioGroup
202 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 230
               :disabled="curState === 1"
207
-              style="margin: 0 40px"
208 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 235
         </template>
216 236
       </Table>
217 237
       <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
@@ -268,6 +288,7 @@ import {
268 288
 } from "@/api/stPad";
269 289
 import { app_list_sel } from "@/api/appgroup";
270 290
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
291
+import { padDevices, padViolates } from "@/utils";
271 292
 export default {
272 293
   components: {
273 294
     TimeStrategy
@@ -298,100 +319,18 @@ export default {
298 319
         padViolates: [] //设备违规
299 320
       },
300 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 324
       columns: [
390 325
         {
391 326
           title: "违规事件",
392 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 336
           title: "违规处理",
@@ -468,6 +407,36 @@ export default {
468 407
     this.init();
469 408
   },
470 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 440
     stPadChange(row) {
472 441
       //切换选择
473 442
       this.stPadInfo.list.forEach((item) => {
@@ -528,8 +497,8 @@ export default {
528 497
                 return v.violateType === item.violateType;
529 498
               });
530 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,8 +599,11 @@ export default {
630 599
       //获取违规处理
631 600
       for (let item of this.padViolates) {
632 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 609
       if (this.strategyInfo.hastime) {
@@ -665,7 +637,7 @@ export default {
665 637
         }
666 638
         //违规处理选项
667 639
         for (let item of padViolates) {
668
-          if (item.handleMethod.length === 0) {
640
+          if (!item.handleMethod) {
669 641
             this.$Message.error("请选择违规处理!");
670 642
             return;
671 643
           }
@@ -705,26 +677,6 @@ export default {
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 680
     delWifi(val) {
729 681
       //删除wifi白名单
730 682
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
@@ -792,8 +744,8 @@ export default {
792 744
                 return v.violateType === item.violateType;
793 745
               });
794 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 751
           this.strategyInfo.padWifis = res.obj.padWifis || [];
@@ -818,11 +770,12 @@ export default {
818 770
       this.strategyInfo.padWifis = []; //wifi白名单
819 771
       this.strategyInfo.padViolates = []; //设备违规
820 772
       this.padDevices.forEach((item) => {
821
-        item.enabled = 2;
773
+        item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
822 774
       });
823 775
       this.padViolates.forEach((item) => {
824 776
         item.checked = false;
825
-        item.handleMethod = [];
777
+        item.noticed = false;
778
+        item.handleMethod = "";
826 779
       });
827 780
       //获取应用列表
828 781
       this.showLoading = true;

+ 78
- 136
src/views/schoolSection/strategy/strategyTemplate.vue Переглянути файл

@@ -100,6 +100,7 @@
100 100
               <Checkbox
101 101
                 v-if="strategyInfo.model != '查看'"
102 102
                 v-model="strategyInfo.hastime"
103
+                @on-change="HandleIsShowChange(strategyInfo.hastime, 1)"
103 104
                 >启用</Checkbox
104 105
               >
105 106
             </div>
@@ -145,6 +146,7 @@
145 146
               <Checkbox
146 147
                 v-if="strategyInfo.model != '查看'"
147 148
                 v-model="strategyInfo.hasapp"
149
+                @on-change="HandleIsShowChange(strategyInfo.hasapp, 2)"
148 150
                 >启用</Checkbox
149 151
               >
150 152
             </div>
@@ -180,6 +182,7 @@
180 182
               <Checkbox
181 183
                 v-if="strategyInfo.model != '查看'"
182 184
                 v-model="strategyInfo.hasdevice"
185
+                @on-change="HandleIsShowChange(strategyInfo.hasdevice, 3)"
183 186
                 >启用</Checkbox
184 187
               >
185 188
             </div>
@@ -226,6 +229,7 @@
226 229
               <Checkbox
227 230
                 v-if="strategyInfo.model != '查看'"
228 231
                 v-model="strategyInfo.haswifi"
232
+                @on-change="HandleIsShowChange(strategyInfo.haswifi, 4)"
229 233
                 >启用</Checkbox
230 234
               >
231 235
             </div>
@@ -271,6 +275,7 @@
271 275
               <Checkbox
272 276
                 v-if="strategyInfo.model != '查看'"
273 277
                 v-model="strategyInfo.hasviolate"
278
+                @on-change="HandleIsShowChange(strategyInfo.hasviolate, 5)"
274 279
                 >启用</Checkbox
275 280
               >
276 281
             </div>
@@ -285,33 +290,40 @@
285 290
               <Checkbox
286 291
                 :disabled="strategyInfo.model === '查看'"
287 292
                 class="checked"
288
-                @on-change="checkedChange(row)"
289 293
                 v-model="row.checked"
294
+                @on-change="headleStrategy(row, 'checked')"
290 295
               ></Checkbox>
291 296
               <span
292 297
                 style="display: inline-block; width: 120px; text-align: left"
293 298
                 >{{ row.title }}</span
294 299
               >
295 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 310
             <template slot-scope="{ row }" slot="violationHandling">
297
-              <CheckboxGroup
298
-                @on-change="checkboxChange(row)"
311
+              <RadioGroup
299 312
                 v-model="row.handleMethod"
313
+                @on-change="headleStrategy(row, 'handleMethod')"
300 314
               >
301
-                <Checkbox
315
+                <Radio
316
+                  style="margin-right: 20px"
302 317
                   :disabled="strategyInfo.model === '查看'"
303
-                  label="通知管理员"
304
-                ></Checkbox>
305
-                <Checkbox
306
-                  :disabled="strategyInfo.model === '查看'"
307
-                  style="margin: 0 40px"
308 318
                   label="锁定"
309
-                ></Checkbox>
310
-                <Checkbox
319
+                  >锁定</Radio
320
+                >
321
+                <Radio
311 322
                   :disabled="strategyInfo.model === '查看'"
312 323
                   label="恢复出厂设置"
313
-                ></Checkbox>
314
-              </CheckboxGroup>
324
+                  >恢复出厂设置</Radio
325
+                >
326
+              </RadioGroup>
315 327
             </template>
316 328
           </Table>
317 329
           <div class="nodata" v-if="!strategyInfo.hasviolate">
@@ -349,8 +361,8 @@ import {
349 361
   stPad_list
350 362
 } from "@/api/stPad";
351 363
 import { app_list_sel } from "@/api/appgroup";
352
-
353 364
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
365
+import { padDevices, padViolates } from "@/utils";
354 366
 export default {
355 367
   components: {
356 368
     TimeStrategy
@@ -392,101 +404,18 @@ export default {
392 404
         hasviolate: false, //是否开启违规通知:0否 1是
393 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 409
       columns1: [
485 410
         {
486 411
           title: "违规事件",
487 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 421
           title: "违规处理",
@@ -592,6 +521,36 @@ export default {
592 521
     this.searchList();
593 522
   },
594 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 554
     stPadChange(row) {
596 555
       //切换选择
597 556
       this.stPadInfo.list.forEach((item) => {
@@ -633,6 +592,7 @@ export default {
633 592
           padApps.push(item.appid);
634 593
         }
635 594
       }
595
+
636 596
       //获取设备
637 597
       for (let item of this.padDevices) {
638 598
         padDevices.push({
@@ -641,12 +601,14 @@ export default {
641 601
           enabled: item.enabled
642 602
         });
643 603
       }
644
-
645 604
       //获取违规处理
646 605
       for (let item of this.padViolates) {
647 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 614
       if (this.strategyInfo.hastime) {
@@ -680,7 +642,7 @@ export default {
680 642
         }
681 643
         //违规处理选项
682 644
         for (let item of padViolates) {
683
-          if (item.handleMethod.length === 0) {
645
+          if (!item.handleMethod) {
684 646
             this.$Message.error("请选择违规处理!");
685 647
             return;
686 648
           }
@@ -707,7 +669,9 @@ export default {
707 669
         form.rversion = this.strategyInfo.rversion;
708 670
       }
709 671
       let api = this.strategyInfo.model === "编辑" ? stPad_edit : stPad_add;
672
+      this.showLoading = true;
710 673
       api(form).then((res) => {
674
+        this.showLoading = false;
711 675
         if (res.code === 0) {
712 676
           this.$Message.success(res.msg);
713 677
           this.searchList();
@@ -717,26 +681,6 @@ export default {
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 684
     delWifi(val) {
741 685
       //删除wifi白名单
742 686
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
@@ -799,16 +743,14 @@ export default {
799 743
     initData() {
800 744
       //数据初始化
801 745
       this.strategyInfo.padTimes = []; // 平板策略时间
802
-      this.strategyInfo.padApps = []; //appid集合
803
-      this.strategyInfo.padDevices = []; //授权应用
804 746
       this.strategyInfo.padWifis = []; //wifi白名单
805
-      this.strategyInfo.padViolates = []; //设备违规
806 747
       this.padDevices.forEach((item) => {
807
-        item.enabled = 2;
748
+        item.enabled = item.pdorder === 1 ? 1 : item.pdorder === 2 ? 1 : 2;
808 749
       });
809 750
       this.padViolates.forEach((item) => {
810 751
         item.checked = false;
811
-        item.handleMethod = [];
752
+        item.noticed = false;
753
+        item.handleMethod = "";
812 754
       });
813 755
       this.padApps.forEach((item) => {
814 756
         item.checked = false;
@@ -923,8 +865,8 @@ export default {
923 865
                 return v.violateType === item.violateType;
924 866
               });
925 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 872
           this.strategyInfo.show = true;

Завантаження…
Відмінити
Зберегти