Blame view

src/views/device/index.vue 34.4 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
e3b0e3e7   梁保满   季度时间格式调整
2
    <div ref="main" class="page-content">
bb778c90   阿宝   设备状态
3
4
5
6
      <back-box>
        <template slot="title">
          <span>设备管理</span>
        </template>
e3b0e3e7   梁保满   季度时间格式调整
7
        <template slot="btns" v-if="role != 'ROLE_JITUAN' && type == 1 && !code">
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
8
          <el-tooltip effect="dark" content="设备导入" placement="bottom">
bb778c90   阿宝   设备状态
9
10
11
12
13
14
            <el-button
              type="primary"
              icon="el-icon-upload2"
              size="mini"
              plain
              circle
db11048f   阿宝   设备状态,学校管理
15
              @click="diaUp = true"
bb778c90   阿宝   设备状态
16
            ></el-button>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
17
          </el-tooltip>
e3b0e3e7   梁保满   季度时间格式调整
18
19
20
21
22
23
          <el-tooltip
            v-if="role == 'ROLE_XUEXIAO'"
            effect="dark"
            content="添加基站"
            placement="bottom"
          >
bb778c90   阿宝   设备状态
24
25
26
27
28
29
            <el-button
              type="primary"
              icon="el-icon-receiving"
              size="mini"
              plain
              circle
e3b0e3e7   梁保满   季度时间格式调整
30
              @click="addDev"
bb778c90   阿宝   设备状态
31
            ></el-button>
e3b0e3e7   梁保满   季度时间格式调整
32
          </el-tooltip>
bb778c90   阿宝   设备状态
33
34
        </template>
      </back-box>
1365ef5e   梁保满   优化
35
      <div>
db11048f   阿宝   设备状态,学校管理
36
37
38
39
40
41
42
43
        <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">
8ea67428   梁保满   飞书bug
44
          <div v-show="type == 1">
225a00b6   梁保满   飞书问题解决
45
            <div class="chart-box" v-if="count">
db11048f   阿宝   设备状态,学校管理
46
              <div class="device-num">
225a00b6   梁保满   飞书问题解决
47
                <p class="p1">{{ count }}</p>
db11048f   阿宝   设备状态,学校管理
48
49
50
51
52
53
54
55
56
57
58
59
60
61
                <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
225a00b6   梁保满   飞书问题解决
62
                    size="small"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
63
                    class="sel sel2"
db11048f   阿宝   设备状态,学校管理
64
65
66
                    clearable
                    placeholder="选择班级"
                    v-model="query.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
67
                    :options="gradeList"
db11048f   阿宝   设备状态,学校管理
68
                    :props="props"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
69
                    collapse-tags
db11048f   阿宝   设备状态,学校管理
70
                    :show-all-levels="false"
db11048f   阿宝   设备状态,学校管理
71
72
73
                  ></el-cascader>
                  <el-select
                    class="sel"
23a6dc5f   阿宝   学校管理相关接口简单对接
74
                    v-model="query.onlineStatus"
db11048f   阿宝   设备状态,学校管理
75
                    placeholder="选择状态"
b21d90ef   梁保满   长水登录
76
                    @change="_QueryData(true)"
db11048f   阿宝   设备状态,学校管理
77
78
79
80
81
82
83
84
85
86
                  >
                    <el-option
                      v-for="item in statusList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <el-input
db11048f   阿宝   设备状态,学校管理
87
                    placeholder="请输入设备编码"
23a6dc5f   阿宝   学校管理相关接口简单对接
88
                    v-model="query.sn"
db11048f   阿宝   设备状态,学校管理
89
90
91
92
93
94
95
96
97
                    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   梁保满   级联选择器调整,日志接口调整
98
                  <el-button class="serach-box" round @click="_QueryData(true)"
b21d90ef   梁保满   长水登录
99
100
                    >筛选</el-button
                  >
db11048f   阿宝   设备状态,学校管理
101
102
103
104
                </div>
              </div>
              <el-table :data="tableData" border style="width: 100%">
                <el-table-column
6d7bd862   梁保满   飞书bug
105
                  prop="sn"
db11048f   阿宝   设备状态,学校管理
106
107
108
109
                  label="设备编码"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
110
                  prop="frequency"
db11048f   阿宝   设备状态,学校管理
111
112
113
114
                  label="频点"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
115
                  prop="pairingCode"
db11048f   阿宝   设备状态,学校管理
116
117
118
119
                  label="配对码"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
120
                  prop="roomName"
db11048f   阿宝   设备状态,学校管理
121
122
123
                  label="所在教室"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
124
125
                <el-table-column label="关联班级" align="center">
                  <template slot-scope="scoped">
e3b0e3e7   梁保满   季度时间格式调整
126
                    <p v-for="(item, index) in scoped.row.classList" :key="index">
23a6dc5f   阿宝   学校管理相关接口简单对接
127
128
129
130
                      {{ item.className }}
                    </p>
                  </template>
                </el-table-column>
db11048f   阿宝   设备状态,学校管理
131
                <el-table-column
6d7bd862   梁保满   飞书bug
132
                  prop="otaVersionName"
23a6dc5f   阿宝   学校管理相关接口简单对接
133
                  label="固件版本号"
db11048f   阿宝   设备状态,学校管理
134
135
136
                  align="center"
                ></el-table-column>
                <el-table-column
6d7bd862   梁保满   飞书bug
137
                  prop="onlineTime"
23a6dc5f   阿宝   学校管理相关接口简单对接
138
                  label="最近上报"
db11048f   阿宝   设备状态,学校管理
139
140
                  align="center"
                ></el-table-column>
db11048f   阿宝   设备状态,学校管理
141
142
143
                <el-table-column label="状态" align="center"
                  ><template slot-scope="scope">
                    {{
6d7bd862   梁保满   飞书bug
144
                      scope.row.onlineStatus == 1
db11048f   阿宝   设备状态,学校管理
145
                        ? "在线"
6d7bd862   梁保满   飞书bug
146
147
148
                        : scope.row.onlineStatus == 2
                        ? "异常"
                        : "离线"
db11048f   阿宝   设备状态,学校管理
149
150
151
152
153
                    }}
                  </template></el-table-column
                >
                <el-table-column label="操作" align="center"
                  ><template slot-scope="scoped">
225a00b6   梁保满   飞书问题解决
154
155
156
157
158
159
                    <el-tooltip
                      effect="dark"
                      v-if="role != 'ROLE_JITUAN'"
                      content="修改基站"
                      placement="top"
                    >
db11048f   阿宝   设备状态,学校管理
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
                      <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>
8ea67428   梁保满   飞书bug
181
          <div v-show="type == 2">
225a00b6   梁保满   飞书问题解决
182
            <div class="chart-box" v-if="count">
db11048f   阿宝   设备状态,学校管理
183
              <div class="device-num">
225a00b6   梁保满   飞书问题解决
184
                <p class="p1">{{ count }}</p>
db11048f   阿宝   设备状态,学校管理
185
186
187
188
189
190
191
192
193
194
195
196
197
198
                <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
225a00b6   梁保满   飞书问题解决
199
                    size="small"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
200
                    class="sel sel2"
db11048f   阿宝   设备状态,学校管理
201
202
203
                    clearable
                    placeholder="选择班级"
                    v-model="query.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
204
                    :options="gradeList"
db11048f   阿宝   设备状态,学校管理
205
                    :props="props"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
206
                    collapse-tags
db11048f   阿宝   设备状态,学校管理
207
                    :show-all-levels="false"
db11048f   阿宝   设备状态,学校管理
208
209
210
                  ></el-cascader>
                  <el-select
                    class="sel"
23a6dc5f   阿宝   学校管理相关接口简单对接
211
                    v-model="query.type"
db11048f   阿宝   设备状态,学校管理
212
                    placeholder="选择状态"
b21d90ef   梁保满   长水登录
213
                    @change="_QueryData(true)"
db11048f   阿宝   设备状态,学校管理
214
215
                  >
                    <el-option
23a6dc5f   阿宝   学校管理相关接口简单对接
216
                      v-for="item in typeList"
db11048f   阿宝   设备状态,学校管理
217
218
219
220
221
222
223
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <el-input
db11048f   阿宝   设备状态,学校管理
224
                    placeholder="请输入设备编码"
23a6dc5f   阿宝   学校管理相关接口简单对接
225
                    v-model="query.sn"
db11048f   阿宝   设备状态,学校管理
226
227
228
229
230
231
232
233
234
                    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   梁保满   级联选择器调整,日志接口调整
235
                  <el-button class="serach-box" round @click="_QueryData(true)"
b21d90ef   梁保满   长水登录
236
                    >筛选</el-button
1b9bae95   梁保满   级联选择器调整,日志接口调整
237
                  >
db11048f   阿宝   设备状态,学校管理
238
239
240
241
                </div>
              </div>
              <el-table :data="tableData" border style="width: 100%">
                <el-table-column
6d7bd862   梁保满   飞书bug
242
                  prop="sn"
db11048f   阿宝   设备状态,学校管理
243
244
245
                  label="设备编码"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
246
247
248
                <el-table-column label="学生信息" align="center"
                  ><template slot-scope="scoped"
                    ><p
6d7bd862   梁保满   飞书bug
249
250
                      v-for="(item, index) in scoped.row.studentList"
                      :key="index"
23a6dc5f   阿宝   学校管理相关接口简单对接
251
252
253
254
255
                    >
                      {{ item.studentName }}
                    </p></template
                  ></el-table-column
                >
db11048f   阿宝   设备状态,学校管理
256
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
257
                  prop="electricity"
db11048f   阿宝   设备状态,学校管理
258
259
260
                  label="电量"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
261
262
                <el-table-column prop="class" label="关联班级" align="center">
                  <template slot-scope="scoped">
6d7bd862   梁保满   飞书bug
263
                    <p v-for="(item, index) in scoped.row.classList" :key="index">
23a6dc5f   阿宝   学校管理相关接口简单对接
264
265
266
267
                      {{ item.className }}
                    </p>
                  </template></el-table-column
                >
db11048f   阿宝   设备状态,学校管理
268
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
269
                  prop="pairingCode"
db11048f   阿宝   设备状态,学校管理
270
271
272
273
                  label="配对码"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
274
                  prop="answerTimes"
db11048f   阿宝   设备状态,学校管理
275
276
277
278
                  label="答题次数"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
279
                  prop="latestReportTime"
db11048f   阿宝   设备状态,学校管理
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>
8ea67428   梁保满   飞书bug
298
          <div v-show="type == 3">
db11048f   阿宝   设备状态,学校管理
299
300
301
302
            <div class="table-box">
              <div class="answer-header">
                <div class="sel-box">
                  <el-cascader
225a00b6   梁保满   飞书问题解决
303
                    size="small"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
304
                    class="sel sel2"
db11048f   阿宝   设备状态,学校管理
305
306
307
                    clearable
                    placeholder="选择班级"
                    v-model="query.classId"
23a6dc5f   阿宝   学校管理相关接口简单对接
308
                    :options="gradeList"
db11048f   阿宝   设备状态,学校管理
309
                    :props="props"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
310
                    collapse-tags
db11048f   阿宝   设备状态,学校管理
311
312
313
                    :show-all-levels="false"
                    @change="_QueryData(false)"
                  ></el-cascader>
e5ff81a1   阿宝   集团管理员接口
314
315
316
                  <span class="sel"
                    >共选择{{ selectionTabIds.length }}个授课端</span
                  >
23a6dc5f   阿宝   学校管理相关接口简单对接
317
                  <el-button plan round @click="autoUpDate(false)"
db11048f   阿宝   设备状态,学校管理
318
319
                    >开启自动更新</el-button
                  >
23a6dc5f   阿宝   学校管理相关接口简单对接
320
                  <el-button plan round @click="stopUpdate(false)"
db11048f   阿宝   设备状态,学校管理
321
322
323
324
325
                    >停止自动更新</el-button
                  >
                </div>
              </div>
              <el-table
0e46bc25   梁保满   优化
326
                ref="multipleTable"
db11048f   阿宝   设备状态,学校管理
327
328
329
330
331
                :data="tableData"
                border
                style="width: 100%"
                @selection-change="handleSelectionChange"
              >
6d7bd862   梁保满   飞书bug
332
                <el-table-column type="selection" width="55"></el-table-column>
a0d49348   梁保满   授课端管理添加设备编码,随堂问、即...
333
334
335
336
337
                <el-table-column
                  prop="sn"
                  label="设备编码"
                  align="center"
                ></el-table-column>
23a6dc5f   阿宝   学校管理相关接口简单对接
338
339
                <el-table-column prop="class" label="关联班级" align="center"
                  ><template slot-scope="scoped">
6d7bd862   梁保满   飞书bug
340
                    <p v-for="(item, index) in scoped.row.classList" :key="index">
23a6dc5f   阿宝   学校管理相关接口简单对接
341
342
343
344
                      {{ item.className }}
                    </p>
                  </template></el-table-column
                >
db11048f   阿宝   设备状态,学校管理
345
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
346
                  prop="lastUpdateTime"
db11048f   阿宝   设备状态,学校管理
347
348
349
350
                  label="最近更新"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
351
                  prop="osInfo"
db11048f   阿宝   设备状态,学校管理
352
353
354
355
                  label="软件系统"
                  align="center"
                ></el-table-column>
                <el-table-column
23a6dc5f   阿宝   学校管理相关接口简单对接
356
                  prop="hardwareInfo"
db11048f   阿宝   设备状态,学校管理
357
358
359
360
                  label="硬件环境"
                  align="center"
                ></el-table-column>
                <el-table-column
255e2506   梁保满   飞书bug及优化
361
                  prop="otaVersionName"
db11048f   阿宝   设备状态,学校管理
362
363
364
365
366
367
                  label="版本号"
                  align="center"
                ></el-table-column>
                <el-table-column label="状态" align="center"
                  ><template slot-scope="scope">
                    {{
6d7bd862   梁保满   飞书bug
368
                      scope.row.onlineStatus == 1
db11048f   阿宝   设备状态,学校管理
369
                        ? "在线"
6d7bd862   梁保满   飞书bug
370
371
372
                        : scope.row.onlineStatus == 2
                        ? "异常"
                        : "离线"
db11048f   阿宝   设备状态,学校管理
373
374
375
376
377
378
                    }}
                  </template></el-table-column
                >
                <el-table-column label="自动更新" align="center"
                  ><template slot-scope="scoped">
                    <el-switch
23a6dc5f   阿宝   学校管理相关接口简单对接
379
                      v-model="scoped.row.upgradeFlag"
db11048f   阿宝   设备状态,学校管理
380
381
382
383
384
385
386
                      @change="changeUpdate($event, scoped.row, this)"
                    >
                    </el-switch> </template
                ></el-table-column>
              </el-table>
            </div>
          </div>
23a6dc5f   阿宝   学校管理相关接口简单对接
387
388
389
390
391
392
393
394
395
396
397
398
          <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   阿宝   设备状态,学校管理
399
400
401
        </div>
      </div>
      <el-dialog title="设备导入" :visible.sync="diaUp" width="400">
e3b0e3e7   梁保满   季度时间格式调整
402
        <up-load
e3b0e3e7   梁保满   季度时间格式调整
403
404
405
406
          :url="url"
          @upSuccess="upSuccess"
          fileName="设备信息"
        >
db11048f   阿宝   设备状态,学校管理
407
408
          <p class="down-txt" slot="down">
            通过Excel名单导入设备,需要提供设备编码,点击
23a6dc5f   阿宝   学校管理相关接口简单对接
409
            <el-link type="danger" @click="downExcel">模板下载</el-link> 。
db11048f   阿宝   设备状态,学校管理
410
411
412
413
414
415
          </p>
        </up-load>
        <div class="dialog-footer" slot="footer">
          <el-button @click="diaUp = false">取 消</el-button>
        </div>
      </el-dialog>
0e46bc25   梁保满   优化
416
417
418
419
420
      <el-dialog
        :title="isAdd ? '添加基站' : '修改基站'"
        :visible.sync="diaAnswerEqu"
        width="400"
      >
db11048f   阿宝   设备状态,学校管理
421
        <el-form ref="forms" :model="form" :rules="formRules" label-width="140px">
1365ef5e   梁保满   优化
422
          <el-form-item label="设备编码:" prop="sn">
6d7bd862   梁保满   飞书bug
423
            <el-col :span="16"
db11048f   阿宝   设备状态,学校管理
424
425
426
              ><el-input
                type="text"
                placeholder="输入设备编码"
1365ef5e   梁保满   优化
427
                v-model.trim="form.sn"
db11048f   阿宝   设备状态,学校管理
428
429
430
                maxlength="30"
                size="45"
                show-word-limit
e3b0e3e7   梁保满   季度时间格式调整
431
                :disabled="!isAdd"
db11048f   阿宝   设备状态,学校管理
432
433
434
435
              >
              </el-input
            ></el-col>
          </el-form-item>
23a6dc5f   阿宝   学校管理相关接口简单对接
436
          <el-form-item label="频点:" prop="frequency">
6d7bd862   梁保满   飞书bug
437
            <el-col :span="16"
db11048f   阿宝   设备状态,学校管理
438
439
440
              ><el-input
                type="text"
                placeholder="输入频点"
23a6dc5f   阿宝   学校管理相关接口简单对接
441
                v-model.trim="form.frequency"
db11048f   阿宝   设备状态,学校管理
442
443
444
445
446
447
448
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
23a6dc5f   阿宝   学校管理相关接口简单对接
449
          <el-form-item label="配对码:" prop="pairingCode">
6d7bd862   梁保满   飞书bug
450
            <el-col :span="16"
db11048f   阿宝   设备状态,学校管理
451
452
453
              ><el-input
                type="text"
                placeholder="输入配对码"
23a6dc5f   阿宝   学校管理相关接口简单对接
454
                v-model.trim="form.pairingCode"
db11048f   阿宝   设备状态,学校管理
455
456
457
458
459
460
461
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
6d7bd862   梁保满   飞书bug
462
463
          <el-form-item label="选择班级:" prop="classIds">
            <el-col :span="16">
db11048f   阿宝   设备状态,学校管理
464
              <el-cascader
6d7bd862   梁保满   飞书bug
465
                class="sel"
db11048f   阿宝   设备状态,学校管理
466
                clearable
6d7bd862   梁保满   飞书bug
467
                v-model="form.classIds"
23a6dc5f   阿宝   学校管理相关接口简单对接
468
                :options="gradeList"
e3b0e3e7   梁保满   季度时间格式调整
469
                :props="{ expandTrigger: 'hover' }"
db11048f   阿宝   设备状态,学校管理
470
471
472
473
474
                :show-all-levels="false"
              ></el-cascader>
            </el-col>
          </el-form-item>
          <el-form-item label="所在教室:">
6d7bd862   梁保满   飞书bug
475
            <el-col :span="16"
db11048f   阿宝   设备状态,学校管理
476
477
478
              ><el-input
                type="text"
                placeholder="输入所在教室"
23a6dc5f   阿宝   学校管理相关接口简单对接
479
                v-model.trim="form.roomName"
db11048f   阿宝   设备状态,学校管理
480
481
482
483
484
485
486
487
488
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input
            ></el-col>
          </el-form-item>
        </el-form>
        <div class="dialog-footer" slot="footer">
236b1f0e   梁保满   周末-飞书bug
489
          <el-button type="primary" @click="setAnswerEqu">确 定</el-button>
db11048f   阿宝   设备状态,学校管理
490
491
492
          <el-button @click="diaAnswerEqu = false">取 消</el-button>
        </div>
      </el-dialog>
bb778c90   阿宝   设备状态
493
    </div>
4c4f7640   梁保满   路由表,路由前端文件
494
495
496
  </template>
  
  <script>
db11048f   阿宝   设备状态,学校管理
497
498
499
  import pieChart from "@/components/charts/pieChart";
  import scatterChart from "@/components/charts/scatterChart";
  import _ from "lodash";
255e2506   梁保满   飞书bug及优化
500
501
  import { downloadFile, formatClass, formatGradeNameClass } from "@/utils";
  import api from "@/api/apis/apis";
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
502
  import BusEvent from "@/utils/busEvent";
db11048f   阿宝   设备状态,学校管理
503
504
  export default {
    components: { pieChart, scatterChart },
23a6dc5f   阿宝   学校管理相关接口简单对接
505
506
507
508
    watch: {
      type: function (val) {
        this.page = 1;
        this.total = 0;
225a00b6   梁保满   飞书问题解决
509
        this.count = 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
510
511
512
513
514
515
516
517
518
519
520
521
        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   阿宝   设备状态,学校管理
522
523
    data() {
      return {
0e46bc25   梁保满   优化
524
        isAdd: false, //添加还是修改基站
e5ff81a1   阿宝   集团管理员接口
525
        role: "",
d32e461c   梁保满   备题组卷
526
        code: "",
db11048f   阿宝   设备状态,学校管理
527
        loading: false,
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
528
        url: "/api_html/teaching/importStation",
db11048f   阿宝   设备状态,学校管理
529
530
        diaUp: false,
        diaAnswerEqu: false,
23a6dc5f   阿宝   学校管理相关接口简单对接
531
532
        gradeList: [],
        gradeListAll: [],
225a00b6   梁保满   飞书问题解决
533
        schoolAll: [],
e3b0e3e7   梁保满   季度时间格式调整
534
        school: {}, //校园账号所属学校信息
255e2506   梁保满   飞书bug及优化
535
536
537
        props: {
          multiple: true,
          checkStrictly: true,
255e2506   梁保满   飞书bug及优化
538
        },
db11048f   阿宝   设备状态,学校管理
539
540
541
        type: 1,
        query: {
          classId: [],
23a6dc5f   阿宝   学校管理相关接口简单对接
542
543
544
          onlineStatus: "",
          sn: "",
          type: "",
db11048f   阿宝   设备状态,学校管理
545
546
        },
        statusList: [
dbbfc6c5   梁保满   飞书优化及bug
547
          { label: "全部", value: "" },
23a6dc5f   阿宝   学校管理相关接口简单对接
548
          { label: "离线", value: 0 },
db11048f   阿宝   设备状态,学校管理
549
          { label: "在线", value: 1 },
23a6dc5f   阿宝   学校管理相关接口简单对接
550
551
552
553
554
555
556
557
558
559
          { 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   阿宝   设备状态,学校管理
560
561
        ],
        form: {
255e2506   梁保满   飞书bug及优化
562
          deviceId: "",
1365ef5e   梁保满   优化
563
          sn: "",
23a6dc5f   阿宝   学校管理相关接口简单对接
564
565
          frequency: "",
          pairingCode: "",
236b1f0e   梁保满   周末-飞书bug
566
          classIds: "",
23a6dc5f   阿宝   学校管理相关接口简单对接
567
          roomName: "",
db11048f   阿宝   设备状态,学校管理
568
569
        },
        formRules: {
e3b0e3e7   梁保满   季度时间格式调整
570
          sn: [{ required: true, message: "请输入设备编码", trigger: "blur" }],
23a6dc5f   阿宝   学校管理相关接口简单对接
571
572
573
574
          frequency: [{ required: true, message: "请输入频点", trigger: "blur" }],
          pairingCode: [
            { required: true, message: "请输入配对码", trigger: "blur" },
          ],
6d7bd862   梁保满   飞书bug
575
          classIds: [{ required: true, message: "请选择班级", trigger: "blur" }],
db11048f   阿宝   设备状态,学校管理
576
        },
23a6dc5f   阿宝   学校管理相关接口简单对接
577
578
        tableData: [],
        total: 0,
225a00b6   梁保满   飞书问题解决
579
        count: 0,
23a6dc5f   阿宝   学校管理相关接口简单对接
580
581
        chartData: [],
        chartData2: [],
db11048f   阿宝   设备状态,学校管理
582
        selectionTabIds: [],
23a6dc5f   阿宝   学校管理相关接口简单对接
583
584
        page: 1,
        size: 20,
db11048f   阿宝   设备状态,学校管理
585
586
587
      };
    },
    created() {
e3b0e3e7   梁保满   季度时间格式调整
588
      this.code = localStorage.getItem("csCode") || "";
e5ff81a1   阿宝   集团管理员接口
589
590
591
592
593
594
595
      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;
255e2506   梁保满   飞书bug及优化
596
      if (this.role == "ROLE_JITUAN") {
e3b0e3e7   梁保满   季度时间格式调整
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
        (this.props.lazy = true),
          (this.props.lazyLoad = function (node, resolve) {
            const { level } = node;
            if (level == 2) {
              console.log(node);
              api
                .tenantClassList({
                  schoolId: node.data.value,
                })
                .then((res) => {
                  let children = formatGradeNameClass(res.data?.list).sort(
                    (a, b) => {
                      return a.grade - b.grade;
                    }
                  );
                  console.log();
255e2506   梁保满   飞书bug及优化
613
  
e3b0e3e7   梁保满   季度时间格式调整
614
615
616
617
618
619
620
621
622
623
624
                  const nodes = [...children];
                  // 通过调用resolve将子节点数据返回,通知组件数据加载完成
                  resolve(nodes);
                });
            } else {
              resolve(node);
            }
          });
      }
      if (this.role == "ROLE_XUEXIAO") {
        this._QueryDataSchool();
255e2506   梁保满   飞书bug及优化
625
      }
23a6dc5f   阿宝   学校管理相关接口简单对接
626
627
628
      this.stationReport();
      this._QueryGradeList();
      this._QueryData();
225a00b6   梁保满   飞书问题解决
629
630
631
      if (role == "ROLE_JITUAN") {
        this.showSchool();
      }
db11048f   阿宝   设备状态,学校管理
632
    },
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
    activated() {
      const that = this;
      BusEvent.$on("keepAlive", async function () {
        that.type = 1;
        that.page = 1;
        that.total = 0;
        that.count = 0;
        that.query.classId = [];
        that.query.onlineStatus = "";
        that.query.sn = "";
        that.query.type = "";
        that.stationReport();
        that._QueryData();
      });
    },
db11048f   阿宝   设备状态,学校管理
648
    methods: {
e3b0e3e7   梁保满   季度时间格式调整
649
650
651
      upSuccess() {
        //导入成功
        this.diaUp = false;
255e2506   梁保满   飞书bug及优化
652
653
        this._QueryData();
      },
6d7bd862   梁保满   飞书bug
654
      edit(obj) {
0e46bc25   梁保满   优化
655
        this.isAdd = false;
255e2506   梁保满   飞书bug及优化
656
657
        for (let key in this.form) {
          if (key == "classIds") {
e3b0e3e7   梁保满   季度时间格式调整
658
            this.form[key] = obj.classList[0]?.classId;
255e2506   梁保满   飞书bug及优化
659
660
          } else {
            this.form[key] = obj[key];
6d7bd862   梁保满   飞书bug
661
662
          }
        }
0e46bc25   梁保满   优化
663
        delete this.form.schoolId;
e3b0e3e7   梁保满   季度时间格式调整
664
        this.form.deviceId = obj.id;
255e2506   梁保满   飞书bug及优化
665
        this.diaAnswerEqu = true;
6d7bd862   梁保满   飞书bug
666
      },
db11048f   阿宝   设备状态,学校管理
667
668
669
670
671
672
673
674
675
676
      linkTo(obj, type) {
        this.$router.push({
          path: "/deviceLog",
          query: {
            id: obj.id,
            type: type,
          },
        });
      },
      clickPieChart(obj) {
23a6dc5f   阿宝   学校管理相关接口简单对接
677
678
679
680
        this.query.onlineStatus =
          obj.name == "在线" ? 1 : obj.name == "离线" ? 0 : 2;
        this.query.sn = "";
        this.page = 1;
b21d90ef   梁保满   长水登录
681
        this._QueryData(false);
db11048f   阿宝   设备状态,学校管理
682
683
      },
      clickScatterChart(obj) {
23a6dc5f   阿宝   学校管理相关接口简单对接
684
685
686
687
688
689
690
691
692
693
694
695
696
697
        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   梁保满   长水登录
698
        this._QueryData(false);
db11048f   阿宝   设备状态,学校管理
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
      },
      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   阿宝   学校管理相关接口简单对接
714
715
      changePage(page) {
        this.page = page;
b21d90ef   梁保满   长水登录
716
        this._QueryData(false);
23a6dc5f   阿宝   学校管理相关接口简单对接
717
      },
e3b0e3e7   梁保满   季度时间格式调整
718
719
720
721
722
723
      addDev() {
        this.form.sn = "";
        this.form.frequency = "";
        this.form.pairingCode = "";
        this.form.classIds = "";
        this.form.roomName = "";
0e46bc25   梁保满   优化
724
725
726
        this.form.schoolId = this.school.id;
        delete this.form.deviceId;
        this.isAdd = true;
e3b0e3e7   梁保满   季度时间格式调整
727
728
        this.diaAnswerEqu = true;
      },
225a00b6   梁保满   飞书问题解决
729
      async showSchool() {
296f7c47   梁保满   集团管理员接口调整
730
731
        const { data, status, info } = await this.$request.schoolList();
        if (status === 0) {
225a00b6   梁保满   飞书问题解决
732
733
734
735
736
737
738
739
740
741
742
743
744
          this.schoolAll = [
            {
              value: 0,
              label: "全部",
              children: data.list?.map((item) => {
                return {
                  value: item.id,
                  label: item.schoolName,
                };
              }),
            },
          ];
          this.gradeList = [...this.schoolAll, ...this.gradeList];
296f7c47   梁保满   集团管理员接口调整
745
746
747
748
        } else {
          this.$message.error(info);
        }
      },
db11048f   阿宝   设备状态,学校管理
749
750
751
752
753
754
755
      async autoUpDate(id) {
        if (!this.selectionTabIds.length && !id) {
          this.$message.warning("请选择授课端~");
          return;
        }
        if (this.loadingUpDate) return;
        this.loadingUpDate = true;
23a6dc5f   阿宝   学校管理相关接口简单对接
756
        let data = await this.$request.modifyUpgradeFlag({
dd5150c5   阿宝   数据同步
757
          deviceIds: id ? [id] : this.selectionTabIds,
23a6dc5f   阿宝   学校管理相关接口简单对接
758
          upgradeFlag: 1,
db11048f   阿宝   设备状态,学校管理
759
760
761
762
        });
        this.loadingUpDate = false;
        if (data && !data.code) {
          this._QueryData(false);
e5ff81a1   阿宝   集团管理员接口
763
          this.selectionTabIds = [];
db11048f   阿宝   设备状态,学校管理
764
765
          this.$message.success("开启自动更新成功");
        } else {
236b1f0e   梁保满   周末-飞书bug
766
          this.$message.error(data.info);
db11048f   阿宝   设备状态,学校管理
767
768
769
770
771
772
773
774
775
        }
      },
      async stopUpdate(id) {
        if (!this.selectionTabIds.length && !id) {
          this.$message.warning("请选择授课端~");
          return;
        }
        if (this.loadingUpDate) return;
        this.loadingUpDate = true;
23a6dc5f   阿宝   学校管理相关接口简单对接
776
        let data = await this.$request.modifyUpgradeFlag({
dd5150c5   阿宝   数据同步
777
          deviceIds: id ? [id] : this.selectionTabIds,
23a6dc5f   阿宝   学校管理相关接口简单对接
778
          upgradeFlag: 0,
db11048f   阿宝   设备状态,学校管理
779
780
781
        });
        this.loadingUpDate = false;
        if (data && !data.code) {
e5ff81a1   阿宝   集团管理员接口
782
          this.selectionTabIds = [];
db11048f   阿宝   设备状态,学校管理
783
784
785
          this._QueryData(false);
          this.$message.success("关闭自动更新成功");
        } else {
236b1f0e   梁保满   周末-飞书bug
786
          this.$message.error(data.info);
db11048f   阿宝   设备状态,学校管理
787
788
789
        }
      },
      async downExcel() {
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
790
        let { data, status, info }  = await this.$request.stationTemplateUrl({
db11048f   阿宝   设备状态,学校管理
791
792
          id: this.id,
        });
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
793
794
795
796
797
798
        if (status == 0) {
          const a = document.createElement("a");
          a.href = data.downloadUrl;
          document.body.appendChild(a);
          a.click();
          a.remove();
db11048f   阿宝   设备状态,学校管理
799
        } else {
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
800
          this.$message.error(info);
db11048f   阿宝   设备状态,学校管理
801
802
803
        }
      },
  
236b1f0e   梁保满   周末-飞书bug
804
805
      // 修改基站
      setAnswerEqu() {
6d7bd862   梁保满   飞书bug
806
807
808
809
        this.$refs.forms.validate(async (valid) => {
          if (valid) {
            if (this.loadingAnswerEqu) return;
            this.loadingAnswerEqu = true;
255e2506   梁保满   飞书bug及优化
810
            let query = { ...this.form };
236b1f0e   梁保满   周末-飞书bug
811
812
813
814
  
            // query.classIds = query.classIds.map((item) => {
            //   return item[1];
            // });
0e46bc25   梁保满   优化
815
816
817
818
            if (
              typeof query.classIds == "string" ||
              typeof query.classIds == "number"
            ) {
e3b0e3e7   梁保满   季度时间格式调整
819
              query.classIds = [query.classIds];
0e46bc25   梁保满   优化
820
            } else {
e3b0e3e7   梁保满   季度时间格式调整
821
822
              query.classIds = [query.classIds[1]];
            }
0e46bc25   梁保满   优化
823
824
825
826
  
            let deviceApi = this.isAdd
              ? this.$request.addStation
              : this.$request.updateDevice;
e3b0e3e7   梁保满   季度时间格式调整
827
            const { data, status, info } = await deviceApi({
255e2506   梁保满   飞书bug及优化
828
829
              ...query,
            });
6d7bd862   梁保满   飞书bug
830
831
832
            this.loadingAnswerEqu = false;
            console.log(status);
            if (status === 0) {
255e2506   梁保满   飞书bug及优化
833
              this.diaAnswerEqu = false;
1365ef5e   梁保满   优化
834
              this.$message.success(info);
6d7bd862   梁保满   飞书bug
835
              this._QueryData();
0e46bc25   梁保满   优化
836
837
              if (this.isAdd) {
                this.stationReport();
e3b0e3e7   梁保满   季度时间格式调整
838
              }
6d7bd862   梁保满   飞书bug
839
840
841
842
843
844
845
            } else {
              this.$message.error(info);
            }
          } else {
            this.$message.warning("数据有误,请检查!");
          }
        });
db11048f   阿宝   设备状态,学校管理
846
      },
e3b0e3e7   梁保满   季度时间格式调整
847
848
849
850
851
852
853
854
      async _QueryDataSchool() {
        const { data, status, info } = await this.$request.schoolDetail();
        if (status === 0) {
          this.school = { ...data };
        } else {
          this.$message.error(info);
        }
      },
db11048f   阿宝   设备状态,学校管理
855
      // 查找班级
23a6dc5f   阿宝   学校管理相关接口简单对接
856
857
      async _QueryGradeList() {
        this.loading = true;
e5ff81a1   阿宝   集团管理员接口
858
859
860
861
862
        const gradeList =
          this.role != "ROLE_JITUAN"
            ? this.$request.gradeList
            : this.$request.regionList;
        const { data, status, info } = await gradeList();
23a6dc5f   阿宝   学校管理相关接口简单对接
863
864
        if (status === 0) {
          if (!!data.list) {
e5ff81a1   阿宝   集团管理员接口
865
866
867
868
            if (this.role != "ROLE_JITUAN") {
              this.gradeList =
                data.list?.map((item) => {
                  let gradeList = {
1b9bae95   梁保满   级联选择器调整,日志接口调整
869
                    value: item.gradeName,
e5ff81a1   阿宝   集团管理员接口
870
871
872
873
874
                    label: item.gradeName,
                  };
                  gradeList.children =
                    item.classList?.map((items) => {
                      return {
1365ef5e   梁保满   优化
875
                        value: Number(items.id),
e5ff81a1   阿宝   集团管理员接口
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
                        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;
                }) || [];
225a00b6   梁保满   飞书问题解决
897
              this.gradeList = [...this.schoolAll, ...this.gradeList];
e5ff81a1   阿宝   集团管理员接口
898
            }
23a6dc5f   阿宝   学校管理相关接口简单对接
899
900
901
902
903
904
905
          }
        } else {
          this.$message.error(info);
        }
      },
      // 基站统计数据
      async stationReport() {
e5ff81a1   阿宝   集团管理员接口
906
907
908
909
910
        const stationReport =
          this.role != "ROLE_JITUAN"
            ? this.$request.stationReport
            : this.$request.tenantStationReport;
        const { data, status, info } = await stationReport();
23a6dc5f   阿宝   学校管理相关接口简单对接
911
912
913
914
915
        if (status === 0) {
          this.chartData =
            data.list?.map((item) => {
              return {
                name:
e5ff81a1   阿宝   集团管理员接口
916
917
918
919
920
                  item.onlineStatus == "1"
                    ? "在线"
                    : item.onlineStatus == 0
                    ? "离线"
                    : "异常",
296f7c47   梁保满   集团管理员接口调整
921
922
                value: item.total,
                rate: item.rate,
23a6dc5f   阿宝   学校管理相关接口简单对接
923
924
              };
            }) || [];
225a00b6   梁保满   飞书问题解决
925
          this.count = data.total || 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
926
927
928
929
930
931
        } else {
          this.$message.error(info);
        }
      },
      // 答题器统计数据
      async keyboardReport() {
e5ff81a1   阿宝   集团管理员接口
932
933
934
935
936
        const keyboardReport =
          this.role != "ROLE_JITUAN"
            ? this.$request.keyboardReport
            : this.$request.tenantKeyboardReport;
        const { data, status, info } = await keyboardReport();
23a6dc5f   阿宝   学校管理相关接口简单对接
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
        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月以上",
225a00b6   梁保满   飞书问题解决
953
954
                count: item.total,
                value: item.rate * 100,
23a6dc5f   阿宝   学校管理相关接口简单对接
955
956
              };
            }) || [];
225a00b6   梁保满   飞书问题解决
957
          this.count = data.total || 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
958
959
960
        } else {
          this.$message.error(info);
        }
db11048f   阿宝   设备状态,学校管理
961
      },
225a00b6   梁保满   飞书问题解决
962
963
964
      setQuery() {
        //整理传参
        let query = {};
23a6dc5f   阿宝   学校管理相关接口简单对接
965
966
967
        if (this.query.sn) {
          query.sn = this.query.sn;
        } else {
23a6dc5f   阿宝   学校管理相关接口简单对接
968
969
970
971
972
973
974
          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   梁保满   级联选择器调整,日志接口调整
975
976
977
          if (this.role == "ROLE_JITUAN") {
            query.regionIds = [];
            query.schoolIds = [];
255e2506   梁保满   飞书bug及优化
978
979
            query.gradeNames = [];
            query.classIds = [];
1b9bae95   梁保满   级联选择器调整,日志接口调整
980
981
            this.query.classId?.map((item) => {
              if (item.length == 1) {
225a00b6   梁保满   飞书问题解决
982
                if (!query.regionIds.includes(item[0])) {
1b9bae95   梁保满   级联选择器调整,日志接口调整
983
984
                  query.regionIds.push(item[0]);
                }
255e2506   梁保满   飞书bug及优化
985
              } else if (item.length == 2) {
1b9bae95   梁保满   级联选择器调整,日志接口调整
986
987
988
                if (!query.schoolIds.includes(item[1])) {
                  query.schoolIds.push(item[1]);
                }
255e2506   梁保满   飞书bug及优化
989
990
991
992
                query.regionIds.includes(item[0])
                  ? query.regionIds.remove(item[0])
                  : "";
              } else if (item.length == 3) {
1365ef5e   梁保满   优化
993
994
995
                if (!query.schoolIds.includes(item[1])) {
                  query.schoolIds.push(item[1]);
                }
255e2506   梁保满   飞书bug及优化
996
997
                if (!query.gradeNames.includes(item[2])) {
                  query.gradeNames.push(item[2]);
1b9bae95   梁保满   级联选择器调整,日志接口调整
998
                }
255e2506   梁保满   飞书bug及优化
999
1000
1001
                query.regionIds.includes(item[0])
                  ? query.regionIds.remove(item[0])
                  : "";
255e2506   梁保满   飞书bug及优化
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
              } else if (item.length == 4) {
                if (!query.classIds.includes(item[3])) {
                  query.classIds.push(item[3]);
                }
                query.regionIds.includes(item[0])
                  ? query.regionIds.remove(item[0])
                  : "";
                query.schoolIds.includes(item[1])
                  ? query.schoolIds.remove(item[1])
                  : "";
                query.gradeNames.includes(item[2])
                  ? query.gradeNames.remove(item[2])
                  : "";
1b9bae95   梁保满   级联选择器调整,日志接口调整
1015
1016
1017
1018
1019
1020
1021
              }
            });
          } else {
            query.gradeNames = [];
            query.classIds = [];
            this.query.classId?.map((item) => {
              if (item.length == 1) {
225a00b6   梁保满   飞书问题解决
1022
                if (!query.gradeNames.includes(item[0])) {
1b9bae95   梁保满   级联选择器调整,日志接口调整
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
                  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   阿宝   学校管理相关接口简单对接
1036
        }
225a00b6   梁保满   飞书问题解决
1037
        return query;
1b9bae95   梁保满   级联选择器调整,日志接口调整
1038
1039
1040
1041
      },
      // 设备列表信息
      async _QueryData(isRef) {
        this.loading = true;
225a00b6   梁保满   飞书问题解决
1042
        let query = this.setQuery();
1b9bae95   梁保满   级联选择器调整,日志接口调整
1043
1044
        if (isRef) {
          this.page = 1;
b21d90ef   梁保满   长水登录
1045
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
1046
        this.loading = true;
e5ff81a1   阿宝   集团管理员接口
1047
1048
1049
1050
        const deviceList =
          this.role != "ROLE_JITUAN"
            ? this.$request.deviceList
            : this.$request.tenantDeviceList;
6d7bd862   梁保满   飞书bug
1051
        this.tableData = [];
e5ff81a1   阿宝   集团管理员接口
1052
        const { data, status, info } = await deviceList({
23a6dc5f   阿宝   学校管理相关接口简单对接
1053
1054
1055
1056
1057
1058
          ...query,
          deviceType: this.type,
          page: this.page,
          size: this.size,
        });
        this.loading = false;
e5ff81a1   阿宝   集团管理员接口
1059
        if (status == 0) {
225a00b6   梁保满   飞书问题解决
1060
          this.tableData =
255e2506   梁保满   飞书bug及优化
1061
1062
1063
1064
1065
1066
            (data?.list &&
              data?.list.map((item) => {
                item.upgradeFlag = item.upgradeFlag == 1 ? true : false;
                return item;
              })) ||
            [];
0e46bc25   梁保满   优化
1067
  
225a00b6   梁保满   飞书问题解决
1068
          this.total = data.count;
e3b0e3e7   梁保满   季度时间格式调整
1069
1070
          this.$nextTick(function () {
            this.$refs.main.scrollTop = 0;
0e46bc25   梁保满   优化
1071
1072
1073
1074
1075
1076
            if (this.query.classId.length) {
              this.selectionTabIds = this.tableData.map((item) => {
                this.$refs.multipleTable.toggleRowSelection(item);
                return item.id;
              });
            }
e3b0e3e7   梁保满   季度时间格式调整
1077
          });
23a6dc5f   阿宝   学校管理相关接口简单对接
1078
1079
1080
        } else {
          this.$message.error(info);
        }
db11048f   阿宝   设备状态,学校管理
1081
1082
1083
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
1084
1085
  </script>
  
db11048f   阿宝   设备状态,学校管理
1086
1087
  <style lang="scss" scoped>
  .page-content {
1365ef5e   梁保满   优化
1088
1089
1090
    padding: 0 20px;
    height: 100%;
    overflow-y: auto;
db11048f   阿宝   设备状态,学校管理
1091
1092
  }
  .tab-box {
e3b0e3e7   梁保满   季度时间格式调整
1093
    padding: 20px 0 12px;
db11048f   阿宝   设备状态,学校管理
1094
  }
db11048f   阿宝   设备状态,学校管理
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
  .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   梁保满   路由表,路由前端文件
1143
  </style>