Showing
1 changed file
with
14 additions
and
6 deletions
| ... | ... | @@ -68,7 +68,7 @@ export default { |
| 68 | 68 | placeholder: '搜索', |
| 69 | 69 | // 使用稳定对象,避免因重新渲染创建新对象导致列表 reload |
| 70 | 70 | listQuery: {}, |
| 71 | - listExtra: { keyword: '' } | |
| 71 | + listExtra: { keyword: '', name: '' } | |
| 72 | 72 | } |
| 73 | 73 | }, |
| 74 | 74 | computed: { |
| ... | ... | @@ -114,7 +114,7 @@ export default { |
| 114 | 114 | this.$emit('update:visible', false) |
| 115 | 115 | }, |
| 116 | 116 | fetchList({ pageIndex, pageSize, query, extra }) { |
| 117 | - const keyword = (extra && (extra.keyword || extra.key || extra.name)) || '' | |
| 117 | + const name = (extra && (extra.name || extra.keyword || extra.key)) || '' | |
| 118 | 118 | if (typeof this.fetchFn === 'function') { |
| 119 | 119 | return this.fetchFn({ pageIndex, pageSize, query, extra }) |
| 120 | 120 | } |
| ... | ... | @@ -122,7 +122,7 @@ export default { |
| 122 | 122 | try { |
| 123 | 123 | // 客户池 |
| 124 | 124 | if (this.source === 'customer') { |
| 125 | - const params = { pageIndex, pageSize, keyword } | |
| 125 | + const params = { pageIndex, pageSize, name } | |
| 126 | 126 | return customerQueryApi(params).then(res => { |
| 127 | 127 | const _data = res.data || {} |
| 128 | 128 | const records = _data.datas || [] |
| ... | ... | @@ -132,7 +132,7 @@ export default { |
| 132 | 132 | }) |
| 133 | 133 | } else if (this.source === 'user') { |
| 134 | 134 | // 人员表 |
| 135 | - const params = { pageIndex, pageSize, keyword, key: keyword, name: keyword, username: keyword } | |
| 135 | + const params = { pageIndex, pageSize, name, username: name } | |
| 136 | 136 | return userSelector(params).then(res => { |
| 137 | 137 | const _data = res.data || {} |
| 138 | 138 | const records = _data.datas || _data.records || _data.list || [] |
| ... | ... | @@ -168,12 +168,20 @@ export default { |
| 168 | 168 | clearTimeout(this.searchDebounceTimer) |
| 169 | 169 | this.searchDebounceTimer = setTimeout(() => { |
| 170 | 170 | this.searchKeywordDebounced = this.searchKeyword |
| 171 | - this.listExtra.keyword = this.searchKeyword | |
| 171 | + if (this.source === 'customer' || this.source === 'user') { | |
| 172 | + this.listExtra.name = this.searchKeyword | |
| 173 | + } else { | |
| 174 | + this.listExtra.keyword = this.searchKeyword | |
| 175 | + } | |
| 172 | 176 | }, 300) |
| 173 | 177 | }, |
| 174 | 178 | onConfirmSearch() { |
| 175 | 179 | this.searchKeywordDebounced = this.searchKeyword |
| 176 | - this.listExtra.keyword = this.searchKeyword | |
| 180 | + if (this.source === 'customer' || this.source === 'user') { | |
| 181 | + this.listExtra.name = this.searchKeyword | |
| 182 | + } else { | |
| 183 | + this.listExtra.keyword = this.searchKeyword | |
| 184 | + } | |
| 177 | 185 | }, |
| 178 | 186 | onCancel() { this.close() }, |
| 179 | 187 | onConfirm() { | ... | ... |