Commit 5a287197980464337d165d0971eefd9dfd35643a
1 parent
31f6e0f6
学校修改学段
Showing
1 changed file
with
27 additions
and
41 deletions
src/views/standard/setUp/school.vue
... | ... | @@ -49,9 +49,7 @@ |
49 | 49 | </li> |
50 | 50 | <li class="school-item"> |
51 | 51 | <span class="s1">学段:</span> |
52 | - <span class="s2">{{ | |
53 | - school.sections | getSections(school.sections) | |
54 | - }}</span> | |
52 | + <span class="s2">{{ sections }}</span> | |
55 | 53 | </li> |
56 | 54 | <li class="school-item"> |
57 | 55 | <span class="s1">所属集团:</span> |
... | ... | @@ -124,9 +122,12 @@ |
124 | 122 | > |
125 | 123 | <el-form-item label="科目:" prop="subjectNames"> |
126 | 124 | <div class="subject-box" :class="showAll ? 'active' : ''"> |
127 | - <span v-show="subjectList.length > 12" class="showAll" @click="showAll = !showAll">{{ | |
128 | - showAll ? "收起" : "更多..." | |
129 | - }}</span> | |
125 | + <span | |
126 | + v-show="subjectList.length > 12" | |
127 | + class="showAll" | |
128 | + @click="showAll = !showAll" | |
129 | + >{{ showAll ? "收起" : "更多..." }}</span | |
130 | + > | |
130 | 131 | <el-checkbox-group v-model="formGrade.subjectNames"> |
131 | 132 | <el-checkbox |
132 | 133 | v-for="item in subjectList" |
... | ... | @@ -239,38 +240,6 @@ |
239 | 240 | <script> |
240 | 241 | import { downloadFile } from "@/utils"; |
241 | 242 | export default { |
242 | - filters: { | |
243 | - getSections(val) { | |
244 | - let arr = val.split(","); | |
245 | - let sections = arr.map((item) => { | |
246 | - let txt; | |
247 | - switch (item) { | |
248 | - case "0": | |
249 | - txt = "未知"; | |
250 | - break; | |
251 | - case "1": | |
252 | - txt = "小学"; | |
253 | - break; | |
254 | - case "2": | |
255 | - txt = "初中"; | |
256 | - break; | |
257 | - case "3": | |
258 | - txt = "高中"; | |
259 | - break; | |
260 | - case "4": | |
261 | - txt = "大学"; | |
262 | - break; | |
263 | - case "7": | |
264 | - txt = "未知"; | |
265 | - break; | |
266 | - default: | |
267 | - txt = "未知"; | |
268 | - } | |
269 | - return txt; | |
270 | - }); | |
271 | - return sections.join(","); | |
272 | - }, | |
273 | - }, | |
274 | 243 | data() { |
275 | 244 | return { |
276 | 245 | code: "", //长水跳转标志 |
... | ... | @@ -335,6 +304,18 @@ export default { |
335 | 304 | diaUpgradeGrade: false, //班级升级 |
336 | 305 | }; |
337 | 306 | }, |
307 | + computed: { | |
308 | + sections: function () { | |
309 | + let arr = this.formSchool.sections || []; | |
310 | + let sections = []; | |
311 | + this.sectionsList.map((item) => { | |
312 | + if (arr.includes(item.code)) { | |
313 | + sections.push(item.name); | |
314 | + } | |
315 | + }); | |
316 | + return sections.join(","); | |
317 | + }, | |
318 | + }, | |
338 | 319 | created() { |
339 | 320 | this.code = localStorage.getItem("csCode") || ""; |
340 | 321 | this._QueryDataSchool(); |
... | ... | @@ -466,13 +447,18 @@ export default { |
466 | 447 | this.loading = true; |
467 | 448 | const { data, status, info } = await this.$request.schoolDetail(); |
468 | 449 | this.loading = false; |
469 | - console.log(status); | |
470 | 450 | if (status === 0) { |
471 | 451 | this.school = { ...data }; |
472 | 452 | for (let key in this.formSchool) { |
473 | - this.formSchool[key] = data[key] || ""; | |
453 | + if (key == "sections") { | |
454 | + this.formSchool.sections = data[key].split(",").map((item) => { | |
455 | + console.log(Number(item)); | |
456 | + return Number(item); | |
457 | + }); | |
458 | + } else { | |
459 | + this.formSchool[key] = data[key] || ""; | |
460 | + } | |
474 | 461 | } |
475 | - this.formSchool.sections = this.formSchool.sections.split(","); | |
476 | 462 | } else { |
477 | 463 | this.$message.error(info); |
478 | 464 | } | ... | ... |