Kaynağa Gözat

个人策略

gzb
guozhongbo 9 ay önce
ebeveyn
işleme
d8750a52ed

+ 4
- 0
src/api/stPad.js Dosyayı Görüntüle

@@ -47,6 +47,10 @@ export const stPad_list_user = (data) => setRequest("stPad/list_user", data);
47 47
  * 6.1.11 平板策略-平板用户
48 48
  */
49 49
 export const stPad_detail_pad = (data) => setRequest("stPad/detail_pad", data);
50
+/**
51
+ * 6.1.12 平板策略-引用
52
+ */
53
+export const stPad_add_quote = (data) => setRequest("stPad/add_quote", data);
50 54
 /**
51 55
  * 6.2.1 应用策略-公共策略列表
52 56
  */

+ 239
- 145
src/views/schoolSection/strategy/personalStrategy.vue Dosyayı Görüntüle

@@ -3,14 +3,14 @@
3 3
     <div class="view_title">
4 4
       <Input
5 5
         v-model="searchForm.name"
6
-        placeholder="请输入名称"
6
+        placeholder="请输入姓名、登录名"
7 7
         search
8 8
         @on-search="searchList()"
9
-        style="width: 150px"
9
+        style="width: 220px"
10 10
       />
11 11
     </div>
12 12
     <div class="table_wrap" style="margin: 0">
13
-      <Table :columns="columns" :data="searchForm.list">
13
+      <Table :columns="columns0" :data="searchForm.list">
14 14
         <template slot-scope="{ row }" slot="operation">
15 15
           <div class="action_list">
16 16
             <div v-if="row.padid" @click="toView(row)">查看</div>
@@ -37,39 +37,43 @@
37 37
     </div>
38 38
     <!-- 编辑 -->
39 39
     <Modal
40
-        class="modal5"
41
-        :mask-closable="false"
42
-        v-model="strategyInfo.show"
43
-        title="编辑"
40
+      class="modal5"
41
+      :mask-closable="false"
42
+      v-model="strategyInfo.show"
43
+      :title="strategyInfo.model === 'see'?'查看':'编辑'"
44 44
     >
45
-      <div class="content">
46
-        <div class="operation">
47
-          <span @click="Reset">重置</span>
45
+      <div class="content" v-if="strategyInfo.show">
46
+        <div class="operation" v-if="strategyInfo.model === 'edit'">
47
+          <span  @click="Reset">重置</span>
48 48
           <span @click="getstPad_list">引用</span>
49 49
         </div>
50 50
         <div class="strategy_list">
51 51
           <div class="strategy_title">
52 52
             <div>
53
-          <span
54
-              style="font-size: 26px"
55
-              class="ivu-icon iconfont icon-shijian"
56
-          ></span
57
-          >时间限制策略
53
+              <span
54
+                style="font-size: 26px"
55
+                class="ivu-icon iconfont icon-shijian"
56
+              ></span
57
+              >时间限制策略
58 58
             </div>
59 59
             <div>
60
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hastime"
61
-              >启用</Checkbox
60
+              <Checkbox
61
+                v-if="strategyInfo.model != 'see'"
62
+                v-model="strategyInfo.hastime"
63
+                >启用</Checkbox
62 64
               >
63 65
             </div>
64 66
           </div>
65 67
           <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
66 68
             <TimeStrategy
67
-                v-if="strategyInfo.model != 'see'"
68
-                :times="strategyInfo.padTimes"
69
-                @timesChange="timesChange"
69
+              v-if="strategyInfo.model != 'see'"
70
+              :times="strategyInfo.padTimes"
71
+              @timesChange="timesChange"
70 72
             ></TimeStrategy>
71 73
             <div class="showtime" v-if="strategyInfo.model === 'see'">
72
-              <div style="line-height: 30px; font-size: 16px; margin-bottom: 10px">
74
+              <div
75
+                style="line-height: 30px; font-size: 16px; margin-bottom: 10px"
76
+              >
73 77
                 设备生效时间
74 78
               </div>
75 79
               <div class="week">
@@ -77,7 +81,9 @@
77 81
                   <div class="day_title">{{ item.title }}</div>
78 82
                   <div class="day_content">
79 83
                     <div class="time" v-for="sitem in getDay(item.id)">
80
-                      {{ getTime(sitem.starttime) }}-{{ getTime(sitem.stoptime) }}
84
+                      {{ getTime(sitem.starttime) }}-{{
85
+                        getTime(sitem.stoptime)
86
+                      }}
81 87
                     </div>
82 88
                   </div>
83 89
                 </div>
@@ -92,8 +98,10 @@
92 98
               <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
93 99
             </div>
94 100
             <div>
95
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hasapp"
96
-              >启用</Checkbox
101
+              <Checkbox
102
+                v-if="strategyInfo.model != 'see'"
103
+                v-model="strategyInfo.hasapp"
104
+                >启用</Checkbox
97 105
               >
98 106
             </div>
99 107
           </div>
@@ -102,17 +110,17 @@
102 110
               <span>授权应用</span>
103 111
             </div>
104 112
             <div
105
-                class="strategy_bottom"
106
-                style="min-height: 160px"
107
-                v-if="padApps.length > 0"
113
+              class="strategy_bottom"
114
+              style="min-height: 160px"
115
+              v-if="padApps.length > 0"
108 116
             >
109 117
               <div class="app_list" v-for="item in padApps" :key="item.appid">
110 118
                 <img :src="$api.baseImageUrl + item.appIcon" />
111 119
                 <div>{{ item.appName }}</div>
112 120
                 <Checkbox
113
-                    class="checked"
114
-                    :disabled="strategyInfo.model === 'see'"
115
-                    v-model="item.checked"
121
+                  class="checked"
122
+                  :disabled="strategyInfo.model === 'see'"
123
+                  v-model="item.checked"
116 124
                 ></Checkbox>
117 125
               </div>
118 126
             </div>
@@ -121,10 +129,14 @@
121 129
         </div>
122 130
         <div class="strategy_list">
123 131
           <div class="strategy_title">
124
-            <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
125 132
             <div>
126
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hasdevice"
127
-              >启用</Checkbox
133
+              <span class="ivu-icon iconfont icon-shezhi"></span>设备策略
134
+            </div>
135
+            <div>
136
+              <Checkbox
137
+                v-if="strategyInfo.model != 'see'"
138
+                v-model="strategyInfo.hasdevice"
139
+                >启用</Checkbox
128 140
               >
129 141
             </div>
130 142
           </div>
@@ -134,20 +146,20 @@
134 146
             </div>
135 147
             <div class="strategy_bottom" style="min-height: 160px">
136 148
               <div
137
-                  class="device_list"
138
-                  v-for="item in padDevices"
139
-                  :key="item.pdorder"
149
+                class="device_list"
150
+                v-for="item in padDevices"
151
+                :key="item.pdorder"
140 152
               >
141 153
                 <div class="icon">
142 154
                   <span :class="[item.icon]"></span>
143 155
                 </div>
144 156
                 <div class="title">{{ item.pdtype }}</div>
145 157
                 <i-switch
146
-                    size="large"
147
-                    v-model="item.enabled"
148
-                    :disabled="strategyInfo.model === 'see'"
149
-                    :true-value="1"
150
-                    :false-value="2"
158
+                  size="large"
159
+                  v-model="item.enabled"
160
+                  :disabled="strategyInfo.model === 'see'"
161
+                  :true-value="1"
162
+                  :false-value="2"
151 163
                 >
152 164
                   <span slot="open">开启</span>
153 165
                   <span slot="close">关闭</span>
@@ -160,15 +172,17 @@
160 172
         <div class="strategy_list">
161 173
           <div class="strategy_title">
162 174
             <div>
163
-          <span
164
-              style="font-size: 18px"
165
-              class="ivu-icon iconfont icon-wifi"
166
-          ></span
167
-          >Wifi白名单策略
175
+              <span
176
+                style="font-size: 18px"
177
+                class="ivu-icon iconfont icon-wifi"
178
+              ></span
179
+              >Wifi白名单策略
168 180
             </div>
169 181
             <div>
170
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.haswifi"
171
-              >启用</Checkbox
182
+              <Checkbox
183
+                v-if="strategyInfo.model != 'see'"
184
+                v-model="strategyInfo.haswifi"
185
+                >启用</Checkbox
172 186
               >
173 187
             </div>
174 188
           </div>
@@ -176,28 +190,28 @@
176 190
             <div class="strategy_top">
177 191
               <span>SSID</span>
178 192
               <span v-if="strategyInfo.model != 'see'">
179
-            <Input
180
-                v-model.trim="ssidName"
181
-                placeholder="请输入SSID"
182
-                style="width: 260px; margin: 0 10px"
183
-            />
184
-            <Button type="primary" class="primary_btn" @click="AddWifi()"
185
-            >添加</Button
186
-            >
187
-          </span>
193
+                <Input
194
+                  v-model.trim="ssidName"
195
+                  placeholder="请输入SSID"
196
+                  style="width: 260px; margin: 0 10px"
197
+                />
198
+                <Button type="primary" class="primary_btn" @click="AddWifi()"
199
+                  >添加</Button
200
+                >
201
+              </span>
188 202
             </div>
189 203
             <div class="strategy_bottom" style="min-height: 76px">
190 204
               <div
191
-                  class="padWifis"
192
-                  v-for="(item, index) in strategyInfo.padWifis"
193
-                  :key="index"
205
+                class="padWifis"
206
+                v-for="(item, index) in strategyInfo.padWifis"
207
+                :key="index"
194 208
               >
195 209
                 <div class="title">{{ item }}</div>
196 210
                 <img
197
-                    v-if="strategyInfo.model != 'see'"
198
-                    @click="delWifi(item)"
199
-                    class="del"
200
-                    src="../../../assets/img/guanbi_red.png"
211
+                  v-if="strategyInfo.model != 'see'"
212
+                  @click="delWifi(item)"
213
+                  class="del"
214
+                  src="../../../assets/img/guanbi_red.png"
201 215
                 />
202 216
               </div>
203 217
             </div>
@@ -210,52 +224,85 @@
210 224
               <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
211 225
             </div>
212 226
             <div>
213
-              <Checkbox v-if="strategyInfo.model != 'see'" v-model="strategyInfo.hasviolate"
214
-              >启用</Checkbox
227
+              <Checkbox
228
+                v-if="strategyInfo.model != 'see'"
229
+                v-model="strategyInfo.hasviolate"
230
+                >启用</Checkbox
215 231
               >
216 232
             </div>
217 233
           </div>
218 234
           <Table
219
-              v-if="strategyInfo.hasviolate"
220
-              class="table"
221
-              :columns="columns1"
222
-              :data="padViolates"
235
+            v-if="strategyInfo.hasviolate"
236
+            class="table"
237
+            :columns="columns"
238
+            :data="padViolates"
223 239
           >
224 240
             <template slot-scope="{ row }" slot="violationEvents">
225 241
               <Checkbox
226
-                  :disabled="strategyInfo.model === 'see'"
227
-                  class="checked"
228
-                  @on-change="checkedChange(row)"
229
-                  v-model="row.checked"
242
+                :disabled="strategyInfo.model === 'see'"
243
+                class="checked"
244
+                @on-change="checkedChange(row)"
245
+                v-model="row.checked"
230 246
               ></Checkbox>
231
-              <span style="display: inline-block; width: 120px; text-align: left">{{
232
-                  row.title
233
-                }}</span>
247
+              <span
248
+                style="display: inline-block; width: 120px; text-align: left"
249
+                >{{ row.title }}</span
250
+              >
234 251
             </template>
235 252
             <template slot-scope="{ row }" slot="violationHandling">
236 253
               <CheckboxGroup
237
-                  @on-change="checkboxChange(row)"
238
-                  v-model="row.handleMethod"
254
+                @on-change="checkboxChange(row)"
255
+                v-model="row.handleMethod"
239 256
               >
240
-                <Checkbox :disabled="strategyInfo.model === 'see'" label="通知管理员"></Checkbox>
241 257
                 <Checkbox
242
-                    :disabled="strategyInfo.model === 'see'"
243
-                    style="margin: 0 40px"
244
-                    label="限制使用"
258
+                  :disabled="strategyInfo.model === 'see'"
259
+                  label="通知管理员"
245 260
                 ></Checkbox>
246 261
                 <Checkbox
247
-                    :disabled="strategyInfo.model === 'see'"
248
-                    label="恢复出厂设置"
262
+                  :disabled="strategyInfo.model === 'see'"
263
+                  style="margin: 0 40px"
264
+                  label="限制使用"
265
+                ></Checkbox>
266
+                <Checkbox
267
+                  :disabled="strategyInfo.model === 'see'"
268
+                  label="恢复出厂设置"
249 269
                 ></Checkbox>
250 270
               </CheckboxGroup>
251 271
             </template>
252 272
           </Table>
253
-          <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
273
+          <div class="nodata" v-if="!strategyInfo.hasviolate">
274
+            未设置违规处理
275
+          </div>
254 276
         </div>
255 277
       </div>
256 278
       <div slot="footer" style="text-align: right">
257
-        <Button style="margin-right: 10px" @click="strategyInfo.show = false">关闭</Button>
258
-        <Button type="primary" class="primary_btn" @click="save()"
279
+        <Button style="margin-right: 10px" @click="strategyInfo.show = false"
280
+          >关闭</Button
281
+        >
282
+        <Button type="primary" class="primary_btn" @click="save()">保存</Button>
283
+      </div>
284
+    </Modal>
285
+    <!-- 引用 -->
286
+    <Modal
287
+        class="modal1"
288
+        :mask-closable="false"
289
+        v-model="stPadInfo.show"
290
+        title="引用"
291
+    >
292
+      <Table
293
+          v-if="stPadInfo.show"
294
+          class="table"
295
+          :columns="columns1"
296
+          :data="stPadInfo.list"
297
+      >
298
+        <template slot-scope="{ row }" slot="active">
299
+          <Radio @on-change="stPadChange(row)" v-model="row.checked"></Radio>
300
+        </template>
301
+      </Table>
302
+
303
+      <div slot="footer" style="text-align: right">
304
+        <Button @click="stPadInfo.show = false">关闭</Button>
305
+        <Button type="primary" class="primary_btn" @click="saveStPadInfo()"
259 306
         >保存</Button
260 307
         >
261 308
       </div>
@@ -268,8 +315,15 @@
268 315
 </template>
269 316
 
270 317
 <script>
271
-import {app_list, app_list_sel} from "@/api/appgroup";
272
-import {stPad_add, stPad_delete, stPad_detail, stPad_edit, stPad_list, stPad_list_user} from "@/api/stPad";
318
+import { app_list, app_list_sel } from "@/api/appgroup";
319
+import {
320
+  stPad_add, stPad_add_quote,
321
+  stPad_delete,
322
+  stPad_detail,
323
+  stPad_edit,
324
+  stPad_list,
325
+  stPad_list_user
326
+} from "@/api/stPad";
273 327
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
274 328
 export default {
275 329
   components: {
@@ -279,6 +333,11 @@ export default {
279 333
   data() {
280 334
     return {
281 335
       showLoading: false,
336
+      stPadInfo: {
337
+        show: false,
338
+        stPad: {},
339
+        list: []
340
+      },
282 341
       strategyInfo: {
283 342
         model: "add", //add添加/edit编辑/see查看
284 343
         userid: null,
@@ -385,7 +444,7 @@ export default {
385 444
           handleMethod: []
386 445
         }
387 446
       ],
388
-      columns1: [
447
+      columns: [
389 448
         {
390 449
           title: "违规事件",
391 450
           slot: "violationEvents",
@@ -398,7 +457,7 @@ export default {
398 457
           align: "center"
399 458
         }
400 459
       ],
401
-      columns2: [
460
+      columns1: [
402 461
         {
403 462
           title: "操作",
404 463
           slot: "active",
@@ -454,7 +513,7 @@ export default {
454 513
         list: [],
455 514
         total: 0
456 515
       },
457
-      columns: [
516
+      columns0: [
458 517
         {
459 518
           title: "序号",
460 519
           align: "center",
@@ -530,26 +589,45 @@ export default {
530 589
         this.$Message.error("请选择引用策略!");
531 590
         return;
532 591
       }
592
+      //数据初始化
593
+      this.strategyInfo.padTimes = []; // 平板策略时间
594
+      this.strategyInfo.padApps = []; //appid集合
595
+      this.strategyInfo.padDevices = []; //授权应用
596
+      this.strategyInfo.padWifis = []; //wifi白名单
597
+      this.strategyInfo.padViolates = []; //设备违规
598
+      this.padDevices.forEach((item) => {
599
+        item.enabled = 2;
600
+      });
601
+      this.padViolates.forEach((item) => {
602
+        item.checked = false;
603
+        item.handleMethod = [];
604
+      });
533 605
       this.showLoading = true;
534
-      stPad_detail({ padid: obj.padid }).then((res) => {
606
+      stPad_add_quote({
607
+        sttype: 3,
608
+        objectid: this.strategyInfo.userid,
609
+        padid: obj.padid
610
+      }).then((res) => {
535 611
         this.showLoading = false;
536 612
         if (res.code === 0) {
537 613
           //数据回显
538
-          this.strategyInfo = res.obj;
539
-          this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
540
-          this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
541
-          this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
542
-              ? true
543
-              : false;
544
-          this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
545
-          this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
546
-              ? true
547
-              : false;
614
+          this.strategyInfo.model = "edit";
615
+          this.strategyInfo.padid = res.obj.padid;
616
+          this.strategyInfo.rversion = res.obj.rversion;
617
+          this.strategyInfo.hastime = res.obj.hastime ? true : false;
618
+          this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
619
+          this.strategyInfo.hasdevice = res.obj.hasdevice
620
+            ? true
621
+            : false;
622
+          this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
623
+          this.strategyInfo.hasviolate = res.obj.hasviolate
624
+            ? true
625
+            : false;
548 626
           if (this.strategyInfo.hasapp) {
549 627
             //回显应用策略
550 628
             this.padApps.forEach((item) => {
551
-              let ishas = this.strategyInfo.padApps.some((v) => {
552
-                return v.appid === item.appid;
629
+              let ishas = res.obj.padApps.some((v) => {
630
+                return v === item.appid;
553 631
               });
554 632
               item.checked = ishas ? true : false;
555 633
             });
@@ -557,7 +635,7 @@ export default {
557 635
           if (this.strategyInfo.hasdevice) {
558 636
             //回显设备策略
559 637
             this.padDevices.forEach((item) => {
560
-              let obj = this.strategyInfo.padDevices.filter((v) => {
638
+              let obj = res.obj.padDevices.filter((v) => {
561 639
                 return v.pdtype === item.pdtype;
562 640
               })[0] || { enabled: 2 };
563 641
               item.enabled = obj.enabled;
@@ -566,16 +644,18 @@ export default {
566 644
           if (this.strategyInfo.hasviolate) {
567 645
             //回显违规处理
568 646
             this.padViolates.forEach((item) => {
569
-              let arr = this.strategyInfo.padViolates.filter((v) => {
647
+              let arr = res.obj.padViolates.filter((v) => {
570 648
                 return v.violateType === item.violateType;
571 649
               });
572 650
               item.checked = arr.length > 0 ? true : false;
573 651
               item.handleMethod =
574
-                  arr.length > 0 ? arr[0].handleMethod.split(";") : [];
652
+                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
575 653
             });
576 654
           }
577
-          this.curState = 2; //编辑状态
655
+          this.strategyInfo.padWifis = res.obj.padWifis || [];
656
+          this.strategyInfo.padTimes = res.obj.padTimes || [];
578 657
           this.stPadInfo.show = false;
658
+          console.log(this.strategyInfo)
579 659
         } else {
580 660
           this.$Message.error(res.msg);
581 661
         }
@@ -584,7 +664,7 @@ export default {
584 664
     getstPad_list() {
585 665
       this.showLoading = true;
586 666
       stPad_list({
587
-        schoolid: this.curClass.id
667
+        schoolid: this.curClass.schoolid
588 668
       }).then((res) => {
589 669
         this.showLoading = false;
590 670
         if (res.code === 0) {
@@ -607,7 +687,7 @@ export default {
607 687
       this.$Modal.confirm({
608 688
         title: "提示",
609 689
         content:
610
-            "<div>确定要重置策略吗?</div><div style='color: #B50000;font-size: 12px'>注:重置后,所有应用都可以在任意时间内进行使用</div>",
690
+          "<div>确定要重置策略吗?</div><div style='color: #B50000;font-size: 12px'>注:重置后,所有应用都可以在任意时间内进行使用</div>",
611 691
         onOk: () => {
612 692
           this.showLoading = true;
613 693
           stPad_delete({
@@ -637,9 +717,19 @@ export default {
637 717
       this.strategyInfo.padTimes = times;
638 718
     },
639 719
     save() {
720
+      if (
721
+          !this.strategyInfo.hastime &&
722
+          !this.strategyInfo.hasapp &&
723
+          !this.strategyInfo.hasdevice &&
724
+          !this.strategyInfo.haswifi &&
725
+          !this.strategyInfo.hasviolate
726
+      ) {
727
+        this.$Message.error("请选择策略!");
728
+        return;
729
+      }
640 730
       let padDevices = [],
641
-          padViolates = [],
642
-          padApps = [];
731
+        padViolates = [],
732
+        padApps = [];
643 733
       //获取授权应用
644 734
       for (let item of this.padApps) {
645 735
         if (item.checked) {
@@ -654,7 +744,6 @@ export default {
654 744
           enabled: item.enabled
655 745
         });
656 746
       }
657
-
658 747
       //获取违规处理
659 748
       for (let item of this.padViolates) {
660 749
         if (item.checked) {
@@ -713,19 +802,19 @@ export default {
713 802
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
714 803
         padApps: this.strategyInfo.hasapp ? padApps : []
715 804
       };
716
-      if (this.strategyInfo.model === 'edit') {
805
+      if (this.strategyInfo.model === "edit") {
717 806
         //编辑
718 807
         form.padid = this.strategyInfo.padid;
719 808
         form.rversion = this.strategyInfo.rversion;
720 809
       }
721
-      let api = this.strategyInfo.model === 'edit' ? stPad_edit : stPad_add;
810
+      let api = this.strategyInfo.model === "edit" ? stPad_edit : stPad_add;
722 811
       console.log(form);
723 812
       api(form).then((res) => {
724 813
         if (res.code === 0) {
725 814
           this.$Message.success(res.msg);
726 815
           this.searchList();
727 816
           this.strategyInfo.show = false;
728
-          console.log(res.obj)
817
+          console.log(res.obj);
729 818
         } else {
730 819
           this.$Message.error(res.msg);
731 820
         }
@@ -754,7 +843,7 @@ export default {
754 843
     delWifi(val) {
755 844
       //删除wifi白名单
756 845
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
757
-          (v) => v != val
846
+        (v) => v != val
758 847
       );
759 848
     },
760 849
     AddWifi() {
@@ -764,10 +853,10 @@ export default {
764 853
       }
765 854
       this.strategyInfo.padWifis.push(this.ssidName);
766 855
       this.strategyInfo.padWifis = Array.from(
767
-          new Set(this.strategyInfo.padWifis)
856
+        new Set(this.strategyInfo.padWifis)
768 857
       );
769 858
     },
770
-    async init(){
859
+    async init() {
771 860
       //获取应用列表
772 861
       this.showLoading = true;
773 862
       let res1 = await app_list_sel({
@@ -783,7 +872,7 @@ export default {
783 872
       } else {
784 873
         this.$Message.error(res1.msg);
785 874
       }
786
-     this.searchList();
875
+      this.searchList();
787 876
     },
788 877
     toView(row) {
789 878
       this.showLoading = true;
@@ -791,16 +880,19 @@ export default {
791 880
         this.showLoading = false;
792 881
         if (res.code === 0) {
793 882
           //数据回显
794
-          this.strategyInfo = res.obj;
883
+          this.strategyInfo.model = "see";
884
+          this.strategyInfo.userid = row.userid;
885
+          this.strategyInfo.padid = res.obj.padid;
886
+          this.strategyInfo.rversion = res.obj.rversion;
795 887
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
796 888
           this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
797 889
           this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
798
-              ? true
799
-              : false;
890
+            ? true
891
+            : false;
800 892
           this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
801 893
           this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
802
-              ? true
803
-              : false;
894
+            ? true
895
+            : false;
804 896
           if (this.strategyInfo.hasapp) {
805 897
             //回显应用策略
806 898
             this.padApps.forEach((item) => {
@@ -827,16 +919,21 @@ export default {
827 919
               });
828 920
               item.checked = arr.length > 0 ? true : false;
829 921
               item.handleMethod =
830
-                  arr.length > 0 ? arr[0].handleMethod.split(";") : [];
922
+                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
831 923
             });
832 924
           }
925
+          this.strategyInfo.padWifis = res.obj.padWifis || [];
926
+          this.strategyInfo.padTimes = res.obj.padTimes || [];
927
+          this.strategyInfo.show = true;
928
+          console.log(this.strategyInfo)
833 929
         } else {
834 930
           this.$Message.error(res.msg);
835 931
         }
836 932
       });
837 933
     },
838 934
     toEdit(row) {
839
-      if(!row.padid){
935
+      console.log(row)
936
+      if (!row.padid) {
840 937
         this.strategyInfo = {
841 938
           model: "add", //添加
842 939
           userid: row.userid,
@@ -853,28 +950,25 @@ export default {
853 950
           padWifis: [], //wifi白名单
854 951
           hasviolate: false, //是否开启违规通知:0否 1是
855 952
           padViolates: [] //设备违规
856
-        }
953
+        };
857 954
         return;
858 955
       }
859 956
       this.showLoading = true;
860 957
       stPad_detail({ padid: row.padid }).then((res) => {
861 958
         this.showLoading = false;
862 959
         if (res.code === 0) {
863
-          console.log(res.obj)
960
+          console.log(res.obj);
864 961
           //数据回显
962
+          this.strategyInfo.model = "edit";
865 963
           this.strategyInfo.padid = res.obj.padid;
866 964
           this.strategyInfo.userid = row.userid;
867 965
           this.strategyInfo.rversion = res.obj.rversion;
868 966
           this.strategyInfo.hastime = res.obj.hastime ? true : false;
869 967
           this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
870
-          this.strategyInfo.hasdevice = res.obj.hasdevice
871
-              ? true
872
-              : false;
968
+          this.strategyInfo.hasdevice = res.obj.hasdevice ? true : false;
873 969
           this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
874
-          this.strategyInfo.hasviolate = res.obj.hasviolate
875
-              ? true
876
-              : false;
877
-          if(this.strategyInfo.hastime){
970
+          this.strategyInfo.hasviolate = res.obj.hasviolate ? true : false;
971
+          if (this.strategyInfo.hastime) {
878 972
             this.strategyInfo.padTimes = res.obj.padTimes;
879 973
           }
880 974
           if (this.strategyInfo.hasapp) {
@@ -895,7 +989,7 @@ export default {
895 989
               item.enabled = obj.enabled;
896 990
             });
897 991
           }
898
-          if(this.strategyInfo.hastime){
992
+          if (this.strategyInfo.hastime) {
899 993
             this.strategyInfo.padWifis = res.obj.padWifis;
900 994
           }
901 995
           if (this.strategyInfo.hasviolate) {
@@ -906,11 +1000,11 @@ export default {
906 1000
               });
907 1001
               item.checked = arr.length > 0 ? true : false;
908 1002
               item.handleMethod =
909
-                  arr.length > 0 ? arr[0].handleMethod.split(";") : [];
1003
+                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
910 1004
             });
911 1005
           }
912 1006
           this.strategyInfo.show = true;
913
-          console.log(this.strategyInfo)
1007
+          console.log(this.strategyInfo);
914 1008
         } else {
915 1009
           this.$Message.error(res.msg);
916 1010
         }
@@ -928,7 +1022,7 @@ export default {
928 1022
           }).then((res) => {
929 1023
             this.showLoading = false;
930 1024
             if (res.code === 0) {
931
-              this.detail();
1025
+              this.searchList();
932 1026
             } else {
933 1027
               this.$Message.error(res.msg);
934 1028
             }
@@ -957,7 +1051,7 @@ export default {
957 1051
     getList() {
958 1052
       this.showLoading = true;
959 1053
       stPad_list_user({
960
-        schoolid: this.curClass.schoolid,
1054
+        schoolid: this.curClass.schoolid || this.curClass.id,
961 1055
         classid: this.curClass.id,
962 1056
         page: this.searchForm.page,
963 1057
         size: this.searchForm.size,
@@ -986,7 +1080,7 @@ export default {
986 1080
     margin-bottom: 16px;
987 1081
   }
988 1082
 }
989
-.content{
1083
+.content {
990 1084
   .operation {
991 1085
     text-align: right;
992 1086
     span {
@@ -1097,7 +1191,7 @@ export default {
1097 1191
           height: 26px;
1098 1192
           margin: 0 20px 10px 0;
1099 1193
           position: relative;
1100
-          .title{
1194
+          .title {
1101 1195
             line-height: 14px;
1102 1196
           }
1103 1197
           img {

+ 56
- 12
src/views/schoolSection/strategy/publicStrategy.vue Dosyayı Görüntüle

@@ -2,7 +2,9 @@
2 2
   <div class="index1">
3 3
     <div class="operation">
4 4
       <span @click="curState = 2">修改</span>
5
-      <span @click="Reset">重置</span>
5
+      <span v-if="curClass.type === strategyInfo.sttype" @click="Reset"
6
+        >重置</span
7
+      >
6 8
       <span @click="getstPad_list">引用</span>
7 9
     </div>
8 10
     <div class="strategy_list">
@@ -260,7 +262,7 @@
260 262
 import {
261 263
   stPad_add,
262 264
   stPad_delete,
263
-  stPad_detail,
265
+  stPad_add_quote,
264 266
   stPad_detail_obj,
265 267
   stPad_edit,
266 268
   stPad_list
@@ -282,6 +284,9 @@ export default {
282 284
       },
283 285
       curState: 1, //1查看/2编辑
284 286
       strategyInfo: {
287
+        sttype: null,
288
+        padid: null,
289
+        rversion: null,
285 290
         hastime: false, // 是否开启时间策略:0否 1是
286 291
         padTimes: [], // 平板策略时间
287 292
         hasapp: false, //是否开启应用策略:0否 1是
@@ -443,8 +448,7 @@ export default {
443 448
           id: 6
444 449
         }
445 450
       ],
446
-      ssidName: "",
447
-      hasSave: null
451
+      ssidName: ""
448 452
     };
449 453
   },
450 454
   watch: {
@@ -479,9 +483,16 @@ export default {
479 483
         return;
480 484
       }
481 485
       this.showLoading = true;
482
-      stPad_detail({ padid: obj.padid }).then((res) => {
486
+      stPad_add_quote({
487
+        sttype: this.curClass.type,
488
+        objectid: this.curClass.id,
489
+        padid: obj.padid
490
+      }).then((res) => {
483 491
         this.showLoading = false;
484 492
         if (res.code === 0) {
493
+          if (document.querySelector(".user_list")) {
494
+            document.querySelector(".user_list").scrollTop = 0;
495
+          }
485 496
           //数据回显
486 497
           this.strategyInfo = res.obj;
487 498
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
@@ -497,7 +508,7 @@ export default {
497 508
             //回显应用策略
498 509
             this.padApps.forEach((item) => {
499 510
               let ishas = this.strategyInfo.padApps.some((v) => {
500
-                return v.appid === item.appid;
511
+                return v === item.appid;
501 512
               });
502 513
               item.checked = ishas ? true : false;
503 514
             });
@@ -524,6 +535,7 @@ export default {
524 535
           }
525 536
           this.curState = 2; //编辑状态
526 537
           this.stPadInfo.show = false;
538
+          console.log(this.stPadInfo);
527 539
         } else {
528 540
           this.$Message.error(res.msg);
529 541
         }
@@ -532,7 +544,7 @@ export default {
532 544
     getstPad_list() {
533 545
       this.showLoading = true;
534 546
       stPad_list({
535
-        schoolid: this.curClass.id
547
+        schoolid: this.curClass.schoolid
536 548
       }).then((res) => {
537 549
         this.showLoading = false;
538 550
         if (res.code === 0) {
@@ -585,6 +597,16 @@ export default {
585 597
       this.strategyInfo.padTimes = times;
586 598
     },
587 599
     save() {
600
+      if (
601
+        !this.strategyInfo.hastime &&
602
+        !this.strategyInfo.hasapp &&
603
+        !this.strategyInfo.hasdevice &&
604
+        !this.strategyInfo.haswifi &&
605
+        !this.strategyInfo.hasviolate
606
+      ) {
607
+        this.$Message.error("请选择策略!");
608
+        return;
609
+      }
588 610
       let padDevices = [],
589 611
         padViolates = [],
590 612
         padApps = [];
@@ -661,16 +683,23 @@ export default {
661 683
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
662 684
         padApps: this.strategyInfo.hasapp ? padApps : []
663 685
       };
664
-      if (this.hasSave) {
686
+      //true是自身的策略即编辑
687
+      let hasSave =
688
+        this.curClass.type === this.strategyInfo.sttype ? true : false;
689
+      if (hasSave) {
665 690
         //编辑
666 691
         form.padid = this.strategyInfo.padid;
667 692
         form.rversion = this.strategyInfo.rversion;
668 693
       }
669
-      let api = this.hasSave ? stPad_edit : stPad_add;
670
-      console.log(form);
694
+      let api = hasSave ? stPad_edit : stPad_add;
695
+      console.log(hasSave, form);
671 696
       api(form).then((res) => {
672 697
         if (res.code === 0) {
673 698
           this.$Message.success(res.msg);
699
+          if (!hasSave) {
700
+            //刷新左侧树
701
+            this.$emit("refresh");
702
+          }
674 703
           this.detail();
675 704
         } else {
676 705
           this.$Message.error(res.msg);
@@ -723,8 +752,10 @@ export default {
723 752
       });
724 753
       this.showLoading = false;
725 754
       if (res.code === 0) {
726
-        this.hasSave = res.obj;
727
-        if (this.hasSave) {
755
+        if (document.querySelector(".user_list")) {
756
+          document.querySelector(".user_list").scrollTop = 0;
757
+        }
758
+        if (res.obj) {
728 759
           //数据回显
729 760
           this.strategyInfo = res.obj;
730 761
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
@@ -779,6 +810,19 @@ export default {
779 810
       }
780 811
     },
781 812
     async init() {
813
+      //数据初始化
814
+      this.strategyInfo.padTimes = []; // 平板策略时间
815
+      this.strategyInfo.padApps = []; //appid集合
816
+      this.strategyInfo.padDevices = []; //授权应用
817
+      this.strategyInfo.padWifis = []; //wifi白名单
818
+      this.strategyInfo.padViolates = []; //设备违规
819
+      this.padDevices.forEach((item) => {
820
+        item.enabled = 2;
821
+      });
822
+      this.padViolates.forEach((item) => {
823
+        item.checked = false;
824
+        item.handleMethod = [];
825
+      });
782 826
       //获取应用列表
783 827
       this.showLoading = true;
784 828
       let res1 = await app_list_sel({

+ 946
- 46
src/views/schoolSection/strategy/strategyTemplate.vue
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


Loading…
İptal
Kaydet