From 50b49c1b760489c3430fc382656d57c5fbbab07c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 29 四月 2024 16:07:24 +0800
Subject: [PATCH] 2024-04-29

---
 src/tabviews/custom/components/share/normalTable/index.jsx |  115 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx
index 66f8c96..04f091d 100644
--- a/src/tabviews/custom/components/share/normalTable/index.jsx
+++ b/src/tabviews/custom/components/share/normalTable/index.jsx
@@ -20,6 +20,63 @@
   '5:1': '20%', '6:1': '16.67%', '7:1': '14.29%', '8:1': '12.5%', '9:1': '11.11%',
   '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%'
 }
+
+// 瀛楁閫忚
+const triggerLink = (e, item, record) => {
+  e.stopPropagation()
+
+  if (item.linkThdMenu) {
+    let __param = {
+      $BID: record.$$uuid
+    }
+
+    if (item.field) {
+      __param.$searchkey = item.field.toLowerCase()
+      __param.$searchval = record[item.field] || ''
+    }
+  
+    if (item.linkThdMenu.urlFields) {
+      let lower = {}
+      Object.keys(record).forEach(key => {
+        lower[key.toLowerCase()] = record[key]
+      })
+
+      item.linkThdMenu.urlFields.split(',').forEach(field => {
+        __param[field] = lower[field.toLowerCase()] || ''
+      })
+    } else if (item.linkfields && item.linkfields.length > 0) {
+      item.linkfields.forEach(field => {
+        __param[field] = record[field] || ''
+      })
+    }
+
+    let tabmenu = item.linkThdMenu
+
+    tabmenu.param = __param
+
+    MKEmitter.emit('modifyTabs', tabmenu, true)
+  } else if (item.linkurl) {
+    let src = item.linkurl
+
+    let con = '?'
+
+    if (/\?/ig.test(src)) {
+      con = '&'
+    }
+
+    if (item.linkfields && item.linkfields.length > 0) {
+      item.linkfields.forEach(field => {
+        if (field.toLowerCase() === 'id') return
+        con += `${field}=${record[field] || ''}&`
+      })
+    }
+    
+    src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
+
+    window.open(src)
+  }
+}
+
 class BodyRow extends React.Component {
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.props.data), fromJS(nextProps.data)) || this.props.className !== nextProps.className
@@ -107,7 +164,7 @@
   }
 
   render() {
-    let { col, config, record, className, style, triggerLink, ...resProps } = this.props
+    let { col, config, record, className, style, ...resProps } = this.props
 
     if (!col) return (<td {...resProps} className={className} style={style}/>)
 
@@ -169,10 +226,7 @@
       resProps.children = content
 
       if (!record.$disabled && (col.linkThdMenu || col.linkurl)) {
-        style = style || {}
-        style.cursor = 'pointer'
-
-        return (<td {...resProps} className={className} onDoubleClick={() => triggerLink(col, record)} style={style}/>)
+        return (<td {...resProps} className={className + ' clickable'} onClick={(e) => triggerLink(e, col, record)} style={style}/>)
       }
     } else if (col.type === 'number') {
       let content = ''
@@ -202,6 +256,7 @@
         }
   
         if (col.format === 'thdSeparator') {
+          content = content + ''
           content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
         }
   
@@ -243,10 +298,7 @@
       resProps.children = content
 
       if (!record.$disabled && (col.linkThdMenu || col.linkurl)) {
-        style = style || {}
-        style.cursor = 'pointer'
-
-        return (<td {...resProps} className={className} onDoubleClick={() => triggerLink(col, record)} style={style}/>)
+        return (<td {...resProps} className={className + ' clickable'} onClick={(e) => triggerLink(e, col, record)} style={style}/>)
       }
     } else if (col.type === 'picture') {
       let photos = ''
@@ -528,7 +580,6 @@
                 record,
                 col: item,
                 config: item.type === 'custom' ? {setting, columns: fields} : null,
-                triggerLink: this.triggerLink
               })
             }
           }
@@ -802,48 +853,6 @@
   
       MKEmitter.emit('resetSelectLine', MenuID, '', '')
       MKEmitter.emit('syncBalconyData', MenuID, [], false)
-    }
-  }
-
-  // 瀛楁閫忚
-  triggerLink = (item, record) => {
-    let __param = {
-      $searchkey: item.field,
-      $searchval: record[item.field] || '',
-      $BID: record.$$uuid
-    }
-
-    if (item.linkfields && item.linkfields.length > 0) {
-      item.linkfields.forEach(field => {
-        __param[field] = record[field] || ''
-      })
-    }
-
-    if (item.linkThdMenu) {
-      let tabmenu = item.linkThdMenu
-
-      tabmenu.param = __param
-
-      MKEmitter.emit('modifyTabs', tabmenu, true)
-    } else if (item.linkurl) {
-      let src = item.linkurl
-
-      let con = '?'
-
-      if (/\?/ig.test(src)) {
-        con = '&'
-      }
-
-      if (item.linkfields && item.linkfields.length > 0) {
-        item.linkfields.forEach(field => {
-          if (field.toLowerCase() === 'id') return
-          con += `${field}=${record[field] || ''}&`
-        })
-      }
-      
-      src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
-
-      window.open(src)
     }
   }
 
@@ -1159,7 +1168,7 @@
     }
 
     return (
-      <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed}`} style={style}>
+      <div className={`normal-custom-table ${setting.tableHeader || ''} ${setting.parity === 'true' ? 'mk-parity' : ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed}`} style={style}>
         {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ?
           <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null
         }

--
Gitblit v1.8.0