From 970c9cf0537a1ed39faf63d4662582f3aa3f08a8 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Tue, 5 Dec 2023 13:14:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=85=AC=E5=85=B1):=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pure/ms-form-create/form-create.vue | 6 +++--- .../src/components/pure/ms-form-create/types.ts | 15 ++++++++++----- .../src/store/modules/form-create/form-create.ts | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/pure/ms-form-create/form-create.vue b/frontend/src/components/pure/ms-form-create/form-create.vue index 3cca345eb8..b7ff5df832 100644 --- a/frontend/src/components/pure/ms-form-create/form-create.vue +++ b/frontend/src/components/pure/ms-form-create/form-create.vue @@ -69,16 +69,16 @@ } }); // 计算远程检索的表单项 - const getOptionsRequest = debounce((val: any) => { + const getOptionsRequest = debounce((val: FormRuleItem) => { // 获取当前变化的一项 监视到被级联的表单项 // 从所有的列表项里边获取所有的link到的那一项 const totalFormList = formCreateStore.formCreateRuleMap.get(props.formCreateKey); if (totalFormList) { const resultItem = totalFormList.find( - (item: Record) => item.link && (item.link as string[]).indexOf(val.field as string) > -1 + (item: any) => item.link && (item.link as string[]).indexOf(val.field as string) > -1 ); if (resultItem) { - formCreateStore.getOptions(val, props.formCreateKey, resultItem as Rule, formApi.value); + formCreateStore.getOptions(val, props.formCreateKey, resultItem as FormRuleItem, formApi.value); } } }, 300); diff --git a/frontend/src/components/pure/ms-form-create/types.ts b/frontend/src/components/pure/ms-form-create/types.ts index b3a55569b7..d124d453cb 100644 --- a/frontend/src/components/pure/ms-form-create/types.ts +++ b/frontend/src/components/pure/ms-form-create/types.ts @@ -1,6 +1,6 @@ import { FieldRule } from '@arco-design/web-vue'; -import { Rule } from '@form-create/arco-design'; +import type { Rule } from '@form-create/arco-design'; export type FormItemType = | 'INPUT' @@ -30,11 +30,16 @@ export interface FormItemDefaultOptions { text: string; value: string; } -// 内置formCreateRule所有配置的项 -export type FormRuleItem = Rule & { - props: Record; +export interface PropsRecord { [key: string]: any; -}; +} +// 内置formCreateRule所有配置的项 +export type FormRuleItem = any; +// TODO +// export type FormRuleItem = Rule & { +// props: Record; +// [key: string]: any; +// }; // 表单配置项 export interface FormItem { type: FormItemType; diff --git a/frontend/src/store/modules/form-create/form-create.ts b/frontend/src/store/modules/form-create/form-create.ts index de667a07ad..21e2e6b3d2 100644 --- a/frontend/src/store/modules/form-create/form-create.ts +++ b/frontend/src/store/modules/form-create/form-create.ts @@ -105,14 +105,14 @@ const useFormCreateStore = defineStore('form-create', { async getOptions( val: FormRuleItem, key: FormCreateKeyEnum[keyof FormCreateKeyEnum], - cascadeItem: Rule, + cascadeItem: FormRuleItem, formValueApi: any ) { const formValue = formValueApi.formData(); // 设置自定义属性给到searchSelect - const formCreateRuleArr = this.formCreateRuleMap.get(key) as Rule[]; + const formCreateRuleArr = this.formCreateRuleMap.get(key); if (formCreateRuleArr) { - const formCreateItem = formCreateRuleArr.find((item: Rule) => cascadeItem.field === item.field); + const formCreateItem = formCreateRuleArr.find((item: FormRuleItem) => cascadeItem.field === item.field); if (formCreateItem && formCreateItem.props) { formCreateItem.props.keyword = val.value; formCreateItem.props.formValue = formValue;