Эх сурвалжийг харах

fix: BsUi基础表格控件

hanxiaohui 4 сар өмнө
parent
commit
864a8cf1c9

+ 13 - 5
src/components/BsUi/Table/Table.vue

@@ -90,7 +90,7 @@
     </template>
 
     <template #pager>
-      <div class="pager" v-if="pagerConfig && pagerConfig.enable">
+      <div :class="`pager ${!has(pagerConfig, 'isFixed') || pagerConfig.isFixed ? 'page_fixed' : '' }`" v-if="pagerConfig && pagerConfig.enable">
         <Pagination :pagerConfig="pagerConfig" />
       </div>
     </template>
@@ -176,14 +176,17 @@
   .wrapper {
     width: 100%;
     height: 100%;
+    border-radius: 8px;
+    background: white;
+    position: relative;
     .top-main {
       width: 100%;
       background: #fff;
       .top-top {
-        padding: 10px;
+        padding: 10px 10px 0 10px;
       }
       .top-bottom {
-        padding: 0 10px 10px 10px;
+        padding: 10px 10px 0px 10px;
         background: white;
         display: flex;
         align-items: center;
@@ -224,10 +227,15 @@
         width: auto !important;
       }
     }
+    .page_fixed {
+      position: absolute;
+      bottom: 0;
+      z-index: 10;
+      padding: 10px;
+    }
     :deep(.vxe-grid--table-container) {
       background: white;
-      //border-radius: 0 0 10px 10px;
-      padding: 0 10px 10px 10px;
+      padding: 10px;
     }
 
     .empty {

+ 4 - 3
src/components/BsUi/Table/component/search/index.vue

@@ -81,11 +81,12 @@
 <style lang="scss" scoped>
   .SearchWrapper {
     width: 100%;
+    padding: 10px 10px 0 10px;
+    border-radius: 8px 8px 0 0;
+    background: white;
     //padding-bottom: 10px;
     :deep(.ant-card-body) {
-      padding: 10px;
-      border-radius: 8px 8px 0 0;
-      background: white;
+      padding: 0px;
     }
     :deep(.ant-card-bordered) {
       border: none;

+ 28 - 24
src/components/BsUi/Table/index.js

@@ -9,6 +9,9 @@ export const useBsTable = (options, tableRef) => {
   let gridRef = null;
 
   const initGridOptions = () => {
+
+    const isFixed = get(tableOptions,'pagerConfig.isFixed', true)
+
     const seqCol = tableOptions?.gridOptions.columns.find(v => ['seq', 'check', 'radio'].includes(v.type));
     const optCol =  tableOptions?.gridOptions.columns.find(v => v?.cellRender && v.cellRender.name === 'CellOption');
     // 操作初始化
@@ -29,6 +32,7 @@ export const useBsTable = (options, tableRef) => {
       showOverflow: true,
       stripe: false,
       round: true,
+      height: isFixed ? `calc(100vh - 101px)` : undefined,
       cellConfig: {
         height: '40px',
         ...tableOptions.gridOptions?.cellConfig
@@ -151,30 +155,30 @@ export const useBsTable = (options, tableRef) => {
         resolve(tableOptions.gridOptions.data);
       } else {
 
-        const resData = await getTableDataApi(tableOptions?.url, { pageNum, pageSize, ...newSearchParams });
-        const { data } = resData;
-        setLoading(false);
-        setTableData(data.list);
-        setPageTotal(data.total);
-        resolve(data);
-        // console.log('入参为 =====>', { pageNum, pageSize, ...newSearchParams });
-        // setTimeout(() => {
-        //   const resData = {
-        //     data:  {
-        //       list: Array.from({ length: 10 }, (_, i) => {
-        //         return {
-        //           name: `hanxiaohui${i}`
-        //         };
-        //       }),
-        //       total: 1
-        //     }
-        //   }
-        //   const { data } = resData;
-        //   setLoading(false);
-        //   setTableData(data.list);
-        //   setPageTotal(data.total);
-        //   resolve(data);
-        // }, 2000);
+        // const resData = await getTableDataApi(tableOptions?.url, { pageNum, pageSize, ...newSearchParams });
+        // const { data } = resData;
+        // setLoading(false);
+        // setTableData(data.list);
+        // setPageTotal(data.total);
+        // resolve(data);
+        console.log('入参为 =====>', { pageNum, pageSize, ...newSearchParams });
+        setTimeout(() => {
+          const resData = {
+            data:  {
+              list: Array.from({ length: 10 }, (_, i) => {
+                return {
+                  name: `hanxiaohui${i}`
+                };
+              }),
+              total: 1
+            }
+          }
+          const { data } = resData;
+          setLoading(false);
+          setTableData(data.list);
+          setPageTotal(data.total);
+          resolve(data);
+        }, 2000);
       }
     });
   };