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

+ 23 - 0
src/pages/Institutions/Staff/components/StaffDrawer.tsx

@@ -155,6 +155,28 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
       }
     })
   }
+
+  const watch = {
+    institutionID: val => {
+      if (!defaultFormData?.institutionID) {
+        queryOrganizationalStructureList({
+          dataID: val,
+          structureType: '1'
+        }).then(organizationList => {
+          if (organizationList) {
+            form.setSchemaByPath('organizationalStructureID', {
+              type: 'string',
+              widget: 'treeSelect',
+              props: {
+                treeDefaultExpandAll: true,
+                treeData: organizationList.data
+              }
+            })
+          }
+        })
+      }
+    }
+  }
   // const handleOnFinish = () => {
   //   ref.current?.validateFields().then(async values => {
   //     try {
@@ -203,6 +225,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
           onFinish={onFinish}
           onMount={onMount}
           widgets={{ site: SiteInput }}
+          watch={watch}
         />
       )}
       <div>