From bc5ec1017fd8a140ec5c30ea9e8ea839d5bf1bda Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 15 十二月 2020 16:22:20 +0800
Subject: [PATCH] 2020-12-15

---
 src/tabviews/custom/components/card/cardcellList/index.jsx |  184 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 143 insertions(+), 41 deletions(-)

diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx
index db519ce..9e34be0 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.jsx
+++ b/src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -62,34 +62,137 @@
     }
   }
 
-  openNewView = (card, url) => {
+  openNewView = (e, card) => {
     const { cardCell, data, cards } = this.props
+
+    if (!card.link) return
+    e.stopPropagation()
+    
+    let url = ''
+
+    if (card.link === 'static') {
+      url = card.linkurl
+    } else {
+      url = data[card.linkurl]
+    }
+
+    if (url === 'sso') {
+      if (!data.LinkUrl1) {
+        url = ''
+      } else {
+        url = data.LinkUrl1 + 'index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
+          UserID: sessionStorage.getItem('UserID'),
+          LoginUID: sessionStorage.getItem('LoginUID'),
+          User_Name: sessionStorage.getItem('User_Name'),
+          Full_Name: sessionStorage.getItem('Full_Name'),
+          avatar: sessionStorage.getItem('avatar'),
+          dataM: data.dataM ? 'true' : '',
+          debug: data.debug || '',
+          role_id: data.role_id || ''
+        })))
+      }
+    } else {
+      let Id = ''
+      let con = '?'
+  
+      if (/\?/ig.test(url)) {
+        con = '&'
+      }
+  
+      if (cards.subtype === 'propcard' && cardCell) {
+        Id = cardCell.setting.primaryId || ''
+      } else {
+        Id = data[cards.setting.primaryKey] || ''
+      }
+      
+      if (card.joint === 'true') {
+        url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
+      }
+    }
+
     if (!url) {
       notification.warning({
         top: 92,
-        message: '鍦板潃閾炬帴涓嶅彲涓虹┖锛�',
+        message: '閾炬帴鍦板潃涓嶅瓨鍦紒',
         duration: 5
       })
       return
     }
-    let Id = ''
-    let con = '?'
-
-    if (/\?/ig.test(url)) {
-      con = '&'
-    }
-
-    if (cards.subtype === 'propcard' && cardCell) {
-      Id = cardCell.setting.primaryId || ''
-    } else {
-      Id = data[cards.setting.primaryKey] || ''
-    }
-    
-    if (card.joint === 'true') {
-      url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
-    }
 
     window.open(url)
+  }
+
+  getMark = (marks, style, content) => {
+    const { data } = this.props
+
+    marks.some(mark => {
+      let originVal = data[mark.field[0]] + ''
+      let contrastVal = ''
+      let result = false
+
+      if (mark.field[1] === 'static') {
+        contrastVal = mark.contrastValue + ''
+      } else {
+        contrastVal = data[mark.field[2]] + ''
+      }
+
+      if (mark.match === '=') {
+        result = originVal === contrastVal
+      } else if (mark.match === '!=') {
+        result = originVal !== contrastVal
+      } else if (mark.match === 'like') {
+        result = originVal.indexOf(contrastVal) > -1
+      } else if (mark.match === '>') {
+        try {
+          originVal = parseFloat(originVal)
+          contrastVal = parseFloat(contrastVal)
+        } catch {
+          originVal = NaN
+        }
+
+        if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) {
+          result = true
+        }
+      } else if (mark.match === '<') {
+        try {
+          originVal = parseFloat(originVal)
+          contrastVal = parseFloat(contrastVal)
+        } catch {
+          originVal = NaN
+        }
+
+        if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) {
+          result = true
+        }
+      }
+
+      if (result) {
+        if (mark.signType[0] === 'font') {
+          style.color = mark.color
+        } else if (mark.signType[0] === 'background') {
+          style.background = mark.color
+          if (mark.fontColor) {
+            style.color = mark.fontColor
+          }
+        } else if (mark.signType[0] === 'underline') {
+          style.textDecoration = 'underline'
+          style.color = mark.color
+        } else if (mark.signType[0] === 'line-through') {
+          style.textDecoration = 'line-through'
+          style.color = mark.color
+        } else if (mark.signType[0] === 'icon') {
+          let icon = (<Icon style={{color: mark.color}} type={mark.signType[3]} />)
+          if (mark.signType[1] === 'front') {
+            content = <span>{icon} {content}</span>
+          } else {
+            content = <span>{content} {icon}</span>
+          }
+        }
+      }
+      return result
+    })
+
+    return content
   }
 
   getContent = (card) => {
@@ -105,6 +208,7 @@
       )
     } else if (card.eleType === 'text') {
       let val = ''
+      let _style = card.style ? {...card.style} : {}
 
       if (card.datatype === 'static') {
         val = card.value
@@ -122,15 +226,24 @@
         val = `${card.prefix || ''}${val}${card.postfix || ''}`
       }
 
+      if (card.marks) {
+        val = this.getMark(card.marks, _style, val)
+      }
+
+      if (card.link) {
+        _style.cursor = 'pointer'
+      }
+
       return (
         <Col key={card.uuid} span={card.width}>
-          <div style={card.style}>
+          <div style={_style} onClick={(e) => {this.openNewView(e, card)}}>
             <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div>
           </div>
         </Col>
       )
     } else if (card.eleType === 'number') {
       let val = ''
+      let _style = card.style ? {...card.style} : {}
 
       if (card.datatype === 'static') {
         val = card.value
@@ -168,31 +281,15 @@
       if (val !== '') {
         val = `${card.prefix || ''}${val}${card.postfix || ''}`
       }
-
-      return (
-        <Col key={card.uuid} span={card.width}>
-          <div style={card.style}>
-            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div>
-          </div>
-        </Col>
-      )
-    } else if (card.eleType === 'link') {
-      let url = ''
-
-      if (card.datatype === 'static') {
-        url = card.value
-      } else if (data.hasOwnProperty(card.field)) {
-        url = data[card.field]
+      
+      if (card.marks) {
+        val = this.getMark(card.marks, _style, val)
       }
 
-      let val = card.label || url
-
       return (
         <Col key={card.uuid} span={card.width}>
-          <div style={card.style}>
-            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>
-              <span style={{cursor: 'pointer'}} onClick={(e) => {e.stopPropagation(); this.openNewView(card, url)}}>{val}</span>
-            </div>
+          <div style={_style}>
+            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div>
           </div>
         </Col>
       )
@@ -251,6 +348,7 @@
       )
     } else if (card.eleType === 'picture') {
       let _imagestyle = {}
+      let _style = card.style ? {...card.style} : {}
 
       if (card.url) {
         _imagestyle = {backgroundImage: `url('${card.url}')`}
@@ -272,9 +370,13 @@
         _imagestyle.paddingTop = '100%'
       }
 
+      if (card.link) {
+        _style.cursor = 'pointer'
+      }
+
       return (
         <Col key={card.uuid} span={card.width}>
-          <div style={card.style}>
+          <div style={_style} onClick={(e) => {this.openNewView(e, card)}}>
             <div className="ant-mk-picture" style={_imagestyle}></div>
           </div>
         </Col>

--
Gitblit v1.8.0