From 325aa13d3b61d1c066f8fcab107003ef36713df3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 一月 2025 10:20:09 +0800
Subject: [PATCH] 2025-01-16

---
 src/tabviews/custom/components/card/cardcellList/index.jsx |  218 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 126 insertions(+), 92 deletions(-)

diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx
index aaf053d..9ebf5c9 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.jsx
+++ b/src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -4,7 +4,7 @@
 import { Col, Tooltip, notification, Typography, message } from 'antd'
 import moment from 'moment'
 
-// import Api from '@/api'
+import Api from '@/api'
 import asyncComponent from '@/utils/asyncComponent'
 import { getMark } from '@/utils/utils.js'
 import MkIcon from '@/components/mk-icon'
@@ -110,7 +110,7 @@
         }
   
         if (card.field) {
-          __param.$searchkey = card.field.toLowerCase()
+          __param.$searchkey = card.field
           __param.$searchval = data[card.field] || ''
         }
       
@@ -162,71 +162,78 @@
     }
 
     // positecgroup
-    // if (/^sso$/ig.test(url)) {
-    //   if (!data.LinkUrl1) {
-    //     notification.warning({
-    //       top: 92,
-    //       message: '閾炬帴鍦板潃涓嶅瓨鍦紒',
-    //       duration: 5
-    //     })
-    //     return
-    //   }
+    if (/^sso$/ig.test(url)) {
+      if (!data.LinkUrl1) {
+        notification.warning({
+          top: 92,
+          message: '閾炬帴鍦板潃涓嶅瓨鍦紒',
+          duration: 5
+        })
+        return
+      }
 
-    //   let _url = data.LinkUrl1
-    //   if (/index\.html/ig.test(_url)) {
-    //     _url = _url.replace(/index\.html.*/ig, '')
-    //   } else if (!/\/$/ig.test(_url)) {
-    //     _url = _url + '/'
-    //   }
+      let _url = data.LinkUrl1
+      if (/index\.html/ig.test(_url)) {
+        _url = _url.replace(/index\.html.*/ig, '')
+      } else if (!/\/$/ig.test(_url)) {
+        _url = _url + '/'
+      }
 
-    //   let key = (() => {
-    //     let uuid = []
-    //     let timestamp = new Date().getTime()
-    //     let _options = '0123456789abcdefghigklmnopqrstuv'
-    //     for (let i = 0; i < 19; i++) {
-    //       uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
-    //     }
-    //     uuid = timestamp + uuid.join('')
-    //     return uuid
-    //   })()
+      let key = (() => {
+        let uuid = []
+        let timestamp = new Date().getTime()
+        let _options = '0123456789abcdefghigklmnopqrstuv'
+        for (let i = 0; i < 19; i++) {
+          uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
+        }
+        uuid = timestamp + uuid.join('')
+        return uuid
+      })()
 
-    //   let _param = {
-    //     func: 'webapi_scan_binding_key',
-    //     binding_type: 'mk',
-    //     scan_type: 'toggle',
-    //     scan_appkey: data.scan_appkey || '',
-    //     id: key
-    //   }
+      let _param = {
+        func: 'webapi_scan_binding_key',
+        binding_type: 'mk',
+        scan_type: 'toggle',
+        scan_appkey: data.scan_appkey || '',
+        id: key
+      }
   
-    //   Api.getSystemConfig(_param).then(res => {
-    //     if (!res.status) {
-    //       notification.warning({
-    //         top: 92,
-    //         message: res.message,
-    //         duration: 5
-    //       })
-    //     } else if (res.thd_party_appid && res.thd_party_member_id && res.thd_party_openid) {
-    //       let href = _url + 'admin/index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
-    //         appid: res.thd_party_appid,
-    //         memberId: res.thd_party_member_id,
-    //         openid: res.thd_party_openid,
-    //         key: key
-    //       })))
-  
-    //       window.open(href)
-    //     } else {
-    //       notification.warning({
-    //         top: 92,
-    //         message: '淇℃伅缂哄け锛岃鑱旂郴绠$悊鍛橈紒',
-    //         duration: 5
-    //       })
-    //     }
-    //   })
-    //   return
-    // }
+      Api.getSystemConfig(_param).then(res => {
+        if (!res.status) {
+          notification.warning({
+            top: 92,
+            message: res.message,
+            duration: 5
+          })
+        } else if (res.thd_party_appid && res.thd_party_member_id && res.thd_party_openid) {
+          let href = _url + 'admin/index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
+            appid: res.thd_party_appid,
+            memberId: res.thd_party_member_id,
+            openid: res.thd_party_openid,
+            key: key
+          })))
+          window.open(href)
+        } else {
+          notification.warning({
+            top: 92,
+            message: '淇℃伅缂哄け锛岃鑱旂郴绠$悊鍛橈紒',
+            duration: 5
+          })
+        }
+      })
+      return
+    }
     
-    if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar|.ppt)$/i.test(url)) {
-      let name = url.replace(/.+\//g, '').replace(/\.{1}[^.]*$/g, '')
+    if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar|.ppt)$/i.test(url) || card.linkType === 'download') {
+      let name = ''
+      if (card.datatype === 'static') {
+        name = card.value || ''
+      } else if (data.hasOwnProperty(card.field)) {
+        name = data[card.field] + ''
+      }
+      name = name.replace(/\.{1}[^.]*$/g, '')
+      name = name ? name + url.replace(/.+\./g, '.') : ''
+
       let d = document.createElement('a')
       d.href = url
       d.setAttribute('download', name)
@@ -257,6 +264,7 @@
 
         Object.keys(data).forEach(key => {
           if (/^\$/.test(key)) return
+          if (key === 'children') return
           let reg = new RegExp('@' + key + '@', 'ig')
           url = url.replace(reg, data[key])
         })
@@ -648,10 +656,21 @@
           }
         }
 
+        let _style = {...card.style}
+
+        if (card.marks) {
+          let _s = {}
+          getMark(card.marks, data, _s)
+
+          if (_s.color) {
+            _style.color = _s.color
+          }
+        }
+
         if (card.tipType === 'text') {
           contents.push(
             <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}>
-              <div style={card.style}>
+              <div style={_style}>
                 {val ? <Tooltip title={val}>
                   <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight}}>{icon}</div>
                 </Tooltip> : <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight}}>{icon}</div>}
@@ -661,7 +680,7 @@
         } else {
           contents.push(
             <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}>
-              <div style={card.style}>
+              <div style={_style}>
                 {val ? <Tooltip title={val}>
                   <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>
                 </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>}
@@ -716,6 +735,7 @@
           }
         } else {
           url = data[card.field] || ''
+          url = url.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
         }
   
         if (url === '' && card.noValue === 'hide') { // 绌哄�奸殣钘�
@@ -961,35 +981,49 @@
           val = ''
         } else if (data) {
           let _val = card.formula
-
-          if (card.$keys && card.noValue === 'hide') { // 绌哄�奸殣钘�
-            let _data = {}
-            let empty = true
-
-            Object.keys(data).forEach(key => {
-              _data[key.toLowerCase()] = data[key]
-            })
-            _data.username = sessionStorage.getItem('User_Name') || ''
-            _data.fullname = sessionStorage.getItem('Full_Name') || ''
-            _data.bid = data.$$BID || ''
-
-            card.$keys.forEach(key => {
-              if (!_data.hasOwnProperty(key)) {
-                empty = false
-              } else if (_data[key] && !/^1949-10-01/.test(_data[key])) {
-                empty = false
-              }
-            })
-
-            if (empty) return null
-          }
-
-          if (/@username@|@fullName@|@bid@/ig.test(_val)) {
-            _val = _val.replace(/@username@/ig, sessionStorage.getItem('User_Name') || '').replace(/@fullName@/ig, sessionStorage.getItem('Full_Name') || '').replace(/@bid@/ig, data.$$BID || '')
-          }
+          let _data = {}
           Object.keys(data).forEach(key => {
+            if (/^\$/.test(key)) return
+            if (key === 'children') return
+            if (/^1949-10-01/.test(data[key])) {
+              _data[key.toLowerCase()] = ''
+            } else if (/\d{4}-\d{2}-\d{2}\s00:00:00/.test(data[key])) {
+              _data[key.toLowerCase()] = data[key].replace(/\s00:00:00/g, '')
+            } else {
+              _data[key.toLowerCase()] = data[key]
+            }
+          })
+          _data.username = sessionStorage.getItem('User_Name') || ''
+          _data.fullname = sessionStorage.getItem('Full_Name') || ''
+          _data.bid = data.$$BID || ''
+
+          if (card.eval === 'false' && card.noValue === 'hide') { // 绌哄�奸殣钘�
+            if (card.$keys) {
+              let empty = true
+
+              card.$keys.forEach(key => {
+                if (!_data.hasOwnProperty(key)) {
+                  empty = false
+                } else if (_data[key]) {
+                  empty = false
+                }
+              })
+  
+              if (empty) return null
+            }
+
+            Object.keys(_data).forEach(key => {
+              if (_data[key]) return
+
+              _val = _val.replace(new RegExp('[^@]*@' + key + '@', 'ig'), '')
+            })
+
+            if (!_val) return null
+          }
+
+          Object.keys(_data).forEach(key => {
             let reg = new RegExp('@' + key + '@', 'ig')
-            _val = _val.replace(reg, data[key])
+            _val = _val.replace(reg, _data[key])
           })
 
           if (card.eval !== 'false') {
@@ -1018,7 +1052,7 @@
         if (val !== '') {
           if (val && typeof(val) === 'string') {
             if (!card.evalchars || card.evalchars.includes('enter')) {
-              val = val.replace(/\n/ig, '<br/>')
+              val = val.replace(/\\n|\n/ig, '<br/>')
             }
             if ((!card.evalchars || card.evalchars.includes('space')) && !/<(span|div|p|a|img)\s/g.test(val)) {
               val = val.replace(/\s/ig, '&nbsp;')

--
Gitblit v1.8.0