Browse Source

学校-设备管理、违规设备

gzb
wangzhonglu 9 months ago
parent
commit
67076bfb14

+ 10
- 0
src/api/device_manager.js View File

20
  */
20
  */
21
 export const device_manager_list_d = (data) =>
21
 export const device_manager_list_d = (data) =>
22
   setRequest("device_manager/list_d", data);
22
   setRequest("device_manager/list_d", data);
23
+/**
24
+ * 11.1.4.2设备管理--设备导出列表
25
+ */
26
+export const device_manager_export_d = (data) =>
27
+  setRequest("device_manager/export_d", data);
28
+/**
29
+ * 11.1.4.3设备管理--安装应用导出列表
30
+ */
31
+export const device_manager_export_id = (data) =>
32
+  setRequest("device_manager/export_id", data);

+ 41
- 10
src/views/schoolSection/deviceManage/breakRuleDevice.vue View File

20
         />
20
         />
21
       </div>
21
       </div>
22
       <div class="search_right">
22
       <div class="search_right">
23
-        <Dropdown>
23
+        <Dropdown @on-click="dropdownSelected">
24
           <div class="drop_btn">
24
           <div class="drop_btn">
25
             其他操作<Icon type="ios-arrow-down" class="arrow_down" />
25
             其他操作<Icon type="ios-arrow-down" class="arrow_down" />
26
           </div>
26
           </div>
27
           <DropdownMenu slot="list">
27
           <DropdownMenu slot="list">
28
-            <DropdownItem>恢复出厂设置</DropdownItem>
29
-            <DropdownItem>发送消息</DropdownItem>
30
-            <DropdownItem>解除限制</DropdownItem>
31
-            <DropdownItem>限制使用</DropdownItem>
32
-            <DropdownItem>更新策略</DropdownItem>
33
-            <DropdownItem>重启设备</DropdownItem>
34
-            <DropdownItem>合理处理</DropdownItem>
28
+            <DropdownItem name="1">恢复出厂设置</DropdownItem>
29
+            <DropdownItem name="2">发送消息</DropdownItem>
30
+            <DropdownItem name="3">解除限制</DropdownItem>
31
+            <DropdownItem name="4">限制使用</DropdownItem>
32
+            <DropdownItem name="5">更新策略</DropdownItem>
33
+            <DropdownItem name="6">重启设备</DropdownItem>
34
+            <DropdownItem name="7">合理处理</DropdownItem>
35
           </DropdownMenu>
35
           </DropdownMenu>
36
         </Dropdown>
36
         </Dropdown>
37
       </div>
37
       </div>
38
     </div>
38
     </div>
39
     <div class="table_wrap">
39
     <div class="table_wrap">
40
-      <Table :columns="columns" :data="searchForm.list">
40
+      <Table
41
+        :columns="columns"
42
+        :data="searchForm.list"
43
+        @on-selection-change="selectionChange"
44
+      >
41
         <template slot-scope="{ row }" slot="actionSlot">
45
         <template slot-scope="{ row }" slot="actionSlot">
42
           <div class="action_list">
46
           <div class="action_list">
43
             <div @click="toDetail(row)">违规详情</div>
47
             <div @click="toDetail(row)">违规详情</div>
77
         list: [],
81
         list: [],
78
         total: 0
82
         total: 0
79
       },
83
       },
84
+      tableSelection: [],
80
       columns: [
85
       columns: [
81
         {
86
         {
82
           type: "selection",
87
           type: "selection",
169
     },
174
     },
170
     // 获取列表
175
     // 获取列表
171
     getList() {
176
     getList() {
177
+      this.tableSelection = [];
172
       device_manager_list_vd({
178
       device_manager_list_vd({
173
         page: this.searchForm.page,
179
         page: this.searchForm.page,
174
         size: this.searchForm.size,
180
         size: this.searchForm.size,
189
     // 恢复出厂
195
     // 恢复出厂
190
     toRestore() {},
196
     toRestore() {},
191
     // 合规处理
197
     // 合规处理
192
-    toHandle() {}
198
+    toHandle() {},
199
+    selectionChange(selection) {
200
+      this.tableSelection = selection;
201
+    },
202
+    // 其他操作
203
+    dropdownSelected(name) {
204
+      if (this.tableSelection.length === 0) {
205
+        this.$Message.error("请选择列表");
206
+        return;
207
+      }
208
+      if (name === "1") {
209
+        // 恢复出厂设置
210
+      } else if (name === "2") {
211
+        // 发送消息
212
+      } else if (name === "3") {
213
+        // 解除限制
214
+      } else if (name === "4") {
215
+        // 限制使用
216
+      } else if (name === "5") {
217
+        // 更新策略
218
+      } else if (name === "6") {
219
+        // 重启设备
220
+      } else if (name === "7") {
221
+        // 合理处理
222
+      }
223
+    }
193
   }
224
   }
194
 };
225
 };
195
 </script>
226
 </script>

+ 150
- 15
src/views/schoolSection/deviceManage/deviceManage.vue View File

44
           />
44
           />
45
         </div>
45
         </div>
46
         <div class="search_right">
46
         <div class="search_right">
47
-          <Button type="primary" class="primary_btn" style="margin-right: 10px"
47
+          <Button
48
+            type="primary"
49
+            class="primary_btn"
50
+            style="margin-right: 10px"
51
+            @click="toDeviceExport()"
48
             >设备导出</Button
52
             >设备导出</Button
49
           >
53
           >
50
-          <Button type="primary" class="primary_btn" style="margin-right: 10px"
54
+          <Button
55
+            type="primary"
56
+            class="primary_btn"
57
+            style="margin-right: 10px"
58
+            @click="toInstallingAppExport()"
51
             >安装应用导出</Button
59
             >安装应用导出</Button
52
           >
60
           >
53
-          <Dropdown>
61
+          <Dropdown @on-click="dropdownSelected">
54
             <div class="drop_btn">
62
             <div class="drop_btn">
55
               其他操作<Icon type="ios-arrow-down" class="arrow_down" />
63
               其他操作<Icon type="ios-arrow-down" class="arrow_down" />
56
             </div>
64
             </div>
57
             <DropdownMenu slot="list">
65
             <DropdownMenu slot="list">
58
-              <DropdownItem>恢复出厂设置</DropdownItem>
59
-              <DropdownItem>发送消息</DropdownItem>
60
-              <DropdownItem>整班发送消息</DropdownItem>
61
-              <DropdownItem>解除限制</DropdownItem>
62
-              <DropdownItem>限制使用</DropdownItem>
63
-              <DropdownItem>更新策略</DropdownItem>
64
-              <DropdownItem>重启设备</DropdownItem>
66
+              <DropdownItem name="1">恢复出厂设置</DropdownItem>
67
+              <DropdownItem name="2">发送消息</DropdownItem>
68
+              <DropdownItem name="3">整班发送消息</DropdownItem>
69
+              <DropdownItem name="4">解除限制</DropdownItem>
70
+              <DropdownItem name="5">限制使用</DropdownItem>
71
+              <DropdownItem name="6">更新策略</DropdownItem>
72
+              <DropdownItem name="7">重启设备</DropdownItem>
65
             </DropdownMenu>
73
             </DropdownMenu>
66
           </Dropdown>
74
           </Dropdown>
67
         </div>
75
         </div>
68
       </div>
76
       </div>
69
       <div class="table_wrap">
77
       <div class="table_wrap">
70
-        <Table :columns="columns" :data="searchForm.list">
78
+        <Table
79
+          :columns="columns"
80
+          :data="searchForm.list"
81
+          @on-selection-change="selectionChange"
82
+        >
71
           <template slot-scope="{ row }" slot="onlineSlot">
83
           <template slot-scope="{ row }" slot="onlineSlot">
72
             <!-- 1在线2离线 -->
84
             <!-- 1在线2离线 -->
73
             <div v-if="row.online === 1">在线</div>
85
             <div v-if="row.online === 1">在线</div>
100
 </template>
112
 </template>
101
 
113
 
102
 <script>
114
 <script>
115
+import { exportToExcel } from "@/utils/exportToExcel";
103
 import { class_list } from "@/api/class";
116
 import { class_list } from "@/api/class";
104
-import { device_manager_list_d } from "@/api/device_manager";
117
+import {
118
+  device_manager_list_d,
119
+  device_manager_export_d,
120
+  device_manager_export_id
121
+} from "@/api/device_manager";
105
 export default {
122
 export default {
106
   data() {
123
   data() {
107
     return {
124
     return {
114
         list: [],
131
         list: [],
115
         total: 0
132
         total: 0
116
       },
133
       },
134
+      tableSelection: [],
117
       schoolInfo: {
135
       schoolInfo: {
118
         schoolid: null,
136
         schoolid: null,
119
         schoolname: null,
137
         schoolname: null,
185
   },
203
   },
186
   created() {
204
   created() {
187
     this.getClassList();
205
     this.getClassList();
188
-    this.searchList();
189
   },
206
   },
190
   methods: {
207
   methods: {
191
     classChange(classid) {
208
     classChange(classid) {
220
             schoolname: data.obj.name,
237
             schoolname: data.obj.name,
221
             classList: data.obj.children
238
             classList: data.obj.children
222
           };
239
           };
240
+          this.searchList();
223
         } else {
241
         } else {
224
           this.$Message.error(data.msg);
242
           this.$Message.error(data.msg);
225
         }
243
         }
227
     },
245
     },
228
     // 获取列表
246
     // 获取列表
229
     getList() {
247
     getList() {
248
+      this.tableSelection = [];
230
       device_manager_list_d({
249
       device_manager_list_d({
231
         page: this.searchForm.page,
250
         page: this.searchForm.page,
232
         size: this.searchForm.size,
251
         size: this.searchForm.size,
233
-        schoolid: this.searchForm.schoolid,
252
+        schoolid: this.schoolInfo.schoolid,
234
         classid: this.searchForm.classid,
253
         classid: this.searchForm.classid,
235
         atype: this.searchForm.atype,
254
         atype: this.searchForm.atype,
236
         name: this.searchForm.name
255
         name: this.searchForm.name
243
         }
262
         }
244
       });
263
       });
245
     },
264
     },
265
+    // 设备导出
266
+    toDeviceExport() {
267
+      device_manager_export_d({
268
+        schoolid: this.schoolInfo.schoolid,
269
+        classid: this.searchForm.classid,
270
+        atype: this.searchForm.atype,
271
+        name: this.searchForm.name
272
+      }).then((data) => {
273
+        if (data.code === 0) {
274
+          exportToExcel(
275
+            [
276
+              {
277
+                list: data.obj.map((item) => {
278
+                  return {
279
+                    登录名: item.loginname,
280
+                    姓名: item.username,
281
+                    // 1在线2离线
282
+                    在线状态:
283
+                      item.online === 1
284
+                        ? "在线"
285
+                        : item.online === 2
286
+                        ? "离线"
287
+                        : "",
288
+                    设备型号: item.deviceModel,
289
+                    "ID(IMEI/MEID/ESN)": item.sn,
290
+                    Rom版本: item.romVersion,
291
+                    更新时间: item.updatetime
292
+                  };
293
+                }),
294
+                name: "设备导出"
295
+              }
296
+            ],
297
+            "设备导出"
298
+          );
299
+        } else {
300
+          this.$Message.error(data.msg);
301
+        }
302
+      });
303
+    },
304
+    // 安装应用导出
305
+    toInstallingAppExport() {
306
+      device_manager_export_id({
307
+        schoolid: this.schoolInfo.schoolid,
308
+        classid: this.searchForm.classid
309
+      }).then((data) => {
310
+        if (data.code === 0) {
311
+          exportToExcel(
312
+            [
313
+              {
314
+                list: data.obj.map((item) => {
315
+                  return {
316
+                    登录名: item.loginname,
317
+                    姓名: item.username,
318
+                    班级: item.classname,
319
+                    应用名称: item.appName,
320
+                    包名: item.appPackage,
321
+                    版本名称: item.appVersion,
322
+                    MAC地址: item.mac,
323
+                    时间: item.createtime
324
+                  };
325
+                }),
326
+                name: "安装应用导出"
327
+              }
328
+            ],
329
+            "安装应用导出"
330
+          );
331
+        } else {
332
+          this.$Message.error(data.msg);
333
+        }
334
+      });
335
+    },
246
     // 查看
336
     // 查看
247
     toView() {},
337
     toView() {},
248
     // 策略
338
     // 策略
249
     toStrategy() {},
339
     toStrategy() {},
250
     // 设备密码
340
     // 设备密码
251
-    toPsw() {}
341
+    toPsw() {},
342
+    selectionChange(selection) {
343
+      this.tableSelection = selection;
344
+    },
345
+    // 其他操作
346
+    dropdownSelected(name) {
347
+      if (name === "1") {
348
+        // 恢复出厂设置
349
+        if (this.tableSelection.length === 0) {
350
+          this.$Message.error("请选择列表");
351
+          return;
352
+        }
353
+      } else if (name === "2") {
354
+        // 发送消息
355
+        if (this.tableSelection.length === 0) {
356
+          this.$Message.error("请选择列表");
357
+          return;
358
+        }
359
+      } else if (name === "3") {
360
+        // 整班发送消息
361
+      } else if (name === "4") {
362
+        // 解除限制
363
+        if (this.tableSelection.length === 0) {
364
+          this.$Message.error("请选择列表");
365
+          return;
366
+        }
367
+      } else if (name === "5") {
368
+        // 限制使用
369
+        if (this.tableSelection.length === 0) {
370
+          this.$Message.error("请选择列表");
371
+          return;
372
+        }
373
+      } else if (name === "6") {
374
+        // 更新策略
375
+        if (this.tableSelection.length === 0) {
376
+          this.$Message.error("请选择列表");
377
+          return;
378
+        }
379
+      } else if (name === "7") {
380
+        // 重启设备
381
+        if (this.tableSelection.length === 0) {
382
+          this.$Message.error("请选择列表");
383
+          return;
384
+        }
385
+      }
386
+    }
252
   }
387
   }
253
 };
388
 };
254
 </script>
389
 </script>

Loading…
Cancel
Save