|
@@ -44,6 +44,7 @@
|
|
|
v-model="modalForm.campusId"
|
|
|
placeholder="请选择所属校区"
|
|
|
style="width: 100%;"
|
|
|
+ @change="updateCourses"
|
|
|
></campus-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="collegeId" label="学院:">
|
|
@@ -60,16 +61,23 @@
|
|
|
cascader
|
|
|
placeholder="请选择专业"
|
|
|
style="width: 100%;"
|
|
|
+ @change="updateCourses"
|
|
|
></major-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="clazzId" label="班级:">
|
|
|
- <class-select
|
|
|
+ <el-select
|
|
|
v-model="modalForm.clazzId"
|
|
|
- :major-id="modalForm.majorId"
|
|
|
- cascader
|
|
|
placeholder="请选择班级"
|
|
|
style="width: 100%;"
|
|
|
- ></class-select>
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in courses"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer">
|
|
@@ -82,7 +90,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { updateStudent } from "../api";
|
|
|
+import { updateStudent, unitQueryByType } from "../api";
|
|
|
|
|
|
const initModalForm = {
|
|
|
id: null,
|
|
@@ -179,13 +187,15 @@ export default {
|
|
|
trigger: "change"
|
|
|
}
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+ courses: []
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
initData(val) {
|
|
|
if (val.id) {
|
|
|
this.modalForm = this.$objAssign(initModalForm, val);
|
|
|
+ this.getCourses();
|
|
|
} else {
|
|
|
this.modalForm = { ...initModalForm };
|
|
|
}
|
|
@@ -199,6 +209,22 @@ export default {
|
|
|
open() {
|
|
|
this.modalIsShow = true;
|
|
|
},
|
|
|
+ updateCourses() {
|
|
|
+ this.modalForm.clazzId = "";
|
|
|
+ this.getCourses();
|
|
|
+ },
|
|
|
+ async getCourses() {
|
|
|
+ this.courses = [];
|
|
|
+ if (!this.modalForm.campusId || !this.modalForm.majorId) return;
|
|
|
+ const res = await unitQueryByType(
|
|
|
+ {
|
|
|
+ campusId: this.modalForm.campusId,
|
|
|
+ majorId: this.modalForm.majorId
|
|
|
+ },
|
|
|
+ "CLAZZ"
|
|
|
+ );
|
|
|
+ this.courses = res;
|
|
|
+ },
|
|
|
async submit() {
|
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
|
if (!valid) return;
|