Commit 35c8e73f851eced75beb9ec99869f9c8c0d0c49d

Authored by 史婷婷
1 parent d68093e9

feat: relate-select优化 增加筛选逻辑

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