Jelajahi Sumber

一级列表表格为空数据的时候的显示

shaogen1995 2 bulan lalu
induk
melakukan
6db0696e4f
35 mengubah file dengan 153 tambahan dan 25 penghapusan
  1. 13 6
      src/components/MyTable/index.module.scss
  2. 27 17
      src/components/MyTable/index.tsx
  3. 20 0
      src/pages/A3_ledger/A32Routing/A32table/index.module.scss
  4. 30 1
      src/pages/A3_ledger/A32Routing/A32table/index.tsx
  5. 1 0
      src/pages/A3_ledger/C1ledger/index.tsx
  6. 1 0
      src/pages/A_workbench/A2business/A2table/index.tsx
  7. 1 0
      src/pages/A_workbench/A3flow/index.tsx
  8. 1 0
      src/pages/A_workbench/A4voucher/index.tsx
  9. 1 0
      src/pages/B_enterTibet/B1collect/index.tsx
  10. 1 0
      src/pages/B_enterTibet/B2identify/index.tsx
  11. 1 0
      src/pages/B_enterTibet/B34typeIn/index.tsx
  12. 1 0
      src/pages/C_goodsManage/C21wealth/index.tsx
  13. 1 0
      src/pages/C_goodsManage/C22goodEdit/index.tsx
  14. 1 0
      src/pages/C_goodsManage/C2files/index.tsx
  15. 1 0
      src/pages/C_goodsManage/C3focus/index.tsx
  16. 1 0
      src/pages/D_storeManage/D1storage/D1Loc/index.tsx
  17. 1 0
      src/pages/D_storeManage/D1storage/D1goods/index.tsx
  18. 1 0
      src/pages/D_storeManage/D2storSet/index.tsx
  19. 1 0
      src/pages/D_storeManage/D3staff/index.tsx
  20. 1 0
      src/pages/D_storeManage/D4impStor/index.tsx
  21. 1 0
      src/pages/D_storeManage/D5moveStor/index.tsx
  22. 1 0
      src/pages/D_storeManage/D6putsStor/index.tsx
  23. 1 0
      src/pages/D_storeManage/D7check/index.tsx
  24. 1 0
      src/pages/D_storeManage/D8cancel/index.tsx
  25. 1 0
      src/pages/E_goodsStorage/E1accident/index.tsx
  26. 1 0
      src/pages/E_goodsStorage/E3actuality/index.tsx
  27. 1 0
      src/pages/E_goodsStorage/E4repair/index.tsx
  28. 1 0
      src/pages/F_exhibition/F1exhibition/index.tsx
  29. 22 0
      src/pages/Z_system/Z1dict/index.module.scss
  30. 12 1
      src/pages/Z_system/Z1dict/index.tsx
  31. 1 0
      src/pages/Z_system/Z2numRule/index.tsx
  32. 1 0
      src/pages/Z_system/Z3flowSet/index.tsx
  33. 1 0
      src/pages/Z_system/Z5role/index.tsx
  34. 1 0
      src/pages/Z_system/Z6user/index.tsx
  35. 1 0
      src/pages/Z_system/Z7log/index.tsx

+ 13 - 6
src/components/MyTable/index.module.scss

@@ -27,12 +27,6 @@
       //   color: var(--themeColor);
       // }
     }
-    .ant-table-placeholder {
-      .ant-table-cell {
-        padding: 0 !important;
-        border-bottom: none !important;
-      }
-    }
 
     .NODATA {
       display: flex;
@@ -56,3 +50,16 @@
     }
   }
 }
+
+.MyTableNull {
+  :global {
+    .ant-table-body {
+      .ant-table-placeholder {
+        .ant-table-cell {
+          padding: 0 !important;
+          border-bottom: none !important;
+        }
+      }
+    }
+  }
+}

+ 27 - 17
src/components/MyTable/index.tsx

@@ -36,6 +36,8 @@ interface MyTableProps extends Omit<TableProps, 'onChange'> {
   widthSet?: any
   rowKey?: string
   readOnly?: boolean
+  // 没有数据的时候展示
+  emptyText?: boolean
 }
 
 export interface MyTableMethods {
@@ -84,6 +86,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
       widthSet,
       rowKey = 'id',
       readOnly,
+      emptyText,
       ...rest
     },
     ref
@@ -277,7 +280,10 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
     return (
       <Form form={form} component={false}>
         <Table
-          className={`${styles.MyTable} MyTable${classKey}`}
+          className={classNames(
+            `${styles.MyTable} MyTable${classKey}`,
+            emptyText ? styles.MyTableNull : ''
+          )}
           scroll={{ y: yHeight ? yHeight : '' }}
           dataSource={list}
           columns={[...startBtn, ...columns, ...lastBtn]}
@@ -294,22 +300,26 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
               : false
           }
           {...rest}
-          locale={{
-            emptyText: (
-              <div
-                className='NODATA'
-                style={{ height: yHeight ? yHeight : 500, opacity: isLoding ? '1' : '0' }}
-              >
-                <img src={baseURL + `/baseData/staImg/build.png`} alt='' />
-                <p>暂无相关搜索结果,请更换关键字搜索</p>
-                <div>
-                  <p>应用归属单位:义乌市博物馆</p>
-                  <p>应用管理员:李亮</p>
-                  <p>联系方式:18767178372</p>
-                </div>
-              </div>
-            )
-          }}
+          locale={
+            emptyText
+              ? {
+                  emptyText: (
+                    <div
+                      className='NODATA'
+                      style={{ height: yHeight ? yHeight : 500, opacity: isLoding ? '1' : '0' }}
+                    >
+                      <img src={baseURL + `/baseData/staImg/build.png`} alt='' />
+                      <p>暂无相关搜索结果,请更换关键字搜索</p>
+                      <div>
+                        <p>应用归属单位:义乌市博物馆</p>
+                        <p>应用管理员:李亮</p>
+                        <p>联系方式:18767178372</p>
+                      </div>
+                    </div>
+                  )
+                }
+              : {}
+          }
         />
       </Form>
     )

+ 20 - 0
src/pages/A3_ledger/A32Routing/A32table/index.module.scss

@@ -8,5 +8,25 @@
       padding: 6px !important;
       min-width: 100px;
     }
+    .NODATA {
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+      align-items: center;
+      color: #666666;
+      font-size: 16px;
+      // img {
+      //   width: 150px;
+      // }
+      & > p {
+        margin-bottom: 10px;
+      }
+      div {
+        width: 80%;
+        margin-top: 8%;
+        display: flex;
+        justify-content: space-around;
+      }
+    }
   }
 }

+ 30 - 1
src/pages/A3_ledger/A32Routing/A32table/index.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useMemo, useState } from 'react'
+import React, { useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
 import { selectObj } from '@/utils/select'
@@ -10,6 +10,7 @@ import { RootState } from '@/store'
 import ImageLazy from '@/components/ImageLazy'
 import { statusCollectObj, statusStorageObj } from '@/utils/tableData'
 import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
+import { baseURL } from '@/utils/http'
 
 type Props = {
   pageNum: number
@@ -133,9 +134,37 @@ function A32table({ pageNum, pageSize, pageChangeFu, advanced }: Props) {
     }
   }, [advanced])
 
+  // 空数据列表会闪一下的问题
+  const timerrRef = useRef(-1)
+  const [isLoding, setIsLoding] = useState(false)
+  useEffect(() => {
+    timerrRef.current = window.setTimeout(() => {
+      setIsLoding(true)
+    }, 500)
+    return () => {
+      clearTimeout(timerrRef.current)
+    }
+  }, [])
+
   return (
     <div className={styles.A32table}>
       <Table
+        locale={{
+          emptyText: (
+            <div
+              className='NODATA'
+              style={{ height: advanced ? 550 : 605, opacity: isLoding ? '1' : '0' }}
+            >
+              <img src={baseURL + `/baseData/staImg/build.png`} alt='' />
+              <p>暂无相关搜索结果,请更换关键字搜索</p>
+              <div>
+                <p>应用归属单位:义乌市博物馆</p>
+                <p>应用管理员:李亮</p>
+                <p>联系方式:18767178372</p>
+              </div>
+            </div>
+          )
+        }}
         scroll={{ y: advanced ? 550 : 605, x: 'max-content' }}
         dataSource={tableInfo.list}
         columns={columns}

+ 1 - 0
src/pages/A3_ledger/C1ledger/index.tsx

@@ -301,6 +301,7 @@ function C1ledger() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={advanced ? 540 : 595}
         list={tableInfo.list}
         columnsTemp={C1tableC}

+ 1 - 0
src/pages/A_workbench/A2business/A2table/index.tsx

@@ -179,6 +179,7 @@ function A2table() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         list={tableObj.list}
         columnsTemp={A2tableC}
         lastBtn={tableLastBtn}

+ 1 - 0
src/pages/A_workbench/A3flow/index.tsx

@@ -253,6 +253,7 @@ function A3flow() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={580}
         list={tableInfo.list}
         columnsTemp={A3FLOW_TABLE_COLUMNS}

+ 1 - 0
src/pages/A_workbench/A4voucher/index.tsx

@@ -251,6 +251,7 @@ function A4voucher() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={580}
         list={tableInfo.list}
         columnsTemp={A4VOUCHER_TABLE_COLUMNS}

+ 1 - 0
src/pages/B_enterTibet/B1collect/index.tsx

@@ -299,6 +299,7 @@ function B1collect() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={B1TableC}

+ 1 - 0
src/pages/B_enterTibet/B2identify/index.tsx

@@ -271,6 +271,7 @@ function B2identify() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={B1TableC.filter((v, i) => i !== 1)}

+ 1 - 0
src/pages/B_enterTibet/B34typeIn/index.tsx

@@ -318,6 +318,7 @@ function B34typeIn({ type }: Props) {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={B34TableC(type)}

+ 1 - 0
src/pages/C_goodsManage/C21wealth/index.tsx

@@ -256,6 +256,7 @@ function C21wealth() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={580}
         list={tableInfo.list}
         columnsTemp={C21WEALTH_TABLE_COLUMNS}

+ 1 - 0
src/pages/C_goodsManage/C22goodEdit/index.tsx

@@ -362,6 +362,7 @@ function C22goodEdit() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={C6tableC}

+ 1 - 0
src/pages/C_goodsManage/C2files/index.tsx

@@ -365,6 +365,7 @@ function C2files() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={600}
         list={tableInfo.list}
         columnsTemp={C2tableC}

+ 1 - 0
src/pages/C_goodsManage/C3focus/index.tsx

@@ -248,6 +248,7 @@ function C3focus() {
       </div>
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={596}
         list={tableInfo.list}
         columnsTemp={C1tableC}

+ 1 - 0
src/pages/D_storeManage/D1storage/D1Loc/index.tsx

@@ -75,6 +75,7 @@ function D1Loc({ lookFu, TreeDom, tableId }: Props) {
         <div className='D1Lmainrr'>
           {/* 表格 */}
           <MyTable
+            emptyText={true}
             yHeight={690}
             list={table}
             columnsTemp={D1tableC}

+ 1 - 0
src/pages/D_storeManage/D1storage/D1goods/index.tsx

@@ -206,6 +206,7 @@ function D1goods({ lookData, TreeDom, tableId }: Props) {
         <div className='D1Gmainrr'>
           {/* 表格 */}
           <MyTable
+            emptyText={true}
             yHeight={620}
             list={table.list}
             columnsTemp={D1GtableC}

+ 1 - 0
src/pages/D_storeManage/D2storSet/index.tsx

@@ -196,6 +196,7 @@ function D2storSet() {
       </div>
       <div className='D2tableBox'>
         <MyTable
+          emptyText={true}
           yHeight={630}
           list={tableInfo.list}
           columnsTemp={D2tableC}

+ 1 - 0
src/pages/D_storeManage/D3staff/index.tsx

@@ -287,6 +287,7 @@ function D3staff() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={540}
         list={tableInfo.list}
         columnsTemp={D3STAFF_TABLE_COLUMNS}

+ 1 - 0
src/pages/D_storeManage/D4impStor/index.tsx

@@ -310,6 +310,7 @@ function D4impStor() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={D4tableC}

+ 1 - 0
src/pages/D_storeManage/D5moveStor/index.tsx

@@ -306,6 +306,7 @@ function D5moveStor() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={D5tableC}

+ 1 - 0
src/pages/D_storeManage/D6putsStor/index.tsx

@@ -330,6 +330,7 @@ function D6putsStor() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={D6tableC}

+ 1 - 0
src/pages/D_storeManage/D7check/index.tsx

@@ -259,6 +259,7 @@ function D7check() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={580}
         list={tableInfo.list}
         columnsTemp={D7CHECK_TABLE_COLUMNS}

+ 1 - 0
src/pages/D_storeManage/D8cancel/index.tsx

@@ -263,6 +263,7 @@ function D8cancel() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={646}
         list={tableInfo.list}
         columnsTemp={D8tableC}

+ 1 - 0
src/pages/E_goodsStorage/E1accident/index.tsx

@@ -320,6 +320,7 @@ function E1accident() {
       </div>
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={E1tableC}

+ 1 - 0
src/pages/E_goodsStorage/E3actuality/index.tsx

@@ -324,6 +324,7 @@ function E3actuality() {
       </div>
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={610}
         list={tableInfo.list}
         columnsTemp={E3tableC}

+ 1 - 0
src/pages/E_goodsStorage/E4repair/index.tsx

@@ -275,6 +275,7 @@ function E4repair() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={650}
         list={tableInfo.list}
         columnsTemp={E4tableC}

+ 1 - 0
src/pages/F_exhibition/F1exhibition/index.tsx

@@ -263,6 +263,7 @@ function F1exhibition() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={580}
         list={tableInfo.list}
         columnsTemp={F1EXHIBITION_TABLE_COLUMNS}

+ 22 - 0
src/pages/Z_system/Z1dict/index.module.scss

@@ -38,6 +38,28 @@
           letter-spacing: 4px;
           font-weight: 700;
         }
+
+        .NODATA {
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          color: #666666;
+          font-size: 16px;
+          height: 100%;
+          // img {
+          //   width: 150px;
+          // }
+          & > p {
+            margin-bottom: 10px;
+          }
+          div {
+            width: 80%;
+            margin-top: 8%;
+            display: flex;
+            justify-content: space-around;
+          }
+        }
       }
       .Z1m1rr {
         width: calc(30% - 24px);

+ 12 - 1
src/pages/Z_system/Z1dict/index.tsx

@@ -10,6 +10,7 @@ import Z1add, { Z1AddInfoType } from './Z1add'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { MessageFu } from '@/utils/message'
 import { filterTreeByName } from '@/utils/history'
+import { baseURL } from '@/utils/http'
 
 // 不可编辑的id集合
 const noIdArr = [
@@ -255,7 +256,17 @@ function Z1dict() {
             />
           ) : null}
 
-          {loding && treeDataTemp.length === 0 ? <div className='Z1m1llNone'>暂无数据</div> : null}
+          {loding && treeDataTemp.length === 0 ? (
+            <div className='NODATA'>
+              <img src={baseURL + `/baseData/staImg/build.png`} alt='' />
+              <p>暂无相关搜索结果,请更换关键字搜索</p>
+              <div>
+                <p>应用归属单位:义乌市博物馆</p>
+                <p>应用管理员:李亮</p>
+                <p>联系方式:18767178372</p>
+              </div>
+            </div>
+          ) : null}
         </div>
         <div className='Z1m1rr'>
           {rightData.id ? (

+ 1 - 0
src/pages/Z_system/Z2numRule/index.tsx

@@ -79,6 +79,7 @@ function Z2numRule() {
       {/* 表格 */}
       <div className='Z2tableBox'>
         <MyTable
+          emptyText={true}
           yHeight={680}
           list={tableList}
           columnsTemp={Z2tableC}

+ 1 - 0
src/pages/Z_system/Z3flowSet/index.tsx

@@ -157,6 +157,7 @@ function Z3flowSet() {
 
       {/* 表格 */}
       <MyTable
+        emptyText={true}
         yHeight={680}
         list={tableList}
         columnsTemp={Z3tableC}

+ 1 - 0
src/pages/Z_system/Z5role/index.tsx

@@ -90,6 +90,7 @@ function Z5role() {
       {/* 表格主体 */}
       <div className='tableBox'>
         <MyTable
+          emptyText={true}
           yHeight={630}
           list={tableInfo.list}
           columnsTemp={Z5tableC}

+ 1 - 0
src/pages/Z_system/Z6user/index.tsx

@@ -224,6 +224,7 @@ function Z6user() {
       {/* 表格主体 */}
       <div className='tableBox'>
         <MyTable
+          emptyText={true}
           yHeight={630}
           list={buMenRes(tableInfo.list)}
           columnsTemp={Z6tableC}

+ 1 - 0
src/pages/Z_system/Z7log/index.tsx

@@ -80,6 +80,7 @@ function Z7log() {
       {/* 表格主体 */}
       <div className='tableMain'>
         <MyTable
+          emptyText={true}
           yHeight={630}
           list={tableInfo.list}
           columnsTemp={Z7tableC}