|
@@ -28,7 +28,8 @@ export default {
|
|
placeholder: { type: String, default: "请选择学期" },
|
|
placeholder: { type: String, default: "请选择学期" },
|
|
value: { type: [Number, String], default: "" },
|
|
value: { type: [Number, String], default: "" },
|
|
clearable: { type: Boolean, default: true },
|
|
clearable: { type: Boolean, default: true },
|
|
- defaultSelectInUsed: { type: Boolean, default: false },
|
|
|
|
|
|
+ defaultSelect: { type: Boolean, default: false },
|
|
|
|
+ enable: { type: Boolean, default: null },
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -51,10 +52,12 @@ export default {
|
|
async search() {
|
|
async search() {
|
|
this.optionList = [];
|
|
this.optionList = [];
|
|
|
|
|
|
- const res = await commonSemesterQuery({}, "SEMESTER");
|
|
|
|
|
|
+ let data = {};
|
|
|
|
+ if (this.enable !== null) data.enable = this.enable;
|
|
|
|
+ const res = await commonSemesterQuery(data);
|
|
this.optionList = res;
|
|
this.optionList = res;
|
|
|
|
|
|
- if (this.defaultSelectInUsed) this.selectDefault();
|
|
|
|
|
|
+ if (this.defaultSelect && !this.value) this.selectDefault();
|
|
},
|
|
},
|
|
select() {
|
|
select() {
|
|
this.$emit("input", this.selected);
|
|
this.$emit("input", this.selected);
|
|
@@ -64,10 +67,11 @@ export default {
|
|
);
|
|
);
|
|
},
|
|
},
|
|
selectDefault() {
|
|
selectDefault() {
|
|
- const defaultCollege = this.optionList.find((item) => item.inUsed);
|
|
|
|
|
|
+ const defaultCollege = this.optionList[0];
|
|
if (defaultCollege) {
|
|
if (defaultCollege) {
|
|
this.selected = defaultCollege.id;
|
|
this.selected = defaultCollege.id;
|
|
- this.select();
|
|
|
|
|
|
+ this.$emit("input", this.selected);
|
|
|
|
+ this.$emit("default-selected", defaultCollege);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|