md
This commit is contained in:
parent
f819e7c674
commit
02b2a46554
@ -52,29 +52,17 @@
|
|||||||
loading:false,
|
loading:false,
|
||||||
svalue: this.value,
|
svalue: this.value,
|
||||||
optionItems: [],
|
optionItems: [],
|
||||||
// 缺省值
|
|
||||||
defaultItems: null,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(newVal,oldVal) {
|
value(newVal,oldVal) {
|
||||||
if(this.value!=null ){
|
if(this.value!=null ){
|
||||||
this.svalue=this.value;
|
this.svalue=this.value;
|
||||||
// 判断默认值中是否存在,若存在则不继续查询
|
|
||||||
if(this.optionItems){
|
|
||||||
let selItem = this.optionItems.find(item => item.destCode == this.svalue);
|
|
||||||
if(selItem){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.queryData(null,this.svalue);
|
this.queryData(null,this.svalue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
countryCode(newVal, oldVal) {
|
countryCode(newVal, oldVal) {
|
||||||
if(newVal!=oldVal){
|
|
||||||
this.defaultItems=null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -84,13 +72,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClick(){
|
onClick(){
|
||||||
// 第一次点击时需要初始化
|
|
||||||
if(!this.defaultItems){
|
|
||||||
this.queryData(null,null);
|
|
||||||
}else{
|
|
||||||
this.optionItems=[];
|
|
||||||
this.optionItems = [...this.defaultItems];
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onChange() {
|
onChange() {
|
||||||
this.$emit("input", this.svalue);
|
this.$emit("input", this.svalue);
|
||||||
@ -106,14 +88,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.optionItems=[];
|
this.optionItems=[];
|
||||||
this.defaultItems=[];
|
|
||||||
listSimpleEmisDestination(queryParams).then(response => {
|
listSimpleEmisDestination(queryParams).then(response => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.optionItems =response.rows;
|
this.optionItems =response.rows;
|
||||||
// 初始值存储
|
|
||||||
if(key==null && val==null){
|
|
||||||
this.defaultItems=[...this.optionItems]
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user