Commit 40c7b32e by 李伟康

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

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