| | |
| | | import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { isMobile } from '@vben/utils'; |
| | | import { watch } from 'vue'; |
| | | |
| | | import { automaticApproval } from '#/store/audit-policy'; |
| | | import { isAuditField } from '#/utils/audit-ui-policy'; |
| | | |
| | | async function initSetupVbenForm() { |
| | | setupVbenForm<ComponentType>({ |
| | |
| | | }); |
| | | } |
| | | |
| | | const useVbenForm = useForm<ComponentType, ComponentPropsMap>; |
| | | const useVbenForm = (options: FormProps<ComponentType, ComponentPropsMap>) => { |
| | | const result = useForm<ComponentType, ComponentPropsMap>(options); |
| | | const schema = options.schema; |
| | | if (schema) { |
| | | watch(automaticApproval, () => { |
| | | result[1].setState({ schema: schema.filter((item) => !automaticApproval.value || !isAuditField(item)) }); |
| | | }, { immediate: true }); |
| | | } |
| | | return result; |
| | | }; |
| | | |
| | | export { initSetupVbenForm, useVbenForm, z }; |
| | | |