Showing
2 changed files
with
28 additions
and
6 deletions
... | ... | @@ -7,6 +7,7 @@ import { QxAppSelector } from '../qx-app-selector'; |
7 | 7 | import type { InputSelectProps } from '../qx-input-select'; |
8 | 8 | import { QxInputSelect } from '../qx-input-select'; |
9 | 9 | |
10 | +import { getFunInfo } from './service'; | |
10 | 11 | import './styles.less'; |
11 | 12 | |
12 | 13 | const prefix = 'qx-form-select'; |
... | ... | @@ -25,7 +26,7 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => { |
25 | 26 | request, |
26 | 27 | disabled, |
27 | 28 | placeholder, |
28 | - title | |
29 | + title, | |
29 | 30 | } = props; |
30 | 31 | |
31 | 32 | const [state, setState] = useSetState<FormSelectState>({ |
... | ... | @@ -39,10 +40,25 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => { |
39 | 40 | if (!val?.code) return; |
40 | 41 | function onOk() { |
41 | 42 | if (val?.code) { |
42 | - onChange?.(val); | |
43 | - setState({ | |
44 | - visible: false, | |
45 | - }); | |
43 | + getFunInfo(request, val.code) | |
44 | + .then((res: any) => { | |
45 | + if (res) { | |
46 | + onChange?.({ | |
47 | + ...res, | |
48 | + appId: res.extract?.appId || val.appId, | |
49 | + isTree: res.extract?.isTree, | |
50 | + funId: res.code, | |
51 | + }); | |
52 | + } | |
53 | + setState({ | |
54 | + visible: false, | |
55 | + }); | |
56 | + }) | |
57 | + .catch(() => { | |
58 | + setState({ | |
59 | + visible: false, | |
60 | + }); | |
61 | + }); | |
46 | 62 | } |
47 | 63 | } |
48 | 64 | onOk(); |
... | ... | @@ -84,7 +100,7 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => { |
84 | 100 | |
85 | 101 | {state.modalVisible ? ( |
86 | 102 | <QxAppSelector |
87 | - title={title || placeholder || "选择数据源"} | |
103 | + title={title || placeholder || '选择数据源'} | |
88 | 104 | item={{ |
89 | 105 | flag: 'SINGLE', |
90 | 106 | currentId: '', | ... | ... |
-
mentioned in commit 986d20eb