- {{
- showAll ? "收起" : "更多..."
- }}
+ {{ showAll ? "收起" : "更多..." }}
import { downloadFile } from "@/utils";
export default {
- 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(",");
- },
- },
data() {
return {
code: "", //长水跳转标志
@@ -335,6 +304,18 @@ export default {
diaUpgradeGrade: false, //班级升级
};
},
+ 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(",");
+ },
+ },
created() {
this.code = localStorage.getItem("csCode") || "";
this._QueryDataSchool();
@@ -466,13 +447,18 @@ export default {
this.loading = true;
const { data, status, info } = await this.$request.schoolDetail();
this.loading = false;
- console.log(status);
if (status === 0) {
this.school = { ...data };
for (let key in this.formSchool) {
- this.formSchool[key] = data[key] || "";
+ if (key == "sections") {
+ this.formSchool.sections = data[key].split(",").map((item) => {
+ console.log(Number(item));
+ return Number(item);
+ });
+ } else {
+ this.formSchool[key] = data[key] || "";
+ }
}
- this.formSchool.sections = this.formSchool.sections.split(",");
} else {
this.$message.error(info);
}