瀏覽代碼

fix: 组织架构弹窗内容报错问题

outaozhen 3 年之前
父節點
當前提交
2da22d0b44

+ 36 - 0
src/pages/Institutions/Company/Detail/components/Organization.tsx

@@ -38,9 +38,24 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
     expandTreeIds: [],
     defaultFormData: null,
     parentID: '',
+<<<<<<< HEAD
     modalType: OrganizationModalEnum.ADD,
     accountTotal: null
   })
+=======
+    typeEum: '0',
+    up: 'up',
+    down: 'down',
+    accountTotal: null
+  })
+  // const titleType = {
+  //   ADD: 1,
+  //   ADDITEM: 2,
+  //   RENAME: 3,
+  //   DEL: 4,
+  //   MOVE: 5
+  // }
+>>>>>>> 8d40226 (fix: 组织架构弹窗内容报错问题)
 
   const { run: tryOrganizationList } = useRequest(
     () => queryOrganizationalStructureList({ dataID, structureType }),
@@ -128,7 +143,11 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
                   ...state,
                   visible: true,
                   defaultFormData: record,
+<<<<<<< HEAD
                   modalType: OrganizationModalEnum.MOVE
+=======
+                  typeEum: ModalType.MOVE
+>>>>>>> 8d40226 (fix: 组织架构弹窗内容报错问题)
                 })
               }}
             >
@@ -149,7 +168,11 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
                   structureType: structureType,
                   parentID: record.ID
                 },
+<<<<<<< HEAD
                 modalType: OrganizationModalEnum.ADDITEM
+=======
+                typeEum: ModalType.ADDITEM
+>>>>>>> 8d40226 (fix: 组织架构弹窗内容报错问题)
               })
             }}
           >
@@ -164,7 +187,11 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
                 ...state,
                 visible: true,
                 defaultFormData: record,
+<<<<<<< HEAD
                 modalType: OrganizationModalEnum.RENAME
+=======
+                typeEum: ModalType.UPDATE
+>>>>>>> 8d40226 (fix: 组织架构弹窗内容报错问题)
               })
             }}
           >
@@ -181,7 +208,11 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
                       ...state,
                       visible: true,
                       defaultFormData: record,
+<<<<<<< HEAD
                       modalType: OrganizationModalEnum.DEL,
+=======
+                      typeEum: ModalType.DEL,
+>>>>>>> 8d40226 (fix: 组织架构弹窗内容报错问题)
                       accountTotal: record.accountTotal
                     })
                   }}
@@ -229,7 +260,12 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
                 setState({
                   ...state,
                   visible: true,
+<<<<<<< HEAD
                   modalType: OrganizationModalEnum.ADD,
+=======
+                  currentModalType: ModalType.ADD,
+                  typeEum: ModalType.ADD,
+>>>>>>> 8d40226 (fix: 组织架构弹窗内容报错问题)
                   defaultFormData: {
                     dataID: dataID,
                     structureType: structureType,

+ 16 - 15
src/pages/Institutions/Company/Detail/components/OrganizationModal.tsx

@@ -10,14 +10,14 @@ import {
   moveOrganizationalStructure,
   queryOrganizationalStructureList
 } from '@/services/api/institution'
-import type { OrganizationModalEnum } from './Organization'
+import { ModalType } from '@/utils/enum'
 
-export enum ModalType {
-  ADD = 0,
-  UPDATE = 1,
-  DEL = 2,
-  MOVE = 5
-}
+// export enum ModalType {
+//   ADD = 0,
+//   UPDATE = 1,
+//   DEL = 2,
+//   MOVE = 5
+// }
 
 type OrganizationModalProps = {
   visible: boolean
@@ -44,29 +44,31 @@ const OrganizationModal: React.FC<OrganizationModalProps> = ({
   accountTotal,
   reload
 }) => {
+  console.log(type)
+
   const ref = useRef<FormInstance>(null)
   const [state, setState] = useState({
     organizationList: []
   })
 
   const titleTypeEunm = {
-    1: {
+    0: {
       key: 'ADD',
       name: '添加父级组织'
     },
-    2: {
+    1: {
       key: 'ADDITEM',
       name: '添加子项'
     },
-    3: {
-      key: 'RENAME',
+    2: {
+      key: 'UPDATE',
       name: '重命名'
     },
-    4: {
+    3: {
       key: 'DEL',
       name: '删除组织架构'
     },
-    5: {
+    4: {
       key: 'MOVE',
       name: '移动'
     }
@@ -146,8 +148,7 @@ const OrganizationModal: React.FC<OrganizationModalProps> = ({
         ref.current?.resetFields()
         setVisible(false)
       }}
-      onOk={() => handleOnFinish()}
-    >
+      onOk={() => handleOnFinish()}>
       <ProForm formRef={ref} submitter={{ render: false }}>
         {type === ModalType.ADD ? (
           <>

+ 4 - 7
src/pages/user/Login/index.tsx

@@ -37,7 +37,7 @@ const Login: React.FC = () => {
   const [type] = useState<string>('account')
   const { initialState, setInitialState } = useModel('@@initialState')
 
-  const { run, loading } = useRequest(queryCurrentUser, {
+  const { run } = useRequest(queryAcountList, {
     manual: true,
     onSuccess: async result => {
       setInitialState({
@@ -150,8 +150,7 @@ const Login: React.FC = () => {
               }}
               onFinish={async values => {
                 handleSubmit(values as API.LoginParams)
-              }}
-            >
+              }}>
               {/* <Tabs activeKey={type} onChange={setType}>
                 <Tabs.TabPane
                   key="account"
@@ -216,16 +215,14 @@ const Login: React.FC = () => {
               <div
                 style={{
                   marginBottom: 24
-                }}
-              >
+                }}>
                 <ProFormCheckbox noStyle name="autoLogin">
                   <FormattedMessage id="pages.login.rememberMe" defaultMessage="自动登录" />
                 </ProFormCheckbox>
                 <a
                   style={{
                     float: 'right'
-                  }}
-                >
+                  }}>
                   <FormattedMessage id="pages.login.forgotPassword" defaultMessage="忘记密码" />
                 </a>
               </div>

+ 5 - 2
src/utils/enum.ts

@@ -1,6 +1,9 @@
 // 适用于抽屉/弹窗表单
 export enum ModalType {
   ADD = 0,
-  UPDATE = 1,
-  PREVIEW = 2
+  // UPDATE = 1,
+  ADDITEM = 1,
+  UPDATE = 2,
+  DEL = 3,
+  MOVE = 4
 }