md
This commit is contained in:
parent
f819e7c674
commit
02b2a46554
@ -52,29 +52,17 @@
|
||||
loading:false,
|
||||
svalue: this.value,
|
||||
optionItems: [],
|
||||
// 缺省值
|
||||
defaultItems: null,
|
||||
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(newVal,oldVal) {
|
||||
if(this.value!=null ){
|
||||
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);
|
||||
}
|
||||
},
|
||||
countryCode(newVal, oldVal) {
|
||||
if(newVal!=oldVal){
|
||||
this.defaultItems=null;
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
@ -84,13 +72,7 @@
|
||||
},
|
||||
methods: {
|
||||
onClick(){
|
||||
// 第一次点击时需要初始化
|
||||
if(!this.defaultItems){
|
||||
this.queryData(null,null);
|
||||
}else{
|
||||
this.optionItems=[];
|
||||
this.optionItems = [...this.defaultItems];
|
||||
}
|
||||
|
||||
},
|
||||
onChange() {
|
||||
this.$emit("input", this.svalue);
|
||||
@ -106,14 +88,9 @@
|
||||
};
|
||||
|
||||
this.optionItems=[];
|
||||
this.defaultItems=[];
|
||||
listSimpleEmisDestination(queryParams).then(response => {
|
||||
this.loading = false;
|
||||
this.optionItems =response.rows;
|
||||
// 初始值存储
|
||||
if(key==null && val==null){
|
||||
this.defaultItems=[...this.optionItems]
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user