Sfoglia il codice sorgente

feat: table设置scroll属性

lanjianrong 3 anni fa
parent
commit
45ffc81dd7

+ 6 - 0
src/global.less

@@ -100,3 +100,9 @@ ol {
     }
   }
 }
+
+.ant-pro-table {
+  .ant-card-body {
+    padding-bottom: 0;
+  }
+}

+ 7 - 3
src/pages/Institutions/Company/Detail/components/Staff.tsx

@@ -135,7 +135,8 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
                   dataID: record.institutionID
                 }
               })
-            }}>
+            }}
+          >
             编辑
           </div>
         </div>
@@ -148,6 +149,7 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
         rowKey="ID"
         params={state.params}
         actionRef={tRef}
+        scroll={{ y: document.body.clientHeight - 314 }}
         columns={generateColumns(columns, schema)}
         search={false}
         request={async (params, filter, sorter) => {
@@ -177,7 +179,8 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
                   institutionDisable: true,
                   defaultFormData: { ...state.params, structureType: '1', institutionID: dataID }
                 })
-              }}>
+              }}
+            >
               添加人员
             </Button>
           ]
@@ -185,7 +188,8 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
       />
       <AnimateContent
         visible={state.visible}
-        onVisibleChange={visible => setState({ ...state, visible })}>
+        onVisibleChange={visible => setState({ ...state, visible })}
+      >
         <StaffDetail
           visible={state.visible}
           onVisibleChange={(visible: boolean) => setState({ ...state, visible })}

+ 8 - 12
src/pages/Institutions/Company/Detail/style.less

@@ -19,10 +19,8 @@
       }
     }
   }
-  :global {
-    .ant-card-body {
-      padding: 0 0 24px;
-    }
+  :global(.ant-card-body) {
+    padding: 0;
   }
   .right {
     flex: 1;
@@ -36,16 +34,14 @@
       line-height: 28px;
     }
   }
+  :global(.ant-list-item) {
+    padding-top: 14px;
+    padding-bottom: 14px;
+  }
   /* stylelint-disable-next-line no-descending-specificity */
-  :global {
-    .ant-list-split .ant-list-item:last-child {
-      border-bottom: 1px solid @border-color-split;
-    }
+  :global(.ant-list-split .ant-list-item:last-child) {
+    border-bottom: 1px solid @border-color-split;
     /* stylelint-disable-next-line no-descending-specificity */
-    .ant-list-item {
-      padding-top: 14px;
-      padding-bottom: 14px;
-    }
   }
 }
 

+ 9 - 6
src/pages/Institutions/Company/List/index.tsx

@@ -68,7 +68,8 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
       render: (name, record) => (
         <span
           onClick={() => goToDetail({ dataID: record.ID, structureType: state.structureType })}
-          className="text-primary cursor-pointer">
+          className="text-primary cursor-pointer"
+        >
           {name}
         </span>
       )
@@ -118,7 +119,8 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
                 currentModalType: ModalType.UPDATE,
                 defaultFormData: record
               })
-            }}>
+            }}
+          >
             编辑
           </div>
           {/* <Popconfirm
@@ -142,6 +144,7 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
         rowKey="ID"
         params={state.params}
         actionRef={tRef}
+        scroll={{ y: document.body.clientHeight - 313 }}
         columns={generateColumns(columns, schema)}
         request={async (params, filter, sorter) => {
           const { code = -1, data: { items = [], totle = 0 } = {} } = await queryInstitutionList({
@@ -162,9 +165,8 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
           actions: [
             <Button
               type="primary"
-              onClick={() =>
-                setState({ ...state, visible: true, currentModalType: ModalType.ADD })
-              }>
+              onClick={() => setState({ ...state, visible: true, currentModalType: ModalType.ADD })}
+            >
               新建企事业单位
             </Button>
           ]
@@ -173,7 +175,8 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
       />
       <AnimateContent
         visible={state.visible}
-        onVisibleChange={visible => setState({ ...state, visible })}>
+        onVisibleChange={visible => setState({ ...state, visible })}
+      >
         <CompanyDrawer
           type={state.currentModalType}
           defaultFormData={state.defaultFormData}

+ 9 - 4
src/pages/Institutions/Staff/index.tsx

@@ -93,7 +93,8 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
                 accountType: record.accountType
               }
             })
-          }}>
+          }}
+        >
           {name}
         </div>
       )
@@ -178,7 +179,8 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
                   accountType: record.accountType
                 }
               })
-            }}>
+            }}
+          >
             编辑
           </div>
           {/* <Popconfirm
@@ -202,6 +204,7 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
         rowKey="ID"
         params={state.params}
         actionRef={tRef}
+        scroll={{ y: document.body.clientHeight - 313 }}
         columns={generateColumns(columns, schema)}
         request={async (params, filter, sorter) => {
           const { code = -1, data: { items = [], totle = 0 } = {} } = await queryAcountList({
@@ -228,7 +231,8 @@ const CompanyList: React.FC<ListProps> = ({ schema, dispatch, accountTypeList })
                   visible: true,
                   currentModalType: ModalType.ADD
                 })
-              }>
+              }
+            >
               新建账号
             </Button>
           ]
@@ -237,7 +241,8 @@ 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}

+ 2 - 0
src/pages/Project/Management/index.tsx

@@ -156,12 +156,14 @@ const List: React.FC<ListProps> = ({ schema, dispatch, pTypeList }) => {
       )
     }
   ]
+
   return (
     <PageContainer title={false}>
       <ProTable<API.ProjectListItem>
         rowKey="ID"
         params={state.params}
         actionRef={tRef}
+        scroll={{ y: document.body.clientHeight - 313 }}
         columns={generateColumns(columns, schema)}
         request={async (params, filter, sorter) => {
           const { code = -1, data: { items = [], totle = 0 } = {} } = await getProjectList({

+ 13 - 6
src/pages/Project/Verification/index.tsx

@@ -60,7 +60,8 @@ const FlowList = () => {
             onClick={() => {
               setState({ ...state, modalType: 'update', modalVisible: true })
               formRef.current?.setFieldsValue({ ID: record.ID, name: record.name })
-            }}>
+            }}
+          >
             编辑
           </span>
           <span
@@ -75,14 +76,16 @@ const FlowList = () => {
                   flowProcessData: record.flowProcessData
                 }
               })
-            }}>
+            }}
+          >
             设置审批人
           </span>
           <Popconfirm
             title={`确认删除${record.name}吗?`}
             okText="确认"
             cancelText="取消"
-            onConfirm={() => tryDel({ ID: record.ID })}>
+            onConfirm={() => tryDel({ ID: record.ID })}
+          >
             <span className="text-hex-F5222D pl-2 cursor-pointer hover:text-hex-967bbd">删除</span>
           </Popconfirm>
         </div>
@@ -96,6 +99,7 @@ const FlowList = () => {
         rowKey="ID"
         actionRef={tRef}
         params={state.params}
+        scroll={{ y: document.body.clientHeight - 313 }}
         request={async (params, filters, sorter) => {
           const {
             code = -1,
@@ -116,7 +120,8 @@ const FlowList = () => {
             <Button
               type="primary"
               onClick={() => setState({ ...state, modalType: 'add', modalVisible: true })}
-              key="add_flow_btn">
+              key="add_flow_btn"
+            >
               新建流程
             </Button>
           ]
@@ -124,7 +129,8 @@ const FlowList = () => {
       />
       <AnimateContent
         visible={state.visible}
-        onVisibleChange={visible => setState({ ...state, visible })}>
+        onVisibleChange={visible => setState({ ...state, visible })}
+      >
         <ApprovalDetail
           data={state.current}
           onVisibleChange={visible => setState({ ...state, visible })}
@@ -148,7 +154,8 @@ const FlowList = () => {
             message.error(error)
             return false
           }
-        }}>
+        }}
+      >
         <ProFormText name="ID" label="名称" hidden />
         <ProFormText name="name" label="名称" />
       </ModalForm>

+ 3 - 5
src/pages/user/Login/index.less

@@ -90,11 +90,9 @@
     max-width: 328px;
   }
 
-  :global {
-    .@{ant-prefix}-tabs-nav-list {
-      margin: auto;
-      font-size: 16px;
-    }
+  :global(.@{ant-prefix}-tabs-nav-list) {
+    margin: auto;
+    font-size: 16px;
   }
 
   .icon {