Browse Source

个人策略

gzb
guozhongbo 9 months ago
parent
commit
d8750a52ed

+ 4
- 0
src/api/stPad.js View File

47
  * 6.1.11 平板策略-平板用户
47
  * 6.1.11 平板策略-平板用户
48
  */
48
  */
49
 export const stPad_detail_pad = (data) => setRequest("stPad/detail_pad", data);
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
  * 6.2.1 应用策略-公共策略列表
55
  * 6.2.1 应用策略-公共策略列表
52
  */
56
  */

+ 239
- 145
src/views/schoolSection/strategy/personalStrategy.vue View File

3
     <div class="view_title">
3
     <div class="view_title">
4
       <Input
4
       <Input
5
         v-model="searchForm.name"
5
         v-model="searchForm.name"
6
-        placeholder="请输入名称"
6
+        placeholder="请输入姓名、登录名"
7
         search
7
         search
8
         @on-search="searchList()"
8
         @on-search="searchList()"
9
-        style="width: 150px"
9
+        style="width: 220px"
10
       />
10
       />
11
     </div>
11
     </div>
12
     <div class="table_wrap" style="margin: 0">
12
     <div class="table_wrap" style="margin: 0">
13
-      <Table :columns="columns" :data="searchForm.list">
13
+      <Table :columns="columns0" :data="searchForm.list">
14
         <template slot-scope="{ row }" slot="operation">
14
         <template slot-scope="{ row }" slot="operation">
15
           <div class="action_list">
15
           <div class="action_list">
16
             <div v-if="row.padid" @click="toView(row)">查看</div>
16
             <div v-if="row.padid" @click="toView(row)">查看</div>
37
     </div>
37
     </div>
38
     <!-- 编辑 -->
38
     <!-- 编辑 -->
39
     <Modal
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
           <span @click="getstPad_list">引用</span>
48
           <span @click="getstPad_list">引用</span>
49
         </div>
49
         </div>
50
         <div class="strategy_list">
50
         <div class="strategy_list">
51
           <div class="strategy_title">
51
           <div class="strategy_title">
52
             <div>
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
             </div>
58
             </div>
59
             <div>
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
             </div>
65
             </div>
64
           </div>
66
           </div>
65
           <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
67
           <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
66
             <TimeStrategy
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
             ></TimeStrategy>
72
             ></TimeStrategy>
71
             <div class="showtime" v-if="strategyInfo.model === 'see'">
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
               </div>
78
               </div>
75
               <div class="week">
79
               <div class="week">
77
                   <div class="day_title">{{ item.title }}</div>
81
                   <div class="day_title">{{ item.title }}</div>
78
                   <div class="day_content">
82
                   <div class="day_content">
79
                     <div class="time" v-for="sitem in getDay(item.id)">
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
                     </div>
87
                     </div>
82
                   </div>
88
                   </div>
83
                 </div>
89
                 </div>
92
               <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
98
               <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
93
             </div>
99
             </div>
94
             <div>
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
             </div>
106
             </div>
99
           </div>
107
           </div>
102
               <span>授权应用</span>
110
               <span>授权应用</span>
103
             </div>
111
             </div>
104
             <div
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
               <div class="app_list" v-for="item in padApps" :key="item.appid">
117
               <div class="app_list" v-for="item in padApps" :key="item.appid">
110
                 <img :src="$api.baseImageUrl + item.appIcon" />
118
                 <img :src="$api.baseImageUrl + item.appIcon" />
111
                 <div>{{ item.appName }}</div>
119
                 <div>{{ item.appName }}</div>
112
                 <Checkbox
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
                 ></Checkbox>
124
                 ></Checkbox>
117
               </div>
125
               </div>
118
             </div>
126
             </div>
121
         </div>
129
         </div>
122
         <div class="strategy_list">
130
         <div class="strategy_list">
123
           <div class="strategy_title">
131
           <div class="strategy_title">
124
-            <div><span class="ivu-icon iconfont icon-shezhi"></span>设备策略</div>
125
             <div>
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
             </div>
141
             </div>
130
           </div>
142
           </div>
134
             </div>
146
             </div>
135
             <div class="strategy_bottom" style="min-height: 160px">
147
             <div class="strategy_bottom" style="min-height: 160px">
136
               <div
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
                 <div class="icon">
153
                 <div class="icon">
142
                   <span :class="[item.icon]"></span>
154
                   <span :class="[item.icon]"></span>
143
                 </div>
155
                 </div>
144
                 <div class="title">{{ item.pdtype }}</div>
156
                 <div class="title">{{ item.pdtype }}</div>
145
                 <i-switch
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
                   <span slot="open">开启</span>
164
                   <span slot="open">开启</span>
153
                   <span slot="close">关闭</span>
165
                   <span slot="close">关闭</span>
160
         <div class="strategy_list">
172
         <div class="strategy_list">
161
           <div class="strategy_title">
173
           <div class="strategy_title">
162
             <div>
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
             </div>
180
             </div>
169
             <div>
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
             </div>
187
             </div>
174
           </div>
188
           </div>
176
             <div class="strategy_top">
190
             <div class="strategy_top">
177
               <span>SSID</span>
191
               <span>SSID</span>
178
               <span v-if="strategyInfo.model != 'see'">
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
             </div>
202
             </div>
189
             <div class="strategy_bottom" style="min-height: 76px">
203
             <div class="strategy_bottom" style="min-height: 76px">
190
               <div
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
                 <div class="title">{{ item }}</div>
209
                 <div class="title">{{ item }}</div>
196
                 <img
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
               </div>
216
               </div>
203
             </div>
217
             </div>
210
               <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
224
               <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
211
             </div>
225
             </div>
212
             <div>
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
             </div>
232
             </div>
217
           </div>
233
           </div>
218
           <Table
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
             <template slot-scope="{ row }" slot="violationEvents">
240
             <template slot-scope="{ row }" slot="violationEvents">
225
               <Checkbox
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
               ></Checkbox>
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
             </template>
251
             </template>
235
             <template slot-scope="{ row }" slot="violationHandling">
252
             <template slot-scope="{ row }" slot="violationHandling">
236
               <CheckboxGroup
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
                 <Checkbox
257
                 <Checkbox
242
-                    :disabled="strategyInfo.model === 'see'"
243
-                    style="margin: 0 40px"
244
-                    label="限制使用"
258
+                  :disabled="strategyInfo.model === 'see'"
259
+                  label="通知管理员"
245
                 ></Checkbox>
260
                 ></Checkbox>
246
                 <Checkbox
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
                 ></Checkbox>
269
                 ></Checkbox>
250
               </CheckboxGroup>
270
               </CheckboxGroup>
251
             </template>
271
             </template>
252
           </Table>
272
           </Table>
253
-          <div class="nodata" v-if="!strategyInfo.hasviolate">未设置违规处理</div>
273
+          <div class="nodata" v-if="!strategyInfo.hasviolate">
274
+            未设置违规处理
275
+          </div>
254
         </div>
276
         </div>
255
       </div>
277
       </div>
256
       <div slot="footer" style="text-align: right">
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
         >保存</Button
306
         >保存</Button
260
         >
307
         >
261
       </div>
308
       </div>
268
 </template>
315
 </template>
269
 
316
 
270
 <script>
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
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
327
 import TimeStrategy from "@/components/TimeStrategy/TimeStrategy";
274
 export default {
328
 export default {
275
   components: {
329
   components: {
279
   data() {
333
   data() {
280
     return {
334
     return {
281
       showLoading: false,
335
       showLoading: false,
336
+      stPadInfo: {
337
+        show: false,
338
+        stPad: {},
339
+        list: []
340
+      },
282
       strategyInfo: {
341
       strategyInfo: {
283
         model: "add", //add添加/edit编辑/see查看
342
         model: "add", //add添加/edit编辑/see查看
284
         userid: null,
343
         userid: null,
385
           handleMethod: []
444
           handleMethod: []
386
         }
445
         }
387
       ],
446
       ],
388
-      columns1: [
447
+      columns: [
389
         {
448
         {
390
           title: "违规事件",
449
           title: "违规事件",
391
           slot: "violationEvents",
450
           slot: "violationEvents",
398
           align: "center"
457
           align: "center"
399
         }
458
         }
400
       ],
459
       ],
401
-      columns2: [
460
+      columns1: [
402
         {
461
         {
403
           title: "操作",
462
           title: "操作",
404
           slot: "active",
463
           slot: "active",
454
         list: [],
513
         list: [],
455
         total: 0
514
         total: 0
456
       },
515
       },
457
-      columns: [
516
+      columns0: [
458
         {
517
         {
459
           title: "序号",
518
           title: "序号",
460
           align: "center",
519
           align: "center",
530
         this.$Message.error("请选择引用策略!");
589
         this.$Message.error("请选择引用策略!");
531
         return;
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
       this.showLoading = true;
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
         this.showLoading = false;
611
         this.showLoading = false;
536
         if (res.code === 0) {
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
           if (this.strategyInfo.hasapp) {
626
           if (this.strategyInfo.hasapp) {
549
             //回显应用策略
627
             //回显应用策略
550
             this.padApps.forEach((item) => {
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
               item.checked = ishas ? true : false;
632
               item.checked = ishas ? true : false;
555
             });
633
             });
557
           if (this.strategyInfo.hasdevice) {
635
           if (this.strategyInfo.hasdevice) {
558
             //回显设备策略
636
             //回显设备策略
559
             this.padDevices.forEach((item) => {
637
             this.padDevices.forEach((item) => {
560
-              let obj = this.strategyInfo.padDevices.filter((v) => {
638
+              let obj = res.obj.padDevices.filter((v) => {
561
                 return v.pdtype === item.pdtype;
639
                 return v.pdtype === item.pdtype;
562
               })[0] || { enabled: 2 };
640
               })[0] || { enabled: 2 };
563
               item.enabled = obj.enabled;
641
               item.enabled = obj.enabled;
566
           if (this.strategyInfo.hasviolate) {
644
           if (this.strategyInfo.hasviolate) {
567
             //回显违规处理
645
             //回显违规处理
568
             this.padViolates.forEach((item) => {
646
             this.padViolates.forEach((item) => {
569
-              let arr = this.strategyInfo.padViolates.filter((v) => {
647
+              let arr = res.obj.padViolates.filter((v) => {
570
                 return v.violateType === item.violateType;
648
                 return v.violateType === item.violateType;
571
               });
649
               });
572
               item.checked = arr.length > 0 ? true : false;
650
               item.checked = arr.length > 0 ? true : false;
573
               item.handleMethod =
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
           this.stPadInfo.show = false;
657
           this.stPadInfo.show = false;
658
+          console.log(this.strategyInfo)
579
         } else {
659
         } else {
580
           this.$Message.error(res.msg);
660
           this.$Message.error(res.msg);
581
         }
661
         }
584
     getstPad_list() {
664
     getstPad_list() {
585
       this.showLoading = true;
665
       this.showLoading = true;
586
       stPad_list({
666
       stPad_list({
587
-        schoolid: this.curClass.id
667
+        schoolid: this.curClass.schoolid
588
       }).then((res) => {
668
       }).then((res) => {
589
         this.showLoading = false;
669
         this.showLoading = false;
590
         if (res.code === 0) {
670
         if (res.code === 0) {
607
       this.$Modal.confirm({
687
       this.$Modal.confirm({
608
         title: "提示",
688
         title: "提示",
609
         content:
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
         onOk: () => {
691
         onOk: () => {
612
           this.showLoading = true;
692
           this.showLoading = true;
613
           stPad_delete({
693
           stPad_delete({
637
       this.strategyInfo.padTimes = times;
717
       this.strategyInfo.padTimes = times;
638
     },
718
     },
639
     save() {
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
       let padDevices = [],
730
       let padDevices = [],
641
-          padViolates = [],
642
-          padApps = [];
731
+        padViolates = [],
732
+        padApps = [];
643
       //获取授权应用
733
       //获取授权应用
644
       for (let item of this.padApps) {
734
       for (let item of this.padApps) {
645
         if (item.checked) {
735
         if (item.checked) {
654
           enabled: item.enabled
744
           enabled: item.enabled
655
         });
745
         });
656
       }
746
       }
657
-
658
       //获取违规处理
747
       //获取违规处理
659
       for (let item of this.padViolates) {
748
       for (let item of this.padViolates) {
660
         if (item.checked) {
749
         if (item.checked) {
713
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
802
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
714
         padApps: this.strategyInfo.hasapp ? padApps : []
803
         padApps: this.strategyInfo.hasapp ? padApps : []
715
       };
804
       };
716
-      if (this.strategyInfo.model === 'edit') {
805
+      if (this.strategyInfo.model === "edit") {
717
         //编辑
806
         //编辑
718
         form.padid = this.strategyInfo.padid;
807
         form.padid = this.strategyInfo.padid;
719
         form.rversion = this.strategyInfo.rversion;
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
       console.log(form);
811
       console.log(form);
723
       api(form).then((res) => {
812
       api(form).then((res) => {
724
         if (res.code === 0) {
813
         if (res.code === 0) {
725
           this.$Message.success(res.msg);
814
           this.$Message.success(res.msg);
726
           this.searchList();
815
           this.searchList();
727
           this.strategyInfo.show = false;
816
           this.strategyInfo.show = false;
728
-          console.log(res.obj)
817
+          console.log(res.obj);
729
         } else {
818
         } else {
730
           this.$Message.error(res.msg);
819
           this.$Message.error(res.msg);
731
         }
820
         }
754
     delWifi(val) {
843
     delWifi(val) {
755
       //删除wifi白名单
844
       //删除wifi白名单
756
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
845
       this.strategyInfo.padWifis = this.strategyInfo.padWifis.filter(
757
-          (v) => v != val
846
+        (v) => v != val
758
       );
847
       );
759
     },
848
     },
760
     AddWifi() {
849
     AddWifi() {
764
       }
853
       }
765
       this.strategyInfo.padWifis.push(this.ssidName);
854
       this.strategyInfo.padWifis.push(this.ssidName);
766
       this.strategyInfo.padWifis = Array.from(
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
       this.showLoading = true;
861
       this.showLoading = true;
773
       let res1 = await app_list_sel({
862
       let res1 = await app_list_sel({
783
       } else {
872
       } else {
784
         this.$Message.error(res1.msg);
873
         this.$Message.error(res1.msg);
785
       }
874
       }
786
-     this.searchList();
875
+      this.searchList();
787
     },
876
     },
788
     toView(row) {
877
     toView(row) {
789
       this.showLoading = true;
878
       this.showLoading = true;
791
         this.showLoading = false;
880
         this.showLoading = false;
792
         if (res.code === 0) {
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
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
887
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
796
           this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
888
           this.strategyInfo.hasapp = this.strategyInfo.hasapp ? true : false;
797
           this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
889
           this.strategyInfo.hasdevice = this.strategyInfo.hasdevice
798
-              ? true
799
-              : false;
890
+            ? true
891
+            : false;
800
           this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
892
           this.strategyInfo.haswifi = this.strategyInfo.haswifi ? true : false;
801
           this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
893
           this.strategyInfo.hasviolate = this.strategyInfo.hasviolate
802
-              ? true
803
-              : false;
894
+            ? true
895
+            : false;
804
           if (this.strategyInfo.hasapp) {
896
           if (this.strategyInfo.hasapp) {
805
             //回显应用策略
897
             //回显应用策略
806
             this.padApps.forEach((item) => {
898
             this.padApps.forEach((item) => {
827
               });
919
               });
828
               item.checked = arr.length > 0 ? true : false;
920
               item.checked = arr.length > 0 ? true : false;
829
               item.handleMethod =
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
         } else {
929
         } else {
834
           this.$Message.error(res.msg);
930
           this.$Message.error(res.msg);
835
         }
931
         }
836
       });
932
       });
837
     },
933
     },
838
     toEdit(row) {
934
     toEdit(row) {
839
-      if(!row.padid){
935
+      console.log(row)
936
+      if (!row.padid) {
840
         this.strategyInfo = {
937
         this.strategyInfo = {
841
           model: "add", //添加
938
           model: "add", //添加
842
           userid: row.userid,
939
           userid: row.userid,
853
           padWifis: [], //wifi白名单
950
           padWifis: [], //wifi白名单
854
           hasviolate: false, //是否开启违规通知:0否 1是
951
           hasviolate: false, //是否开启违规通知:0否 1是
855
           padViolates: [] //设备违规
952
           padViolates: [] //设备违规
856
-        }
953
+        };
857
         return;
954
         return;
858
       }
955
       }
859
       this.showLoading = true;
956
       this.showLoading = true;
860
       stPad_detail({ padid: row.padid }).then((res) => {
957
       stPad_detail({ padid: row.padid }).then((res) => {
861
         this.showLoading = false;
958
         this.showLoading = false;
862
         if (res.code === 0) {
959
         if (res.code === 0) {
863
-          console.log(res.obj)
960
+          console.log(res.obj);
864
           //数据回显
961
           //数据回显
962
+          this.strategyInfo.model = "edit";
865
           this.strategyInfo.padid = res.obj.padid;
963
           this.strategyInfo.padid = res.obj.padid;
866
           this.strategyInfo.userid = row.userid;
964
           this.strategyInfo.userid = row.userid;
867
           this.strategyInfo.rversion = res.obj.rversion;
965
           this.strategyInfo.rversion = res.obj.rversion;
868
           this.strategyInfo.hastime = res.obj.hastime ? true : false;
966
           this.strategyInfo.hastime = res.obj.hastime ? true : false;
869
           this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
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
           this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
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
             this.strategyInfo.padTimes = res.obj.padTimes;
972
             this.strategyInfo.padTimes = res.obj.padTimes;
879
           }
973
           }
880
           if (this.strategyInfo.hasapp) {
974
           if (this.strategyInfo.hasapp) {
895
               item.enabled = obj.enabled;
989
               item.enabled = obj.enabled;
896
             });
990
             });
897
           }
991
           }
898
-          if(this.strategyInfo.hastime){
992
+          if (this.strategyInfo.hastime) {
899
             this.strategyInfo.padWifis = res.obj.padWifis;
993
             this.strategyInfo.padWifis = res.obj.padWifis;
900
           }
994
           }
901
           if (this.strategyInfo.hasviolate) {
995
           if (this.strategyInfo.hasviolate) {
906
               });
1000
               });
907
               item.checked = arr.length > 0 ? true : false;
1001
               item.checked = arr.length > 0 ? true : false;
908
               item.handleMethod =
1002
               item.handleMethod =
909
-                  arr.length > 0 ? arr[0].handleMethod.split(";") : [];
1003
+                arr.length > 0 ? arr[0].handleMethod.split(";") : [];
910
             });
1004
             });
911
           }
1005
           }
912
           this.strategyInfo.show = true;
1006
           this.strategyInfo.show = true;
913
-          console.log(this.strategyInfo)
1007
+          console.log(this.strategyInfo);
914
         } else {
1008
         } else {
915
           this.$Message.error(res.msg);
1009
           this.$Message.error(res.msg);
916
         }
1010
         }
928
           }).then((res) => {
1022
           }).then((res) => {
929
             this.showLoading = false;
1023
             this.showLoading = false;
930
             if (res.code === 0) {
1024
             if (res.code === 0) {
931
-              this.detail();
1025
+              this.searchList();
932
             } else {
1026
             } else {
933
               this.$Message.error(res.msg);
1027
               this.$Message.error(res.msg);
934
             }
1028
             }
957
     getList() {
1051
     getList() {
958
       this.showLoading = true;
1052
       this.showLoading = true;
959
       stPad_list_user({
1053
       stPad_list_user({
960
-        schoolid: this.curClass.schoolid,
1054
+        schoolid: this.curClass.schoolid || this.curClass.id,
961
         classid: this.curClass.id,
1055
         classid: this.curClass.id,
962
         page: this.searchForm.page,
1056
         page: this.searchForm.page,
963
         size: this.searchForm.size,
1057
         size: this.searchForm.size,
986
     margin-bottom: 16px;
1080
     margin-bottom: 16px;
987
   }
1081
   }
988
 }
1082
 }
989
-.content{
1083
+.content {
990
   .operation {
1084
   .operation {
991
     text-align: right;
1085
     text-align: right;
992
     span {
1086
     span {
1097
           height: 26px;
1191
           height: 26px;
1098
           margin: 0 20px 10px 0;
1192
           margin: 0 20px 10px 0;
1099
           position: relative;
1193
           position: relative;
1100
-          .title{
1194
+          .title {
1101
             line-height: 14px;
1195
             line-height: 14px;
1102
           }
1196
           }
1103
           img {
1197
           img {

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

2
   <div class="index1">
2
   <div class="index1">
3
     <div class="operation">
3
     <div class="operation">
4
       <span @click="curState = 2">修改</span>
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
       <span @click="getstPad_list">引用</span>
8
       <span @click="getstPad_list">引用</span>
7
     </div>
9
     </div>
8
     <div class="strategy_list">
10
     <div class="strategy_list">
260
 import {
262
 import {
261
   stPad_add,
263
   stPad_add,
262
   stPad_delete,
264
   stPad_delete,
263
-  stPad_detail,
265
+  stPad_add_quote,
264
   stPad_detail_obj,
266
   stPad_detail_obj,
265
   stPad_edit,
267
   stPad_edit,
266
   stPad_list
268
   stPad_list
282
       },
284
       },
283
       curState: 1, //1查看/2编辑
285
       curState: 1, //1查看/2编辑
284
       strategyInfo: {
286
       strategyInfo: {
287
+        sttype: null,
288
+        padid: null,
289
+        rversion: null,
285
         hastime: false, // 是否开启时间策略:0否 1是
290
         hastime: false, // 是否开启时间策略:0否 1是
286
         padTimes: [], // 平板策略时间
291
         padTimes: [], // 平板策略时间
287
         hasapp: false, //是否开启应用策略:0否 1是
292
         hasapp: false, //是否开启应用策略:0否 1是
443
           id: 6
448
           id: 6
444
         }
449
         }
445
       ],
450
       ],
446
-      ssidName: "",
447
-      hasSave: null
451
+      ssidName: ""
448
     };
452
     };
449
   },
453
   },
450
   watch: {
454
   watch: {
479
         return;
483
         return;
480
       }
484
       }
481
       this.showLoading = true;
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
         this.showLoading = false;
491
         this.showLoading = false;
484
         if (res.code === 0) {
492
         if (res.code === 0) {
493
+          if (document.querySelector(".user_list")) {
494
+            document.querySelector(".user_list").scrollTop = 0;
495
+          }
485
           //数据回显
496
           //数据回显
486
           this.strategyInfo = res.obj;
497
           this.strategyInfo = res.obj;
487
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
498
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
497
             //回显应用策略
508
             //回显应用策略
498
             this.padApps.forEach((item) => {
509
             this.padApps.forEach((item) => {
499
               let ishas = this.strategyInfo.padApps.some((v) => {
510
               let ishas = this.strategyInfo.padApps.some((v) => {
500
-                return v.appid === item.appid;
511
+                return v === item.appid;
501
               });
512
               });
502
               item.checked = ishas ? true : false;
513
               item.checked = ishas ? true : false;
503
             });
514
             });
524
           }
535
           }
525
           this.curState = 2; //编辑状态
536
           this.curState = 2; //编辑状态
526
           this.stPadInfo.show = false;
537
           this.stPadInfo.show = false;
538
+          console.log(this.stPadInfo);
527
         } else {
539
         } else {
528
           this.$Message.error(res.msg);
540
           this.$Message.error(res.msg);
529
         }
541
         }
532
     getstPad_list() {
544
     getstPad_list() {
533
       this.showLoading = true;
545
       this.showLoading = true;
534
       stPad_list({
546
       stPad_list({
535
-        schoolid: this.curClass.id
547
+        schoolid: this.curClass.schoolid
536
       }).then((res) => {
548
       }).then((res) => {
537
         this.showLoading = false;
549
         this.showLoading = false;
538
         if (res.code === 0) {
550
         if (res.code === 0) {
585
       this.strategyInfo.padTimes = times;
597
       this.strategyInfo.padTimes = times;
586
     },
598
     },
587
     save() {
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
       let padDevices = [],
610
       let padDevices = [],
589
         padViolates = [],
611
         padViolates = [],
590
         padApps = [];
612
         padApps = [];
661
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
683
         padWifis: this.strategyInfo.haswifi ? this.strategyInfo.padWifis : [],
662
         padApps: this.strategyInfo.hasapp ? padApps : []
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
         form.padid = this.strategyInfo.padid;
691
         form.padid = this.strategyInfo.padid;
667
         form.rversion = this.strategyInfo.rversion;
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
       api(form).then((res) => {
696
       api(form).then((res) => {
672
         if (res.code === 0) {
697
         if (res.code === 0) {
673
           this.$Message.success(res.msg);
698
           this.$Message.success(res.msg);
699
+          if (!hasSave) {
700
+            //刷新左侧树
701
+            this.$emit("refresh");
702
+          }
674
           this.detail();
703
           this.detail();
675
         } else {
704
         } else {
676
           this.$Message.error(res.msg);
705
           this.$Message.error(res.msg);
723
       });
752
       });
724
       this.showLoading = false;
753
       this.showLoading = false;
725
       if (res.code === 0) {
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
           this.strategyInfo = res.obj;
760
           this.strategyInfo = res.obj;
730
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
761
           this.strategyInfo.hastime = this.strategyInfo.hastime ? true : false;
779
       }
810
       }
780
     },
811
     },
781
     async init() {
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
       this.showLoading = true;
827
       this.showLoading = true;
784
       let res1 = await app_list_sel({
828
       let res1 = await app_list_sel({

+ 946
- 46
src/views/schoolSection/strategy/strategyTemplate.vue
File diff suppressed because it is too large
View File


Loading…
Cancel
Save