From 5a995a24857abb0a1dac5e4c67c600e54db01539 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 13 十月 2021 17:35:56 +0800
Subject: [PATCH] 2021-10-13

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

diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx
index 800a973..c80e3d2 100644
--- a/src/tabviews/custom/components/share/normalTable/index.jsx
+++ b/src/tabviews/custom/components/share/normalTable/index.jsx
@@ -351,6 +351,39 @@
           {content && _href ? <a href={_href} target="_blank" rel="noopener noreferrer">{content}</a> : null }
         </div>
       )
+    } else if (col.type === 'formula') {
+      let content = col.formula
+      Object.keys(record).forEach(key => {
+        let reg = new RegExp('@' + key + '@', 'ig')
+        content = content.replace(reg, record[key])
+      })
+
+      if (col.eval !== 'false') {
+        try {
+          // eslint-disable-next-line
+          content = eval(content)
+        } catch (e) {
+          content = ''
+        }
+      }
+
+      content = content === undefined ? '' : content
+
+      if (content !== '') {
+        content = `${col.prefix || ''}${content}${col.postfix || ''}`
+
+        if (col.eval === 'false') {
+          content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, '&nbsp;')
+          content = <span dangerouslySetInnerHTML={{__html: content}}></span>
+        }
+      }
+
+      if (col.marks) {
+        style = style || {}
+        content = this.getMark(record, col.marks, style, content)
+      }
+
+      resProps.children = content
     } else if (col.type === 'custom') {
       style.padding = '0px'
       if (col.style) {

--
Gitblit v1.8.0