|
@@ -10,25 +10,31 @@
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in optionList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- :label="`${item.name}(${item.code})`"
|
|
|
+ :key="item.basicCourseId"
|
|
|
+ :value="item.basicCourseId"
|
|
|
+ :label="`${item.courseName}(${item.courseCode})`"
|
|
|
>
|
|
|
- <span>{{ `${item.name}(${item.code})` }}</span>
|
|
|
+ <span>{{ `${item.courseName}(${item.courseCode})` }}</span>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { courseQuery } from "../../modules/base/api";
|
|
|
+import { courseQueryByOrg } from "../../modules/base/api";
|
|
|
|
|
|
export default {
|
|
|
- name: "base-course-select",
|
|
|
+ name: "org-course-select",
|
|
|
props: {
|
|
|
disabled: { type: Boolean, default: false },
|
|
|
placeholder: { type: String, default: "请选择" },
|
|
|
value: { type: [Number, String], default: "" },
|
|
|
clearable: { type: Boolean, default: true },
|
|
|
+ filterParam: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -43,30 +49,27 @@ export default {
|
|
|
this.selected = val;
|
|
|
},
|
|
|
},
|
|
|
- teachingRoomId(val, oldval) {
|
|
|
- if (val !== oldval) {
|
|
|
- this.search("");
|
|
|
+ filterParam(val, oldval) {
|
|
|
+ if (JSON.stringify(val) !== JSON.stringify(oldval)) {
|
|
|
+ this.search();
|
|
|
this.$emit("input", "");
|
|
|
this.$emit("change", {});
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- async created() {
|
|
|
- this.search();
|
|
|
- },
|
|
|
methods: {
|
|
|
- async search(query) {
|
|
|
- const res = await courseQuery({
|
|
|
- param: query,
|
|
|
- teachingRoomId: this.teachingRoomId,
|
|
|
- });
|
|
|
- this.optionList = res.basicCourseList;
|
|
|
+ async search() {
|
|
|
+ this.optionList = [];
|
|
|
+ if (!this.filterParam.examId || !this.filterParam.belongOrgId) return;
|
|
|
+
|
|
|
+ const res = await courseQueryByOrg(this.filterParam);
|
|
|
+ this.optionList = res || [];
|
|
|
},
|
|
|
select() {
|
|
|
this.$emit("input", this.selected);
|
|
|
this.$emit(
|
|
|
"change",
|
|
|
- this.optionList.find((item) => item.id === this.selected)
|
|
|
+ this.optionList.find((item) => item.basicCourseId === this.selected)
|
|
|
);
|
|
|
},
|
|
|
},
|