Showing
2 changed files
with
116 additions
and
114 deletions
1 | - | |
1 | +import { QxBaseIcon } from '@qx/common'; | |
2 | +import type { ModalProps } from 'antd'; | |
3 | +import { Modal, Radio, Select, Typography } from 'antd'; | |
2 | 4 | import React, { useEffect, useMemo, useState } from 'react'; |
3 | 5 | import { |
4 | 6 | getAggreList, |
... | ... | @@ -6,17 +8,9 @@ import { |
6 | 8 | getDatasetListByAppid, |
7 | 9 | getFunList, |
8 | 10 | } from './service'; |
9 | -import { | |
10 | - Modal, | |
11 | - Radio, | |
12 | - Select, | |
13 | - Typography, | |
14 | -} from 'antd'; | |
15 | -import type { ModalProps } from 'antd'; | |
16 | -import {QxBaseIcon} from '@qx/common'; | |
17 | 11 | |
12 | +import '../style/reset.less'; | |
18 | 13 | import './styles.less'; |
19 | -import '../style/reset.less' | |
20 | 14 | |
21 | 15 | const { Title, Text } = Typography; |
22 | 16 | /** |
... | ... | @@ -127,78 +121,83 @@ const RelItemOption: React.FC<any> = (riProps) => { |
127 | 121 | |
128 | 122 | //搜索 |
129 | 123 | const filterOption = (input: string, option: any) => |
130 | - (option?.name ?? '').toLowerCase().includes(input.toLowerCase()); | |
124 | + (option?.name ?? '').toLowerCase().includes(input.toLowerCase()); | |
131 | 125 | |
132 | 126 | return ( |
133 | - <> | |
134 | - <Title level={5} style={{ margin: '16px 0 8px' }}> | |
135 | - {riProps.title} | |
136 | - </Title> | |
137 | - <div style={{ width: '100%'}}> | |
138 | - <Select | |
139 | - showSearch | |
140 | - style={{ width: '100%', height: '36px' }} | |
141 | - placeholder={riProps.placeholder || '请选择数据源'} | |
142 | - options={list} | |
143 | - value={item?.code} | |
144 | - onChange={(val)=>{ | |
145 | - const _list = list.filter((el: any) => el.code === val); | |
146 | - if(_list?.length) { | |
147 | - riProps.onChange(_list[0]) | |
148 | - } | |
149 | - }} | |
150 | - dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |
151 | - getPopupContainer={() => document.body} | |
152 | - filterOption={filterOption} | |
153 | - fieldNames={{ | |
154 | - label: 'name', | |
155 | - value: 'code' | |
156 | - }} | |
157 | - /> | |
158 | - {/*<Popover*/} | |
159 | - {/* content={menus}*/} | |
160 | - {/* open={visible}*/} | |
161 | - {/* trigger={'click'}*/} | |
162 | - {/* onOpenChange={handleVisibleChange}*/} | |
163 | - {/* placement="bottomLeft"*/} | |
164 | - {/* overlayClassName={'qx-fg-select-overlay'}*/} | |
165 | - {/* getPopupContainer={(triggerNode) => triggerNode}*/} | |
166 | - {/*>*/} | |
167 | - {/* <div*/} | |
168 | - {/* className={`ant-input qx-fr-input--fake select-source`}*/} | |
169 | - {/* >*/} | |
170 | - {/* <div>*/} | |
171 | - {/* {item?.name ? (*/} | |
172 | - {/* item.name*/} | |
173 | - {/* ) : (*/} | |
174 | - {/* <Text type="secondary">{riProps.placeholder}</Text>*/} | |
175 | - {/* )}*/} | |
176 | - {/* </div>*/} | |
177 | - {/* <DownOutlined />*/} | |
178 | - {/* </div>*/} | |
179 | - {/*</Popover>*/} | |
180 | - </div> | |
181 | - </> | |
127 | + <> | |
128 | + <Title level={5} style={{ margin: '16px 0 8px' }}> | |
129 | + {riProps.title} | |
130 | + </Title> | |
131 | + <div style={{ width: '100%' }}> | |
132 | + <Select | |
133 | + showSearch | |
134 | + style={{ width: '100%', height: '36px' }} | |
135 | + placeholder={riProps.placeholder || '请选择数据源'} | |
136 | + options={list} | |
137 | + value={item?.code} | |
138 | + onChange={(val) => { | |
139 | + const _list = list.filter((el: any) => el.code === val); | |
140 | + if (_list?.length) { | |
141 | + riProps.onChange(_list[0]); | |
142 | + } | |
143 | + }} | |
144 | + dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |
145 | + getPopupContainer={() => document.body} | |
146 | + filterOption={filterOption} | |
147 | + fieldNames={{ | |
148 | + label: 'name', | |
149 | + value: 'code', | |
150 | + }} | |
151 | + /> | |
152 | + {/*<Popover*/} | |
153 | + {/* content={menus}*/} | |
154 | + {/* open={visible}*/} | |
155 | + {/* trigger={'click'}*/} | |
156 | + {/* onOpenChange={handleVisibleChange}*/} | |
157 | + {/* placement="bottomLeft"*/} | |
158 | + {/* overlayClassName={'qx-fg-select-overlay'}*/} | |
159 | + {/* getPopupContainer={(triggerNode) => triggerNode}*/} | |
160 | + {/*>*/} | |
161 | + {/* <div*/} | |
162 | + {/* className={`ant-input qx-fr-input--fake select-source`}*/} | |
163 | + {/* >*/} | |
164 | + {/* <div>*/} | |
165 | + {/* {item?.name ? (*/} | |
166 | + {/* item.name*/} | |
167 | + {/* ) : (*/} | |
168 | + {/* <Text type="secondary">{riProps.placeholder}</Text>*/} | |
169 | + {/* )}*/} | |
170 | + {/* </div>*/} | |
171 | + {/* <DownOutlined />*/} | |
172 | + {/* </div>*/} | |
173 | + {/*</Popover>*/} | |
174 | + </div> | |
175 | + </> | |
182 | 176 | ); |
183 | 177 | }; |
184 | 178 | /* 聚合表组件 */ |
185 | 179 | const AggreOption: React.FC<any> = (_props: any) => { |
180 | + //搜索 | |
181 | + const filterOption = (input: string, option: any) => | |
182 | + (option?.label ?? '').toLowerCase().includes(input.toLowerCase()); | |
183 | + | |
186 | 184 | return ( |
187 | - <> | |
188 | - <Title level={5} style={{ margin: '16px 0 8px' }}> | |
189 | - {_props.title} | |
190 | - </Title> | |
191 | - <Select | |
192 | - allowClear | |
193 | - style={{ width: '100%', height: '36px' }} | |
194 | - placeholder={_props.placeholder || '请选择数据源'} | |
195 | - options={_props.aggreList} | |
196 | - value={_props.aggreValue} | |
197 | - onChange={_props.onChange} | |
198 | - dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |
199 | - getPopupContainer={() => document.body} | |
200 | - /> | |
201 | - </> | |
185 | + <> | |
186 | + <Title level={5} style={{ margin: '16px 0 8px' }}> | |
187 | + {_props.title} | |
188 | + </Title> | |
189 | + <Select | |
190 | + showSearch | |
191 | + filterOption={filterOption} | |
192 | + style={{ width: '100%', height: '36px' }} | |
193 | + placeholder={_props.placeholder || '请选择数据源'} | |
194 | + options={_props.aggreList} | |
195 | + value={_props.aggreValue} | |
196 | + onChange={_props.onChange} | |
197 | + dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |
198 | + getPopupContainer={() => document.body} | |
199 | + /> | |
200 | + </> | |
202 | 201 | ); |
203 | 202 | }; |
204 | 203 | |
... | ... | @@ -206,43 +205,43 @@ const AggreOption: React.FC<any> = (_props: any) => { |
206 | 205 | * 表单类型选择 |
207 | 206 | */ |
208 | 207 | const TableTypeNode: React.FC<any> = (_typeProps: any) => { |
209 | - const {showTableTypeTab, flag} = _typeProps | |
208 | + const { showTableTypeTab, flag } = _typeProps; | |
210 | 209 | return ( |
211 | - <> | |
212 | - {showTableTypeTab && ( | |
213 | - <Radio.Group | |
214 | - onChange={(e: any) => _typeProps.radioChange(e, _typeProps.appData)} | |
215 | - value={_typeProps.radioType} | |
216 | - defaultValue={_typeProps.defaultRadioType} | |
217 | - optionType="button" | |
218 | - style={{ | |
219 | - width: '100%', | |
220 | - textAlign: 'center', | |
221 | - display: flag === 'join' ? '' : 'none', | |
222 | - height: '36px', | |
223 | - }} | |
224 | - > | |
225 | - <Radio.Button | |
226 | - value="single" | |
227 | - style={{ | |
228 | - width: '50%', | |
229 | - height: '36px', | |
230 | - }} | |
231 | - > | |
232 | - 表单 | |
233 | - </Radio.Button> | |
234 | - <Radio.Button | |
235 | - value="join" | |
236 | - style={{ | |
237 | - width: '50%', | |
238 | - height: '36px', | |
239 | - }} | |
240 | - > | |
241 | - 聚合表 | |
242 | - </Radio.Button> | |
243 | - </Radio.Group> | |
244 | - )} | |
245 | - </> | |
210 | + <> | |
211 | + {showTableTypeTab && ( | |
212 | + <Radio.Group | |
213 | + onChange={(e: any) => _typeProps.radioChange(e, _typeProps.appData)} | |
214 | + value={_typeProps.radioType} | |
215 | + defaultValue={_typeProps.defaultRadioType} | |
216 | + optionType="button" | |
217 | + style={{ | |
218 | + width: '100%', | |
219 | + textAlign: 'center', | |
220 | + display: flag === 'join' ? '' : 'none', | |
221 | + height: '36px', | |
222 | + }} | |
223 | + > | |
224 | + <Radio.Button | |
225 | + value="single" | |
226 | + style={{ | |
227 | + width: '50%', | |
228 | + height: '36px', | |
229 | + }} | |
230 | + > | |
231 | + 表单 | |
232 | + </Radio.Button> | |
233 | + <Radio.Button | |
234 | + value="join" | |
235 | + style={{ | |
236 | + width: '50%', | |
237 | + height: '36px', | |
238 | + }} | |
239 | + > | |
240 | + 聚合表 | |
241 | + </Radio.Button> | |
242 | + </Radio.Group> | |
243 | + )} | |
244 | + </> | |
246 | 245 | ); |
247 | 246 | }; |
248 | 247 | |
... | ... | @@ -285,9 +284,11 @@ export const QxAppSelector: React.FC<QxAppSelectProps> = ({ |
285 | 284 | return; |
286 | 285 | } |
287 | 286 | if (props?.haveChildren) { |
288 | - getFunList(request, targetItem.code, { hasChild: true }).then((re: any) => { | |
289 | - setFormList(re); | |
290 | - }); | |
287 | + getFunList(request, targetItem.code, { hasChild: true }).then( | |
288 | + (re: any) => { | |
289 | + setFormList(re); | |
290 | + }, | |
291 | + ); | |
291 | 292 | } else { |
292 | 293 | getFunList(request, targetItem.code).then((re: any) => { |
293 | 294 | setFormList(re); | ... | ... |