guozhongbo 9 місяці тому
джерело
коміт
307a8f506e

+ 12332
- 27
package-lock.json
Різницю між файлами не показано, бо вона завелика
Переглянути файл


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

@@ -40,11 +40,15 @@
40 40
       class="modal5"
41 41
       :mask-closable="false"
42 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 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 52
           <span @click="getstPad_list">引用</span>
49 53
         </div>
50 54
         <div class="strategy_list">
@@ -279,21 +283,27 @@
279 283
         <Button style="margin-right: 10px" @click="strategyInfo.show = false"
280 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 293
       </div>
284 294
     </Modal>
285 295
     <!-- 引用 -->
286 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 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 308
         <template slot-scope="{ row }" slot="active">
299 309
           <Radio @on-change="stPadChange(row)" v-model="row.checked"></Radio>
@@ -303,7 +313,7 @@
303 313
       <div slot="footer" style="text-align: right">
304 314
         <Button @click="stPadInfo.show = false">关闭</Button>
305 315
         <Button type="primary" class="primary_btn" @click="saveStPadInfo()"
306
-        >保存</Button
316
+          >保存</Button
307 317
         >
308 318
       </div>
309 319
     </Modal>
@@ -315,9 +325,10 @@
315 325
 </template>
316 326
 
317 327
 <script>
318
-import { app_list, app_list_sel } from "@/api/appgroup";
328
+import { app_list_sel } from "@/api/appgroup";
319 329
 import {
320
-  stPad_add, stPad_add_quote,
330
+  stPad_add,
331
+  stPad_add_quote,
321 332
   stPad_delete,
322 333
   stPad_detail,
323 334
   stPad_edit,
@@ -340,6 +351,7 @@ export default {
340 351
       },
341 352
       strategyInfo: {
342 353
         model: "add", //add添加/edit编辑/see查看
354
+        username: null,
343 355
         userid: null,
344 356
         rversion: null,
345 357
         padid: null,
@@ -413,7 +425,7 @@ export default {
413 425
         },
414 426
         {
415 427
           pdorder: 10,
416
-          pdtype: "SD卡",
428
+          pdtype: "OTG",
417 429
           enabled: 2,
418 430
           icon: "ivu-icon iconfont icon-icon-OTG"
419 431
         }
@@ -582,13 +594,7 @@ export default {
582 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 599
       this.strategyInfo.padTimes = []; // 平板策略时间
594 600
       this.strategyInfo.padApps = []; //appid集合
@@ -602,6 +608,18 @@ export default {
602 608
         item.checked = false;
603 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 623
       this.showLoading = true;
606 624
       stPad_add_quote({
607 625
         sttype: 3,
@@ -616,13 +634,9 @@ export default {
616 634
           this.strategyInfo.rversion = res.obj.rversion;
617 635
           this.strategyInfo.hastime = res.obj.hastime ? true : false;
618 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 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 640
           if (this.strategyInfo.hasapp) {
627 641
             //回显应用策略
628 642
             this.padApps.forEach((item) => {
@@ -655,7 +669,7 @@ export default {
655 669
           this.strategyInfo.padWifis = res.obj.padWifis || [];
656 670
           this.strategyInfo.padTimes = res.obj.padTimes || [];
657 671
           this.stPadInfo.show = false;
658
-          console.log(this.strategyInfo)
672
+          console.log(this.strategyInfo);
659 673
         } else {
660 674
           this.$Message.error(res.msg);
661 675
         }
@@ -718,11 +732,11 @@ export default {
718 732
     },
719 733
     save() {
720 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 741
         this.$Message.error("请选择策略!");
728 742
         return;
@@ -875,28 +889,26 @@ export default {
875 889
       this.searchList();
876 890
     },
877 891
     toView(row) {
892
+      this.initData();
878 893
       this.showLoading = true;
879 894
       stPad_detail({ padid: row.padid }).then((res) => {
880 895
         this.showLoading = false;
881 896
         if (res.code === 0) {
882 897
           //数据回显
883 898
           this.strategyInfo.model = "see";
899
+          this.strategyInfo.username = row.username;
884 900
           this.strategyInfo.userid = row.userid;
885 901
           this.strategyInfo.padid = res.obj.padid;
886 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 908
           if (this.strategyInfo.hasapp) {
897 909
             //回显应用策略
898 910
             this.padApps.forEach((item) => {
899
-              let ishas = this.strategyInfo.padApps.some((v) => {
911
+              let ishas = res.obj.padApps.some((v) => {
900 912
                 return v.appid === item.appid;
901 913
               });
902 914
               item.checked = ishas ? true : false;
@@ -905,7 +917,7 @@ export default {
905 917
           if (this.strategyInfo.hasdevice) {
906 918
             //回显设备策略
907 919
             this.padDevices.forEach((item) => {
908
-              let obj = this.strategyInfo.padDevices.filter((v) => {
920
+              let obj = res.obj.padDevices.filter((v) => {
909 921
                 return v.pdtype === item.pdtype;
910 922
               })[0] || { enabled: 2 };
911 923
               item.enabled = obj.enabled;
@@ -914,7 +926,7 @@ export default {
914 926
           if (this.strategyInfo.hasviolate) {
915 927
             //回显违规处理
916 928
             this.padViolates.forEach((item) => {
917
-              let arr = this.strategyInfo.padViolates.filter((v) => {
929
+              let arr = res.obj.padViolates.filter((v) => {
918 930
                 return v.violateType === item.violateType;
919 931
               });
920 932
               item.checked = arr.length > 0 ? true : false;
@@ -925,18 +937,20 @@ export default {
925 937
           this.strategyInfo.padWifis = res.obj.padWifis || [];
926 938
           this.strategyInfo.padTimes = res.obj.padTimes || [];
927 939
           this.strategyInfo.show = true;
928
-          console.log(this.strategyInfo)
940
+          console.log(this.strategyInfo);
929 941
         } else {
930 942
           this.$Message.error(res.msg);
931 943
         }
932 944
       });
933 945
     },
934 946
     toEdit(row) {
935
-      console.log(row)
947
+      this.initData();
948
+      console.log(row);
936 949
       if (!row.padid) {
937 950
         this.strategyInfo = {
938 951
           model: "add", //添加
939 952
           userid: row.userid,
953
+          username: row.username,
940 954
           padid: null,
941 955
           rversion: null,
942 956
           show: true,
@@ -960,6 +974,7 @@ export default {
960 974
           console.log(res.obj);
961 975
           //数据回显
962 976
           this.strategyInfo.model = "edit";
977
+          this.strategyInfo.username = row.username;
963 978
           this.strategyInfo.padid = res.obj.padid;
964 979
           this.strategyInfo.userid = row.userid;
965 980
           this.strategyInfo.rversion = res.obj.rversion;

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

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

+ 22
- 13
src/views/schoolSection/strategy/strategyManage.vue Переглянути файл

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

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

@@ -16,8 +16,8 @@
16 16
       <Table :columns="columns" :data="searchForm.list">
17 17
         <template slot-scope="{ row }" slot="actionSlot">
18 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 21
             <div class="action_del" @click="toDel(row)">删除</div>
22 22
             <div @click="toEmpower(row)">授权</div>
23 23
           </div>
@@ -72,35 +72,48 @@
72 72
     </Modal>
73 73
     <!-- 编辑 -->
74 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 90
         <div class="strategy_list">
82 91
           <div class="strategy_title">
83 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 98
             </div>
90 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 105
             </div>
95 106
           </div>
96 107
           <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
97 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 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 118
               </div>
106 119
               <div class="week">
@@ -108,7 +121,9 @@
108 121
                   <div class="day_title">{{ item.title }}</div>
109 122
                   <div class="day_content">
110 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 127
                     </div>
113 128
                   </div>
114 129
                 </div>
@@ -123,8 +138,10 @@
123 138
               <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
124 139
             </div>
125 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 146
             </div>
130 147
           </div>
@@ -133,17 +150,17 @@
133 150
               <span>授权应用</span>
134 151
             </div>
135 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 157
               <div class="app_list" v-for="item in padApps" :key="item.appid">
141 158
                 <img :src="$api.baseImageUrl + item.appIcon" />
142 159
                 <div>{{ item.appName }}</div>
143 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 164
                 ></Checkbox>
148 165
               </div>
149 166
             </div>
@@ -152,10 +169,14 @@
152 169
         </div>
153 170
         <div class="strategy_list">
154 171
           <div class="strategy_title">
155
-            <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
156 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 181
             </div>
161 182
           </div>
@@ -165,20 +186,20 @@
165 186
             </div>
166 187
             <div class="strategy_bottom" style="min-height: 160px">
167 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 193
                 <div class="icon">
173 194
                   <span :class="[item.icon]"></span>
174 195
                 </div>
175 196
                 <div class="title">{{ item.pdtype }}</div>
176 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 204
                   <span slot="open">开启</span>
184 205
                   <span slot="close">关闭</span>
@@ -191,44 +212,46 @@
191 212
         <div class="strategy_list">
192 213
           <div class="strategy_title">
193 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 220
             </div>
200 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 227
             </div>
205 228
           </div>
206 229
           <div class="strategy_content" v-if="strategyInfo.haswifi">
207 230
             <div class="strategy_top">
208 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 242
             </div>
220 243
             <div class="strategy_bottom" style="min-height: 76px">
221 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 249
                 <div class="title">{{ item }}</div>
227 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 256
               </div>
234 257
             </div>
@@ -241,53 +264,66 @@
241 264
               <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
242 265
             </div>
243 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 272
             </div>
248 273
           </div>
249 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 280
             <template slot-scope="{ row }" slot="violationEvents">
256 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 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 291
             </template>
266 292
             <template slot-scope="{ row }" slot="violationHandling">
267 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 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 305
                 ></Checkbox>
277 306
                 <Checkbox
278
-                    :disabled="strategyInfo.model === 'see'"
279
-                    label="恢复出厂设置"
307
+                  :disabled="strategyInfo.model === '查看'"
308
+                  label="恢复出厂设置"
280 309
                 ></Checkbox>
281 310
               </CheckboxGroup>
282 311
             </template>
283 312
           </Table>
284
-          <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
313
+          <div class="nodata" v-if="!strategyInfo.hasviolate">
314
+            未设置违规处理
315
+          </div>
285 316
         </div>
286 317
       </div>
287 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 328
       </div>
293 329
     </Modal>
@@ -301,11 +337,14 @@
301 337
 <script>
302 338
 import {
303 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 345
   stPad_list
307 346
 } from "@/api/stPad";
308
-import {app_list_sel} from "@/api/appgroup";
347
+import { app_list_sel } from "@/api/appgroup";
309 348
 
310 349
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
311 350
 export default {
@@ -322,26 +361,18 @@ export default {
322 361
         list: [],
323 362
         total: 0
324 363
       },
325
-      rules: {
326
-        name: [
327
-          {
328
-            required: true,
329
-            message: "请输入名称",
330
-            trigger: "change"
331
-          }
332
-        ]
333
-      },
334 364
       empowerInfo: {
335 365
         show: false,
336 366
         name: "",
337 367
         checked: false,
338
-        stappid: null,
368
+        padid: null,
339 369
         schoolid: null,
340 370
         classids: [],
341 371
         schoolInfo: {}
342 372
       },
343 373
       strategyInfo: {
344 374
         model: "add", //add添加/edit编辑/see查看
375
+        name: null,
345 376
         userid: null,
346 377
         rversion: null,
347 378
         padid: null,
@@ -415,7 +446,7 @@ export default {
415 446
         },
416 447
         {
417 448
           pdorder: 10,
418
-          pdtype: "SD卡",
449
+          pdtype: "OTG",
419 450
           enabled: 2,
420 451
           icon: "ivu-icon iconfont icon-icon-OTG"
421 452
         }
@@ -563,64 +594,6 @@ export default {
563 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 597
     getTime(time) {
625 598
       return time;
626 599
     },
@@ -633,9 +606,23 @@ export default {
633 606
       this.strategyInfo.padTimes = times;
634 607
     },
635 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 623
       let padDevices = [],
637
-          padViolates = [],
638
-          padApps = [];
624
+        padViolates = [],
625
+        padApps = [];
639 626
       //获取授权应用
640 627
       for (let item of this.padApps) {
641 628
         if (item.checked) {
@@ -696,8 +683,9 @@ export default {
696 683
         }
697 684
       }
698 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 689
         hastime: this.strategyInfo.hastime ? 1 : 0,
702 690
         hasapp: this.strategyInfo.hasapp ? 1 : 0,
703 691
         hasdevice: this.strategyInfo.hasdevice ? 1 : 0,
@@ -709,19 +697,19 @@ export default {
709 697
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
710 698
         padApps: this.strategyInfo.hasapp ? padApps : []
711 699
       };
712
-      if (this.strategyInfo.model === 'edit') {
700
+      if (this.strategyInfo.model === "编辑") {
713 701
         //编辑
714 702
         form.padid = this.strategyInfo.padid;
715 703
         form.rversion = this.strategyInfo.rversion;
716 704
       }
717
-      let api = this.strategyInfo.model === 'edit' ? stPad_edit : stPad_add;
705
+      let api = this.strategyInfo.model === "编辑" ? stPad_edit : stPad_add;
718 706
       console.log(form);
719 707
       api(form).then((res) => {
720 708
         if (res.code === 0) {
721 709
           this.$Message.success(res.msg);
722 710
           this.searchList();
723 711
           this.strategyInfo.show = false;
724
-          console.log(res.obj)
712
+          console.log(res.obj);
725 713
         } else {
726 714
           this.$Message.error(res.msg);
727 715
         }
@@ -750,7 +738,7 @@ export default {
750 738
     delWifi(val) {
751 739
       //删除wifi白名单
752 740
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
753
-          (v) => v != val
741
+        (v) => v != val
754 742
       );
755 743
     },
756 744
     AddWifi() {
@@ -760,18 +748,17 @@ export default {
760 748
       }
761 749
       this.strategyInfo.padWifis.push(this.ssidName);
762 750
       this.strategyInfo.padWifis = Array.from(
763
-          new Set(this.strategyInfo.padWifis)
751
+        new Set(this.strategyInfo.padWifis)
764 752
       );
765 753
     },
766 754
     saveEmpowerInfo() {
767 755
       //保存授权
768
-      console.log(this.empowerInfo);
769 756
       if (this.empowerInfo.classids.length === 0 && !this.empowerInfo.checked) {
770 757
         this.$Message.error("请选择学校/班级!");
771 758
         return;
772 759
       }
773 760
       let form = {
774
-        stappid: this.empowerInfo.stappid
761
+        padid: this.empowerInfo.padid
775 762
       };
776 763
       if (this.empowerInfo.checked) {
777 764
         form.schoolid = this.empowerInfo.schoolid;
@@ -781,7 +768,7 @@ export default {
781 768
       }
782 769
       console.log(form);
783 770
       this.empowerInfo.show = true;
784
-      stApp_add_empower(form).then((data) => {
771
+      stPad_add_empower(form).then((data) => {
785 772
         if (data.code === 0) {
786 773
           this.empowerInfo.show = false;
787 774
           this.$Message.success(data.msg);
@@ -807,10 +794,32 @@ export default {
807 794
       this.searchForm.page = 1;
808 795
       this.getList();
809 796
     },
797
+    initData() {
798
+      //数据初始化
799
+      this.strategyInfo.padTimes = []; // 平板策略时间
800
+      this.strategyInfo.padApps = []; //appid集合
801
+      this.strategyInfo.padDevices = []; //授权应用
802
+      this.strategyInfo.padWifis = []; //wifi白名单
803
+      this.strategyInfo.padViolates = []; //设备违规
804
+      this.padDevices.forEach((item) => {
805
+        item.enabled = 2;
806
+      });
807
+      this.padViolates.forEach((item) => {
808
+        item.checked = false;
809
+        item.handleMethod = [];
810
+      });
811
+      this.padApps.forEach((item) => {
812
+        item.checked = false;
813
+      });
814
+    },
810 815
     // 获取列表
811 816
     getList() {
812 817
       this.showLoading = true;
813
-      stPad_list({ schoolid: this.powerParams.objectid }).then((res) => {
818
+      stPad_list({
819
+        size: this.searchForm.size,
820
+        page: this.searchForm.page,
821
+        schoolid: this.powerParams.objectid
822
+      }).then((res) => {
814 823
         this.showLoading = false;
815 824
         if (res.code === 0) {
816 825
           this.searchForm.list = res.obj;
@@ -824,8 +833,10 @@ export default {
824 833
     // 新建
825 834
     async toAdd() {
826 835
       await this.getAppList();
836
+      this.initData();
827 837
       this.strategyInfo = {
828
-        model: "add", //添加
838
+        model: "新建", //添加
839
+        name: null,
829 840
         padid: null,
830 841
         rversion: null,
831 842
         show: true,
@@ -839,13 +850,13 @@ export default {
839 850
         padWifis: [], //wifi白名单
840 851
         hasviolate: false, //是否开启违规通知:0否 1是
841 852
         padViolates: [] //设备违规
842
-      }
843
-      console.log(this.strategyInfo)
853
+      };
854
+      console.log(this.strategyInfo);
844 855
     },
845
-    async getAppList(){
856
+    async getAppList() {
846 857
       //获取应用列表
847 858
       this.showLoading = true;
848
-       let res = await app_list_sel({
859
+      let res = await app_list_sel({
849 860
         rtype: this.powerParams.rtype,
850 861
         objectid: this.powerParams.objectid
851 862
       });
@@ -855,7 +866,7 @@ export default {
855 866
           v.checked = false;
856 867
           return v;
857 868
         });
858
-        console.log(this.padApps)
869
+        console.log(this.padApps);
859 870
       } else {
860 871
         this.$Message.error(res.msg);
861 872
       }
@@ -863,9 +874,73 @@ export default {
863 874
     // 保存新建
864 875
     saveAddInfo() {},
865 876
     // 查看
866
-    toView(row) {},
877
+    toView(row) {
878
+      this.initData();
879
+    },
867 880
     // 编辑
868
-    toEdit(row) {},
881
+    async toEdit(row, type) {
882
+      //type 1查看 2编辑
883
+      await this.getAppList();
884
+      this.initData();
885
+      this.showLoading = true;
886
+      stPad_detail({ padid: row.padid }).then((res) => {
887
+        this.showLoading = false;
888
+        if (res.code === 0) {
889
+          console.log(res.obj);
890
+          //数据回显
891
+          this.strategyInfo.model = type === 1 ? "查看" : "编辑";
892
+          this.strategyInfo.name = res.obj.name;
893
+          this.strategyInfo.username = row.username;
894
+          this.strategyInfo.padid = res.obj.padid;
895
+          this.strategyInfo.userid = row.userid;
896
+          this.strategyInfo.rversion = res.obj.rversion;
897
+          this.strategyInfo.hastime = res.obj.hastime ? true : false;
898
+          this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
899
+          this.strategyInfo.hasdevice = res.obj.hasdevice ? true : false;
900
+          this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
901
+          this.strategyInfo.hasviolate = res.obj.hasviolate ? true : false;
902
+          if (this.strategyInfo.hastime) {
903
+            this.strategyInfo.padTimes = res.obj.padTimes;
904
+          }
905
+          if (this.strategyInfo.hasapp) {
906
+            //回显应用策略
907
+            this.padApps.forEach((item) => {
908
+              let ishas = res.obj.padApps.some((v) => {
909
+                return v.appid === item.appid;
910
+              });
911
+              item.checked = ishas ? true : false;
912
+            });
913
+          }
914
+          if (this.strategyInfo.hasdevice) {
915
+            //回显设备策略
916
+            this.padDevices.forEach((item) => {
917
+              let obj = res.obj.padDevices.filter((v) => {
918
+                return v.pdtype === item.pdtype;
919
+              })[0] || { enabled: 2 };
920
+              item.enabled = obj.enabled;
921
+            });
922
+          }
923
+          if (this.strategyInfo.hastime) {
924
+            this.strategyInfo.padWifis = res.obj.padWifis;
925
+          }
926
+          if (this.strategyInfo.hasviolate) {
927
+            //回显违规处理
928
+            this.padViolates.forEach((item) => {
929
+              let arr = res.obj.padViolates.filter((v) => {
930
+                return v.violateType === item.violateType;
931
+              });
932
+              item.checked = arr.length > 0 ? true : false;
933
+              item.handleMethod =
934
+                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
935
+            });
936
+          }
937
+          this.strategyInfo.show = true;
938
+          console.log(this.strategyInfo);
939
+        } else {
940
+          this.$Message.error(res.msg);
941
+        }
942
+      });
943
+    },
869 944
     // 删除
870 945
     toDel(row) {
871 946
       this.$Modal.confirm({
@@ -902,7 +977,7 @@ export default {
902 977
             name: row.name,
903 978
             schoolInfo: res.obj,
904 979
             checked: false,
905
-            stappid: row.padid,
980
+            padid: row.padid,
906 981
             schoolid: res.obj.id,
907 982
             classids: []
908 983
           };
@@ -957,7 +1032,30 @@ export default {
957 1032
     }
958 1033
   }
959 1034
 }
960
-.content{
1035
+.content {
1036
+  .titles {
1037
+    height: 40px;
1038
+    margin-bottom: 10px;
1039
+    display: flex;
1040
+    align-items: center;
1041
+    .require {
1042
+      width: 80px;
1043
+      color: #253a70;
1044
+      font-size: 16px;
1045
+      font-weight: 400;
1046
+      font-family: "SourceHanSansCN";
1047
+      margin-right: 10px;
1048
+      &::before {
1049
+        content: "*" !important;
1050
+        display: inline-block;
1051
+        margin-right: 4px;
1052
+        line-height: 1;
1053
+        font-family: SimSun;
1054
+        font-size: 14px;
1055
+        color: #ed4014;
1056
+      }
1057
+    }
1058
+  }
961 1059
   .strategy_list {
962 1060
     font-family: "SourceHanSansCN";
963 1061
     .strategy_title {
@@ -1057,7 +1155,7 @@ export default {
1057 1155
           height: 26px;
1058 1156
           margin: 0 20px 10px 0;
1059 1157
           position: relative;
1060
-          .title{
1158
+          .title {
1061 1159
             line-height: 14px;
1062 1160
           }
1063 1161
           img {

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