Blame view

src/views/device/index.vue 28.7 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
bb778c90   阿宝   设备状态
2
3
4
5
6
    <div>
      <back-box>
        <template slot="title">
          <span>设备管理</span>
        </template>
db11048f   阿宝   设备状态,学校管理
7
        <template slot="btns" v-if="type == 1 && school !== '长水'">
bb778c90   阿宝   设备状态
8
9
10
11
12
13
14
          <el-tooltip effect="dark" content="设备导入" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-upload2"
              size="mini"
              plain
              circle
db11048f   阿宝   设备状态,学校管理
15
              @click="diaUp = true"
bb778c90   阿宝   设备状态
16
17
18
19
20
21
22
23
24
            ></el-button>
          </el-tooltip>
          <el-tooltip effect="dark" content="添加基站" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-receiving"
              size="mini"
              plain
              circle
db11048f   阿宝   设备状态,学校管理
25
              @click="diaAnswerEqu = true"
bb778c90   阿宝   设备状态
26
27
28
29
            ></el-button>
          </el-tooltip>
        </template>
      </back-box>
db11048f   阿宝   设备状态,学校管理
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
      <div class="page-content">
        <div class="tab-box">
          <el-radio-group v-model="type">
            <el-radio-button :label="1">基站管理</el-radio-button>
            <el-radio-button :label="2">答题器管理</el-radio-button>
            <el-radio-button :label="3">授课端管理</el-radio-button>
          </el-radio-group>
        </div>
        <div class="content">
          <div v-if="type == 1">
            <div class="chart-box">
              <div class="device-num">
                <p class="p1">{{ total }}</p>
                <p class="p2">基站数量</p>
              </div>
              <div class="chart">
                <pie-chart
                  id="pieChart"
                  :params="chartData"
                  @clickPieChart="clickPieChart"
                ></pie-chart>
              </div>
            </div>
            <div class="table-box">
              <div class="answer-header">
                <div class="sel-box">
                  <el-cascader
                    class="sel"
                    collapse-tags
                    clearable
                    placeholder="选择班级"
                    v-model="query.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
62
                    :options="gradeList"
db11048f   阿宝   设备状态,学校管理
63
64
                    :props="props"
                    :show-all-levels="false"
db11048f   阿宝   设备状态,学校管理
65
66
67
                  ></el-cascader>
                  <el-select
                    class="sel"
23a6dc5f   阿宝   学校管理相关接口简单对接
68
                    v-model="query.onlineStatus"
db11048f   阿宝   设备状态,学校管理
69
                    placeholder="选择状态"
b21d90ef   梁保满   长水登录
70
                    @change="_QueryData(true)"
db11048f   阿宝   设备状态,学校管理
71
72
73
74
75
76
77
78
79
80
81
82
                  >
                    <el-option
                      v-for="item in statusList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <el-input
                    type="number"
                    placeholder="请输入设备编码"
23a6dc5f   阿宝   学校管理相关接口简单对接
83
                    v-model="query.sn"
db11048f   阿宝   设备状态,学校管理
84
85
86
87
88
89
90
91
92
                    class="input-with-select"
                    @keyup.enter.native="_QueryData(true)"
                  >
                    <el-button
                      slot="append"
                      icon="el-icon-search"
                      @click="_QueryData(true)"
                    ></el-button>
                  </el-input>
1b9bae95   梁保满   级联选择器调整,日志接口调整
93
                  <el-button class="serach-box" round @click="_QueryData(true)"
b21d90ef   梁保满   长水登录
94
95
                    >筛选</el-button
                  >
db11048f   阿宝   设备状态,学校管理
96
97
98
99
                </div>
              </div>
              <el-table :data="tableData" border style="width: 100%">
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
100
                  prop="deviceId"
db11048f   阿宝   设备状态,学校管理
101
102
103
104
                  label="设备编码"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
105
                  prop="frequency"
db11048f   阿宝   设备状态,学校管理
106
107
108
109
                  label="频点"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
110
                  prop="pairingCode"
db11048f   阿宝   设备状态,学校管理
111
112
113
114
                  label="配对码"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
115
                  prop="roomName"
db11048f   阿宝   设备状态,学校管理
116
117
118
                  label="所在教室"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
119
120
121
122
123
124
125
                <el-table-column label="关联班级" align="center">
                  <template slot-scope="scoped">
                    <p v-for="item in scoped.row.classList" :key="item.classId">
                      {{ item.className }}
                    </p>
                  </template>
                </el-table-column>
db11048f   阿宝   设备状态,学校管理
126
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
127
128
                  prop="otaVersionNumber"
                  label="固件版本号"
db11048f   阿宝   设备状态,学校管理
129
130
131
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
132
133
                  prop="latestReportTime"
                  label="最近上报"
db11048f   阿宝   设备状态,学校管理
134
135
                  align="center"
                ></el-table-column>
db11048f   阿宝   设备状态,学校管理
136
137
138
139
140
                <el-table-column label="状态" align="center"
                  ><template slot-scope="scope">
                    {{
                      scope.row.status == 1
                        ? "在线"
23a6dc5f   阿宝   学校管理相关接口简单对接
141
                        : scope.row.status == 0
db11048f   阿宝   设备状态,学校管理
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
                        ? "离线"
                        : "异常"
                    }}
                  </template></el-table-column
                >
                <el-table-column label="操作" align="center"
                  ><template slot-scope="scoped">
                    <el-tooltip effect="dark" content="修改基站" placement="top">
                      <el-button
                        type="primary"
                        circle
                        size="mini"
                        icon="fa fa-edit"
                        @click="edit(scoped.row)"
                      ></el-button>
                    </el-tooltip>
                    <el-tooltip effect="dark" content="日志" placement="top">
                      <el-button
                        type="warning"
                        circle
                        size="mini"
                        icon="fa fa-eye"
                        @click="linkTo(scoped.row, 1)"
                      ></el-button>
                    </el-tooltip> </template
                ></el-table-column>
              </el-table>
            </div>
          </div>
          <div v-if="type == 2">
            <div class="chart-box">
              <div class="device-num">
                <p class="p1">{{ total }}</p>
                <p class="p2">答题器数量</p>
              </div>
              <div class="chart">
                <scatter-chart
                  id="scatterChart"
                  :params="chartData2"
                  @clickScatterChart="clickScatterChart"
                ></scatter-chart>
              </div>
            </div>
            <div class="table-box">
              <div class="answer-header">
                <div class="sel-box">
                  <el-cascader
                    class="sel"
                    collapse-tags
                    clearable
                    placeholder="选择班级"
                    v-model="query.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
194
                    :options="gradeList"
db11048f   阿宝   设备状态,学校管理
195
196
                    :props="props"
                    :show-all-levels="false"
db11048f   阿宝   设备状态,学校管理
197
198
199
                  ></el-cascader>
                  <el-select
                    class="sel"
23a6dc5f   阿宝   学校管理相关接口简单对接
200
                    v-model="query.type"
db11048f   阿宝   设备状态,学校管理
201
                    placeholder="选择状态"
b21d90ef   梁保满   长水登录
202
                    @change="_QueryData(true)"
db11048f   阿宝   设备状态,学校管理
203
204
                  >
                    <el-option
23a6dc5f   阿宝   学校管理相关接口简单对接
205
                      v-for="item in typeList"
db11048f   阿宝   设备状态,学校管理
206
207
208
209
210
211
212
213
214
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <el-input
                    type="number"
                    placeholder="请输入设备编码"
23a6dc5f   阿宝   学校管理相关接口简单对接
215
                    v-model="query.sn"
db11048f   阿宝   设备状态,学校管理
216
217
218
219
220
221
222
223
224
                    class="input-with-select"
                    @keyup.enter.native="_QueryData(true)"
                  >
                    <el-button
                      slot="append"
                      icon="el-icon-search"
                      @click="_QueryData(true)"
                    ></el-button>
                  </el-input>
1b9bae95   梁保满   级联选择器调整,日志接口调整
225
                  <el-button class="serach-box" round @click="_QueryData(true)"
b21d90ef   梁保满   长水登录
226
                    >筛选</el-button
1b9bae95   梁保满   级联选择器调整,日志接口调整
227
                  >
db11048f   阿宝   设备状态,学校管理
228
229
230
231
                </div>
              </div>
              <el-table :data="tableData" border style="width: 100%">
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
232
                  prop="deviceId"
db11048f   阿宝   设备状态,学校管理
233
234
235
                  label="设备编码"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
236
237
238
239
240
241
242
243
244
245
                <el-table-column label="学生信息" align="center"
                  ><template slot-scope="scoped"
                    ><p
                      v-for="item in scoped.row.studentList"
                      :key="item.studentId"
                    >
                      {{ item.studentName }}
                    </p></template
                  ></el-table-column
                >
db11048f   阿宝   设备状态,学校管理
246
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
247
                  prop="electricity"
db11048f   阿宝   设备状态,学校管理
248
249
250
                  label="电量"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
251
252
253
254
255
256
257
                <el-table-column prop="class" label="关联班级" align="center">
                  <template slot-scope="scoped">
                    <p v-for="item in scoped.row.classList" :key="item.classId">
                      {{ item.className }}
                    </p>
                  </template></el-table-column
                >
db11048f   阿宝   设备状态,学校管理
258
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
259
                  prop="pairingCode"
db11048f   阿宝   设备状态,学校管理
260
261
262
263
                  label="配对码"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
264
                  prop="answerTimes"
db11048f   阿宝   设备状态,学校管理
265
266
267
268
                  label="答题次数"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
269
                  prop="latestReportTime"
db11048f   阿宝   设备状态,学校管理
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
                  label="最后答题时间"
                  align="center"
                ></el-table-column>
                <el-table-column label="操作" align="center"
                  ><template slot-scope="scoped">
                    <el-tooltip effect="dark" content="日志" placement="top">
                      <el-button
                        type="warning"
                        circle
                        size="mini"
                        icon="fa fa-eye"
                        @click="linkTo(scoped.row, 2)"
                      ></el-button>
                    </el-tooltip> </template
                ></el-table-column>
              </el-table>
            </div>
          </div>
          <div v-if="type == 3">
            <div class="table-box">
              <div class="answer-header">
                <div class="sel-box">
                  <el-cascader
                    class="sel"
                    collapse-tags
                    clearable
                    placeholder="选择班级"
                    v-model="query.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
298
                    :options="gradeList"
db11048f   阿宝   设备状态,学校管理
299
300
301
302
                    :props="props"
                    :show-all-levels="false"
                    @change="_QueryData(false)"
                  ></el-cascader>
e5ff81a1   阿宝   集团管理员接口
303
304
305
                  <span class="sel"
                    >共选择{{ selectionTabIds.length }}个授课端</span
                  >
23a6dc5f   阿宝   学校管理相关接口简单对接
306
                  <el-button plan round @click="autoUpDate(false)"
db11048f   阿宝   设备状态,学校管理
307
308
                    >开启自动更新</el-button
                  >
23a6dc5f   阿宝   学校管理相关接口简单对接
309
                  <el-button plan round @click="stopUpdate(false)"
db11048f   阿宝   设备状态,学校管理
310
311
312
313
314
315
316
317
318
319
320
                    >停止自动更新</el-button
                  >
                </div>
              </div>
              <el-table
                :data="tableData"
                border
                style="width: 100%"
                @selection-change="handleSelectionChange"
              >
                <el-table-column type="selection" width="55"> </el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
321
322
323
324
325
326
327
                <el-table-column prop="class" label="关联班级" align="center"
                  ><template slot-scope="scoped">
                    <p v-for="item in scoped.row.classList" :key="item.classId">
                      {{ item.className }}
                    </p>
                  </template></el-table-column
                >
db11048f   阿宝   设备状态,学校管理
328
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
329
                  prop="lastUpdateTime"
db11048f   阿宝   设备状态,学校管理
330
331
332
333
                  label="最近更新"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
334
                  prop="osInfo"
db11048f   阿宝   设备状态,学校管理
335
336
337
338
                  label="软件系统"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
339
                  prop="hardwareInfo"
db11048f   阿宝   设备状态,学校管理
340
341
342
343
                  label="硬件环境"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
344
                  prop="otaVersionNumber"
db11048f   阿宝   设备状态,学校管理
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
                  label="版本号"
                  align="center"
                ></el-table-column>
                <el-table-column label="状态" align="center"
                  ><template slot-scope="scope">
                    {{
                      scope.row.status == 1
                        ? "在线"
                        : scope.row.status == 2
                        ? "离线"
                        : "异常"
                    }}
                  </template></el-table-column
                >
                <el-table-column label="自动更新" align="center"
                  ><template slot-scope="scoped">
                    <el-switch
23a6dc5f   阿宝   学校管理相关接口简单对接
362
                      v-model="scoped.row.upgradeFlag"
db11048f   阿宝   设备状态,学校管理
363
364
365
366
367
368
369
                      @change="changeUpdate($event, scoped.row, this)"
                    >
                    </el-switch> </template
                ></el-table-column>
              </el-table>
            </div>
          </div>
23a6dc5f   阿宝   学校管理相关接口简单对接
370
371
372
373
374
375
376
377
378
379
380
381
          <div class="pagination-box">
            <el-pagination
              small=""
              layout="total,prev, pager, next"
              :hide-on-single-page="true"
              :total="total"
              @current-change="changePage"
              :current-page="page"
              :page-size="size"
            >
            </el-pagination>
          </div>
db11048f   阿宝   设备状态,学校管理
382
383
384
385
386
387
        </div>
      </div>
      <el-dialog title="设备导入" :visible.sync="diaUp" width="400">
        <up-load id="downDevice" :url="url" fileName="设备信息">
          <p class="down-txt" slot="down">
            通过Excel名单导入设备,需要提供设备编码,点击
23a6dc5f   阿宝   学校管理相关接口简单对接
388
            <el-link type="danger" @click="downExcel">模板下载</el-link> 。
db11048f   阿宝   设备状态,学校管理
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
          </p>
        </up-load>
        <div class="dialog-footer" slot="footer">
          <el-button @click="diaUp = false">取 消</el-button>
        </div>
      </el-dialog>
      <el-dialog title="添加答题器" :visible.sync="diaAnswerEqu" width="400">
        <el-form ref="forms" :model="form" :rules="formRules" label-width="140px">
          <el-form-item label="设备编码:" prop="number">
            <el-col :span="10"
              ><el-input
                type="text"
                placeholder="输入设备编码"
                v-model.trim="form.number"
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
23a6dc5f   阿宝   学校管理相关接口简单对接
410
          <el-form-item label="频点:" prop="frequency">
db11048f   阿宝   设备状态,学校管理
411
412
413
414
            <el-col :span="10"
              ><el-input
                type="text"
                placeholder="输入频点"
23a6dc5f   阿宝   学校管理相关接口简单对接
415
                v-model.trim="form.frequency"
db11048f   阿宝   设备状态,学校管理
416
417
418
419
420
421
422
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
23a6dc5f   阿宝   学校管理相关接口简单对接
423
          <el-form-item label="配对码:" prop="pairingCode">
db11048f   阿宝   设备状态,学校管理
424
425
426
427
            <el-col :span="10"
              ><el-input
                type="text"
                placeholder="输入配对码"
23a6dc5f   阿宝   学校管理相关接口简单对接
428
                v-model.trim="form.pairingCode"
db11048f   阿宝   设备状态,学校管理
429
430
431
432
433
434
435
436
437
438
439
440
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
          <el-form-item label="选择班级:" prop="classId">
            <el-col :span="10">
              <el-cascader
                clearable
                v-model="form.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
441
                :options="gradeList"
db11048f   阿宝   设备状态,学校管理
442
443
444
445
446
447
448
449
450
451
                :props="{ expandTrigger: 'hover' }"
                :show-all-levels="false"
              ></el-cascader>
            </el-col>
          </el-form-item>
          <el-form-item label="所在教室:">
            <el-col :span="10"
              ><el-input
                type="text"
                placeholder="输入所在教室"
23a6dc5f   阿宝   学校管理相关接口简单对接
452
                v-model.trim="form.roomName"
db11048f   阿宝   设备状态,学校管理
453
454
455
456
457
458
459
460
461
462
463
464
465
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
        </el-form>
        <div class="dialog-footer" slot="footer">
          <el-button type="primary" @click="addAnswerEqu">确 定</el-button>
          <el-button @click="diaAnswerEqu = false">取 消</el-button>
        </div>
      </el-dialog>
bb778c90   阿宝   设备状态
466
    </div>
4c4f7640   梁保满   路由表,路由前端文件
467
468
469
  </template>
  
  <script>
db11048f   阿宝   设备状态,学校管理
470
471
472
473
474
475
  import pieChart from "@/components/charts/pieChart";
  import scatterChart from "@/components/charts/scatterChart";
  import _ from "lodash";
  import { downloadFile, formatClass } from "@/utils";
  export default {
    components: { pieChart, scatterChart },
23a6dc5f   阿宝   学校管理相关接口简单对接
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
    watch: {
      type: function (val) {
        this.page = 1;
        this.total = 0;
        this.query.classId = [];
        this.query.onlineStatus = "";
        this.query.sn = "";
        this.query.type = "";
        if (val == 1) {
          this.stationReport();
        } else if (val == 2) {
          this.keyboardReport();
        }
        this._QueryData();
      },
    },
db11048f   阿宝   设备状态,学校管理
492
493
    data() {
      return {
e5ff81a1   阿宝   集团管理员接口
494
        role: "",
db11048f   阿宝   设备状态,学校管理
495
496
497
498
499
        school: "",
        loading: false,
        url: "/web/upLoadDevice",
        diaUp: false,
        diaAnswerEqu: false,
23a6dc5f   阿宝   学校管理相关接口简单对接
500
501
        gradeList: [],
        gradeListAll: [],
296f7c47   梁保满   集团管理员接口调整
502
        schoolAll:[],
1b9bae95   梁保满   级联选择器调整,日志接口调整
503
        props: { multiple: true, checkStrictly: true },
db11048f   阿宝   设备状态,学校管理
504
505
506
        type: 1,
        query: {
          classId: [],
23a6dc5f   阿宝   学校管理相关接口简单对接
507
508
509
          onlineStatus: "",
          sn: "",
          type: "",
db11048f   阿宝   设备状态,学校管理
510
511
        },
        statusList: [
23a6dc5f   阿宝   学校管理相关接口简单对接
512
          { label: "离线", value: 0 },
db11048f   阿宝   设备状态,学校管理
513
          { label: "在线", value: 1 },
23a6dc5f   阿宝   学校管理相关接口简单对接
514
515
516
517
518
519
520
521
522
523
          { label: "异常", value: 2 },
        ],
        typeList: [
          { label: "全部", value: 0 },
          { label: "1日内", value: 1 },
          { label: "3日内", value: 2 },
          { label: "7日内", value: 3 },
          { label: "1月内", value: 4 },
          { label: "3月内", value: 5 },
          { label: "3月以上", value: 6 },
db11048f   阿宝   设备状态,学校管理
524
525
526
        ],
        form: {
          number: "",
23a6dc5f   阿宝   学校管理相关接口简单对接
527
528
          frequency: "",
          pairingCode: "",
db11048f   阿宝   设备状态,学校管理
529
          classId: "",
23a6dc5f   阿宝   学校管理相关接口简单对接
530
          roomName: "",
db11048f   阿宝   设备状态,学校管理
531
532
533
534
535
        },
        formRules: {
          number: [
            { required: true, message: "请输入设备编码", trigger: "blur" },
          ],
23a6dc5f   阿宝   学校管理相关接口简单对接
536
537
538
539
          frequency: [{ required: true, message: "请输入频点", trigger: "blur" }],
          pairingCode: [
            { required: true, message: "请输入配对码", trigger: "blur" },
          ],
db11048f   阿宝   设备状态,学校管理
540
541
          classId: [{ required: true, message: "请选择班级", trigger: "blur" }],
        },
23a6dc5f   阿宝   学校管理相关接口简单对接
542
543
544
545
        tableData: [],
        total: 0,
        chartData: [],
        chartData2: [],
db11048f   阿宝   设备状态,学校管理
546
        selectionTabIds: [],
23a6dc5f   阿宝   学校管理相关接口简单对接
547
548
        page: 1,
        size: 20,
db11048f   阿宝   设备状态,学校管理
549
550
551
      };
    },
    created() {
e5ff81a1   阿宝   集团管理员接口
552
553
554
555
556
557
558
      let role = "";
      this.$store.getters.info.permissions.map((item) => {
        if (item.roleName == this.$store.getters.info.showRoleName) {
          role = item.role;
        }
      });
      this.role = role ? role : this.$store.getters.info.permissions[0].role;
23a6dc5f   阿宝   学校管理相关接口简单对接
559
560
561
      this.stationReport();
      this._QueryGradeList();
      this._QueryData();
296f7c47   梁保满   集团管理员接口调整
562
      this.showSchool()
db11048f   阿宝   设备状态,学校管理
563
564
565
566
567
568
569
570
571
572
573
574
575
    },
    methods: {
      edit() {},
      linkTo(obj, type) {
        this.$router.push({
          path: "/deviceLog",
          query: {
            id: obj.id,
            type: type,
          },
        });
      },
      clickPieChart(obj) {
23a6dc5f   阿宝   学校管理相关接口简单对接
576
577
578
579
        this.query.onlineStatus =
          obj.name == "在线" ? 1 : obj.name == "离线" ? 0 : 2;
        this.query.sn = "";
        this.page = 1;
b21d90ef   梁保满   长水登录
580
        this._QueryData(false);
db11048f   阿宝   设备状态,学校管理
581
582
      },
      clickScatterChart(obj) {
23a6dc5f   阿宝   学校管理相关接口简单对接
583
584
585
586
587
588
589
590
591
592
593
594
595
596
        this.query.type =
          obj.name == "1日内"
            ? 1
            : obj.name == "3日内"
            ? 2
            : obj.name == "7日内"
            ? 3
            : obj.name == "1月内"
            ? 4
            : obj.name == "3月内"
            ? 5
            : 6;
        this.query.sn = "";
        this.page = 1;
b21d90ef   梁保满   长水登录
597
        this._QueryData(false);
db11048f   阿宝   设备状态,学校管理
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
      },
      handleSelectionChange(val) {
        console.log(val);
        this.selectionTabIds = val.map((item) => {
          return item.id;
        });
      },
      changeUpdate: _.debounce(function (event, obj) {
        console.log(this);
        if (event) {
          this.autoUpDate(obj.id);
        } else {
          this.stopUpdate(obj.id);
        }
      }, 800),
23a6dc5f   阿宝   学校管理相关接口简单对接
613
614
      changePage(page) {
        this.page = page;
b21d90ef   梁保满   长水登录
615
        this._QueryData(false);
23a6dc5f   阿宝   学校管理相关接口简单对接
616
      },
296f7c47   梁保满   集团管理员接口调整
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
       async showSchool() {
        const { data, status, info } = await this.$request.schoolList();
        if (status === 0) {
          this.schoolAll= [{
            value:0,
            label:"全部",
            children:data.list?.map(item=>{
              return {
                value:item.id,
                label:item.schoolName,
              }
            })
          }]
          this.gradeList = [...this.schoolAll,...this.gradeList]
        } else {
          this.$message.error(info);
        }
      },
db11048f   阿宝   设备状态,学校管理
635
636
637
638
639
640
641
      async autoUpDate(id) {
        if (!this.selectionTabIds.length && !id) {
          this.$message.warning("请选择授课端~");
          return;
        }
        if (this.loadingUpDate) return;
        this.loadingUpDate = true;
23a6dc5f   阿宝   学校管理相关接口简单对接
642
        let data = await this.$request.modifyUpgradeFlag({
dd5150c5   阿宝   数据同步
643
          deviceIds: id ? [id] : this.selectionTabIds,
23a6dc5f   阿宝   学校管理相关接口简单对接
644
          upgradeFlag: 1,
db11048f   阿宝   设备状态,学校管理
645
646
647
648
        });
        this.loadingUpDate = false;
        if (data && !data.code) {
          this._QueryData(false);
e5ff81a1   阿宝   集团管理员接口
649
          this.selectionTabIds = [];
db11048f   阿宝   设备状态,学校管理
650
651
652
653
654
655
656
657
658
659
660
661
          this.$message.success("开启自动更新成功");
        } else {
          this.$message.error(data.message);
        }
      },
      async stopUpdate(id) {
        if (!this.selectionTabIds.length && !id) {
          this.$message.warning("请选择授课端~");
          return;
        }
        if (this.loadingUpDate) return;
        this.loadingUpDate = true;
23a6dc5f   阿宝   学校管理相关接口简单对接
662
        let data = await this.$request.modifyUpgradeFlag({
dd5150c5   阿宝   数据同步
663
          deviceIds: id ? [id] : this.selectionTabIds,
23a6dc5f   阿宝   学校管理相关接口简单对接
664
          upgradeFlag: 0,
db11048f   阿宝   设备状态,学校管理
665
666
667
        });
        this.loadingUpDate = false;
        if (data && !data.code) {
e5ff81a1   阿宝   集团管理员接口
668
          this.selectionTabIds = [];
db11048f   阿宝   设备状态,学校管理
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
          this._QueryData(false);
          this.$message.success("关闭自动更新成功");
        } else {
          this.$message.error(data.message);
        }
      },
      async downExcel() {
        let data = await this.$request.downDevice({
          id: this.id,
        });
        if (data && !data.code) {
          let blob = new Blob([data], {
            type: "application/vnd.ms-excel;charset=utf-8",
          });
          downloadFile(`设备信息.xlsx`, blob);
        } else {
          this.$message.error(data.message);
        }
      },
  
      // 添加设备
      async addAnswerEqu() {
23a6dc5f   阿宝   学校管理相关接口简单对接
691
692
693
694
695
696
697
698
699
700
        if (this.loadingAnswerEqu) return;
        this.loadingAnswerEqu = true;
        const { data, status, info } = await this.$request.fetchgradeList();
        this.loadingAnswerEqu = false;
        console.log(status);
        if (status === 0) {
          this._QueryData();
        } else {
          this.$message.error(info);
        }
db11048f   阿宝   设备状态,学校管理
701
702
      },
      // 查找班级
23a6dc5f   阿宝   学校管理相关接口简单对接
703
704
      async _QueryGradeList() {
        this.loading = true;
e5ff81a1   阿宝   集团管理员接口
705
706
707
708
709
        const gradeList =
          this.role != "ROLE_JITUAN"
            ? this.$request.gradeList
            : this.$request.regionList;
        const { data, status, info } = await gradeList();
23a6dc5f   阿宝   学校管理相关接口简单对接
710
711
        if (status === 0) {
          if (!!data.list) {
e5ff81a1   阿宝   集团管理员接口
712
713
714
715
            if (this.role != "ROLE_JITUAN") {
              this.gradeList =
                data.list?.map((item) => {
                  let gradeList = {
1b9bae95   梁保满   级联选择器调整,日志接口调整
716
                    value: item.gradeName,
e5ff81a1   阿宝   集团管理员接口
717
718
719
720
721
                    label: item.gradeName,
                  };
                  gradeList.children =
                    item.classList?.map((items) => {
                      return {
1b9bae95   梁保满   级联选择器调整,日志接口调整
722
                        value: Number(items.classCode),
e5ff81a1   阿宝   集团管理员接口
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
                        label: items.className,
                      };
                    }) || [];
                  return gradeList;
                }) || [];
            } else {
              this.gradeList =
                data.list?.map((item) => {
                  let gradeList = {
                    value: item.id,
                    label: item.regionName,
                  };
                  gradeList.children =
                    item.schoolList?.map((items) => {
                      return {
                        value: items.id,
                        label: items.schoolName,
                      };
                    }) || [];
                  return gradeList;
                }) || [];
296f7c47   梁保满   集团管理员接口调整
744
                this.gradeList = [...this.schoolAll,...this.gradeList]
e5ff81a1   阿宝   集团管理员接口
745
            }
23a6dc5f   阿宝   学校管理相关接口简单对接
746
747
748
749
750
751
752
          }
        } else {
          this.$message.error(info);
        }
      },
      // 基站统计数据
      async stationReport() {
e5ff81a1   阿宝   集团管理员接口
753
754
755
756
757
        const stationReport =
          this.role != "ROLE_JITUAN"
            ? this.$request.stationReport
            : this.$request.tenantStationReport;
        const { data, status, info } = await stationReport();
23a6dc5f   阿宝   学校管理相关接口简单对接
758
759
760
761
762
        if (status === 0) {
          this.chartData =
            data.list?.map((item) => {
              return {
                name:
e5ff81a1   阿宝   集团管理员接口
763
764
765
766
767
                  item.onlineStatus == "1"
                    ? "在线"
                    : item.onlineStatus == 0
                    ? "离线"
                    : "异常",
296f7c47   梁保满   集团管理员接口调整
768
769
                value: item.total,
                rate: item.rate,
23a6dc5f   阿宝   学校管理相关接口简单对接
770
771
              };
            }) || [];
296f7c47   梁保满   集团管理员接口调整
772
          // this.total = data.total || 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
773
774
775
776
777
778
        } else {
          this.$message.error(info);
        }
      },
      // 答题器统计数据
      async keyboardReport() {
e5ff81a1   阿宝   集团管理员接口
779
780
781
782
783
        const keyboardReport =
          this.role != "ROLE_JITUAN"
            ? this.$request.keyboardReport
            : this.$request.tenantKeyboardReport;
        const { data, status, info } = await keyboardReport();
23a6dc5f   阿宝   学校管理相关接口简单对接
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
        if (status === 0) {
          this.chartData2 =
            data.list?.map((item) => {
              return {
                name:
                  item.type == 1
                    ? "1日内"
                    : item.type == 2
                    ? "3日内"
                    : item.type == 3
                    ? "7日内"
                    : item.type == 4
                    ? "1月内"
                    : item.type == 5
                    ? "3月内"
                    : "3月以上",
                value: item.total,
                rate: item.rate,
              };
            }) || [];
296f7c47   梁保满   集团管理员接口调整
804
          // this.total = data.total || 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
805
806
807
        } else {
          this.$message.error(info);
        }
db11048f   阿宝   设备状态,学校管理
808
      },
1b9bae95   梁保满   级联选择器调整,日志接口调整
809
810
      setQuery(){//整理传参
        let query = {}
23a6dc5f   阿宝   学校管理相关接口简单对接
811
812
813
        if (this.query.sn) {
          query.sn = this.query.sn;
        } else {
23a6dc5f   阿宝   学校管理相关接口简单对接
814
815
816
817
818
819
820
          if (this.type == 1) {
            this.query.onlineStatus !== ""
              ? (query.onlineStatus = this.query.onlineStatus)
              : "";
          } else if (this.type == 2) {
            this.query.type !== "" ? (query.type = this.query.type) : "";
          }
1b9bae95   梁保满   级联选择器调整,日志接口调整
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
          if (this.role == "ROLE_JITUAN") {
            query.regionIds = [];
            query.schoolIds = [];
            this.query.classId?.map((item) => {
              if (item.length == 1) {
                if(!query.regionIds.includes(item[0])){
                  query.regionIds.push(item[0]);
                }
              } else {
                if (!query.schoolIds.includes(item[1])) {
                  query.schoolIds.push(item[1]);
                }
                if (query.regionIds.includes(item[0])) {
                  query.regionIds.remove(item[0]);
                }
              }
            });
          } else {
            query.gradeNames = [];
            query.classIds = [];
            this.query.classId?.map((item) => {
              if (item.length == 1) {
                if(!query.gradeNames.includes(item[0])){
                  query.gradeNames.push(item[0]);
                }
              } else {
                if (!query.classIds.includes(item[1])) {
                  query.classIds.push(item[1]);
                }
                if (query.gradeNames.includes(item[0])) {
                  query.gradeNames.remove(item[0]);
                }
              }
            });
          }
          delete query.classId;
23a6dc5f   阿宝   学校管理相关接口简单对接
857
        }
1b9bae95   梁保满   级联选择器调整,日志接口调整
858
859
860
861
862
863
864
865
        return query
      },
      // 设备列表信息
      async _QueryData(isRef) {
        this.loading = true;
        let query = this.setQuery()
        if (isRef) {
          this.page = 1;
b21d90ef   梁保满   长水登录
866
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
867
        this.loading = true;
e5ff81a1   阿宝   集团管理员接口
868
869
870
871
872
        const deviceList =
          this.role != "ROLE_JITUAN"
            ? this.$request.deviceList
            : this.$request.tenantDeviceList;
        const { data, status, info } = await deviceList({
23a6dc5f   阿宝   学校管理相关接口简单对接
873
874
875
876
877
878
          ...query,
          deviceType: this.type,
          page: this.page,
          size: this.size,
        });
        this.loading = false;
e5ff81a1   阿宝   集团管理员接口
879
880
        if (status == 0) {
          this.tableData = data?.list || [];
296f7c47   梁保满   集团管理员接口调整
881
          this.total = data.count
23a6dc5f   阿宝   学校管理相关接口简单对接
882
883
884
        } else {
          this.$message.error(info);
        }
db11048f   阿宝   设备状态,学校管理
885
886
887
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
888
889
  </script>
  
db11048f   阿宝   设备状态,学校管理
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
  <style lang="scss" scoped>
  .page-content {
    padding: 20px 20px 0;
  }
  .tab-box {
    margin-bottom: 12px;
  }
  .content {
    background: #f8f8f8;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    overflow: hidden;
    :deep(.fa-edit) {
      width: 12px;
      height: 12px;
      &::before {
        margin-left: 2px;
      }
    }
    :deep(.fa-eye) {
      width: 12px;
      height: 12px;
      &::before {
        margin-left: 1px;
      }
    }
    .chart-box {
      display: flex;
      overflow: hidden;
      height: 240px;
      border-bottom: 0.5px solid #e2e2e2;
      .device-num {
        width: 280px;
        border-right: 0.5px solid #e2e2e2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .p1 {
          font-size: 28px;
        }
      }
      .chart {
        flex: 1;
        height: 100%;
      }
    }
    .table-box {
      padding: 20px;
      .answer-header {
        padding: 0;
        margin-bottom: 12px;
      }
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
945
  </style>