Explorar el Código

Merge remote-tracking branch 'origin/gzb' into wzl

gzb
wangzhonglu hace 9 meses
padre
commit
d354f0f872
Se han modificado 1 ficheros con 125 adiciones y 119 borrados
  1. 125
    119
      src/views/schoolSection/strategy/publicStrategy.vue

+ 125
- 119
src/views/schoolSection/strategy/publicStrategy.vue Ver fichero

@@ -46,13 +46,9 @@
46 46
         <div
47 47
           class="strategy_bottom"
48 48
           style="min-height: 160px"
49
-          v-if="strategyInfo.padApps.length > 0"
49
+          v-if="padApps.length > 0"
50 50
         >
51
-          <div
52
-            class="app_list"
53
-            v-for="item in strategyInfo.padApps"
54
-            :key="item.appid"
55
-          >
51
+          <div class="app_list" v-for="item in padApps" :key="item.appid">
56 52
             <img :src="$api.baseImageUrl + item.appIcon" />
57 53
             <div>{{ item.appName }}</div>
58 54
             <Checkbox
@@ -79,11 +75,7 @@
79 75
           <span>设备功能管理</span>
80 76
         </div>
81 77
         <div class="strategy_bottom" style="min-height: 160px">
82
-          <div
83
-            class="device_list"
84
-            v-for="item in strategyInfo.padDevices"
85
-            :key="item.id"
86
-          >
78
+          <div class="device_list" v-for="item in padDevices" :key="item.id">
87 79
             <div class="icon">
88 80
               <span :class="[item.icon]"></span>
89 81
             </div>
@@ -165,7 +157,7 @@
165 157
         v-if="strategyInfo.hasviolate"
166 158
         class="table"
167 159
         :columns="columns"
168
-        :data="strategyInfo.padViolates"
160
+        :data="padViolates"
169 161
       >
170 162
         <template slot-scope="{ row }" slot="violationEvents">
171 163
           <Checkbox
@@ -224,10 +216,11 @@ import {
224 216
   stApp_add,
225 217
   stApp_detail_obj,
226 218
   stApp_edit,
227
-  stPad_add, stPad_detail_obj,
219
+  stPad_add,
220
+  stPad_detail_obj,
228 221
   stPad_edit
229 222
 } from "@/api/stPad";
230
-import { app_list } from "@/api/appgroup";
223
+import { app_list, app_list_sel } from "@/api/appgroup";
231 224
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
232 225
 export default {
233 226
   components: {
@@ -244,98 +237,101 @@ export default {
244 237
         hasapp: true, //是否开启应用策略:0否 1是
245 238
         padApps: [], //appid集合
246 239
         hasdevice: true, //是否开启设备策略:0否 1是
247
-        padDevices: [
248
-          {
249
-            id: 1,
250
-            title: "摄像头",
251
-            enabled: 2,
252
-            icon: "ivu-icon iconfont icon-ball-camera"
253
-          },
254
-          {
255
-            id: 2,
256
-            title: "蓝牙",
257
-            enabled: 2,
258
-            icon: "ivu-icon iconfont icon-lanya"
259
-          },
260
-          {
261
-            id: 3,
262
-            title: "USB连接",
263
-            enabled: 2,
264
-            icon: "ivu-icon iconfont icon-USB"
265
-          },
266
-          {
267
-            id: 4,
268
-            title: "Wi-Fi开关",
269
-            enabled: 2,
270
-            icon: "ivu-icon iconfont icon-bx-wifi-2"
271
-          },
272
-          {
273
-            id: 5,
274
-            title: "电话短信",
275
-            enabled: 2,
276
-            icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
277
-          },
278
-          {
279
-            id: 6,
280
-            title: "数据流量",
281
-            enabled: 2,
282
-            icon: "ivu-icon iconfont icon-liuliang"
283
-          },
284
-          {
285
-            id: 7,
286
-            title: "GPS",
287
-            enabled: 2,
288
-            icon: "ivu-icon iconfont icon-GPSxinxi"
289
-          },
290
-          {
291
-            id: 8,
292
-            title: "Wi-Fi高级选项",
293
-            enabled: 2,
294
-            icon: "ivu-icon iconfont icon-wifiguanbi"
295
-          },
296
-          {
297
-            id: 9,
298
-            title: "SD卡",
299
-            enabled: 2,
300
-            icon: "ivu-icon iconfont icon-sdka-09"
301
-          },
302
-          {
303
-            id: 10,
304
-            title: "SD卡",
305
-            enabled: 2,
306
-            icon: "ivu-icon iconfont icon-icon-OTG"
307
-          }
308
-        ], //授权应用
240
+        padDevices: [], //授权应用
309 241
         haswifi: true, //是否开启wifi白名单策略:0否 1是
310 242
         padWifis: ["xhkjedu"], //wifi白名单
311 243
         hasviolate: true, //是否开启违规通知:0否 1是
312
-        padViolates: [
313
-          {
314
-            title: "已ROOT",
315
-            violateType: 1,
316
-            checked: true,
317
-            handleMethod: ["通知管理员", "限制使用"]
318
-          },
319
-          {
320
-            title: "安装非商店应用",
321
-            violateType: 2,
322
-            checked: false,
323
-            handleMethod: []
324
-          },
325
-          {
326
-            title: "更换SIM卡",
327
-            violateType: 3,
328
-            checked: false,
329
-            handleMethod: []
330
-          },
331
-          {
332
-            title: "USB连接电脑",
333
-            violateType: 4,
334
-            checked: false,
335
-            handleMethod: []
336
-          }
337
-        ] //设备违规
244
+        padViolates: [] //设备违规
338 245
       },
246
+      padApps: [],
247
+      padDevices: [
248
+        {
249
+          id: 1,
250
+          title: "摄像头",
251
+          enabled: 2,
252
+          icon: "ivu-icon iconfont icon-ball-camera"
253
+        },
254
+        {
255
+          id: 2,
256
+          title: "蓝牙",
257
+          enabled: 2,
258
+          icon: "ivu-icon iconfont icon-lanya"
259
+        },
260
+        {
261
+          id: 3,
262
+          title: "USB连接",
263
+          enabled: 2,
264
+          icon: "ivu-icon iconfont icon-USB"
265
+        },
266
+        {
267
+          id: 4,
268
+          title: "Wi-Fi开关",
269
+          enabled: 2,
270
+          icon: "ivu-icon iconfont icon-bx-wifi-2"
271
+        },
272
+        {
273
+          id: 5,
274
+          title: "电话短信",
275
+          enabled: 2,
276
+          icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
277
+        },
278
+        {
279
+          id: 6,
280
+          title: "数据流量",
281
+          enabled: 2,
282
+          icon: "ivu-icon iconfont icon-liuliang"
283
+        },
284
+        {
285
+          id: 7,
286
+          title: "GPS",
287
+          enabled: 2,
288
+          icon: "ivu-icon iconfont icon-GPSxinxi"
289
+        },
290
+        {
291
+          id: 8,
292
+          title: "Wi-Fi高级选项",
293
+          enabled: 2,
294
+          icon: "ivu-icon iconfont icon-wifiguanbi"
295
+        },
296
+        {
297
+          id: 9,
298
+          title: "SD卡",
299
+          enabled: 2,
300
+          icon: "ivu-icon iconfont icon-sdka-09"
301
+        },
302
+        {
303
+          id: 10,
304
+          title: "SD卡",
305
+          enabled: 2,
306
+          icon: "ivu-icon iconfont icon-icon-OTG"
307
+        }
308
+      ],
309
+      padViolates: [
310
+        {
311
+          title: "已ROOT",
312
+          violateType: 1,
313
+          checked: true,
314
+          handleMethod: ["通知管理员", "限制使用"]
315
+        },
316
+        {
317
+          title: "安装非商店应用",
318
+          violateType: 2,
319
+          checked: false,
320
+          handleMethod: []
321
+        },
322
+        {
323
+          title: "更换SIM卡",
324
+          violateType: 3,
325
+          checked: false,
326
+          handleMethod: []
327
+        },
328
+        {
329
+          title: "USB连接电脑",
330
+          violateType: 4,
331
+          checked: false,
332
+          handleMethod: []
333
+        }
334
+      ],
339 335
       columns: [
340 336
         {
341 337
           title: "违规事件",
@@ -382,14 +378,14 @@ export default {
382 378
         padViolates = [],
383 379
         padApps = [];
384 380
       //获取授权应用
385
-      for (let item of this.strategyInfo.padApps) {
381
+      for (let item of this.padApps) {
386 382
         if (item.checked) {
387 383
           padApps.push(item.appid);
388 384
         }
389 385
       }
390 386
       //获取设备
391 387
       let pdorder = 0;
392
-      for (let item of this.strategyInfo.padDevices) {
388
+      for (let item of this.padDevices) {
393 389
         if (item.enabled === 1) {
394 390
           pdorder++;
395 391
           padDevices.push({ pdtype: item.title, pdorder });
@@ -397,7 +393,7 @@ export default {
397 393
       }
398 394
 
399 395
       //获取违规处理
400
-      for (let item of this.strategyInfo.padViolates) {
396
+      for (let item of this.padViolates) {
401 397
         if (item.checked) {
402 398
           let handleMethod = item.handleMethod.join(";");
403 399
           padViolates.push({ violateType: item.violateType, handleMethod });
@@ -468,7 +464,7 @@ export default {
468 464
     },
469 465
     checkboxChange(row) {
470 466
       row.checked = row.handleMethod.length > 0 ? true : false;
471
-      this.strategyInfo.padViolates.forEach((item) => {
467
+      this.padViolates.forEach((item) => {
472 468
         if (item.violateType === row.violateType) {
473 469
           item.checked = row.handleMethod.length > 0 ? true : false;
474 470
           item.handleMethod = row.handleMethod;
@@ -477,7 +473,7 @@ export default {
477 473
     },
478 474
     //违规事件
479 475
     checkedChange(row) {
480
-      this.strategyInfo.padViolates.forEach((item) => {
476
+      this.padViolates.forEach((item) => {
481 477
         if (item.violateType === row.violateType) {
482 478
           if (!row.checked) {
483 479
             //清空违规处理
@@ -503,7 +499,7 @@ export default {
503 499
       );
504 500
       console.log(this.strategyInfo.padWifis);
505 501
     },
506
-    async detail(){
502
+    async detail() {
507 503
       this.showLoading = true;
508 504
       //获取学校/班级策略详情
509 505
       let res = await stPad_detail_obj({
@@ -514,30 +510,40 @@ export default {
514 510
       this.showLoading = false;
515 511
       if (res.code === 0) {
516 512
         this.hasSave = res.obj;
517
-        if(this.hasSave){
518
-
513
+        if (this.hasSave) {
514
+          //数据回显
515
+          this.strategyInfo = res.obj;
516
+          this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
517
+          this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
518
+          this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
519
+            ? true
520
+            : false;
521
+          this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
522
+          this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
523
+            ? true
524
+            : false;
519 525
         }
520
-        console.log(this.hasSave);
526
+        console.log(this.strategyInfo);
521 527
       } else {
522 528
         this.$Message.error(res.msg);
523 529
       }
524 530
     },
525 531
     async init() {
526
-       await this.detail();
532
+      await this.detail();
527 533
       //获取应用列表
528
-      let res1 = await app_list({
534
+      this.showLoading = true;
535
+      let res1 = await app_list_sel({
529 536
         rtype: this.powerParams.rtype,
530
-        objectid: this.powerParams.objectid,
531
-        appgroupid: 0,
532
-        page: 1,
533
-        size: 1000
537
+        objectid: this.powerParams.objectid
534 538
       });
539
+      this.showLoading = false;
535 540
       if (res1.code === 0) {
536
-        this.strategyInfo.padApps = res1.obj.data.map((v) => {
541
+        this.padApps = res1.obj.map((v) => {
537 542
           v.checked = false;
538 543
           return v;
539 544
         });
540
-        console.log(this.strategyInfo.padApps);
545
+
546
+        console.log(this.padApps);
541 547
       } else {
542 548
         this.$Message.error(res1.msg);
543 549
       }

Loading…
Cancelar
Guardar