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