|
@@ -29,36 +29,40 @@
|
|
|
<Form ref="FilterForm" label-position="left" inline>
|
|
|
<FormItem>
|
|
|
<Select
|
|
|
- v-model="filter.subject"
|
|
|
- @on-change="subjectChange"
|
|
|
- placeholder="选择科目"
|
|
|
+ v-model="filter.areaCode"
|
|
|
+ @on-change="areaChange"
|
|
|
+ placeholder="选择考区"
|
|
|
>
|
|
|
<Option
|
|
|
- v-for="(subject, index) in subjects"
|
|
|
- :key="index"
|
|
|
- :value="subject.subject"
|
|
|
- >{{ subject.name }}</Option
|
|
|
- >
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem>
|
|
|
- <Select v-model="filter.areaCode" placeholder="选择考区">
|
|
|
- <Option
|
|
|
- v-for="area in areas"
|
|
|
- :key="area.id"
|
|
|
+ v-for="area in cascadeList"
|
|
|
+ :key="area.areaCode"
|
|
|
:value="area.areaCode"
|
|
|
:label="area.areaName"
|
|
|
></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
- <Select v-model="filter.schoolId" placeholder="选择学校">
|
|
|
- <Option value=""></Option>
|
|
|
+ <Select
|
|
|
+ v-model="filter.school"
|
|
|
+ @on-change="schoolChange"
|
|
|
+ placeholder="学校"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="(item, index) in schools"
|
|
|
+ :key="index"
|
|
|
+ :value="item.school"
|
|
|
+ :label="item.school"
|
|
|
+ ></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
- <Select v-model="filter.examRoom" placeholder="选择考场">
|
|
|
- <Option value=""></Option>
|
|
|
+ <Select v-model="filter.examRoom" placeholder="考场">
|
|
|
+ <Option
|
|
|
+ v-for="(room, index) in rooms"
|
|
|
+ :key="index"
|
|
|
+ :value="room"
|
|
|
+ :label="room"
|
|
|
+ ></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
|
|
@@ -98,7 +102,7 @@
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
- <Select v-model="filter.upload" placeholder="选择状态">
|
|
|
+ <Select v-model="filter.upload" placeholder="是否上传">
|
|
|
<Option
|
|
|
v-for="(val, key) in PAPER_UPLOAD_TYPE"
|
|
|
:key="key"
|
|
@@ -166,6 +170,7 @@
|
|
|
</import-file>
|
|
|
<!-- modify-student -->
|
|
|
<modify-student
|
|
|
+ :cascade-list="cascadeList"
|
|
|
:instance="curStudent"
|
|
|
@modified="getList"
|
|
|
ref="ModifyStudent"
|
|
@@ -174,7 +179,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { areaList, subjectList, studentPageList, deleteStudent } from "@/api";
|
|
|
+import {
|
|
|
+ subjectList,
|
|
|
+ studentPageList,
|
|
|
+ deleteStudent,
|
|
|
+ areaSchoolRoomCascadeList
|
|
|
+} from "@/api";
|
|
|
import ImportFile from "@/components/common/ImportFile";
|
|
|
import ModifyStudent from "./components/ModifyStudent";
|
|
|
import { BOOLEAN_TYPE, PAPER_UPLOAD_TYPE } from "@/constants/enumerate";
|
|
@@ -186,15 +196,15 @@ export default {
|
|
|
return {
|
|
|
filter: {
|
|
|
workId: this.$route.params.workId,
|
|
|
- name: "",
|
|
|
- schoolId: "",
|
|
|
+ subject: null,
|
|
|
+ areaCode: null,
|
|
|
+ school: "",
|
|
|
examRoom: "",
|
|
|
startNumber: null,
|
|
|
endNumber: null,
|
|
|
- subject: null,
|
|
|
- areaCode: null,
|
|
|
+ name: "",
|
|
|
upload: null,
|
|
|
- isAbsent: 0
|
|
|
+ isAbsent: null
|
|
|
},
|
|
|
current: 1,
|
|
|
size: this.GLOBAL.pageSize,
|
|
@@ -202,7 +212,9 @@ export default {
|
|
|
students: [],
|
|
|
curStudent: {},
|
|
|
subjects: [],
|
|
|
- areas: [],
|
|
|
+ cascadeList: [],
|
|
|
+ schools: [],
|
|
|
+ rooms: [],
|
|
|
BOOLEAN_TYPE,
|
|
|
PAPER_UPLOAD_TYPE,
|
|
|
columns: [
|
|
@@ -232,7 +244,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
title: "学校",
|
|
|
- key: "sourceName",
|
|
|
+ key: "school",
|
|
|
minWidth: 150
|
|
|
},
|
|
|
{
|
|
@@ -298,12 +310,12 @@ export default {
|
|
|
methods: {
|
|
|
async iniData() {
|
|
|
await this.getSubjects();
|
|
|
+ this.getAreaList();
|
|
|
this.getList();
|
|
|
},
|
|
|
async getList() {
|
|
|
const datas = {
|
|
|
- // ...this.filter,
|
|
|
- workId: this.filter.workId,
|
|
|
+ ...this.filter,
|
|
|
page: this.current - 1,
|
|
|
size: this.size
|
|
|
};
|
|
@@ -328,17 +340,7 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
async getAreaList() {
|
|
|
- const data = await areaList({
|
|
|
- workId: this.filter.workId,
|
|
|
- subject: this.filter.subject
|
|
|
- });
|
|
|
- this.areas = data.map(item => {
|
|
|
- return {
|
|
|
- id: item.id,
|
|
|
- areaName: item.areaName,
|
|
|
- areaCode: item.areaCode
|
|
|
- };
|
|
|
- });
|
|
|
+ this.cascadeList = await areaSchoolRoomCascadeList(this.filter.workId);
|
|
|
},
|
|
|
async getSubjects() {
|
|
|
const data = await subjectList(this.filter.workId);
|
|
@@ -352,9 +354,24 @@ export default {
|
|
|
this.columns.splice(this.columns.length - 1, 0, column);
|
|
|
});
|
|
|
},
|
|
|
- subjectChange() {
|
|
|
- this.filter.areaCode = "";
|
|
|
- this.getAreaList();
|
|
|
+ areaChange() {
|
|
|
+ const curArea = this.cascadeList.find(
|
|
|
+ item => item.areaCode === this.filter.areaCode
|
|
|
+ );
|
|
|
+ this.schools = curArea.schools;
|
|
|
+ this.rooms = [];
|
|
|
+ this.filter.examRoom = null;
|
|
|
+ if (curArea.schools.length === 1) {
|
|
|
+ this.filter.school = curArea.schools[0].school;
|
|
|
+ this.schoolChange();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ schoolChange() {
|
|
|
+ const curSchool = this.schools.find(
|
|
|
+ item => item.school === this.filter.school
|
|
|
+ );
|
|
|
+ this.rooms = curSchool.rooms;
|
|
|
+ this.filter.examRoom = null;
|
|
|
},
|
|
|
toEdit(row) {
|
|
|
this.curStudent = row;
|
|
@@ -390,6 +407,7 @@ export default {
|
|
|
uploadSuccess(result) {
|
|
|
if (!result.success) return;
|
|
|
this.getList();
|
|
|
+ this.getAreaList();
|
|
|
},
|
|
|
toDelete(row) {
|
|
|
this.$Modal.confirm({
|