Commit 40c7b32e by 李伟康

fix(OrderPopup): 优化员工列表搜索功能

- 修改 getList 方法,增加 search 参数来区分是否是搜索操作
- 更新 handleSearch 方法,传入 true 表示是搜索操作
- 在 popupType 变化时重置 searchValue
-
1 parent 8b836871
......@@ -31,10 +31,10 @@ export default {
mounted () {
},
methods: {
async getList (searchValue) {
async getList (searchValue, search) {
const { userInfo, params, apiData } = this
this.currentId = ''
if (!searchValue && apiData && apiData.length) {
if (!search && apiData && apiData.length) {
this.list = apiData
return
}
......@@ -46,12 +46,12 @@ export default {
})
if (data && data.length) {
this.list = data
if (!searchValue) this.$emit('update:apiData', data)
this.$emit('update:apiData', data)
}
},
handleSearch (searchValue) {
this.list = []
this.getList(searchValue)
this.getList(searchValue, true)
},
choose (i) {
this.currentId = i.uuid
......
......@@ -117,8 +117,9 @@ export default {
watch: {
popupType: {
handler (val) {
// console.log(val)
this.searchValue = ''
},
deep: true,
immediate: true
},
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!