Blame view

src/views/setUp/school.vue 6.99 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
db11048f   阿宝   设备状态,学校管理
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    <div>
      <back-box>
        <template slot="title">
          <span>学校设置</span>
        </template>
        <template slot="btns">
          <el-tooltip effect="dark" content="导入学校名单" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-upload2"
              size="mini"
              plain
              circle
              @click="diaUp = true"
            ></el-button>
          </el-tooltip>
        </template>
      </back-box>
      <div class="page-content">
        <div class="content-box">
          <i class="el-icon-edit"></i>
          <ul class="school-info">
            <li class="school-item">
              <span class="s1">学校名称:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
26
              <span class="s2">{{ school.schoolName || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
27
28
29
            </li>
            <li class="school-item">
              <span class="s1">授课端管理密码:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
30
              <span class="s2">{{ school.managePwd || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
31
32
33
            </li>
            <li class="school-item">
              <span class="s1">联系人:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
34
              <span class="s2">{{ school.contactPerson || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
35
36
37
            </li>
            <li class="school-item">
              <span class="s1">手机号码:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
38
              <span class="s2">{{ school.contactPhone || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
39
40
41
            </li>
            <li class="school-item">
              <span class="s1">学段:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
42
43
44
              <span class="s2">{{
                school.sections | getSections(school.sections)
              }}</span>
db11048f   阿宝   设备状态,学校管理
45
46
47
            </li>
            <li class="school-item">
              <span class="s1">所属集团:</span>
23a6dc5f   阿宝   学校管理相关接口简单对接
48
              <span class="s2">{{ school.tenantName || "--" }}</span>
db11048f   阿宝   设备状态,学校管理
49
50
51
52
53
            </li>
          </ul>
          <div class="grade-box">
            <p class="h-title">年级管理</p>
            <ul class="grade-info">
23a6dc5f   阿宝   学校管理相关接口简单对接
54
55
56
57
58
59
60
              <li
                class="grade-item"
                v-for="item in tableData"
                :key="item.grade"
                @click="setGrade(item)"
              >
                <p class="grade-name">{{ item.gradeName }}</p>
db11048f   阿宝   设备状态,学校管理
61
                <div class="grade-class">
23a6dc5f   阿宝   学校管理相关接口简单对接
62
63
64
65
66
67
68
69
70
71
                  <p>
                    <i class="fa fa-building"></i>班级:{{
                      item.classList.length
                    }}个
                  </p>
                  <p>
                    <i class="fa fa-book"></i>科目:{{
                      item.subjectNames.length
                    }}个
                  </p>
db11048f   阿宝   设备状态,学校管理
72
73
74
                </div>
              </li>
            </ul>
23a6dc5f   阿宝   学校管理相关接口简单对接
75
76
77
78
79
            <el-empty
              :image-size="100"
              v-if="!tableData.length && loading == false"
              description="没有更多数据"
            ></el-empty>
db11048f   阿宝   设备状态,学校管理
80
81
82
83
84
85
          </div>
        </div>
      </div>
      <el-dialog title="导入学校名单" :visible.sync="diaUp" width="400">
        <up-load id="downDevice" :url="url" fileName="学校名单">
          <p class="down-txt" slot="down">
23a6dc5f   阿宝   学校管理相关接口简单对接
86
            通过Excel名单导入学校名单,点击
db11048f   阿宝   设备状态,学校管理
87
88
89
90
91
92
93
94
            <el-link type="danger" @click="downExcel">模板下载</el-link> 。
          </p>
        </up-load>
        <div class="dialog-footer" slot="footer">
          <el-button @click="diaUp = false">取 消</el-button>
        </div>
      </el-dialog>
    </div>
4c4f7640   梁保满   路由表,路由前端文件
95
96
97
  </template>
  
  <script>
db11048f   阿宝   设备状态,学校管理
98
  import { downloadFile } from "@/utils";
4c4f7640   梁保满   路由表,路由前端文件
99
  export default {
23a6dc5f   阿宝   学校管理相关接口简单对接
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    filters: {
      getSections(val) {
        let arr = val.split(",");
        let sections = arr.map((item) => {
          let txt;
          switch (item) {
            case "0":
              txt = "未知";
              break;
            case "1":
              txt = "小学";
              break;
            case "2":
              txt = "初中";
              break;
            case "3":
              txt = "高中";
              break;
            case "4":
              txt = "大学";
              break;
            case "7":
              txt = "未知";
              break;
            default:
              txt = "未知";
          }
          return txt;
        });
        return sections.join(",");
      },
    },
db11048f   阿宝   设备状态,学校管理
132
133
134
135
    data() {
      return {
        url: "xxx",
        diaUp: false,
23a6dc5f   阿宝   学校管理相关接口简单对接
136
        loading: false,
db11048f   阿宝   设备状态,学校管理
137
        school: {
23a6dc5f   阿宝   学校管理相关接口简单对接
138
139
140
141
142
143
          schoolName: "长水实验中学",
          managePwd: "123456",
          contactPerson: "张老师",
          contactPhone: "13548645321",
          sections: "初中",
          tenantName: "长水集团",
db11048f   阿宝   设备状态,学校管理
144
        },
23a6dc5f   阿宝   学校管理相关接口简单对接
145
        tableData: [],
db11048f   阿宝   设备状态,学校管理
146
147
      };
    },
23a6dc5f   阿宝   学校管理相关接口简单对接
148
149
150
151
    created() {
      this._QueryDataSchool();
      this._QueryDataGrade();
    },
db11048f   阿宝   设备状态,学校管理
152
    methods: {
23a6dc5f   阿宝   学校管理相关接口简单对接
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
      setGrade(obj) {},
      async _QueryDataSchool() {
        this.loading = true;
        const { data, status, info } = await this.$request.schoolDetail();
        this.loading = false;
        console.log(status);
        if (status === 0) {
          this.school = { ...data };
        } 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   阿宝   设备状态,学校管理
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
      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);
        }
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
191
192
  </script>
  
db11048f   阿宝   设备状态,学校管理
193
194
195
196
197
198
199
200
201
202
203
  <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   阿宝   学校管理相关接口简单对接
204
205
        padding: 5px;
        font-size: 18px;
db11048f   阿宝   设备状态,学校管理
206
        cursor: pointer;
23a6dc5f   阿宝   学校管理相关接口简单对接
207
208
        &:hover {
          color: #36f;
db11048f   阿宝   设备状态,学校管理
209
210
211
212
213
214
215
        }
      }
    }
    .school-info {
      display: flex;
      flex-wrap: wrap;
      padding: 16px 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
216
      border-bottom: 0.5px solid #f2f2f2;
db11048f   阿宝   设备状态,学校管理
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
      .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;
23a6dc5f   阿宝   学校管理相关接口简单对接
235
      .grade-info {
db11048f   阿宝   设备状态,学校管理
236
        display: flex;
23a6dc5f   阿宝   学校管理相关接口简单对接
237
238
239
240
241
242
        flex-wrap: wrap;
        padding: 20px;
        .grade-item {
          width: 300px;
          margin-right: 50px;
          margin-bottom: 40px;
db11048f   阿宝   设备状态,学校管理
243
          box-sizing: border-box;
23a6dc5f   阿宝   学校管理相关接口简单对接
244
245
          padding: 12px 16px;
          border-radius: 10px;
db11048f   阿宝   设备状态,学校管理
246
          box-shadow: 1px 1px 3px #888;
23a6dc5f   阿宝   学校管理相关接口简单对接
247
248
249
250
251
252
          cursor: pointer;
          transition: all .5s;
          &:hover{
            transform: translate(-2px,-5px);
            box-shadow: 5px 5px 10px #888;
          }
db11048f   阿宝   设备状态,学校管理
253
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
254
255
        .grade-name {
          font-size: 16px;
db11048f   阿宝   设备状态,学校管理
256
257
          font-weight: bold;
          line-height: 18px;
23a6dc5f   阿宝   学校管理相关接口简单对接
258
          padding-bottom: 12px;
db11048f   阿宝   设备状态,学校管理
259
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
260
        .grade-class {
db11048f   阿宝   设备状态,学校管理
261
262
          display: flex;
          justify-content: space-between;
23a6dc5f   阿宝   学校管理相关接口简单对接
263
264
265
266
267
268
          font-size: 15px;
          padding-right: 20px;
          .fa {
            font-size: 18px;
            margin-right: 5px;
            color: #a4a4a4;
db11048f   阿宝   设备状态,学校管理
269
          }
23a6dc5f   阿宝   学校管理相关接口简单对接
270
271
          .fa-book {
            font-size: 20px;
db11048f   阿宝   设备状态,学校管理
272
273
274
275
276
          }
        }
      }
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
277
  </style>