lanjianrong 3 lat temu
rodzic
commit
1865111d98

+ 28 - 16
src/pages/Institutions/Staff/components/StaffDrawer.tsx

@@ -28,7 +28,7 @@ type StaffModalProps = ConnectProps & {
   }
   accountTypeList: API.AccountType
   organizationList: API.OrganizationalStructureListItem
-  reloadTable: () => void
+  reload: () => void
   schema?: Record<string, any> | null
 }
 
@@ -40,19 +40,29 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
   type,
   defaultFormData,
   accountTypeList,
-  // organizationList,
-  // pTypeList,
-  reloadTable
+  organizationList,
+  reload
 }) => {
   const form = useForm()
   useEffect(() => {
-    if (visible && !schema) {
-      dispatch({
-        type: 'schemaBase/querySchema',
-        payload: {
-          columnType: BaseMenuEnum.STAFF
-        }
-      })
+    if (visible) {
+      if (!schema) {
+        dispatch({
+          type: 'schemaBase/querySchema',
+          payload: {
+            columnType: BaseMenuEnum.STAFF
+          }
+        })
+      }
+      if (!organizationList?.length) {
+        dispatch({
+          type: 'institutions/queryOrganizationList',
+          payload: {
+            dataID: defaultFormData?.dataID,
+            structureType: '1'
+          }
+        })
+      }
     }
   }, [visible])
   // useEffect(() => {
@@ -74,6 +84,8 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
   })
 
   const onMount = () => {
+    console.log(defaultFormData)
+
     form.setValues({ ...defaultFormData })
     delay(80).then(() => {
       form.setSchemaByPath('accountType', {
@@ -114,7 +126,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
         await tryUpdateAccount(formData)
       }
       setVisible(false)
-      reloadTable()
+      reload()
     } catch (error) {
       message.error(error)
     }
@@ -162,10 +174,10 @@ export default connect(
       label: item.name,
       value: item.value
     })),
-    // organizationList: institutions.organizationType.map(item => ({
-    //   label: item.name,
-    //   value: item.dataID
-    // })),
+    organizationList: institutions.organizationType.map(item => ({
+      label: item.name,
+      value: item.dataID
+    })),
     schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
   })
 )(StaffDrawer)

+ 1 - 1
src/pages/Institutions/Staff/index.tsx

@@ -120,7 +120,7 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, accountTypeList }) => {
                 visible: true,
                 currentModalType: ModalType.UPDATE,
                 defaultFormData: {
-                  ...record,
+                  // ...record,
                   institutionID: record.ID,
                   accountType: record.accountType,
                   dataID: record.institution.ID

+ 2 - 2
src/pages/Institutions/model.ts

@@ -58,8 +58,8 @@ const InstitutionsModel: InstitutionsModelType = {
         })
       }
     },
-    *queryOrganizationList(_, { call, put }) {
-      const response = yield call(queryOrganizationalStructureList)
+    *queryOrganizationList({ payload }, { call, put }) {
+      const response = yield call(queryOrganizationalStructureList, payload)
       if (response?.code === consts.RET_CODE.SUCCESS) {
         yield put({
           type: 'save',

+ 5 - 0
src/pages/Project/Verification/index.tsx

@@ -0,0 +1,5 @@
+const Verification = () => {
+  return <div></div>
+}
+
+export default Verification

+ 2 - 0
src/services/api/institution.ts

@@ -66,6 +66,8 @@ export async function getAccountTypeList() {
 export async function queryOrganizationalStructureList(
   params: API.OrganizationalStructureListParams
 ) {
+  console.log(params)
+
   return request('/OrganizationalStructure/list', {
     method: 'POST',
     data: params