|
@@ -53,13 +53,15 @@
|
|
|
<el-select
|
|
|
v-model="ruleForm.school"
|
|
|
filterable
|
|
|
+ clearable
|
|
|
+ @clear="clearSchoolList"
|
|
|
placeholder="请输入学校"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in options"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -168,6 +170,9 @@ export default {
|
|
|
},
|
|
|
tx: require("../assets/avatar2.png"),
|
|
|
options: [],
|
|
|
+ list: [],
|
|
|
+ loading: false,
|
|
|
+ schoolList: [],
|
|
|
num: "",
|
|
|
dialogVisibleSuccess: false,
|
|
|
copyText: "",
|
|
@@ -196,6 +201,22 @@ export default {
|
|
|
}
|
|
|
this.ruleForm.region = "广东省" + loc;
|
|
|
},
|
|
|
+ remoteMethod(query) {
|
|
|
+ if (query !== "") {
|
|
|
+ this.loading = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.options = this.list.filter((item) => {
|
|
|
+ return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
|
+ });
|
|
|
+ }, 200);
|
|
|
+ } else {
|
|
|
+ this.options = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clearSchoolList() {
|
|
|
+ this.options = [];
|
|
|
+ },
|
|
|
getSchool() {
|
|
|
let params = {
|
|
|
n: "",
|
|
@@ -203,8 +224,10 @@ export default {
|
|
|
this.ajax
|
|
|
.get(this.$store.state.api + "getSchool", params)
|
|
|
.then((res) => {
|
|
|
- debugger;
|
|
|
- this.options = res.data[0];
|
|
|
+ this.schoolList = res.data[0];
|
|
|
+ this.list = this.schoolList.map((item) => {
|
|
|
+ return { value: item.id, label: item.name };
|
|
|
+ });
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.error(err);
|