Browse Source

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

gzb
wangzhonglu 9 months ago
parent
commit
dc99a2d6d3

+ 12332
- 27
package-lock.json
File diff suppressed because it is too large
View File


+ 64
- 49
src/views/schoolSection/strategy/personalStrategy.vue View File

40
       class="modal5"
40
       class="modal5"
41
       :mask-closable="false"
41
       :mask-closable="false"
42
       v-model="strategyInfo.show"
42
       v-model="strategyInfo.show"
43
-      :title="strategyInfo.model === 'see'?'查看':'编辑'"
43
+      :title="
44
+        strategyInfo.model === 'see'
45
+          ? '查看【' + strategyInfo.username + '】'
46
+          : '编辑【' + strategyInfo.username + '】'
47
+      "
44
     >
48
     >
45
       <div class="content" v-if="strategyInfo.show">
49
       <div class="content" v-if="strategyInfo.show">
46
-        <div class="operation" v-if="strategyInfo.model === 'edit'">
47
-          <span  @click="Reset">重置</span>
50
+        <div class="operation" v-if="strategyInfo.model != 'see'">
51
+          <span v-if="strategyInfo.model === 'edit'" @click="Reset">重置</span>
48
           <span @click="getstPad_list">引用</span>
52
           <span @click="getstPad_list">引用</span>
49
         </div>
53
         </div>
50
         <div class="strategy_list">
54
         <div class="strategy_list">
279
         <Button style="margin-right: 10px" @click="strategyInfo.show = false"
283
         <Button style="margin-right: 10px" @click="strategyInfo.show = false"
280
           >关闭</Button
284
           >关闭</Button
281
         >
285
         >
282
-        <Button type="primary" class="primary_btn" @click="save()">保存</Button>
286
+        <Button
287
+          v-if="strategyInfo.model != 'see'"
288
+          type="primary"
289
+          class="primary_btn"
290
+          @click="save()"
291
+          >保存</Button
292
+        >
283
       </div>
293
       </div>
284
     </Modal>
294
     </Modal>
285
     <!-- 引用 -->
295
     <!-- 引用 -->
286
     <Modal
296
     <Modal
287
-        class="modal1"
288
-        :mask-closable="false"
289
-        v-model="stPadInfo.show"
290
-        title="引用"
297
+      class="modal1"
298
+      :mask-closable="false"
299
+      v-model="stPadInfo.show"
300
+      title="引用"
291
     >
301
     >
292
       <Table
302
       <Table
293
-          v-if="stPadInfo.show"
294
-          class="table"
295
-          :columns="columns1"
296
-          :data="stPadInfo.list"
303
+        v-if="stPadInfo.show"
304
+        class="table"
305
+        :columns="columns1"
306
+        :data="stPadInfo.list"
297
       >
307
       >
298
         <template slot-scope="{ row }" slot="active">
308
         <template slot-scope="{ row }" slot="active">
299
           <Radio @on-change="stPadChange(row)" v-model="row.checked"></Radio>
309
           <Radio @on-change="stPadChange(row)" v-model="row.checked"></Radio>
303
       <div slot="footer" style="text-align: right">
313
       <div slot="footer" style="text-align: right">
304
         <Button @click="stPadInfo.show = false">关闭</Button>
314
         <Button @click="stPadInfo.show = false">关闭</Button>
305
         <Button type="primary" class="primary_btn" @click="saveStPadInfo()"
315
         <Button type="primary" class="primary_btn" @click="saveStPadInfo()"
306
-        >保存</Button
316
+          >保存</Button
307
         >
317
         >
308
       </div>
318
       </div>
309
     </Modal>
319
     </Modal>
315
 </template>
325
 </template>
316
 
326
 
317
 <script>
327
 <script>
318
-import { app_list, app_list_sel } from "@/api/appgroup";
328
+import { app_list_sel } from "@/api/appgroup";
319
 import {
329
 import {
320
-  stPad_add, stPad_add_quote,
330
+  stPad_add,
331
+  stPad_add_quote,
321
   stPad_delete,
332
   stPad_delete,
322
   stPad_detail,
333
   stPad_detail,
323
   stPad_edit,
334
   stPad_edit,
340
       },
351
       },
341
       strategyInfo: {
352
       strategyInfo: {
342
         model: "add", //add添加/edit编辑/see查看
353
         model: "add", //add添加/edit编辑/see查看
354
+        username: null,
343
         userid: null,
355
         userid: null,
344
         rversion: null,
356
         rversion: null,
345
         padid: null,
357
         padid: null,
413
         },
425
         },
414
         {
426
         {
415
           pdorder: 10,
427
           pdorder: 10,
416
-          pdtype: "SD卡",
428
+          pdtype: "OTG",
417
           enabled: 2,
429
           enabled: 2,
418
           icon: "ivu-icon iconfont icon-icon-OTG"
430
           icon: "ivu-icon iconfont icon-icon-OTG"
419
         }
431
         }
582
         item.checked = item.padid === row.padid ? true : false;
594
         item.checked = item.padid === row.padid ? true : false;
583
       });
595
       });
584
     },
596
     },
585
-    saveStPadInfo() {
586
-      //保存引用策略
587
-      let obj = this.stPadInfo.list.filter((v) => v.checked)[0] || null;
588
-      if (!obj) {
589
-        this.$Message.error("请选择引用策略!");
590
-        return;
591
-      }
597
+    initData() {
592
       //数据初始化
598
       //数据初始化
593
       this.strategyInfo.padTimes = []; // 平板策略时间
599
       this.strategyInfo.padTimes = []; // 平板策略时间
594
       this.strategyInfo.padApps = []; //appid集合
600
       this.strategyInfo.padApps = []; //appid集合
602
         item.checked = false;
608
         item.checked = false;
603
         item.handleMethod = [];
609
         item.handleMethod = [];
604
       });
610
       });
611
+      this.padApps.forEach((item) => {
612
+        item.checked = false;
613
+      });
614
+    },
615
+    saveStPadInfo() {
616
+      //保存引用策略
617
+      let obj = this.stPadInfo.list.filter((v) => v.checked)[0] || null;
618
+      if (!obj) {
619
+        this.$Message.error("请选择引用策略!");
620
+        return;
621
+      }
622
+      this.initData();
605
       this.showLoading = true;
623
       this.showLoading = true;
606
       stPad_add_quote({
624
       stPad_add_quote({
607
         sttype: 3,
625
         sttype: 3,
616
           this.strategyInfo.rversion = res.obj.rversion;
634
           this.strategyInfo.rversion = res.obj.rversion;
617
           this.strategyInfo.hastime = res.obj.hastime ? true : false;
635
           this.strategyInfo.hastime = res.obj.hastime ? true : false;
618
           this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
636
           this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
619
-          this.strategyInfo.hasdevice = res.obj.hasdevice
620
-            ? true
621
-            : false;
637
+          this.strategyInfo.hasdevice = res.obj.hasdevice ? true : false;
622
           this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
638
           this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
623
-          this.strategyInfo.hasviolate = res.obj.hasviolate
624
-            ? true
625
-            : false;
639
+          this.strategyInfo.hasviolate = res.obj.hasviolate ? true : false;
626
           if (this.strategyInfo.hasapp) {
640
           if (this.strategyInfo.hasapp) {
627
             //回显应用策略
641
             //回显应用策略
628
             this.padApps.forEach((item) => {
642
             this.padApps.forEach((item) => {
655
           this.strategyInfo.padWifis = res.obj.padWifis || [];
669
           this.strategyInfo.padWifis = res.obj.padWifis || [];
656
           this.strategyInfo.padTimes = res.obj.padTimes || [];
670
           this.strategyInfo.padTimes = res.obj.padTimes || [];
657
           this.stPadInfo.show = false;
671
           this.stPadInfo.show = false;
658
-          console.log(this.strategyInfo)
672
+          console.log(this.strategyInfo);
659
         } else {
673
         } else {
660
           this.$Message.error(res.msg);
674
           this.$Message.error(res.msg);
661
         }
675
         }
718
     },
732
     },
719
     save() {
733
     save() {
720
       if (
734
       if (
721
-          !this.strategyInfo.hastime &&
722
-          !this.strategyInfo.hasapp &&
723
-          !this.strategyInfo.hasdevice &&
724
-          !this.strategyInfo.haswifi &&
725
-          !this.strategyInfo.hasviolate
735
+        !this.strategyInfo.hastime &&
736
+        !this.strategyInfo.hasapp &&
737
+        !this.strategyInfo.hasdevice &&
738
+        !this.strategyInfo.haswifi &&
739
+        !this.strategyInfo.hasviolate
726
       ) {
740
       ) {
727
         this.$Message.error("请选择策略!");
741
         this.$Message.error("请选择策略!");
728
         return;
742
         return;
875
       this.searchList();
889
       this.searchList();
876
     },
890
     },
877
     toView(row) {
891
     toView(row) {
892
+      this.initData();
878
       this.showLoading = true;
893
       this.showLoading = true;
879
       stPad_detail({ padid: row.padid }).then((res) => {
894
       stPad_detail({ padid: row.padid }).then((res) => {
880
         this.showLoading = false;
895
         this.showLoading = false;
881
         if (res.code === 0) {
896
         if (res.code === 0) {
882
           //数据回显
897
           //数据回显
883
           this.strategyInfo.model = "see";
898
           this.strategyInfo.model = "see";
899
+          this.strategyInfo.username = row.username;
884
           this.strategyInfo.userid = row.userid;
900
           this.strategyInfo.userid = row.userid;
885
           this.strategyInfo.padid = res.obj.padid;
901
           this.strategyInfo.padid = res.obj.padid;
886
           this.strategyInfo.rversion = res.obj.rversion;
902
           this.strategyInfo.rversion = res.obj.rversion;
887
-          this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
888
-          this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
889
-          this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
890
-            ? true
891
-            : false;
892
-          this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
893
-          this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
894
-            ? true
895
-            : false;
903
+          this.strategyInfo.hastime = res.obj.hastime ? true : false;
904
+          this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
905
+          this.strategyInfo.hasdevice = res.obj.hasdevice ? true : false;
906
+          this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
907
+          this.strategyInfo.hasviolate = res.obj.hasviolate ? true : false;
896
           if (this.strategyInfo.hasapp) {
908
           if (this.strategyInfo.hasapp) {
897
             //回显应用策略
909
             //回显应用策略
898
             this.padApps.forEach((item) => {
910
             this.padApps.forEach((item) => {
899
-              let ishas = this.strategyInfo.padApps.some((v) => {
911
+              let ishas = res.obj.padApps.some((v) => {
900
                 return v.appid === item.appid;
912
                 return v.appid === item.appid;
901
               });
913
               });
902
               item.checked = ishas ? true : false;
914
               item.checked = ishas ? true : false;
905
           if (this.strategyInfo.hasdevice) {
917
           if (this.strategyInfo.hasdevice) {
906
             //回显设备策略
918
             //回显设备策略
907
             this.padDevices.forEach((item) => {
919
             this.padDevices.forEach((item) => {
908
-              let obj = this.strategyInfo.padDevices.filter((v) => {
920
+              let obj = res.obj.padDevices.filter((v) => {
909
                 return v.pdtype === item.pdtype;
921
                 return v.pdtype === item.pdtype;
910
               })[0] || { enabled: 2 };
922
               })[0] || { enabled: 2 };
911
               item.enabled = obj.enabled;
923
               item.enabled = obj.enabled;
914
           if (this.strategyInfo.hasviolate) {
926
           if (this.strategyInfo.hasviolate) {
915
             //回显违规处理
927
             //回显违规处理
916
             this.padViolates.forEach((item) => {
928
             this.padViolates.forEach((item) => {
917
-              let arr = this.strategyInfo.padViolates.filter((v) => {
929
+              let arr = res.obj.padViolates.filter((v) => {
918
                 return v.violateType === item.violateType;
930
                 return v.violateType === item.violateType;
919
               });
931
               });
920
               item.checked = arr.length > 0 ? true : false;
932
               item.checked = arr.length > 0 ? true : false;
925
           this.strategyInfo.padWifis = res.obj.padWifis || [];
937
           this.strategyInfo.padWifis = res.obj.padWifis || [];
926
           this.strategyInfo.padTimes = res.obj.padTimes || [];
938
           this.strategyInfo.padTimes = res.obj.padTimes || [];
927
           this.strategyInfo.show = true;
939
           this.strategyInfo.show = true;
928
-          console.log(this.strategyInfo)
940
+          console.log(this.strategyInfo);
929
         } else {
941
         } else {
930
           this.$Message.error(res.msg);
942
           this.$Message.error(res.msg);
931
         }
943
         }
932
       });
944
       });
933
     },
945
     },
934
     toEdit(row) {
946
     toEdit(row) {
935
-      console.log(row)
947
+      this.initData();
948
+      console.log(row);
936
       if (!row.padid) {
949
       if (!row.padid) {
937
         this.strategyInfo = {
950
         this.strategyInfo = {
938
           model: "add", //添加
951
           model: "add", //添加
939
           userid: row.userid,
952
           userid: row.userid,
953
+          username: row.username,
940
           padid: null,
954
           padid: null,
941
           rversion: null,
955
           rversion: null,
942
           show: true,
956
           show: true,
960
           console.log(res.obj);
974
           console.log(res.obj);
961
           //数据回显
975
           //数据回显
962
           this.strategyInfo.model = "edit";
976
           this.strategyInfo.model = "edit";
977
+          this.strategyInfo.username = row.username;
963
           this.strategyInfo.padid = res.obj.padid;
978
           this.strategyInfo.padid = res.obj.padid;
964
           this.strategyInfo.userid = row.userid;
979
           this.strategyInfo.userid = row.userid;
965
           this.strategyInfo.rversion = res.obj.rversion;
980
           this.strategyInfo.rversion = res.obj.rversion;

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

356
         },
356
         },
357
         {
357
         {
358
           pdorder: 10,
358
           pdorder: 10,
359
-          pdtype: "SD卡",
359
+          pdtype: "OTG",
360
           enabled: 2,
360
           enabled: 2,
361
           icon: "ivu-icon iconfont icon-icon-OTG"
361
           icon: "ivu-icon iconfont icon-icon-OTG"
362
         }
362
         }
576
           }).then((res) => {
576
           }).then((res) => {
577
             this.showLoading = false;
577
             this.showLoading = false;
578
             if (res.code === 0) {
578
             if (res.code === 0) {
579
+              //刷新左侧树
580
+              this.$emit("refresh");
579
               this.detail();
581
               this.detail();
580
             } else {
582
             } else {
581
               this.$Message.error(res.msg);
583
               this.$Message.error(res.msg);
696
       api(form).then((res) => {
698
       api(form).then((res) => {
697
         if (res.code === 0) {
699
         if (res.code === 0) {
698
           this.$Message.success(res.msg);
700
           this.$Message.success(res.msg);
699
-          if (!hasSave) {
700
-            //刷新左侧树
701
-            this.$emit("refresh");
702
-          }
701
+          //刷新左侧树
702
+          this.$emit("refresh");
703
           this.detail();
703
           this.detail();
704
         } else {
704
         } else {
705
           this.$Message.error(res.msg);
705
           this.$Message.error(res.msg);

+ 23
- 14
src/views/schoolSection/strategy/strategyManage.vue View File

2
   <div class="main_root">
2
   <div class="main_root">
3
     <div class="schoolInfo">
3
     <div class="schoolInfo">
4
       <div
4
       <div
5
-        @click="curClass = schoolInfo"
5
+        @click="selectClass(schoolInfo)"
6
         :class="[
6
         :class="[
7
           'schoolname',
7
           'schoolname',
8
           curClass.id === schoolInfo.id && curClass.type === schoolInfo.type
8
           curClass.id === schoolInfo.id && curClass.type === schoolInfo.type
11
         ]"
11
         ]"
12
       >
12
       >
13
         {{ schoolInfo.name }}
13
         {{ schoolInfo.name }}
14
-        <span v-if="schoolInfo.hasst" class="ivu-icon iconfont icon-ding-mianxing"></span>
14
+        <span
15
+          v-if="schoolInfo.hasst"
16
+          class="ivu-icon iconfont icon-ding-mianxing"
17
+        ></span>
15
       </div>
18
       </div>
16
       <div class="class_list">
19
       <div class="class_list">
17
         <div v-for="item in schoolInfo.children" :key="item.id">
20
         <div v-for="item in schoolInfo.children" :key="item.id">
25
             @click="selectClass(item)"
28
             @click="selectClass(item)"
26
           >
29
           >
27
             {{ item.name }}
30
             {{ item.name }}
28
-            <span v-if="item.hasst" class="ivu-icon iconfont icon-ding-mianxing"></span>
31
+            <span
32
+              v-if="item.hasst"
33
+              class="ivu-icon iconfont icon-ding-mianxing"
34
+            ></span>
29
           </div>
35
           </div>
30
         </div>
36
         </div>
31
       </div>
37
       </div>
32
     </div>
38
     </div>
33
     <div class="user_list">
39
     <div class="user_list">
34
       <div class="login_type">
40
       <div class="login_type">
35
-        <div @click="strategy = 1" :class="[strategy == 1 ? 'active' : '']">
41
+        <div @click="toggle(1)" :class="[strategy == 1 ? 'active' : '']">
36
           公共策略
42
           公共策略
37
         </div>
43
         </div>
38
-        <div @click="strategy = 2" :class="[strategy == 2 ? 'active' : '']">
44
+        <div @click="toggle(2)" :class="[strategy == 2 ? 'active' : '']">
39
           个人策略
45
           个人策略
40
         </div>
46
         </div>
41
       </div>
47
       </div>
42
       <PublicStrategy
48
       <PublicStrategy
43
         :curClass="curClass"
49
         :curClass="curClass"
44
         v-if="strategy === 1"
50
         v-if="strategy === 1"
51
+        @refresh="init()"
45
       ></PublicStrategy>
52
       ></PublicStrategy>
46
       <PersonalStrategy
53
       <PersonalStrategy
47
         :curClass="curClass"
54
         :curClass="curClass"
56
 </template>
63
 </template>
57
 
64
 
58
 <script>
65
 <script>
59
-import { class_list } from "@/api/school";
60
 import PublicStrategy from "./publicStrategy.vue";
66
 import PublicStrategy from "./publicStrategy.vue";
61
 import PersonalStrategy from "./personalStrategy";
67
 import PersonalStrategy from "./personalStrategy";
62
-import {class_list_strategy} from "@/api/stPad";
68
+import { class_list_strategy } from "@/api/stPad";
63
 export default {
69
 export default {
64
   components: {
70
   components: {
65
     PublicStrategy,
71
     PublicStrategy,
96
   methods: {
102
   methods: {
97
     selectClass(item) {
103
     selectClass(item) {
98
       this.curClass = item;
104
       this.curClass = item;
99
-      console.log(this.curClass);
105
+    },
106
+    toggle(type) {
107
+      this.strategy = type;
100
     },
108
     },
101
     init() {
109
     init() {
102
       this.showLoading = true;
110
       this.showLoading = true;
103
-      class_list_strategy({ schoolid: this.powerParams.objectid,
104
-        st:"pad"}).then((res) => {
111
+      class_list_strategy({
112
+        schoolid: this.powerParams.objectid,
113
+        st: "pad"
114
+      }).then((res) => {
105
         this.showLoading = false;
115
         this.showLoading = false;
106
         if (res.code === 0) {
116
         if (res.code === 0) {
107
           this.schoolInfo = res.obj;
117
           this.schoolInfo = res.obj;
108
-          if (this.schoolInfo.children.length > 0) {
118
+          this.curClass = this.schoolInfo;
119
+          if (this.schoolInfo.children.length > 0 && !this.curClass.id) {
109
             this.schoolInfo.children.forEach((item) => {
120
             this.schoolInfo.children.forEach((item) => {
110
               item.schoolid = this.schoolInfo.id;
121
               item.schoolid = this.schoolInfo.id;
111
             });
122
             });
112
-            this.curClass = this.schoolInfo.children[0];
113
           }
123
           }
114
-          this.strategy = 1; //渲染页面
115
-          console.log(this.schoolInfo)
124
+          this.strategy = this.strategy ? this.strategy : 1; //渲染页面
116
         } else {
125
         } else {
117
           this.$Message.error(res.msg);
126
           this.$Message.error(res.msg);
118
         }
127
         }

+ 275
- 192
src/views/schoolSection/strategy/strategyTemplate.vue View File

16
       <Table :columns="columns" :data="searchForm.list">
16
       <Table :columns="columns" :data="searchForm.list">
17
         <template slot-scope="{ row }" slot="actionSlot">
17
         <template slot-scope="{ row }" slot="actionSlot">
18
           <div class="action_list">
18
           <div class="action_list">
19
-            <div @click="toView(row)">查看</div>
20
-            <div @click="toEdit(row)">编辑</div>
19
+            <div @click="toEdit(row, 1)">查看</div>
20
+            <div @click="toEdit(row, 2)">编辑</div>
21
             <div class="action_del" @click="toDel(row)">删除</div>
21
             <div class="action_del" @click="toDel(row)">删除</div>
22
             <div @click="toEmpower(row)">授权</div>
22
             <div @click="toEmpower(row)">授权</div>
23
           </div>
23
           </div>
72
     </Modal>
72
     </Modal>
73
     <!-- 编辑 -->
73
     <!-- 编辑 -->
74
     <Modal
74
     <Modal
75
-        class="modal5"
76
-        :mask-closable="false"
77
-        v-model="strategyInfo.show"
78
-        title="编辑"
75
+      class="modal5"
76
+      :mask-closable="false"
77
+      v-model="strategyInfo.show"
78
+      :title="strategyInfo.model"
79
     >
79
     >
80
-      <div class="content">
80
+      <div class="content" v-if="strategyInfo.show">
81
+        <div class="titles">
82
+          <div class="require">策略名称</div>
83
+          <Input
84
+            v-model.trim="strategyInfo.name"
85
+            :disabled="strategyInfo.model === '查看'"
86
+            style="width: 400px"
87
+            placeholder="请输入策略名称"
88
+          ></Input>
89
+        </div>
81
         <div class="strategy_list">
90
         <div class="strategy_list">
82
           <div class="strategy_title">
91
           <div class="strategy_title">
83
             <div>
92
             <div>
84
-          <span
85
-              style="font-size: 26px"
86
-              class="ivu-icon iconfont icon-shijian"
87
-          ></span
88
-          >时间限制策略
93
+              <span
94
+                style="font-size: 26px"
95
+                class="ivu-icon iconfont icon-shijian"
96
+              ></span
97
+              >时间限制策略
89
             </div>
98
             </div>
90
             <div>
99
             <div>
91
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hastime"
92
-              >启用</Checkbox
100
+              <Checkbox
101
+                v-if="strategyInfo.model != '查看'"
102
+                v-model="strategyInfo.hastime"
103
+                >启用</Checkbox
93
               >
104
               >
94
             </div>
105
             </div>
95
           </div>
106
           </div>
96
           <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
107
           <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
97
             <TimeStrategy
108
             <TimeStrategy
98
-                v-if="strategyInfo.model != 'see'"
99
-                :times="strategyInfo.padTimes"
100
-                @timesChange="timesChange"
109
+              v-if="strategyInfo.model != '查看'"
110
+              :times="strategyInfo.padTimes"
111
+              @timesChange="timesChange"
101
             ></TimeStrategy>
112
             ></TimeStrategy>
102
-            <div class="showtime" v-if="strategyInfo.model === 'see'">
103
-              <div style="line-height: 30px; font-size: 16px; margin-bottom: 10px">
113
+            <div class="showtime" v-if="strategyInfo.model === '查看'">
114
+              <div
115
+                style="line-height: 30px; font-size: 16px; margin-bottom: 10px"
116
+              >
104
                 设备生效时间
117
                 设备生效时间
105
               </div>
118
               </div>
106
               <div class="week">
119
               <div class="week">
108
                   <div class="day_title">{{ item.title }}</div>
121
                   <div class="day_title">{{ item.title }}</div>
109
                   <div class="day_content">
122
                   <div class="day_content">
110
                     <div class="time" v-for="sitem in getDay(item.id)">
123
                     <div class="time" v-for="sitem in getDay(item.id)">
111
-                      {{ getTime(sitem.starttime) }}-{{ getTime(sitem.stoptime) }}
124
+                      {{ getTime(sitem.starttime) }}-{{
125
+                        getTime(sitem.stoptime)
126
+                      }}
112
                     </div>
127
                     </div>
113
                   </div>
128
                   </div>
114
                 </div>
129
                 </div>
123
               <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
138
               <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
124
             </div>
139
             </div>
125
             <div>
140
             <div>
126
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hasapp"
127
-              >启用</Checkbox
141
+              <Checkbox
142
+                v-if="strategyInfo.model != '查看'"
143
+                v-model="strategyInfo.hasapp"
144
+                >启用</Checkbox
128
               >
145
               >
129
             </div>
146
             </div>
130
           </div>
147
           </div>
133
               <span>授权应用</span>
150
               <span>授权应用</span>
134
             </div>
151
             </div>
135
             <div
152
             <div
136
-                class="strategy_bottom"
137
-                style="min-height: 160px"
138
-                v-if="padApps.length > 0"
153
+              class="strategy_bottom"
154
+              style="min-height: 160px"
155
+              v-if="padApps.length > 0"
139
             >
156
             >
140
               <div class="app_list" v-for="item in padApps" :key="item.appid">
157
               <div class="app_list" v-for="item in padApps" :key="item.appid">
141
                 <img :src="$api.baseImageUrl + item.appIcon" />
158
                 <img :src="$api.baseImageUrl + item.appIcon" />
142
                 <div>{{ item.appName }}</div>
159
                 <div>{{ item.appName }}</div>
143
                 <Checkbox
160
                 <Checkbox
144
-                    class="checked"
145
-                    :disabled="strategyInfo.model === 'see'"
146
-                    v-model="item.checked"
161
+                  class="checked"
162
+                  :disabled="strategyInfo.model === '查看'"
163
+                  v-model="item.checked"
147
                 ></Checkbox>
164
                 ></Checkbox>
148
               </div>
165
               </div>
149
             </div>
166
             </div>
152
         </div>
169
         </div>
153
         <div class="strategy_list">
170
         <div class="strategy_list">
154
           <div class="strategy_title">
171
           <div class="strategy_title">
155
-            <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
156
             <div>
172
             <div>
157
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hasdevice"
158
-              >启用</Checkbox
173
+              <span class="ivu-icon iconfont icon-shezhi"></span>设备策略
174
+            </div>
175
+            <div>
176
+              <Checkbox
177
+                v-if="strategyInfo.model != '查看'"
178
+                v-model="strategyInfo.hasdevice"
179
+                >启用</Checkbox
159
               >
180
               >
160
             </div>
181
             </div>
161
           </div>
182
           </div>
165
             </div>
186
             </div>
166
             <div class="strategy_bottom" style="min-height: 160px">
187
             <div class="strategy_bottom" style="min-height: 160px">
167
               <div
188
               <div
168
-                  class="device_list"
169
-                  v-for="item in padDevices"
170
-                  :key="item.pdorder"
189
+                class="device_list"
190
+                v-for="item in padDevices"
191
+                :key="item.pdorder"
171
               >
192
               >
172
                 <div class="icon">
193
                 <div class="icon">
173
                   <span :class="[item.icon]"></span>
194
                   <span :class="[item.icon]"></span>
174
                 </div>
195
                 </div>
175
                 <div class="title">{{ item.pdtype }}</div>
196
                 <div class="title">{{ item.pdtype }}</div>
176
                 <i-switch
197
                 <i-switch
177
-                    size="large"
178
-                    v-model="item.enabled"
179
-                    :disabled="strategyInfo.model === 'see'"
180
-                    :true-value="1"
181
-                    :false-value="2"
198
+                  size="large"
199
+                  v-model="item.enabled"
200
+                  :disabled="strategyInfo.model === '查看'"
201
+                  :true-value="1"
202
+                  :false-value="2"
182
                 >
203
                 >
183
                   <span slot="open">开启</span>
204
                   <span slot="open">开启</span>
184
                   <span slot="close">关闭</span>
205
                   <span slot="close">关闭</span>
191
         <div class="strategy_list">
212
         <div class="strategy_list">
192
           <div class="strategy_title">
213
           <div class="strategy_title">
193
             <div>
214
             <div>
194
-          <span
195
-              style="font-size: 18px"
196
-              class="ivu-icon iconfont icon-wifi"
197
-          ></span
198
-          >Wifi白名单策略
215
+              <span
216
+                style="font-size: 18px"
217
+                class="ivu-icon iconfont icon-wifi"
218
+              ></span
219
+              >Wifi白名单策略
199
             </div>
220
             </div>
200
             <div>
221
             <div>
201
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.haswifi"
202
-              >启用</Checkbox
222
+              <Checkbox
223
+                v-if="strategyInfo.model != '查看'"
224
+                v-model="strategyInfo.haswifi"
225
+                >启用</Checkbox
203
               >
226
               >
204
             </div>
227
             </div>
205
           </div>
228
           </div>
206
           <div class="strategy_content" v-if="strategyInfo.haswifi">
229
           <div class="strategy_content" v-if="strategyInfo.haswifi">
207
             <div class="strategy_top">
230
             <div class="strategy_top">
208
               <span>SSID</span>
231
               <span>SSID</span>
209
-              <span v-if="strategyInfo.model != 'see'">
210
-            <Input
211
-                v-model.trim="ssidName"
212
-                placeholder="请输入SSID"
213
-                style="width: 260px; margin: 0 10px"
214
-            />
215
-            <Button type="primary" class="primary_btn" @click="AddWifi()"
216
-            >添加</Button
217
-            >
218
-          </span>
232
+              <span v-if="strategyInfo.model != '查看'">
233
+                <Input
234
+                  v-model.trim="ssidName"
235
+                  placeholder="请输入SSID"
236
+                  style="width: 260px; margin: 0 10px"
237
+                />
238
+                <Button type="primary" class="primary_btn" @click="AddWifi()"
239
+                  >添加</Button
240
+                >
241
+              </span>
219
             </div>
242
             </div>
220
             <div class="strategy_bottom" style="min-height: 76px">
243
             <div class="strategy_bottom" style="min-height: 76px">
221
               <div
244
               <div
222
-                  class="padWifis"
223
-                  v-for="(item, index) in strategyInfo.padWifis"
224
-                  :key="index"
245
+                class="padWifis"
246
+                v-for="(item, index) in strategyInfo.padWifis"
247
+                :key="index"
225
               >
248
               >
226
                 <div class="title">{{ item }}</div>
249
                 <div class="title">{{ item }}</div>
227
                 <img
250
                 <img
228
-                    v-if="strategyInfo.model != 'see'"
229
-                    @click="delWifi(item)"
230
-                    class="del"
231
-                    src="../../../assets/img/guanbi_red.png"
251
+                  v-if="strategyInfo.model != '查看'"
252
+                  @click="delWifi(item)"
253
+                  class="del"
254
+                  src="../../../assets/img/guanbi_red.png"
232
                 />
255
                 />
233
               </div>
256
               </div>
234
             </div>
257
             </div>
241
               <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
264
               <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
242
             </div>
265
             </div>
243
             <div>
266
             <div>
244
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hasviolate"
245
-              >启用</Checkbox
267
+              <Checkbox
268
+                v-if="strategyInfo.model != '查看'"
269
+                v-model="strategyInfo.hasviolate"
270
+                >启用</Checkbox
246
               >
271
               >
247
             </div>
272
             </div>
248
           </div>
273
           </div>
249
           <Table
274
           <Table
250
-              v-if="strategyInfo.hasviolate"
251
-              class="table"
252
-              :columns="columns1"
253
-              :data="padViolates"
275
+            v-if="strategyInfo.hasviolate"
276
+            class="table"
277
+            :columns="columns1"
278
+            :data="padViolates"
254
           >
279
           >
255
             <template slot-scope="{ row }" slot="violationEvents">
280
             <template slot-scope="{ row }" slot="violationEvents">
256
               <Checkbox
281
               <Checkbox
257
-                  :disabled="strategyInfo.model === 'see'"
258
-                  class="checked"
259
-                  @on-change="checkedChange(row)"
260
-                  v-model="row.checked"
282
+                :disabled="strategyInfo.model === '查看'"
283
+                class="checked"
284
+                @on-change="checkedChange(row)"
285
+                v-model="row.checked"
261
               ></Checkbox>
286
               ></Checkbox>
262
-              <span style="display: inline-block; width: 120px; text-align: left">{{
263
-                  row.title
264
-                }}</span>
287
+              <span
288
+                style="display: inline-block; width: 120px; text-align: left"
289
+                >{{ row.title }}</span
290
+              >
265
             </template>
291
             </template>
266
             <template slot-scope="{ row }" slot="violationHandling">
292
             <template slot-scope="{ row }" slot="violationHandling">
267
               <CheckboxGroup
293
               <CheckboxGroup
268
-                  @on-change="checkboxChange(row)"
269
-                  v-model="row.handleMethod"
294
+                @on-change="checkboxChange(row)"
295
+                v-model="row.handleMethod"
270
               >
296
               >
271
-                <Checkbox :disabled="strategyInfo.model === 'see'" label="通知管理员"></Checkbox>
272
                 <Checkbox
297
                 <Checkbox
273
-                    :disabled="strategyInfo.model === 'see'"
274
-                    style="margin: 0 40px"
275
-                    label="限制使用"
298
+                  :disabled="strategyInfo.model === '查看'"
299
+                  label="通知管理员"
300
+                ></Checkbox>
301
+                <Checkbox
302
+                  :disabled="strategyInfo.model === '查看'"
303
+                  style="margin: 0 40px"
304
+                  label="限制使用"
276
                 ></Checkbox>
305
                 ></Checkbox>
277
                 <Checkbox
306
                 <Checkbox
278
-                    :disabled="strategyInfo.model === 'see'"
279
-                    label="恢复出厂设置"
307
+                  :disabled="strategyInfo.model === '查看'"
308
+                  label="恢复出厂设置"
280
                 ></Checkbox>
309
                 ></Checkbox>
281
               </CheckboxGroup>
310
               </CheckboxGroup>
282
             </template>
311
             </template>
283
           </Table>
312
           </Table>
284
-          <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
313
+          <div class="nodata" v-if="!strategyInfo.hasviolate">
314
+            未设置违规处理
315
+          </div>
285
         </div>
316
         </div>
286
       </div>
317
       </div>
287
       <div slot="footer" style="text-align: right">
318
       <div slot="footer" style="text-align: right">
288
-        <Button style="margin-right: 10px" @click="strategyInfo.show = false">关闭</Button>
289
-        <Button type="primary" class="primary_btn" @click="save()"
290
-        >保存</Button
319
+        <Button @click="strategyInfo.show = false">关闭</Button>
320
+        <Button
321
+          v-if="strategyInfo.model != '查看'"
322
+          style="margin-left: 10px"
323
+          type="primary"
324
+          class="primary_btn"
325
+          @click="save()"
326
+          >保存</Button
291
         >
327
         >
292
       </div>
328
       </div>
293
     </Modal>
329
     </Modal>
301
 <script>
337
 <script>
302
 import {
338
 import {
303
   class_list_strategy,
339
   class_list_strategy,
304
-  stApp_add_empower, stPad_add,
305
-  stPad_delete, stPad_detail, stPad_edit,
340
+  stPad_add,
341
+  stPad_add_empower,
342
+  stPad_delete,
343
+  stPad_detail,
344
+  stPad_edit,
306
   stPad_list
345
   stPad_list
307
 } from "@/api/stPad";
346
 } from "@/api/stPad";
308
-import {app_list_sel} from "@/api/appgroup";
347
+import { app_list_sel } from "@/api/appgroup";
309
 
348
 
310
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
349
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
311
 export default {
350
 export default {
322
         list: [],
361
         list: [],
323
         total: 0
362
         total: 0
324
       },
363
       },
325
-      rules: {
326
-        name: [
327
-          {
328
-            required: true,
329
-            message: "请输入名称",
330
-            trigger: "change"
331
-          }
332
-        ]
333
-      },
334
       empowerInfo: {
364
       empowerInfo: {
335
         show: false,
365
         show: false,
336
         name: "",
366
         name: "",
337
         checked: false,
367
         checked: false,
338
-        stappid: null,
368
+        padid: null,
339
         schoolid: null,
369
         schoolid: null,
340
         classids: [],
370
         classids: [],
341
         schoolInfo: {}
371
         schoolInfo: {}
342
       },
372
       },
343
       strategyInfo: {
373
       strategyInfo: {
344
         model: "add", //add添加/edit编辑/see查看
374
         model: "add", //add添加/edit编辑/see查看
375
+        name: null,
345
         userid: null,
376
         userid: null,
346
         rversion: null,
377
         rversion: null,
347
         padid: null,
378
         padid: null,
415
         },
446
         },
416
         {
447
         {
417
           pdorder: 10,
448
           pdorder: 10,
418
-          pdtype: "SD卡",
449
+          pdtype: "OTG",
419
           enabled: 2,
450
           enabled: 2,
420
           icon: "ivu-icon iconfont icon-icon-OTG"
451
           icon: "ivu-icon iconfont icon-icon-OTG"
421
         }
452
         }
563
         item.checked = item.padid === row.padid ? true : false;
594
         item.checked = item.padid === row.padid ? true : false;
564
       });
595
       });
565
     },
596
     },
566
-    saveStPadInfo() {
567
-      //保存引用策略
568
-      let obj = this.stPadInfo.list.filter((v) => v.checked)[0] || null;
569
-      if (!obj) {
570
-        this.$Message.error("请选择引用策略!");
571
-        return;
572
-      }
573
-      this.showLoading = true;
574
-      stPad_detail({ padid: obj.padid }).then((res) => {
575
-        this.showLoading = false;
576
-        if (res.code === 0) {
577
-          //数据回显
578
-          this.strategyInfo = res.obj;
579
-          this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
580
-          this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
581
-          this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
582
-              ? true
583
-              : false;
584
-          this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
585
-          this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
586
-              ? true
587
-              : false;
588
-          if (this.strategyInfo.hasapp) {
589
-            //回显应用策略
590
-            this.padApps.forEach((item) => {
591
-              let ishas = this.strategyInfo.padApps.some((v) => {
592
-                return v.appid === item.appid;
593
-              });
594
-              item.checked = ishas ? true : false;
595
-            });
596
-          }
597
-          if (this.strategyInfo.hasdevice) {
598
-            //回显设备策略
599
-            this.padDevices.forEach((item) => {
600
-              let obj = this.strategyInfo.padDevices.filter((v) => {
601
-                return v.pdtype === item.pdtype;
602
-              })[0] || { enabled: 2 };
603
-              item.enabled = obj.enabled;
604
-            });
605
-          }
606
-          if (this.strategyInfo.hasviolate) {
607
-            //回显违规处理
608
-            this.padViolates.forEach((item) => {
609
-              let arr = this.strategyInfo.padViolates.filter((v) => {
610
-                return v.violateType === item.violateType;
611
-              });
612
-              item.checked = arr.length > 0 ? true : false;
613
-              item.handleMethod =
614
-                  arr.length > 0 ? arr[0].handleMethod.split(";") : [];
615
-            });
616
-          }
617
-          this.curState = 2; //编辑状态
618
-          this.stPadInfo.show = false;
619
-        } else {
620
-          this.$Message.error(res.msg);
621
-        }
622
-      });
623
-    },
624
     getTime(time) {
597
     getTime(time) {
625
       return time;
598
       return time;
626
     },
599
     },
633
       this.strategyInfo.padTimes = times;
606
       this.strategyInfo.padTimes = times;
634
     },
607
     },
635
     save() {
608
     save() {
609
+      if (!this.strategyInfo.name) {
610
+        this.$Message.error("请输入策略名称!");
611
+        return;
612
+      }
613
+      if (
614
+        !this.strategyInfo.hastime &&
615
+        !this.strategyInfo.hasapp &&
616
+        !this.strategyInfo.hasdevice &&
617
+        !this.strategyInfo.haswifi &&
618
+        !this.strategyInfo.hasviolate
619
+      ) {
620
+        this.$Message.error("请选择策略!");
621
+        return;
622
+      }
636
       let padDevices = [],
623
       let padDevices = [],
637
-          padViolates = [],
638
-          padApps = [];
624
+        padViolates = [],
625
+        padApps = [];
639
       //获取授权应用
626
       //获取授权应用
640
       for (let item of this.padApps) {
627
       for (let item of this.padApps) {
641
         if (item.checked) {
628
         if (item.checked) {
696
         }
683
         }
697
       }
684
       }
698
       let form = {
685
       let form = {
699
-        sttype: 3, //1学校策略 2班级策略 3个人策略
700
-        objectid: this.strategyInfo.userid,
686
+        name: this.strategyInfo.name,
687
+        sttype: 0, //0公共 1学校策略 2班级策略 3个人策略
688
+        objectid: this.powerParams.objectid,
701
         hastime: this.strategyInfo.hastime ? 1 : 0,
689
         hastime: this.strategyInfo.hastime ? 1 : 0,
702
         hasapp: this.strategyInfo.hasapp ? 1 : 0,
690
         hasapp: this.strategyInfo.hasapp ? 1 : 0,
703
         hasdevice: this.strategyInfo.hasdevice ? 1 : 0,
691
         hasdevice: this.strategyInfo.hasdevice ? 1 : 0,
709
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
697
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
710
         padApps: this.strategyInfo.hasapp ? padApps : []
698
         padApps: this.strategyInfo.hasapp ? padApps : []
711
       };
699
       };
712
-      if (this.strategyInfo.model === 'edit') {
700
+      if (this.strategyInfo.model === "编辑") {
713
         //编辑
701
         //编辑
714
         form.padid = this.strategyInfo.padid;
702
         form.padid = this.strategyInfo.padid;
715
         form.rversion = this.strategyInfo.rversion;
703
         form.rversion = this.strategyInfo.rversion;
716
       }
704
       }
717
-      let api = this.strategyInfo.model === 'edit' ? stPad_edit : stPad_add;
718
-      console.log(form);
705
+      let api = this.strategyInfo.model === "编辑" ? stPad_edit : stPad_add;
719
       api(form).then((res) => {
706
       api(form).then((res) => {
720
         if (res.code === 0) {
707
         if (res.code === 0) {
721
           this.$Message.success(res.msg);
708
           this.$Message.success(res.msg);
722
           this.searchList();
709
           this.searchList();
723
           this.strategyInfo.show = false;
710
           this.strategyInfo.show = false;
724
-          console.log(res.obj)
725
         } else {
711
         } else {
726
           this.$Message.error(res.msg);
712
           this.$Message.error(res.msg);
727
         }
713
         }
750
     delWifi(val) {
736
     delWifi(val) {
751
       //删除wifi白名单
737
       //删除wifi白名单
752
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
738
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
753
-          (v) => v != val
739
+        (v) => v != val
754
       );
740
       );
755
     },
741
     },
756
     AddWifi() {
742
     AddWifi() {
760
       }
746
       }
761
       this.strategyInfo.padWifis.push(this.ssidName);
747
       this.strategyInfo.padWifis.push(this.ssidName);
762
       this.strategyInfo.padWifis = Array.from(
748
       this.strategyInfo.padWifis = Array.from(
763
-          new Set(this.strategyInfo.padWifis)
749
+        new Set(this.strategyInfo.padWifis)
764
       );
750
       );
765
     },
751
     },
766
     saveEmpowerInfo() {
752
     saveEmpowerInfo() {
767
       //保存授权
753
       //保存授权
768
-      console.log(this.empowerInfo);
769
       if (this.empowerInfo.classids.length === 0 && !this.empowerInfo.checked) {
754
       if (this.empowerInfo.classids.length === 0 && !this.empowerInfo.checked) {
770
         this.$Message.error("请选择学校/班级!");
755
         this.$Message.error("请选择学校/班级!");
771
         return;
756
         return;
772
       }
757
       }
773
       let form = {
758
       let form = {
774
-        stappid: this.empowerInfo.stappid
759
+        padid: this.empowerInfo.padid
775
       };
760
       };
776
       if (this.empowerInfo.checked) {
761
       if (this.empowerInfo.checked) {
777
         form.schoolid = this.empowerInfo.schoolid;
762
         form.schoolid = this.empowerInfo.schoolid;
779
       if (this.empowerInfo.classids.length > 0) {
764
       if (this.empowerInfo.classids.length > 0) {
780
         form.classids = this.empowerInfo.classids;
765
         form.classids = this.empowerInfo.classids;
781
       }
766
       }
782
-      console.log(form);
783
       this.empowerInfo.show = true;
767
       this.empowerInfo.show = true;
784
-      stApp_add_empower(form).then((data) => {
768
+      stPad_add_empower(form).then((data) => {
785
         if (data.code === 0) {
769
         if (data.code === 0) {
786
           this.empowerInfo.show = false;
770
           this.empowerInfo.show = false;
787
           this.$Message.success(data.msg);
771
           this.$Message.success(data.msg);
807
       this.searchForm.page = 1;
791
       this.searchForm.page = 1;
808
       this.getList();
792
       this.getList();
809
     },
793
     },
794
+    initData() {
795
+      //数据初始化
796
+      this.strategyInfo.padTimes = []; // 平板策略时间
797
+      this.strategyInfo.padApps = []; //appid集合
798
+      this.strategyInfo.padDevices = []; //授权应用
799
+      this.strategyInfo.padWifis = []; //wifi白名单
800
+      this.strategyInfo.padViolates = []; //设备违规
801
+      this.padDevices.forEach((item) => {
802
+        item.enabled = 2;
803
+      });
804
+      this.padViolates.forEach((item) => {
805
+        item.checked = false;
806
+        item.handleMethod = [];
807
+      });
808
+      this.padApps.forEach((item) => {
809
+        item.checked = false;
810
+      });
811
+    },
810
     // 获取列表
812
     // 获取列表
811
     getList() {
813
     getList() {
812
       this.showLoading = true;
814
       this.showLoading = true;
813
-      stPad_list({ schoolid: this.powerParams.objectid }).then((res) => {
815
+      stPad_list({
816
+        size: this.searchForm.size,
817
+        page: this.searchForm.page,
818
+        schoolid: this.powerParams.objectid
819
+      }).then((res) => {
814
         this.showLoading = false;
820
         this.showLoading = false;
815
         if (res.code === 0) {
821
         if (res.code === 0) {
816
-          this.searchForm.list = res.obj;
822
+          this.searchForm.list = res.obj.data;
817
           this.searchForm.total = res.total;
823
           this.searchForm.total = res.total;
818
-          console.log(res.obj);
819
         } else {
824
         } else {
820
           this.$Message.error(res.msg);
825
           this.$Message.error(res.msg);
821
         }
826
         }
824
     // 新建
829
     // 新建
825
     async toAdd() {
830
     async toAdd() {
826
       await this.getAppList();
831
       await this.getAppList();
832
+      this.initData();
827
       this.strategyInfo = {
833
       this.strategyInfo = {
828
-        model: "add", //添加
834
+        model: "新建", //添加
835
+        name: null,
829
         padid: null,
836
         padid: null,
830
         rversion: null,
837
         rversion: null,
831
         show: true,
838
         show: true,
839
         padWifis: [], //wifi白名单
846
         padWifis: [], //wifi白名单
840
         hasviolate: false, //是否开启违规通知:0否 1是
847
         hasviolate: false, //是否开启违规通知:0否 1是
841
         padViolates: [] //设备违规
848
         padViolates: [] //设备违规
842
-      }
843
-      console.log(this.strategyInfo)
849
+      };
844
     },
850
     },
845
-    async getAppList(){
851
+    async getAppList() {
846
       //获取应用列表
852
       //获取应用列表
847
       this.showLoading = true;
853
       this.showLoading = true;
848
-       let res = await app_list_sel({
854
+      let res = await app_list_sel({
849
         rtype: this.powerParams.rtype,
855
         rtype: this.powerParams.rtype,
850
         objectid: this.powerParams.objectid
856
         objectid: this.powerParams.objectid
851
       });
857
       });
855
           v.checked = false;
861
           v.checked = false;
856
           return v;
862
           return v;
857
         });
863
         });
858
-        console.log(this.padApps)
859
       } else {
864
       } else {
860
         this.$Message.error(res.msg);
865
         this.$Message.error(res.msg);
861
       }
866
       }
862
     },
867
     },
863
-    // 保存新建
864
-    saveAddInfo() {},
865
-    // 查看
866
-    toView(row) {},
867
     // 编辑
868
     // 编辑
868
-    toEdit(row) {},
869
+    async toEdit(row, type) {
870
+      //type 1查看 2编辑
871
+      await this.getAppList();
872
+      this.initData();
873
+      this.showLoading = true;
874
+      stPad_detail({ padid: row.padid }).then((res) => {
875
+        this.showLoading = false;
876
+        if (res.code === 0) {
877
+          //数据回显
878
+          this.strategyInfo.model = type === 1 ? "查看" : "编辑";
879
+          this.strategyInfo.name = res.obj.name;
880
+          this.strategyInfo.username = row.username;
881
+          this.strategyInfo.padid = res.obj.padid;
882
+          this.strategyInfo.userid = row.userid;
883
+          this.strategyInfo.rversion = res.obj.rversion;
884
+          this.strategyInfo.hastime = res.obj.hastime ? true : false;
885
+          this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
886
+          this.strategyInfo.hasdevice = res.obj.hasdevice ? true : false;
887
+          this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
888
+          this.strategyInfo.hasviolate = res.obj.hasviolate ? true : false;
889
+          if (this.strategyInfo.hastime) {
890
+            this.strategyInfo.padTimes = res.obj.padTimes;
891
+          }
892
+          if (this.strategyInfo.hasapp) {
893
+            //回显应用策略
894
+            this.padApps.forEach((item) => {
895
+              let ishas = res.obj.padApps.some((v) => {
896
+                return v.appid === item.appid;
897
+              });
898
+              item.checked = ishas ? true : false;
899
+            });
900
+          }
901
+          if (this.strategyInfo.hasdevice) {
902
+            //回显设备策略
903
+            this.padDevices.forEach((item) => {
904
+              let obj = res.obj.padDevices.filter((v) => {
905
+                return v.pdtype === item.pdtype;
906
+              })[0] || { enabled: 2 };
907
+              item.enabled = obj.enabled;
908
+            });
909
+          }
910
+          if (this.strategyInfo.hastime) {
911
+            this.strategyInfo.padWifis = res.obj.padWifis;
912
+          }
913
+          if (this.strategyInfo.hasviolate) {
914
+            //回显违规处理
915
+            this.padViolates.forEach((item) => {
916
+              let arr = res.obj.padViolates.filter((v) => {
917
+                return v.violateType === item.violateType;
918
+              });
919
+              item.checked = arr.length > 0 ? true : false;
920
+              item.handleMethod =
921
+                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
922
+            });
923
+          }
924
+          this.strategyInfo.show = true;
925
+        } else {
926
+          this.$Message.error(res.msg);
927
+        }
928
+      });
929
+    },
869
     // 删除
930
     // 删除
870
     toDel(row) {
931
     toDel(row) {
871
       this.$Modal.confirm({
932
       this.$Modal.confirm({
902
             name: row.name,
963
             name: row.name,
903
             schoolInfo: res.obj,
964
             schoolInfo: res.obj,
904
             checked: false,
965
             checked: false,
905
-            stappid: row.padid,
966
+            padid: row.padid,
906
             schoolid: res.obj.id,
967
             schoolid: res.obj.id,
907
             classids: []
968
             classids: []
908
           };
969
           };
909
-          console.log(this.empowerInfo);
910
         } else {
970
         } else {
911
           this.$Message.error(res.msg);
971
           this.$Message.error(res.msg);
912
         }
972
         }
957
     }
1017
     }
958
   }
1018
   }
959
 }
1019
 }
960
-.content{
1020
+.content {
1021
+  .titles {
1022
+    height: 40px;
1023
+    margin-bottom: 10px;
1024
+    display: flex;
1025
+    align-items: center;
1026
+    .require {
1027
+      width: 80px;
1028
+      color: #253a70;
1029
+      font-size: 16px;
1030
+      font-weight: 400;
1031
+      font-family: "SourceHanSansCN";
1032
+      margin-right: 10px;
1033
+      &::before {
1034
+        content: "*" !important;
1035
+        display: inline-block;
1036
+        margin-right: 4px;
1037
+        line-height: 1;
1038
+        font-family: SimSun;
1039
+        font-size: 14px;
1040
+        color: #ed4014;
1041
+      }
1042
+    }
1043
+  }
961
   .strategy_list {
1044
   .strategy_list {
962
     font-family: "SourceHanSansCN";
1045
     font-family: "SourceHanSansCN";
963
     .strategy_title {
1046
     .strategy_title {
1057
           height: 26px;
1140
           height: 26px;
1058
           margin: 0 20px 10px 0;
1141
           margin: 0 20px 10px 0;
1059
           position: relative;
1142
           position: relative;
1060
-          .title{
1143
+          .title {
1061
             line-height: 14px;
1144
             line-height: 14px;
1062
           }
1145
           }
1063
           img {
1146
           img {

Loading…
Cancel
Save