diff --git a/src/components/FormCreate/src/components/useApiSelect.tsx b/src/components/FormCreate/src/components/useApiSelect.tsx index 8ff95fb0..61454097 100644 --- a/src/components/FormCreate/src/components/useApiSelect.tsx +++ b/src/components/FormCreate/src/components/useApiSelect.tsx @@ -69,11 +69,24 @@ export const useApiSelect = (option: ApiSelectProps) => { if (isEmpty(props.url)) { return } + switch (props.method) { case 'GET': let url: string = props.url if (props.remote) { - url = `${url}?${props.remoteField}=${queryParam.value}` + if(queryParam.value!=undefined) + { + if(checkUrl(url)) + { + url = `${url}&${props.remoteField}=${queryParam.value}` + }else + { + url = `${url}?${props.remoteField}=${queryParam.value}` + } + }else + { + url = `${url}` + } } parseOptions(await request.get({ url: url })) break @@ -87,6 +100,11 @@ export const useApiSelect = (option: ApiSelectProps) => { } } + function checkUrl(url) + { + return url.includes('?') + } + function parseOptions(data: any) { // 情况一:如果有自定义解析函数优先使用自定义解析 if (!isEmpty(props.parseFunc)) { diff --git a/src/components/FormCreate/src/config/useSelectRule.ts b/src/components/FormCreate/src/config/useSelectRule.ts index ff21a223..e1d77fbc 100644 --- a/src/components/FormCreate/src/config/useSelectRule.ts +++ b/src/components/FormCreate/src/config/useSelectRule.ts @@ -17,6 +17,7 @@ export const useSelectRule = (option: SelectRuleOption) => { icon: option.icon, label, name, + event: option.event, rule() { return { type: name, diff --git a/src/components/FormCreate/src/type/index.ts b/src/components/FormCreate/src/type/index.ts index 42dccc76..6d7a3209 100644 --- a/src/components/FormCreate/src/type/index.ts +++ b/src/components/FormCreate/src/type/index.ts @@ -46,5 +46,6 @@ export interface SelectRuleOption { label: string // label 名称 name: string // 组件名称 icon: string // 组件图标 - props?: any[] // 组件规则 + props?: any[], // 组件规则 + event?: any[] // 事件 } diff --git a/src/components/FormCreate/src/useFormCreateDesigner.ts b/src/components/FormCreate/src/useFormCreateDesigner.ts index 53fee78e..c0307950 100644 --- a/src/components/FormCreate/src/useFormCreateDesigner.ts +++ b/src/components/FormCreate/src/useFormCreateDesigner.ts @@ -63,7 +63,8 @@ export const useFormCreateDesigner = async (designer: Ref) => { name: 'ApiSelect', label: '接口选择器', icon: 'icon-server', - props: [...apiSelectRule] + props: [...apiSelectRule], + event:['click','change','visibleChange','clear','blur','focus'] }) /**