Explorar el Código

fix: 人员列表详情只读

outaozhen hace 3 años
padre
commit
62a26a0124

+ 3 - 0
src/pages/Institutions/Staff/components/StaffDetail.tsx

@@ -21,6 +21,7 @@ import { ModalType } from '@/utils/enum'
 
 type StaffModalProps = ConnectProps & {
   visible: boolean
+  readOnly: boolean
   onVisibleChange: (visible: boolean) => void
   institutionDisable: boolean
   type: ModalType
@@ -43,6 +44,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
   schema,
   dispatch,
   type,
+  readOnly,
   defaultFormData,
   accountTypeList,
   reload
@@ -251,6 +253,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
             schema={schema}
             onFinish={onFinish}
             onMount={onMount}
+            readOnly={readOnly}
             widgets={{ site: SiteInput }}
             watch={watch}
           />

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

@@ -80,6 +80,7 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
             setState({
               ...state,
               visible: true,
+              readOnly: true,
               currentModalType: ModalType.PREVIEW,
               defaultFormData: {
                 // ...record,
@@ -93,8 +94,7 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
                 accountType: record.accountType
               }
             })
-          }}
-        >
+          }}>
           {name}
         </div>
       )
@@ -166,6 +166,7 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
               setState({
                 ...state,
                 visible: true,
+                readOnly: false,
                 currentModalType: ModalType.UPDATE,
                 defaultFormData: {
                   // ...record,
@@ -179,8 +180,7 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
                   accountType: record.accountType
                 }
               })
-            }}
-          >
+            }}>
             编辑
           </div>
           {/* <Popconfirm
@@ -229,10 +229,10 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
                 setState({
                   ...state,
                   visible: true,
+                  readOnly: false,
                   currentModalType: ModalType.ADD
                 })
-              }
-            >
+              }>
               新建账号
             </Button>
           ]
@@ -241,12 +241,12 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
       />
       <AnimateContent
         visible={state.visible}
-        onVisibleChange={visible => setState({ ...state, visible })}
-      >
+        onVisibleChange={visible => setState({ ...state, visible })}>
         <StaffDetail
           type={state.currentModalType}
           defaultFormData={state.defaultFormData}
           visible={state.visible}
+          readOnly={state.readOnly}
           institutionDisable={state.institutionDisable}
           reload={() => tRef.current?.reload()}
           onVisibleChange={(visible: boolean) => setState({ ...state, visible })}