多租户环境下表单配置的个性化
This commit is contained in:
@ -342,6 +342,7 @@
|
||||
const designType = inject<string>('designType');
|
||||
const isFieldUpper = inject<Ref<boolean>>('isFieldUpper', ref(false));
|
||||
let mainTableName = inject<Ref<string>>('mainTableName', ref(''));
|
||||
const formType = inject<Ref<number>>('formType');
|
||||
|
||||
watch(
|
||||
() => generatorConfig?.databaseId,
|
||||
@ -382,12 +383,29 @@
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
|
||||
const filterFormSchema=(formSchema:FormSchema[])=>{
|
||||
customFormConfig.formType=formType.value;
|
||||
const rtSchema=[];
|
||||
for(let i=0;i<formSchema.length;i++){
|
||||
let item=formSchema[i];
|
||||
if(item.field=='category'){
|
||||
if(formType.value==1){
|
||||
rtSchema.push(item);
|
||||
}
|
||||
}else{
|
||||
rtSchema.push(item);
|
||||
}
|
||||
}
|
||||
// alert("xx"+customFormConfig.formType);
|
||||
return rtSchema;
|
||||
};
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const [register, { validate, getFieldsValue, setFieldsValue, updateSchema }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: designType === 'data' ? formSchemaData : formSchema,
|
||||
schemas: designType === 'data' ? filterFormSchema(formSchemaData) : filterFormSchema(formSchema),
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user