From 95ccc1acc6d8ede1c839493e7aecc9c97fd34c8c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 24 九月 2021 15:55:39 +0800
Subject: [PATCH] 2021-09-24

---
 src/tabviews/zshare/normalTable/index.jsx |  270 ++++++++++++++++++++++++++++++++---------------------
 1 files changed, 163 insertions(+), 107 deletions(-)

diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx
index 38c2501..7aa11e6 100644
--- a/src/tabviews/zshare/normalTable/index.jsx
+++ b/src/tabviews/zshare/normalTable/index.jsx
@@ -17,6 +17,16 @@
 const TabButton = asyncComponent(() => import('@/tabviews/zshare/actionList/tabbutton'))
 const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton'))
 
+class BodyRow extends React.Component {
+  shouldComponentUpdate (nextProps) {
+    return this.props.className !== nextProps.className
+  }
+
+  render() {
+    return <tr {...this.props}/>
+  }
+}
+
 class NormalTable extends Component {
   static propTpyes = {
     tableId: PropTypes.string,       // 鍒楄〃Id
@@ -49,7 +59,7 @@
   }
 
   UNSAFE_componentWillMount () {
-    const { menuType, memberLevel, pageSize } = this.props
+    const { menuType, memberLevel, pageSize, setting } = this.props
     let columns = fromJS(this.props.columns).toJS()
     let lineMarks = []
     let _columns = []
@@ -57,122 +67,159 @@
     let _format = false    // 鏄惁铏氬寲澶勭悊
     let rowspans = []
 
-    if (window.GLOB.dataFormat && menuType !== 'HS' && memberLevel) {
-      _format = true
-
-      if (memberLevel >= 30) {
-        radio = 20
-      } else if (memberLevel >= 20) {
-        radio = 10
-      }
-    }
-
-    columns.forEach((item, index) => {
-      if (item.hidden === true || item.Hide === 'true') return
-      let cell = null
-
-      if (item.type === 'colspan') {
-        cell = {title: item.label, children: []}
-
-        item.subcols.forEach(col => {
-          if (col.rowspan === 'true') {
-            rowspans.push(col.field)
-          }
-          if (_format && !Math.floor(Math.random() * radio)) {
-            col.blur = true
-          }
-
-          if (col.marks) { // 杩囨护琛屽拰鍗$墖鏍囪
-            col.marks = col.marks.filter(mark => {
-              if (mark.signType === 'line') {
-                lineMarks.push(mark)
-              }
-              return mark.signType !== 'line' && mark.signType !== 'card'
+    if (setting.tableMode === 'fast') {
+      rowspans = null
+      columns.forEach(item => {
+        if (item.hidden === true || item.Hide === 'true') return
+        let cell = null
+  
+        if (item.type === 'colspan' || item.type === 'old_colspan') {
+          cell = {title: item.label, children: []}
+  
+          item.subcols.forEach(col => {
+            cell.children.push({
+              align: col.Align,
+              title: col.label,
+              dataIndex: col.field || col.uuid,
+              key: col.uuid,
+              width: col.Width || 120
             })
-    
-            if (col.marks.length === 0) {
-              col.marks = ''
-            }
-          }
-
-          cell.children.push({
-            align: col.Align,
-            title: col.label,
-            dataIndex: col.field || col.uuid,
-            key: col.uuid,
-            width: col.Width || 120,
-            render: (text, record) => {
-              return this.getContent(col, record)
-            }
           })
-        })
-      } else if (item.type === 'old_colspan') {
-        item.subcols.forEach(col => {
-          if (col.marks) { // 杩囨护琛屽拰鍗$墖鏍囪
-            col.marks = col.marks.filter(mark => {
-              if (mark.signType === 'line') {
-                lineMarks.push(mark)
+        } else {
+          if (item.type === 'index') {
+            item.field = '$Index'
+            item.type = 'text'
+          }
+  
+          cell = {
+            align: item.Align,
+            dataIndex: item.field || item.uuid,
+            title: item.label,
+            sorter: item.field && item.IsSort === 'true',
+            width: item.Width || 120
+          }
+        }
+        
+        _columns.push(cell)
+      })
+    } else {
+      if (window.GLOB.dataFormat && menuType !== 'HS' && memberLevel) {
+        _format = true
+  
+        if (memberLevel >= 30) {
+          radio = 20
+        } else if (memberLevel >= 20) {
+          radio = 10
+        }
+      }
+  
+      columns.forEach((item, index) => {
+        if (item.hidden === true || item.Hide === 'true') return
+        let cell = null
+  
+        if (item.type === 'colspan') {
+          cell = {title: item.label, children: []}
+  
+          item.subcols.forEach(col => {
+            if (col.rowspan === 'true') {
+              rowspans.push(col.field)
+            }
+            if (_format && !Math.floor(Math.random() * radio)) {
+              col.blur = true
+            }
+  
+            if (col.marks) { // 杩囨护琛屽拰鍗$墖鏍囪
+              col.marks = col.marks.filter(mark => {
+                if (mark.signType === 'line') {
+                  lineMarks.push(mark)
+                }
+                return mark.signType !== 'line' && mark.signType !== 'card'
+              })
+      
+              if (col.marks.length === 0) {
+                col.marks = ''
               }
-              return mark.signType !== 'line' && mark.signType !== 'card'
+            }
+  
+            cell.children.push({
+              align: col.Align,
+              title: col.label,
+              dataIndex: col.field || col.uuid,
+              key: col.uuid,
+              width: col.Width || 120,
+              render: (text, record) => {
+                return this.getContent(col, record)
+              }
             })
-    
-            if (col.marks.length === 0) {
-              col.marks = ''
+          })
+        } else if (item.type === 'old_colspan') {
+          item.subcols.forEach(col => {
+            if (col.marks) { // 杩囨护琛屽拰鍗$墖鏍囪
+              col.marks = col.marks.filter(mark => {
+                if (mark.signType === 'line') {
+                  lineMarks.push(mark)
+                }
+                return mark.signType !== 'line' && mark.signType !== 'card'
+              })
+      
+              if (col.marks.length === 0) {
+                col.marks = ''
+              }
             }
-          }
-        })
-
-        cell = {
-          align: item.Align,
-          dataIndex: item.field || item.uuid,
-          title: item.label,
-          sorter: item.field && item.IsSort === 'true',
-          width: item.Width || 120,
-          render: (text, record) => {
-            return this.getContent(item, record)
-          }
-        }
-      } else {
-        if (item.rowspan === 'true') {
-          rowspans.push(item.field)
-        }
-        if (item.type === 'index') {
-          item.field = '$Index'
-          item.type = 'text'
-        } else if (_format && !Math.floor(Math.random() * radio)) {
-          item.blur = true
-        }
-
-        if (item.marks) { // 杩囨护琛屽拰鍗$墖鏍囪
-          item.marks = item.marks.filter(mark => {
-            if (mark.signType === 'line') {
-              lineMarks.push(mark)
-            }
-            return mark.signType !== 'line' && mark.signType !== 'card'
           })
   
-          if (item.marks.length === 0) {
-            item.marks = ''
+          cell = {
+            align: item.Align,
+            dataIndex: item.field || item.uuid,
+            title: item.label,
+            sorter: item.field && item.IsSort === 'true',
+            width: item.Width || 120,
+            render: (text, record) => {
+              return this.getContent(item, record)
+            }
+          }
+        } else {
+          if (item.rowspan === 'true') {
+            rowspans.push(item.field)
+          }
+          if (item.type === 'index') {
+            item.field = '$Index'
+            item.type = 'text'
+          } else if (_format && !Math.floor(Math.random() * radio)) {
+            item.blur = true
+          }
+  
+          if (item.marks) { // 杩囨护琛屽拰鍗$墖鏍囪
+            item.marks = item.marks.filter(mark => {
+              if (mark.signType === 'line') {
+                lineMarks.push(mark)
+              }
+              return mark.signType !== 'line' && mark.signType !== 'card'
+            })
+    
+            if (item.marks.length === 0) {
+              item.marks = ''
+            }
+          }
+  
+          cell = {
+            align: item.Align,
+            dataIndex: item.field || item.uuid,
+            title: item.label,
+            sorter: item.field && item.IsSort === 'true',
+            width: item.Width || 120,
+            render: (text, record) => {
+              return this.getContent(item, record)
+            }
           }
         }
-
-        cell = {
-          align: item.Align,
-          dataIndex: item.field || item.uuid,
-          title: item.label,
-          sorter: item.field && item.IsSort === 'true',
-          width: item.Width || 120,
-          render: (text, record) => {
-            return this.getContent(item, record)
-          }
-        }
+        
+        _columns.push(cell)
+      })
+  
+      if (rowspans.length === 0) {
+        rowspans = null
       }
-      
-      _columns.push(cell)
-    })
-
-    if (rowspans.length === 0) {
-      rowspans = null
     }
     
     this.setState({
@@ -1056,6 +1103,14 @@
     const { setting, pickup, statFValue } = this.props
     const { selectedRowKeys, lineMarks, activeIndex } = this.state
 
+    let components = {
+      body: {}
+    }
+
+    if (setting.tableMode === 'fast') {
+      components.body.row = BodyRow
+    }
+
     // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙��
     let rowSelection = null
     if (setting.tableType) {
@@ -1136,6 +1191,7 @@
           />
         </Affix>}
         <Table
+          components={components}
           size={setting.size || 'middle'}
           style={style}
           bordered={setting.bordered !== 'false'}

--
Gitblit v1.8.0