Commit 07baa686fceba9ebd77b3de3767b33a29d0883db
1 parent
226aff84
fix: device list product field placeholder is null && can not search
Showing
2 changed files
with
7 additions
and
22 deletions
... | ... | @@ -90,6 +90,7 @@ export const searchFormSchema: FormSchema[] = [ |
90 | 90 | { label: '直连设备', value: DeviceTypeEnum.DIRECT_CONNECTION }, |
91 | 91 | { label: '网关子设备', value: DeviceTypeEnum.SENSOR }, |
92 | 92 | ], |
93 | + placeholder: '请选择设备类型', | |
93 | 94 | }, |
94 | 95 | colProps: { span: 6 }, |
95 | 96 | }, |
... | ... | @@ -103,13 +104,14 @@ export const searchFormSchema: FormSchema[] = [ |
103 | 104 | { label: '在线', value: DeviceState.ONLINE }, |
104 | 105 | { label: '离线', value: DeviceState.OFFLINE }, |
105 | 106 | ], |
107 | + placeholder: '请选择设备状态', | |
106 | 108 | }, |
107 | 109 | colProps: { span: 6 }, |
108 | 110 | }, |
109 | 111 | { |
110 | 112 | field: 'deviceProfileId', |
111 | 113 | label: '产品', |
112 | - component: 'ApiSearchSelect', | |
114 | + component: 'ApiSelect', | |
113 | 115 | colProps: { span: 6 }, |
114 | 116 | componentProps: () => { |
115 | 117 | return { |
... | ... | @@ -118,26 +120,9 @@ export const searchFormSchema: FormSchema[] = [ |
118 | 120 | valueField: 'id', |
119 | 121 | resultField: 'data', |
120 | 122 | placeholder: '请选择产品', |
121 | - api: async () => { | |
122 | - const data = await deviceProfile({ params: '' }); | |
123 | - const returnData = data.map((m) => { | |
124 | - return { | |
125 | - name: m.name, | |
126 | - id: m.id, | |
127 | - }; | |
128 | - }); | |
129 | - return returnData; | |
130 | - }, | |
131 | - searchApi: async (params: Recordable) => { | |
132 | - const data = await deviceProfile({ textSearch: params.text }); | |
133 | - const returnData = data.map((m) => { | |
134 | - return { | |
135 | - name: m.name, | |
136 | - id: m.id, | |
137 | - }; | |
138 | - }); | |
139 | - return returnData; | |
140 | - }, | |
123 | + api: deviceProfile, | |
124 | + filterOption: (inputValue: string, option: Record<'label' | 'value', string>) => | |
125 | + option.label.includes(inputValue), | |
141 | 126 | }; |
142 | 127 | }, |
143 | 128 | }, | ... | ... |
... | ... | @@ -287,7 +287,7 @@ |
287 | 287 | setTableData(items); |
288 | 288 | const { setFieldsValue, resetFields } = getForm(); |
289 | 289 | setFieldsValue({ |
290 | - deviceProfileId: deviceProfileId.value, | |
290 | + deviceProfileId: deviceProfileId.value || null, | |
291 | 291 | }); |
292 | 292 | if (onCloseVal.value == 1) { |
293 | 293 | resetFields(); | ... | ... |