outaozhen vor 3 Jahren
Ursprung
Commit
fb443c4499

+ 35 - 25
src/pages/Institutions/Staff/components/StaffDrawer.tsx

@@ -24,7 +24,7 @@ type StaffModalProps = ConnectProps & {
     ID: string
     name: string
     accountType: string
-    institutionID: string
+    dataID: string
   }
   accountTypeList: API.AccountType
   organizationList: API.OrganizationalStructureListItem[]
@@ -45,24 +45,45 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
 }) => {
   const form = useForm()
   useEffect(() => {
-    if (!schema) {
-      dispatch({
-        type: 'schemaBase/querySchema',
-        payload: {
-          columnType: BaseMenuEnum.STAFF
-        }
-      })
+    if (visible) {
+      if (!schema) {
+        dispatch({
+          type: 'schemaBase/querySchema',
+          payload: {
+            columnType: BaseMenuEnum.STAFF
+          }
+        })
+      }
     }
-    if (defaultFormData?.institutionID && !organizationList?.length) {
+    if (!organizationList?.length) {
       dispatch({
         type: 'institutions/queryOrganizationList',
         payload: {
-          dataID: defaultFormData?.institutionID,
+          dataID: defaultFormData?.dataID,
           structureType: '1'
         }
       })
     }
-  }, [visible, defaultFormData?.institutionID])
+  }, [visible])
+  // useEffect(() => {
+  //   if (!schema) {
+  //     dispatch({
+  //       type: 'schemaBase/querySchema',
+  //       payload: {
+  //         columnType: BaseMenuEnum.STAFF
+  //       }
+  //     })
+  //   }
+  //   if (defaultFormData?.dataID && !organizationList?.length) {
+  //     dispatch({
+  //       type: 'institutions/queryOrganizationList',
+  //       payload: {
+  //         dataID: defaultFormData?.dataID,
+  //         structureType: '1'
+  //       }
+  //     })
+  //   }
+  // }, [visible, defaultFormData?.dataID])
 
   const { run: tryUpdateAccount } = useRequest(updateAccount, {
     manual: true,
@@ -79,26 +100,21 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
   })
 
   const onMount = () => {
-    console.log(organizationList)
-
     form.setValues({ ...defaultFormData })
     delay(80).then(() => {
       form.setSchemaByPath('accountType', {
         enum: accountTypeList.map(item => item.value),
         enumNames: accountTypeList.map(item => item.label)
       })
-
-      // console.log('organizationList', organizationList)
     })
-    delay(500).then(() => {
+    delay(80).then(() => {
       form.setSchemaByPath('organizationalStructureID', {
         // enum: organizationList.map(item => item.value),
         // enumNames: organizationList.map(item => item.label),
-        description: '',
-        type: 'string',
+        // description: '',
+        // type: 'string',
         widget: 'treeSelect',
         props: {
-          // defaultValue: defaultFormData.institutionID,
           treeDefaultExpandAll: true,
           treeData: organizationList
         }
@@ -106,12 +122,6 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
     })
   }
 
-  // const watch = {
-  //   institution: val => {
-  //     console.log('表单的时时数据为:', val)
-  //   }
-  // }
-
   // const handleOnFinish = () => {
   //   ref.current?.validateFields().then(async values => {
   //     try {

+ 0 - 2
src/pages/Institutions/Staff/index.tsx

@@ -181,8 +181,6 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
         type={state.currentModalType}
         defaultFormData={state.defaultFormData}
         visible={state.visible}
-        accountTypeList={accountTypeList}
-        // accountType={accountTypeList}
         reload={() => tRef.current?.reload()}
         setVisible={(visible: boolean) => setState({ ...state, visible })}
       />