fix(公共): 解决编译报错

This commit is contained in:
xinxin.wu 2023-12-05 13:14:50 +08:00 committed by 刘瑞斌
parent 25a957cabe
commit 970c9cf053
3 changed files with 16 additions and 11 deletions

View File

@ -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<string, any>) => 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);

View File

@ -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<string, any>;
export interface PropsRecord {
[key: string]: any;
};
}
// 内置formCreateRule所有配置的项
export type FormRuleItem = any;
// TODO
// export type FormRuleItem = Rule & {
// props: Record<string, any>;
// [key: string]: any;
// };
// 表单配置项
export interface FormItem {
type: FormItemType;

View File

@ -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;