Browse Source

学校-设备管理查看策略

gzb
wangzhonglu 9 months ago
parent
commit
b49fa493f5
3 changed files with 479 additions and 1 deletions
  1. 4
    0
      src/api/stPad.js
  2. 60
    0
      src/utils/index.js
  3. 415
    1
      src/views/schoolSection/deviceManage/deviceManage.vue

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

@@ -43,6 +43,10 @@ export const stPad_detail_obj = (data) => setRequest("stPad/detail_obj", data);
43 43
  * 6.1.10 平板策略-个人策略
44 44
  */
45 45
 export const stPad_list_user = (data) => setRequest("stPad/list_user", data);
46
+/**
47
+ * 平板策略-个人策略(网页端)
48
+ */
49
+export const stPad_detail_web = (data) => setRequest("stPad/detail_web", data);
46 50
 /**
47 51
  * 6.1.11 平板策略-平板用户
48 52
  */

+ 60
- 0
src/utils/index.js View File

@@ -609,3 +609,63 @@ export const pushTypeInfo = {
609 609
   5: "重启设备",
610 610
   6: "恢复出厂"
611 611
 };
612
+export const padDeviceIcon = [
613
+  {
614
+    pdtype: "摄像头",
615
+    icon: "ivu-icon iconfont icon-ball-camera"
616
+  },
617
+  {
618
+    pdtype: "蓝牙",
619
+    icon: "ivu-icon iconfont icon-lanya"
620
+  },
621
+  {
622
+    pdtype: "USB连接",
623
+    icon: "ivu-icon iconfont icon-USB"
624
+  },
625
+  {
626
+    pdtype: "Wi-Fi开关",
627
+    icon: "ivu-icon iconfont icon-bx-wifi-2"
628
+  },
629
+  {
630
+    pdtype: "电话短信",
631
+    icon: "ivu-icon iconfont icon-dianhuaduanxin_line"
632
+  },
633
+  {
634
+    pdtype: "数据流量",
635
+    icon: "ivu-icon iconfont icon-liuliang"
636
+  },
637
+  {
638
+    pdtype: "GPS",
639
+    icon: "ivu-icon iconfont icon-GPSxinxi"
640
+  },
641
+  {
642
+    pdtype: "Wi-Fi高级选项",
643
+    icon: "ivu-icon iconfont icon-wifiguanbi"
644
+  },
645
+  {
646
+    pdtype: "SD卡",
647
+    icon: "ivu-icon iconfont icon-sdka-09"
648
+  },
649
+  {
650
+    pdtype: "OTG",
651
+    icon: "ivu-icon iconfont icon-icon-OTG"
652
+  }
653
+];
654
+export const padViolatesInfo = [
655
+  {
656
+    title: "已ROOT",
657
+    violateType: 1
658
+  },
659
+  {
660
+    title: "安装非商店应用",
661
+    violateType: 2
662
+  },
663
+  {
664
+    title: "更换SIM卡",
665
+    violateType: 3
666
+  },
667
+  {
668
+    title: "USB连接电脑",
669
+    violateType: 4
670
+  }
671
+];

+ 415
- 1
src/views/schoolSection/deviceManage/deviceManage.vue View File

@@ -165,6 +165,190 @@
165 165
         <Button @click="devicePswInfo.show = false">关闭</Button>
166 166
       </div>
167 167
     </Modal>
168
+    <Modal
169
+      class="modal5"
170
+      :mask-closable="false"
171
+      v-model="strategyInfo.show"
172
+      :title="`策略【${strategyInfo.username}】`"
173
+    >
174
+      <div class="content" v-if="strategyInfo.show">
175
+        <div class="strategy_list">
176
+          <div class="strategy_title">
177
+            <div>
178
+              <span
179
+                style="font-size: 26px"
180
+                class="ivu-icon iconfont icon-shijian"
181
+              ></span
182
+              >时间限制策略
183
+            </div>
184
+          </div>
185
+          <div style="margin-bottom: 10px" v-if="strategyInfo.hastime">
186
+            <div class="showtime">
187
+              <div
188
+                style="line-height: 30px; font-size: 16px; margin-bottom: 10px"
189
+              >
190
+                设备生效时间
191
+              </div>
192
+              <div class="week">
193
+                <div class="day" v-for="item in weekDay" :key="item.value">
194
+                  <div class="day_title">{{ item.alias }}</div>
195
+                  <div class="day_content">
196
+                    <div
197
+                      class="time"
198
+                      v-for="(sItem, sIndex) in strategyPadTimes(item.value)"
199
+                      :key="sIndex"
200
+                    >
201
+                      {{ sItem.starttime }} - {{ sItem.stoptime }}
202
+                    </div>
203
+                  </div>
204
+                </div>
205
+              </div>
206
+            </div>
207
+          </div>
208
+          <div class="nodata" v-else>未设置时间限制策略</div>
209
+        </div>
210
+        <div class="strategy_list">
211
+          <div class="strategy_title">
212
+            <div>
213
+              <span class="ivu-icon iconfont icon-yingyongcelve"></span>应用策略
214
+            </div>
215
+          </div>
216
+          <div class="strategy_content" v-if="strategyInfo.hasapp">
217
+            <div class="strategy_top">
218
+              <span>授权应用</span>
219
+            </div>
220
+            <div
221
+              class="strategy_bottom"
222
+              style="min-height: 160px"
223
+              v-if="strategyInfo.padApps.length > 0"
224
+            >
225
+              <div
226
+                class="app_list"
227
+                v-for="item in strategyInfo.padApps"
228
+                :key="item.appid"
229
+              >
230
+                <img :src="$api.baseImageUrl + item.appIcon" />
231
+                <div>{{ item.appName }}</div>
232
+              </div>
233
+            </div>
234
+          </div>
235
+          <div class="nodata" v-else>未设置应用策略</div>
236
+        </div>
237
+        <div class="strategy_list">
238
+          <div class="strategy_title">
239
+            <div>
240
+              <span class="ivu-icon iconfont icon-shezhi"></span>设备策略
241
+            </div>
242
+          </div>
243
+          <div class="strategy_content" v-if="strategyInfo.hasdevice">
244
+            <div class="strategy_top">
245
+              <span>设备功能管理</span>
246
+            </div>
247
+            <div class="strategy_bottom" style="min-height: 160px">
248
+              <div
249
+                class="device_list"
250
+                v-for="item in padDeviceIcon"
251
+                :key="item.pdtype"
252
+              >
253
+                <div class="icon">
254
+                  <span :class="[item.icon]"></span>
255
+                </div>
256
+                <div class="title">{{ item.pdtype }}</div>
257
+                <i-switch
258
+                  size="large"
259
+                  :value="strategyInfo.pdtypeInfo[item.pdtype]"
260
+                  :disabled="true"
261
+                  :true-value="1"
262
+                  :false-value="2"
263
+                >
264
+                  <span slot="open">开启</span>
265
+                  <span slot="close">关闭</span>
266
+                </i-switch>
267
+              </div>
268
+            </div>
269
+          </div>
270
+          <div class="nodata" v-else>未设置设备策略</div>
271
+        </div>
272
+        <div class="strategy_list">
273
+          <div class="strategy_title">
274
+            <div>
275
+              <span
276
+                style="font-size: 18px"
277
+                class="ivu-icon iconfont icon-wifi"
278
+              ></span
279
+              >Wifi白名单策略
280
+            </div>
281
+          </div>
282
+          <div class="strategy_content" v-if="strategyInfo.haswifi">
283
+            <div class="strategy_top">
284
+              <span>SSID</span>
285
+            </div>
286
+            <div class="strategy_bottom" style="min-height: 76px">
287
+              <div
288
+                class="padWifis"
289
+                v-for="(item, index) in strategyInfo.padWifis"
290
+                :key="index"
291
+              >
292
+                <div class="title">{{ item }}</div>
293
+              </div>
294
+            </div>
295
+          </div>
296
+          <div class="nodata" v-else>未设置Wifi白名单</div>
297
+        </div>
298
+        <div class="strategy_list">
299
+          <div class="strategy_title">
300
+            <div>
301
+              <span class="ivu-icon iconfont icon-weiguiguanli"></span>违规处理
302
+            </div>
303
+          </div>
304
+          <div style="border: 1px solid #ced9f2; border-bottom: none">
305
+            <Table
306
+              v-if="strategyInfo.hasviolate"
307
+              class="table"
308
+              :columns="violationColumns"
309
+              :data="padViolatesInfo"
310
+            >
311
+              <template slot-scope="{ row }" slot="violationEvents">
312
+                <Checkbox
313
+                  :disabled="true"
314
+                  class="checked"
315
+                  :value="
316
+                    strategyInfo.violatesInfo[row.violateType] &&
317
+                    strategyInfo.violatesInfo[row.violateType].length > 0
318
+                  "
319
+                ></Checkbox>
320
+                <span
321
+                  style="display: inline-block; width: 120px; text-align: left"
322
+                  >{{ row.title }}</span
323
+                >
324
+              </template>
325
+              <template slot-scope="{ row }" slot="violationHandling">
326
+                <CheckboxGroup
327
+                  :value="
328
+                    strategyInfo.violatesInfo[row.violateType] &&
329
+                    strategyInfo.violatesInfo[row.violateType]
330
+                  "
331
+                >
332
+                  <Checkbox :disabled="true" label="通知管理员"></Checkbox>
333
+                  <Checkbox
334
+                    :disabled="true"
335
+                    style="margin: 0 40px"
336
+                    label="限制使用"
337
+                  ></Checkbox>
338
+                  <Checkbox :disabled="true" label="恢复出厂设置"></Checkbox>
339
+                </CheckboxGroup>
340
+              </template>
341
+            </Table>
342
+          </div>
343
+          <div class="nodata" v-if="!strategyInfo.hasviolate">
344
+            未设置违规处理
345
+          </div>
346
+        </div>
347
+      </div>
348
+      <div slot="footer" style="text-align: center">
349
+        <Button @click="strategyInfo.show = false">关闭</Button>
350
+      </div>
351
+    </Modal>
168 352
   </div>
169 353
 </template>
170 354
 
@@ -179,10 +363,15 @@ import {
179 363
   device_manager_export_id
180 364
 } from "@/api/device_manager";
181 365
 import { password_detail_userpwd } from "@/api/setting";
366
+import { stPad_detail_web } from "@/api/stPad";
182 367
 import { logPush_add } from "@/api/log";
368
+import { weekDay, padDeviceIcon, padViolatesInfo } from "@/utils";
183 369
 export default {
184 370
   data() {
185 371
     return {
372
+      weekDay,
373
+      padDeviceIcon,
374
+      padViolatesInfo,
186 375
       userInfo: {},
187 376
       // ws连接后回发信息
188 377
       wsEnterInfo: {
@@ -295,6 +484,37 @@ export default {
295 484
           width: 200,
296 485
           align: "center"
297 486
         }
487
+      ],
488
+      strategyInfo: {
489
+        username: null,
490
+        userid: null,
491
+        rversion: null,
492
+        padid: null,
493
+        show: false,
494
+        hastime: false, // 是否开启时间策略:0否 1是
495
+        padTimes: [], // 平板策略时间
496
+        hasapp: false, //是否开启应用策略:0否 1是
497
+        padApps: [], //appid集合
498
+        hasdevice: false, //是否开启设备策略:0否 1是
499
+        padDevices: [], //授权应用
500
+        pdtypeInfo: {},
501
+        haswifi: false, //是否开启wifi白名单策略:0否 1是
502
+        padWifis: [], //wifi白名单
503
+        hasviolate: false, //是否开启违规通知:0否 1是
504
+        padViolates: [] //设备违规
505
+      },
506
+      violationColumns: [
507
+        {
508
+          title: "违规事件",
509
+          slot: "violationEvents",
510
+          align: "center",
511
+          width: 260
512
+        },
513
+        {
514
+          title: "违规处理",
515
+          slot: "violationHandling",
516
+          align: "center"
517
+        }
298 518
       ]
299 519
     };
300 520
   },
@@ -493,7 +713,40 @@ export default {
493 713
     // 查看
494 714
     toView() {},
495 715
     // 策略
496
-    toStrategy() {},
716
+    toStrategy(row) {
717
+      stPad_detail_web({ objectid: row.userid }).then((res) => {
718
+        if (res.code === 0) {
719
+          this.strategyInfo.username = row.username;
720
+          this.strategyInfo.userid = row.userid;
721
+          this.strategyInfo.padid = res.obj.padid;
722
+          this.strategyInfo.rversion = res.obj.rversion;
723
+          this.strategyInfo.hastime = res.obj.hastime ? true : false;
724
+          this.strategyInfo.hasapp = res.obj.hasapp ? true : false;
725
+          this.strategyInfo.hasdevice = res.obj.hasdevice ? true : false;
726
+          this.strategyInfo.haswifi = res.obj.haswifi ? true : false;
727
+          this.strategyInfo.hasviolate = res.obj.hasviolate ? true : false;
728
+          this.strategyInfo.padApps = res.obj.padApps || [];
729
+          this.strategyInfo.padWifis = res.obj.padWifis || [];
730
+          this.strategyInfo.padTimes = res.obj.padTimes || [];
731
+          let pdtypeInfo = {};
732
+          this.strategyInfo.padDevices = res.obj.padDevices;
733
+          this.strategyInfo.padDevices.forEach((item) => {
734
+            pdtypeInfo[item.pdtype] = item.enabled;
735
+          });
736
+          this.strategyInfo.pdtypeInfo = pdtypeInfo;
737
+          let violatesInfo = {};
738
+          this.strategyInfo.padViolates = res.obj.padViolates;
739
+          this.strategyInfo.padViolates.forEach((item) => {
740
+            violatesInfo[item.violateType] =
741
+              item.handle_method && item.handle_method.split(";");
742
+          });
743
+          this.strategyInfo.violatesInfo = violatesInfo;
744
+          this.strategyInfo.show = true;
745
+        } else {
746
+          this.$Message.error(res.msg);
747
+        }
748
+      });
749
+    },
497 750
     // 设备密码
498 751
     toPsw(row) {
499 752
       password_detail_userpwd({
@@ -771,6 +1024,9 @@ export default {
771 1024
           this.$Message.error(data.msg);
772 1025
         }
773 1026
       });
1027
+    },
1028
+    strategyPadTimes(id) {
1029
+      return this.strategyInfo.padTimes.filter((v) => v.week === id);
774 1030
     }
775 1031
   }
776 1032
 };
@@ -883,4 +1139,162 @@ export default {
883 1139
     background: #f3f4fc;
884 1140
   }
885 1141
 }
1142
+.content {
1143
+  .strategy_list {
1144
+    font-family: "SourceHanSansCN";
1145
+    .strategy_title {
1146
+      height: 40px;
1147
+      font-size: 16px;
1148
+      display: flex;
1149
+      justify-content: space-between;
1150
+      align-items: center;
1151
+      div:first-of-type {
1152
+        font-weight: bold;
1153
+        span {
1154
+          font-size: 22px;
1155
+          color: #339dff;
1156
+          margin-right: 4px;
1157
+        }
1158
+      }
1159
+    }
1160
+    .strategy_content {
1161
+      border-radius: 6px 6px 0 0;
1162
+      border: 1px solid #ced9f2;
1163
+      .strategy_top {
1164
+        display: flex;
1165
+        height: 46px;
1166
+        align-items: center;
1167
+        background: #edf3ff;
1168
+        padding-left: 20px;
1169
+        border-bottom: 1px solid #ced9f2;
1170
+        span {
1171
+          font-size: 16px;
1172
+          color: #253a70;
1173
+          font-weight: 400;
1174
+          font-family: "SourceHanSansCN";
1175
+        }
1176
+      }
1177
+      .strategy_bottom {
1178
+        display: flex;
1179
+        flex-wrap: wrap;
1180
+        padding: 20px;
1181
+        .app_list {
1182
+          margin: 0 16px 16px 0;
1183
+          width: 100px;
1184
+          height: 110px;
1185
+          border-radius: 10px;
1186
+          border: 1px solid #798cb51a;
1187
+          background: #ffffff;
1188
+          text-align: center;
1189
+          position: relative;
1190
+          img {
1191
+            margin: 16px 0;
1192
+            width: 40px;
1193
+            height: 40px;
1194
+            object-fit: cover;
1195
+          }
1196
+          .checked {
1197
+            position: absolute;
1198
+            right: 2px;
1199
+            top: 8px;
1200
+            /deep/ .ivu-checkbox-inner {
1201
+              border-radius: 50%;
1202
+            }
1203
+          }
1204
+          &:hover {
1205
+            cursor: pointer;
1206
+            box-shadow: 10px 10px 20px 0 #339dff26;
1207
+          }
1208
+        }
1209
+        .device_list {
1210
+          display: flex;
1211
+          height: 80px;
1212
+          align-items: center;
1213
+          margin-right: 40px;
1214
+          .icon {
1215
+            width: 56px;
1216
+            height: 56px;
1217
+            border-radius: 6px;
1218
+            border: 1px solid #e5e5e5;
1219
+            display: flex;
1220
+            align-items: center;
1221
+            justify-content: center;
1222
+            span {
1223
+              font-size: 28px;
1224
+              color: #339dff;
1225
+            }
1226
+          }
1227
+          .title {
1228
+            width: 92px;
1229
+            margin: 0 10px;
1230
+          }
1231
+        }
1232
+        .padWifis {
1233
+          border-radius: 5px;
1234
+          border: 1px solid #339dff;
1235
+          background: #eaf5ff;
1236
+          padding: 4px 20px 4px 16px;
1237
+          height: 26px;
1238
+          margin: 0 20px 10px 0;
1239
+          position: relative;
1240
+          .title {
1241
+            line-height: 14px;
1242
+          }
1243
+          img {
1244
+            width: 16px;
1245
+            height: 16px;
1246
+            object-fit: cover;
1247
+            position: absolute;
1248
+            right: -4px;
1249
+            top: -8px;
1250
+            cursor: pointer;
1251
+          }
1252
+        }
1253
+      }
1254
+    }
1255
+    .nodata {
1256
+      color: #798cb5;
1257
+      font-size: 16px;
1258
+      line-height: 30px;
1259
+    }
1260
+  }
1261
+  .showtime {
1262
+    .week {
1263
+      display: flex;
1264
+      width: 100%;
1265
+      .day {
1266
+        width: 14.2%;
1267
+        border: 1px solid #ced9f2;
1268
+        border-right: none;
1269
+        &:last-of-type {
1270
+          border-right: 1px solid #ced9f2;
1271
+        }
1272
+        .day_title {
1273
+          width: 100%;
1274
+          height: 40px;
1275
+          line-height: 40px;
1276
+          background: #edf3ff;
1277
+          border-bottom: 1px solid #ced9f2;
1278
+          text-align: center;
1279
+        }
1280
+        .day_content {
1281
+          min-height: 50px;
1282
+          padding: 10px;
1283
+          .time {
1284
+            height: 30px;
1285
+            line-height: 30px;
1286
+            border-radius: 6px;
1287
+            background: #dbeeff;
1288
+            text-align: center;
1289
+            color: #339dff;
1290
+            font-size: 14px;
1291
+            font-weight: 500;
1292
+            margin-top: 10px;
1293
+            font-family: "SourceHanSansCN";
1294
+          }
1295
+        }
1296
+      }
1297
+    }
1298
+  }
1299
+}
886 1300
 </style>

Loading…
Cancel
Save