Commit 418efbb63e991a78bee2a073834941f3a5da5875
1 parent
5dcc9a60
perf: 云端环境中,物模型键值查询,输入的键或值不存在,应该界面回显为空,而不是全部物模型
Showing
1 changed file
with
11 additions
and
0 deletions
... | ... | @@ -119,6 +119,7 @@ |
119 | 119 | ], |
120 | 120 | }; |
121 | 121 | }); |
122 | + const cacheSearchValue = ref(''); | |
122 | 123 | |
123 | 124 | const [registerForm, { getFieldsValue }] = useForm({ |
124 | 125 | schemas: [ |
... | ... | @@ -141,6 +142,8 @@ |
141 | 142 | |
142 | 143 | pagination.current = 1; |
143 | 144 | |
145 | + cacheSearchValue.value = value; | |
146 | + | |
144 | 147 | socketInfo.filterAttrKeys = value |
145 | 148 | ? unref(socketInfo.rawDataSource) |
146 | 149 | .filter( |
... | ... | @@ -161,6 +164,7 @@ |
161 | 164 | resetFunc: async () => { |
162 | 165 | try { |
163 | 166 | socketInfo.filterAttrKeys = []; |
167 | + cacheSearchValue.value = ''; | |
164 | 168 | handleFilterChange(); |
165 | 169 | unref(mode) === EnumTableCardMode.TABLE && setTableModeData(); |
166 | 170 | } catch (error) {} |
... | ... | @@ -201,8 +205,15 @@ |
201 | 205 | const { createMessage } = useMessage(); |
202 | 206 | |
203 | 207 | const setDataSource = () => { |
208 | + const filterValueByCacheSearchValue = socketInfo.rawDataSource.filter( | |
209 | + (item) => | |
210 | + item.key?.toUpperCase().includes(cacheSearchValue.value.toUpperCase()) || | |
211 | + item.name?.toUpperCase().includes(cacheSearchValue.value.toUpperCase()) | |
212 | + ); | |
204 | 213 | socketInfo.dataSource = socketInfo.filterAttrKeys.length |
205 | 214 | ? socketInfo.rawDataSource.filter((item) => socketInfo.filterAttrKeys.includes(item.key)) |
215 | + : filterValueByCacheSearchValue.length === 0 | |
216 | + ? [] | |
206 | 217 | : socketInfo.rawDataSource; |
207 | 218 | }; |
208 | 219 | ... | ... |