Commit b7633a897d177c21b2cdde67d8390b998b7e9e9d

Authored by 李婷
1 parent 5caba1dc

feat: 更改出参

@@ -7,6 +7,7 @@ import { QxAppSelector } from '../qx-app-selector'; @@ -7,6 +7,7 @@ import { QxAppSelector } from '../qx-app-selector';
7 import type { InputSelectProps } from '../qx-input-select'; 7 import type { InputSelectProps } from '../qx-input-select';
8 import { QxInputSelect } from '../qx-input-select'; 8 import { QxInputSelect } from '../qx-input-select';
9 9
  10 +import { getFunInfo } from './service';
10 import './styles.less'; 11 import './styles.less';
11 12
12 const prefix = 'qx-form-select'; 13 const prefix = 'qx-form-select';
@@ -25,7 +26,7 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => { @@ -25,7 +26,7 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => {
25 request, 26 request,
26 disabled, 27 disabled,
27 placeholder, 28 placeholder,
28 - title 29 + title,
29 } = props; 30 } = props;
30 31
31 const [state, setState] = useSetState<FormSelectState>({ 32 const [state, setState] = useSetState<FormSelectState>({
@@ -39,10 +40,25 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => { @@ -39,10 +40,25 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => {
39 if (!val?.code) return; 40 if (!val?.code) return;
40 function onOk() { 41 function onOk() {
41 if (val?.code) { 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 onOk(); 64 onOk();
@@ -84,7 +100,7 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => { @@ -84,7 +100,7 @@ export const QxFormSelect: React.FC<FormSelectProps> = (props) => {
84 100
85 {state.modalVisible ? ( 101 {state.modalVisible ? (
86 <QxAppSelector 102 <QxAppSelector
87 - title={title || placeholder || "选择数据源"} 103 + title={title || placeholder || '选择数据源'}
88 item={{ 104 item={{
89 flag: 'SINGLE', 105 flag: 'SINGLE',
90 currentId: '', 106 currentId: '',
  1 +/**
  2 + * 根据表单ID获取详细信息
  3 + */
  4 +export function getFunInfo(request: any, funId: string) {
  5 + return request.get(`/qx-apaas-lowcode/app/form/${funId}`);
  6 +}