浏览代码

fix: 自定义表单类型

outaozhen 3 年之前
父节点
当前提交
b34539dce3
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11 1
      src/pages/Institutions/Staff/components/StaffDrawer.tsx

+ 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>