Przeglądaj źródła

fix: 自定义表单类型

outaozhen 3 lat temu
rodzic
commit
b34539dce3

+ 11 - 1
src/pages/Institutions/Staff/components/StaffDrawer.tsx

@@ -99,6 +99,10 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
     })
   }
 
+  const watch = () => {
+    form.setValueByPath('institution', { widget: 'treeSelect' })
+  }
+
   // const handleOnFinish = () => {
   //   ref.current?.validateFields().then(async values => {
   //     try {
@@ -153,7 +157,13 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
       }}
       title={type === ModalType.ADD ? '新增账号' : '编辑账号'}>
       {schema && (
-        <FormRender form={form} schema={JSON.parse(schema)} onFinish={onFinish} onMount={onMount} />
+        <FormRender
+          form={form}
+          schema={JSON.parse(schema)}
+          onFinish={onFinish}
+          onMount={onMount}
+          watch={watch}
+        />
       )}
       <div>
         <Button onClick={form.submit}>提交</Button>