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