给单据中商品的搜索框增加500毫秒的延迟搜索功能
This commit is contained in:
@@ -57,6 +57,7 @@
|
|||||||
ids: "",
|
ids: "",
|
||||||
names: "",
|
names: "",
|
||||||
materialData: [],
|
materialData: [],
|
||||||
|
setTimeFlag: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -74,7 +75,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
initComp(name) {
|
initComp(name) {
|
||||||
if(this.kind === 'material') {
|
if(this.kind === 'material') {
|
||||||
this.names = name?name:'输入条码或名称'
|
this.names = name?name:'请输入条码或名称'
|
||||||
} else {
|
} else {
|
||||||
this.names = name
|
this.names = name
|
||||||
}
|
}
|
||||||
@@ -83,11 +84,17 @@
|
|||||||
this.$refs.selectModal.showModal()
|
this.$refs.selectModal.showModal()
|
||||||
},
|
},
|
||||||
handleSearch(value) {
|
handleSearch(value) {
|
||||||
getMaterialByParam({q: value}).then((res) => {
|
let that = this
|
||||||
if (res && res.code === 200) {
|
if(this.setTimeFlag != null){
|
||||||
this.materialData = res.data
|
clearTimeout(this.setTimeFlag);
|
||||||
}
|
}
|
||||||
})
|
this.setTimeFlag = setTimeout(()=>{
|
||||||
|
getMaterialByParam({q: value}).then((res) => {
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
that.materialData = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},500)
|
||||||
},
|
},
|
||||||
handleChange(value) {
|
handleChange(value) {
|
||||||
this.$emit("change", value)
|
this.$emit("change", value)
|
||||||
|
|||||||
Reference in New Issue
Block a user