Blame view

src/views/basic/setUp/school.vue 12.5 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
db11048f   阿宝   设备状态,学校管理
2
3
4
5
6
    <div>
      <back-box>
        <template slot="title">
          <span>学校设置</span>
        </template>
db11048f   阿宝   设备状态,学校管理
7
8
9
      </back-box>
      <div class="page-content">
        <div class="content-box">
560c12f2   阿宝   学校设置,软件下载
10
          <i class="el-icon-edit" @click="diaSchool = true"></i>
db11048f   阿宝   设备状态,学校管理
11
12
13
          <ul class="school-info">
            <li class="school-item">
              <span class="s1">学校名称:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
14
              <span class="s2">{{ school.schoolName || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
15
16
17
            </li>
            <li class="school-item">
              <span class="s1">授课端管理密码:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
18
              <span class="s2">{{ school.managePwd || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
19
20
21
            </li>
            <li class="school-item">
              <span class="s1">联系人:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
22
              <span class="s2">{{ school.contactPerson || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
23
24
25
            </li>
            <li class="school-item">
              <span class="s1">手机号码:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
26
              <span class="s2">{{ school.contactPhone || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
27
28
29
            </li>
            <li class="school-item">
              <span class="s1">学段:</span>
5a287197   梁保满   学校修改学段
30
              <span class="s2">{{ sections }}</span>
db11048f   阿宝   设备状态,学校管理
31
32
33
            </li>
            <li class="school-item">
              <span class="s1">所属集团:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
34
              <span class="s2">{{ school.tenantName || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
35
            </li>
4c2fb560   梁保满   反馈新需求
36
37
38
39
            <li class="school-item">
              <span class="s1">基站登录密码 :</span>
              <span class="s2">{{ school.stationPwd || "--" }}</span>
            </li>
db11048f   阿宝   设备状态,学校管理
40
41
          </ul>
          <div class="grade-box">
e5e4a3e6   梁保满   v1.3
42
43
            <p class="h-title">
              年级管理
8ef22809   梁保满   软件下载页面添加.net环境下载
44
              <span v-if="!code" class="popconfirm-box" @click="diaUpgradeGrade = true">
e5e4a3e6   梁保满   v1.3
45
                年级升级<i class="fa fa-level-up"></i>
8ef22809   梁保满   软件下载页面添加.net环境下载
46
              </span>
e5e4a3e6   梁保满   v1.3
47
            </p>
db11048f   阿宝   设备状态,学校管理
48
            <ul class="grade-info">
23a6dc5f   阿宝   学校管理相关接口简单对接
49
50
51
52
              <li
                class="grade-item"
                v-for="item in tableData"
                :key="item.grade"
23a6dc5f   阿宝   学校管理相关接口简单对接
53
54
              >
                <p class="grade-name">{{ item.gradeName }}</p>
db11048f   阿宝   设备状态,学校管理
55
                <div class="grade-class">
23a6dc5f   阿宝   学校管理相关接口简单对接
56
57
58
59
60
61
62
63
64
65
                  <p>
                    <i class="fa fa-building"></i>班级:{{
                      item.classList.length
                    }}个
                  </p>
                  <p>
                    <i class="fa fa-book"></i>科目:{{
                      item.subjectNames.length
                    }}个
                  </p>
db11048f   阿宝   设备状态,学校管理
66
67
68
                </div>
              </li>
            </ul>
23a6dc5f   阿宝   学校管理相关接口简单对接
69
70
71
72
73
            <el-empty
              :image-size="100"
              v-if="!tableData.length && loading == false"
              description="没有更多数据"
            ></el-empty>
db11048f   阿宝   设备状态,学校管理
74
75
76
          </div>
        </div>
      </div>
5cfb0264   梁保满   班级管理交互优化
77
      <el-dialog :close-on-click-modal="false" title="修改学校信息" :visible.sync="diaSchool" width="400">
560c12f2   阿宝   学校设置,软件下载
78
        <el-form
225a00b6   梁保满   飞书问题解决
79
          ref="formSchool"
560c12f2   阿宝   学校设置,软件下载
80
81
82
83
84
85
86
87
88
          class="form-box"
          :model="formSchool"
          :rules="rulesSchool"
          label-width="160px"
        >
          <el-form-item label="学段:" prop="sections">
            <el-checkbox-group v-model="formSchool.sections">
              <el-checkbox
                v-for="item in sectionsList"
c3cdce9c   梁保满   bug
89
90
                :label="item.code"
                :key="item.code"
b9dd8ed5   梁保满   学校设置已选学段不允许取消
91
                :disabled="defaultSections.includes(item.code)"
560c12f2   阿宝   学校设置,软件下载
92
93
94
95
96
97
98
                >{{ item.name }}</el-checkbox
              >
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="授课端管理密码:" prop="managePwd">
            <el-col :span="10">
              <el-input
225a00b6   梁保满   飞书问题解决
99
                maxlength="20"
560c12f2   阿宝   学校设置,软件下载
100
                v-model="formSchool.managePwd"
225a00b6   梁保满   飞书问题解决
101
                show-password
560c12f2   阿宝   学校设置,软件下载
102
103
104
105
                placeholder="请输入授课端管理密码"
              ></el-input>
            </el-col>
          </el-form-item>
4c2fb560   梁保满   反馈新需求
106
107
108
109
110
111
112
113
114
115
          <el-form-item label="基站登录密码:" prop="stationPwd">
            <el-col :span="10">
              <el-input
                maxlength="6"
                v-model="formSchool.stationPwd"
                show-password
                placeholder="请输入基站登录密码"
              ></el-input>
            </el-col>
          </el-form-item>
560c12f2   阿宝   学校设置,软件下载
116
117
118
119
120
121
122
123
124
125
126
          <el-form-item label="联系人:" prop="contactPerson"
            ><el-col :span="10"
              ><el-input
                maxlength="30"
                v-model="formSchool.contactPerson"
                placeholder="请输入联系人"
              ></el-input></el-col
          ></el-form-item>
          <el-form-item label="手机号码:" prop="contactPhone"
            ><el-col :span="10"
              ><el-input
560c12f2   阿宝   学校设置,软件下载
127
                v-model="formSchool.contactPhone"
e5ff81a1   阿宝   集团管理员接口
128
                type="number"
ca39cc52   阿宝   飞书问题处理
129
                oninput="if(value.length > 11) value = value.slice(0,11)"
560c12f2   阿宝   学校设置,软件下载
130
131
132
133
134
135
136
137
138
                placeholder="请输入联系人手机号码"
              ></el-input></el-col
          ></el-form-item>
        </el-form>
        <div class="dialog-footer" slot="footer">
          <el-button @click="editSchool">确 定</el-button>
          <el-button @click="diaSchool = false">取 消</el-button>
        </div>
      </el-dialog>
5cfb0264   梁保满   班级管理交互优化
139
      <el-dialog :close-on-click-modal="false" title="班级升级" :visible.sync="diaUpgradeGrade" width="400">
e5e4a3e6   梁保满   v1.3
140
141
142
143
144
145
146
147
        <p>注意该操作会将所有年级升级,请谨慎操作!</p>
        <div class="dialog-footer" slot="footer">
          <el-button type="danger" @click="_UpgradeGrade()">确认升级</el-button>
          <el-button type="primary" @click="diaUpgradeGrade = false"
            >取 消</el-button
          >
        </div>
      </el-dialog>
db11048f   阿宝   设备状态,学校管理
148
    </div>
4c4f7640   梁保满   路由表,路由前端文件
149
150
151
  </template>
  
  <script>
db11048f   阿宝   设备状态,学校管理
152
  import { downloadFile } from "@/utils";
4c4f7640   梁保满   路由表,路由前端文件
153
  export default {
db11048f   阿宝   设备状态,学校管理
154
155
    data() {
      return {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
156
        code: "", //长水跳转标志
560c12f2   阿宝   学校设置,软件下载
157
        loading: false,
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
158
        url: "/api_html/school/manager/importClassAndStudent",
560c12f2   阿宝   学校设置,软件下载
159
        diaSchool: false,
db11048f   阿宝   设备状态,学校管理
160
        school: {
dd5150c5   阿宝   数据同步
161
162
163
164
165
166
          schoolName: "",
          managePwd: "",
          contactPerson: "",
          contactPhone: "",
          sections: "",
          tenantName: "",
db11048f   阿宝   设备状态,学校管理
167
        },
23a6dc5f   阿宝   学校管理相关接口简单对接
168
        tableData: [],
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
169
170
        formSchool: {
          //修改学校
560c12f2   阿宝   学校设置,软件下载
171
172
          sections: "",
          managePwd: "",
4c2fb560   梁保满   反馈新需求
173
          stationPwd: "",
560c12f2   阿宝   学校设置,软件下载
174
175
176
177
178
179
180
          contactPerson: "",
          contactPhone: "",
        },
        rulesSchool: {
          sections: [{ required: true, message: "请选择学段", trigger: "blur" }],
          managePwd: [
            { required: true, message: "请填写管理密码", trigger: "blur" },
225a00b6   梁保满   飞书问题解决
181
182
183
184
185
186
            {
              min: 8,
              max: 20,
              message: "长度在 8 到 20 个字符",
              trigger: "blur",
            },
560c12f2   阿宝   学校设置,软件下载
187
          ],
4c2fb560   梁保满   反馈新需求
188
189
190
191
192
193
194
195
196
          stationPwd: [
            { required: true, message: "请填写基站登陆密码", trigger: "blur" },
            {
              min: 6,
              max: 6,
              message: "长度为 6 个字符",
              trigger: "blur",
            },
          ],
560c12f2   阿宝   学校设置,软件下载
197
        },
ca39cc52   阿宝   飞书问题处理
198
        subjectName: "",
c3cdce9c   梁保满   bug
199
        sectionsList: [],
e5e4a3e6   梁保满   v1.3
200
        diaUpgradeGrade: false, //班级升级
b9dd8ed5   梁保满   学校设置已选学段不允许取消
201
        defaultSections: [],
db11048f   阿宝   设备状态,学校管理
202
203
      };
    },
5a287197   梁保满   学校修改学段
204
205
206
207
208
209
210
211
212
213
214
215
    computed: {
      sections: function () {
        let arr = this.formSchool.sections || [];
        let sections = [];
        this.sectionsList.map((item) => {
          if (arr.includes(item.code)) {
            sections.push(item.name);
          }
        });
        return sections.join(",");
      },
    },
23a6dc5f   阿宝   学校管理相关接口简单对接
216
    created() {
7812e986   梁保满   班主任查看报表添加额外信息
217
      this.code = this.$store.getters.csCode;
23a6dc5f   阿宝   学校管理相关接口简单对接
218
219
      this._QueryDataSchool();
      this._QueryDataGrade();
c3cdce9c   梁保满   bug
220
      this._QuerySectionList();
23a6dc5f   阿宝   学校管理相关接口简单对接
221
    },
db11048f   阿宝   设备状态,学校管理
222
    methods: {
0761e2ba   梁保满   分班和学校管理调整
223
     
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
224
225
      editSchool() {
        //保存修改学校信息
560c12f2   阿宝   学校设置,软件下载
226
227
228
229
230
231
232
233
        if (!this.formSchool.sections.length) {
          this.$message.error("请选择学段!");
          return;
        }
        if (!this.formSchool.managePwd) {
          this.$message.error("请填写密码!");
          return;
        }
4c2fb560   梁保满   反馈新需求
234
235
236
237
        if (!this.formSchool.stationPwd) {
          this.$message.error("请填写基站登录密码!");
          return;
        }
560c12f2   阿宝   学校设置,软件下载
238
239
240
        if (this.loading) {
          return;
        }
225a00b6   梁保满   飞书问题解决
241
242
243
244
245
246
247
248
249
250
251
252
253
        this.$refs.formSchool.validate(async (valid) => {
          if (valid) {
            this.loading = true;
            let form = { ...this.formSchool };
            form.sections = this.formSchool.sections.join(",");
            const { data, status, info } = await this.$request.updateSchool({
              ...form,
            });
            this.loading = false;
            if (status === 0) {
              this.$message.success("修改成功~");
              this.diaSchool = false;
              this._QueryDataSchool();
62e1818e   梁保满   学校设置学段刷新年级列表,添加学生...
254
              this._QueryDataGrade();
225a00b6   梁保满   飞书问题解决
255
256
257
258
259
260
            } else {
              this.$message.error(info);
            }
          } else {
            this.$message.error("数据有误,请检查!");
          }
dd5150c5   阿宝   数据同步
261
        });
560c12f2   阿宝   学校设置,软件下载
262
      },
0454f787   梁保满   班级管理,班级列表修改,科目设置
263
      
e5e4a3e6   梁保满   v1.3
264
265
266
267
268
269
270
271
      async _UpgradeGrade() {
        this.loading = true;
        const { data, status, info } = await this.$request.upgradeGrade();
        this.loading = false;
        if (status === 0) {
          this.$message.success("升级成功~");
          this.diaUpgradeGrade = false;
          this._QueryDataGrade();
dd5150c5   阿宝   数据同步
272
273
274
275
        } else {
          this.$message.error(info);
        }
      },
0454f787   梁保满   班级管理,班级列表修改,科目设置
276
  
c3cdce9c   梁保满   bug
277
278
279
280
281
282
283
284
285
286
      async _QuerySectionList() {
        //学校学段
        const { data, status, info } = await this.$request.sectionList();
        console.log(status);
        if (status === 0) {
          this.sectionsList = data?.list || [];
        } else {
          this.$message.error(info);
        }
      },
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
287
288
      async _QueryDataSchool() {
        //学校详情
23a6dc5f   阿宝   学校管理相关接口简单对接
289
290
291
        this.loading = true;
        const { data, status, info } = await this.$request.schoolDetail();
        this.loading = false;
23a6dc5f   阿宝   学校管理相关接口简单对接
292
293
        if (status === 0) {
          this.school = { ...data };
560c12f2   阿宝   学校设置,软件下载
294
          for (let key in this.formSchool) {
5a287197   梁保满   学校修改学段
295
296
297
298
299
300
301
302
            if (key == "sections") {
              this.formSchool.sections = data[key].split(",").map((item) => {
                console.log(Number(item));
                return Number(item);
              });
            } else {
              this.formSchool[key] = data[key] || "";
            }
560c12f2   阿宝   学校设置,软件下载
303
          }
b9dd8ed5   梁保满   学校设置已选学段不允许取消
304
          this.defaultSections = [...this.formSchool.sections];
23a6dc5f   阿宝   学校管理相关接口简单对接
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
        } else {
          this.$message.error(info);
        }
      },
      async _QueryDataGrade() {
        this.loading = true;
        const { data, status, info } = await this.$request.gradeList();
        this.loading = false;
        console.log(status);
        if (status === 0) {
          this.tableData = data.list || [];
        } else {
          this.$message.error(info);
        }
      },
db11048f   阿宝   设备状态,学校管理
320
321
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
322
323
  </script>
  
db11048f   阿宝   设备状态,学校管理
324
325
326
327
328
329
330
331
332
333
334
  <style lang="scss" scoped>
  .page-content {
    padding: 20px;
    .content-box {
      background: #f8f8f8;
      border-radius: 16px;
      position: relative;
      .el-icon-edit {
        position: absolute;
        top: 12px;
        right: 12px;
23a6dc5f   阿宝   学校管理相关接口简单对接
335
336
        padding: 5px;
        font-size: 18px;
db11048f   阿宝   设备状态,学校管理
337
        cursor: pointer;
23a6dc5f   阿宝   学校管理相关接口简单对接
338
339
        &:hover {
          color: #36f;
db11048f   阿宝   设备状态,学校管理
340
341
342
343
344
345
346
        }
      }
    }
    .school-info {
      display: flex;
      flex-wrap: wrap;
      padding: 16px 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
347
      border-bottom: 0.5px solid #f2f2f2;
db11048f   阿宝   设备状态,学校管理
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
      .school-item {
        width: 50%;
        line-height: 48px;
        padding-left: 100px;
        display: flex;
        box-sizing: border-box;
        .s1 {
          width: 160px;
          font-size: 15px;
          color: #888;
        }
        .s2 {
          flex: 1;
        }
      }
    }
    .grade-box {
      padding: 20px;
e5e4a3e6   梁保满   v1.3
366
367
368
369
370
371
372
373
      .h-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .popconfirm-box {
          cursor: pointer;
          font-size: 14px;
          color: #999;
c3cdce9c   梁保满   bug
374
375
376
          .fa-level-up {
            font-size: 16px;
            padding-left: 2px;
e5e4a3e6   梁保满   v1.3
377
378
379
380
381
382
          }
          &:hover {
            color: #f30;
          }
        }
      }
23a6dc5f   阿宝   学校管理相关接口简单对接
383
      .grade-info {
db11048f   阿宝   设备状态,学校管理
384
        display: flex;
23a6dc5f   阿宝   学校管理相关接口简单对接
385
386
387
        flex-wrap: wrap;
        padding: 20px;
        .grade-item {
ca39cc52   阿宝   飞书问题处理
388
          width: calc((100% - 100px) / 3);
23a6dc5f   阿宝   学校管理相关接口简单对接
389
390
          margin-right: 50px;
          margin-bottom: 40px;
db11048f   阿宝   设备状态,学校管理
391
          box-sizing: border-box;
23a6dc5f   阿宝   学校管理相关接口简单对接
392
393
          padding: 12px 16px;
          border-radius: 10px;
db11048f   阿宝   设备状态,学校管理
394
          box-shadow: 1px 1px 3px #888;
560c12f2   阿宝   学校设置,软件下载
395
396
397
          transition: all 0.5s;
          &:hover {
            transform: translate(-2px, -5px);
23a6dc5f   阿宝   学校管理相关接口简单对接
398
399
            box-shadow: 5px 5px 10px #888;
          }
ca39cc52   阿宝   飞书问题处理
400
401
402
          &:nth-of-type(3n) {
            margin-right: 0;
          }
db11048f   阿宝   设备状态,学校管理
403
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
404
405
        .grade-name {
          font-size: 16px;
db11048f   阿宝   设备状态,学校管理
406
407
          font-weight: bold;
          line-height: 18px;
23a6dc5f   阿宝   学校管理相关接口简单对接
408
          padding-bottom: 12px;
db11048f   阿宝   设备状态,学校管理
409
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
410
        .grade-class {
db11048f   阿宝   设备状态,学校管理
411
412
          display: flex;
          justify-content: space-between;
23a6dc5f   阿宝   学校管理相关接口简单对接
413
414
415
416
417
418
          font-size: 15px;
          padding-right: 20px;
          .fa {
            font-size: 18px;
            margin-right: 5px;
            color: #a4a4a4;
db11048f   阿宝   设备状态,学校管理
419
          }
23a6dc5f   阿宝   学校管理相关接口简单对接
420
421
          .fa-book {
            font-size: 20px;
db11048f   阿宝   设备状态,学校管理
422
423
424
425
426
          }
        }
      }
    }
  }
560c12f2   阿宝   学校设置,软件下载
427
428
  .form-box {
    margin: 0 20px;
560c12f2   阿宝   学校设置,软件下载
429
  }
ca39cc52   阿宝   飞书问题处理
430
  .el-icon-plus {
dd5150c5   阿宝   数据同步
431
    cursor: pointer;
ca39cc52   阿宝   飞书问题处理
432
433
    &:hover {
      color: #667ffd;
dd5150c5   阿宝   数据同步
434
435
    }
  }
ec6394d1   梁保满   v1.3.1。细节调整
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
  :deep(.el-checkbox-group) {
    display: flex;
    flex-wrap: wrap;
    .p1 {
      padding-right: 30px;
      position: relative;
      &:hover {
        .el-icon-delete {
          display: block;
        }
        .is-checked + .el-icon-delete {
          display: none;
        }
      }
    }
    .el-icon-delete {
      font-size: 14px;
      color: #999;
      position: absolute;
      right: 10px;
      top: 13px;
      cursor: pointer;
      display: none;
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
461
  </style>