diff --git a/src/views/School/School.vue b/src/views/School/School.vue index f41da94..683b242 100644 --- a/src/views/School/School.vue +++ b/src/views/School/School.vue @@ -22,6 +22,22 @@ > + + + + @@ -286,6 +311,7 @@ export default { }, data() { return { + action: `${process.env.VUE_APP_BASE_API}/api/admin/score/import`, uploadSize, examineKey: 0, isShowAdd: false, @@ -346,8 +372,9 @@ export default { }, }, created() { - this.getArea(); - this.getSchool(); + this.getArea().then(_ => { + this.getSchool(); + }) this.getList(); }, @@ -356,6 +383,19 @@ export default { this.calcTableHeight(); }, methods: { + getToken, + uploadData() { + this.$refs.upload.submit(); + }, + uploadSuccess(response) { + console.log(response) + if (response.hasOwnProperty('errcode')) { + this.$message.error(response.errmsg) + } else { + this.$message.success(`已导入${response.total}条`) + this.getList(true) + } + }, exportMethod() { this.$confirm("请选择导出方式", "提示", { confirmButtonText: "全量导出", diff --git a/src/views/Score/components/ShowScore.vue b/src/views/Score/components/ShowScore.vue index d442b18..d6452e7 100644 --- a/src/views/Score/components/ShowScore.vue +++ b/src/views/Score/components/ShowScore.vue @@ -24,9 +24,7 @@ {{ - school.find((i) => i["id"] === form["school_id"]) - ? school.find((i) => i["id"] === form["school_id"])["name"] - : "" + form['school'] ? form['school'].name : '' }} @@ -96,7 +94,7 @@ export default { code: "", school_id: "", - + school: "", year: "", total_score: "", @@ -122,6 +120,7 @@ export default { try { const detail = await show({ id, + show_relation: ['school'] }); for (let key in this.form) { if (detail.hasOwnProperty(key)) { diff --git a/src/views/Specialty/Specialty.vue b/src/views/Specialty/Specialty.vue index 62ebb50..c8351b5 100644 --- a/src/views/Specialty/Specialty.vue +++ b/src/views/Specialty/Specialty.vue @@ -22,15 +22,27 @@ @click="isShowAdd = true" >新增 - + + 搜索 + > + + :edit-render="{}" + > + + { + this.getSchool(); + }) this.getList(); }, @@ -391,7 +416,20 @@ export default { await this.$refs["ShowSpecialty"].getDetail(row.id); this.isShowDetail = true; }, - + async getArea() { + try { + const res = await areaIndex( + { + page: 1, + page_size: 999, + }, + false + ); + this.area = res.data; + } catch (err) { + console.error(err); + } + }, async getSchool() { try { const res = await schoolIndex( @@ -401,7 +439,11 @@ export default { }, false ); - this.school = res.data; + + this.school = this.area.map(area => ({ + ...area, + children: res.data.filter(school => school.area_id === area.id) + })) } catch (err) { console.error(err); } diff --git a/src/views/Specialty/components/AddSpecialty.vue b/src/views/Specialty/components/AddSpecialty.vue index c52bf81..5229a3c 100644 --- a/src/views/Specialty/components/AddSpecialty.vue +++ b/src/views/Specialty/components/AddSpecialty.vue @@ -30,20 +30,17 @@ - - - + :props="{ + emitPath: false, + value: 'id', + label: 'name', + }"> diff --git a/src/views/Specialty/components/ShowSpecialty.vue b/src/views/Specialty/components/ShowSpecialty.vue index 80c0407..73bb223 100644 --- a/src/views/Specialty/components/ShowSpecialty.vue +++ b/src/views/Specialty/components/ShowSpecialty.vue @@ -10,23 +10,23 @@ @close="$emit('update:isShow',false)">
- + {{ form['code'] }} - + - {{ school.find(i => i['id'] === form['school_id']) ? school.find(i => i['id'] === form['school_id'])['name'] : '' }} + {{ form['school'] ? form['school'].name : '' }} - + {{ form['name'] }} - +
- +
@@ -44,27 +44,27 @@ default: false, required: true }, - + school : { type: Array, default: () => [] }, - + }, data() { return { loading: false, visible: false, form: { - + code: '', - + school_id: '', - + name: '', - + content: '', - + }, } },