Selaa lähdekoodia

fix: 修改人员管理没有dataID的请求

outaozhen 3 vuotta sitten
vanhempi
commit
6f94cd405f

+ 1 - 2
src/pages/Institutions/Company/Detail/components/Organization.tsx

@@ -1,7 +1,6 @@
 import { Button, Popconfirm, message, Table, Tooltip } from 'antd'
 import type { ActionType } from '@ant-design/pro-table'
-import ProTable from '@ant-design/pro-table'
-import React, { useState, useEffect, useRef } from 'react'
+import React, { useState, useRef } from 'react'
 import { useRequest } from 'umi'
 import {
   ArrowDownOutlined,

+ 6 - 0
src/pages/Institutions/Company/Detail/components/Staff.tsx

@@ -65,6 +65,12 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
         return <span>{genderEum[gender]}</span>
       }
     },
+    // {
+    //   dataIndex: 'organizationalStructureID',
+    //   key: 'organizationalStructureID',
+    //   title: '组织架构',
+    //   renderText: (_, record) => record.organizationalStructure.name
+    // },
     {
       dataIndex: 'institutionID',
       key: 'institutionID',

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

@@ -139,26 +139,34 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
         widget: 'site'
       })
     })
-    queryOrganizationalStructureList({
-      dataID: defaultFormData?.institutionID,
-      structureType: '1'
-    }).then(organizationList => {
-      if (organizationList) {
-        form.setSchemaByPath('organizationalStructureID', {
-          type: 'string',
-          widget: 'treeSelect',
-          props: {
-            treeDefaultExpandAll: true,
-            treeData: organizationList.data
-          }
-        })
-      }
-    })
+    if (defaultFormData?.institutionID) {
+      queryOrganizationalStructureList({
+        dataID: defaultFormData?.institutionID,
+        structureType: '1'
+      }).then(organizationList => {
+        if (organizationList) {
+          form.setSchemaByPath('organizationalStructureID', {
+            type: 'string',
+            widget: 'treeSelect',
+            props: {
+              treeDefaultExpandAll: true,
+              treeData: organizationList.data
+            }
+          })
+        }
+      })
+    } else {
+      form.setSchemaByPath('organizationalStructureID', {
+        type: 'string',
+        widget: 'treeSelect',
+        hidden: true
+      })
+    }
   }
 
   const watch = {
     institutionID: val => {
-      if (!defaultFormData?.institutionID) {
+      if (!defaultFormData?.institutionID && val) {
         queryOrganizationalStructureList({
           dataID: val,
           structureType: '1'

+ 5 - 6
src/pages/Institutions/Staff/index.tsx

@@ -74,7 +74,7 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
         <div
           className="text-primary cursor-pointer hover:text-hex-967bbd"
           onClick={() => {
-            setState({ ...state, visibles: true, staffDetail: record })
+            setState({ ...state, visibles: true, staffDetail: record, readOnly: true })
           }}>
           {name}
         </div>
@@ -99,11 +99,10 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
       }
     },
     // {
-    //   dataIndex: 'institution',
-    //   key: 'institution',
-    //   title: '所属企事业单位',
-    //   renderText: (_, record) => record.institution.name
-    //   // valueEnum:
+    //   dataIndex: 'organizationalStructureID',
+    //   key: 'organizationalStructureID',
+    //   title: '组织架构',
+    //   renderText: (_, record) => record.organizationalStructure.name
     // },
     {
       dataIndex: 'institutionID',