king
2023-11-30 a6be5cfd9c6fb084af584b77f79100fe32b385c1
src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -76,7 +76,7 @@
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props.data), fromJS(nextProps.data)) || (nextProps.syncData && !is(fromJS(this.props.syncData), fromJS(nextProps.syncData)))
    return !is(fromJS(this.props.data), fromJS(nextProps.data)) || (nextProps.syncData ? !is(fromJS(this.props.syncData), fromJS(nextProps.syncData)) : false)
  }
  /**
@@ -197,26 +197,36 @@
    //   })
    //   return
    // }
    let Id = ''
    if (cards.subtype === 'propcard' && cardCell) {
      Id = cardCell.setting.primaryId || ''
    } else {
      Id = data[cards.setting.primaryKey] || ''
    }
    
    if (card.joint === 'true') {
      let con = '?'
      if (/\?/ig.test(url)) {
        con = '&'
    if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar|.ppt)$/i.test(url)) {
      let d = document.createElement('a')
      d.href = url
      d.setAttribute('download', 'download')
      d.setAttribute('target', '_blank')
      document.body.appendChild(d)
      d.click()
      d.remove()
    } else {
      if (card.joint === 'true') {
        let Id = ''
        if (cards.subtype === 'propcard' && cardCell) {
          Id = cardCell.setting.primaryId || ''
        } else {
          Id = data[cards.setting.primaryKey] || ''
        }
        let con = '?'
        if (/\?/ig.test(url)) {
          con = '&'
        }
        url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
      }
      url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
      window.open(url)
    }
    window.open(url)
  }
  getColor = (marks) => {
@@ -278,8 +288,7 @@
          _style.lineHeight = card.innerHeight + 'px'
  
          let mark = getMark(card.marks, data, _style)
          _style = mark.style
          className = mark.signType
        }
        contents.push(
@@ -295,12 +304,13 @@
  
        if (card.datatype === 'static') {
          val = card.value || ''
          if (/@username@|@fullName@|@mk_city@|@bid@/ig.test(val)) {
          if (/@username@|@fullName@|@mk_city@|@appname@|@bid@/ig.test(val)) {
            let userName = sessionStorage.getItem('User_Name') || ''
            let fullName = sessionStorage.getItem('Full_Name') || ''
            let city = sessionStorage.getItem('city') || ''
            let appname = sessionStorage.getItem('appname') || ''
            let bid = data.$$BID || ''
            val = val.replace(/@username@/ig, userName).replace(/@fullName@/ig, fullName).replace(/@mk_city@/ig, city).replace(/@bid@/ig, bid)
            val = val.replace(/@username@/ig, userName).replace(/@fullName@/ig, fullName).replace(/@mk_city@/ig, city).replace(/@appname@/ig, appname).replace(/@bid@/ig, bid)
          } else if (/@month@/ig.test(val)) {
            val = val.replace(/@month@/ig, new Date().toLocaleString('en-US', { month: 'long' }))
          } else if (/@week@/ig.test(val)) {
@@ -418,16 +428,46 @@
        if (card.marks) {
          let mark = getMark(card.marks, data, _style)
  
          _style = mark.style
          if (mark.icon) {
            if (mark.position === 'front') {
              val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span>
            } else {
              val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span>
            }
          } else if (mark.space) {
            val = <><span style={{float: 'left'}} dangerouslySetInnerHTML={{__html: mark.space}}></span>{val}</>
          } else if (mark.point) {
            if (mark.position === 'front') {
              val = <>{mark.point}{val}</>
            } else {
              val = <>{val}{mark.point}</>
            }
          }
          className = mark.signType
        }
        if (card.linkType === 'download') {
          let url = ''
          if (card.link === 'static') {
            url = card.linkurl
          } else {
            url = data[card.linkurl]
          }
          if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar)$/i.test(url)) {
            if (/pdf$/i.test(url)) {
              val = <><img src="/media/pdf.png" className="file-image" alt=""/> {val}</>
            } else if (/(.doc|.docx)$/i.test(url)) {
              val = <><img src="/media/word.png" className="file-image" alt=""/> {val}</>
            } else if (/(.xlsx|.xls)$/i.test(url)) {
              val = <><img src="/media/excel.png" className="file-image" alt=""/> {val}</>
            } else if (/(.zip|.rar)$/i.test(url)) {
              val = <><img src="/media/rar.png" className="file-image" alt=""/> {val}</>
            } else {
              val = <><img src="/media/txt.png" className="file-image" alt=""/> {val}</>
            }
          }
        }
  
        if (card.link || (card.anchors && card.anchors.length > 0)) {
@@ -500,13 +540,19 @@
        if (card.marks) {
          let mark = getMark(card.marks, data, _style)
  
          _style = mark.style
          if (mark.icon) {
            if (mark.position === 'front') {
              val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span>
            } else {
              val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span>
            }
          } else if (mark.space) {
            val = <><span style={{float: 'left'}} dangerouslySetInnerHTML={{__html: mark.space}}></span>{val}</>
          } else if (mark.point) {
            if (mark.position === 'front') {
              val = <>{mark.point}{val}</>
            } else {
              val = <>{val}{mark.point}</>
            }
          }
          className = mark.signType
@@ -543,7 +589,6 @@
        }
        if (/\\n|\n/.test(val)) {
          val = val + val
          val = val.replace(/(\\n|\n)$/, '')
        
          if (val) {
@@ -642,6 +687,10 @@
  
        if (card.link) {
          _style.cursor = 'pointer'
        }
        if (_style.position === 'absolute') {
          _style.width = '100%'
        }
  
        let scale = url && card.scale === 'true'
@@ -775,9 +824,7 @@
            let func = new Function('data', card.formula)
            val = func(_data)
          } catch (e) {
            if (window.debugger) {
              console.warn(e)
            }
            console.warn(e)
            val = ''
          }
        } else if (card.$sync) {
@@ -795,10 +842,8 @@
                // eslint-disable-next-line
                _val = eval(_val)
              } catch (e) {
                if (window.debugger) {
                  console.info(_val)
                  console.warn(e)
                }
                console.info(_val)
                console.warn(e)
                _val = 0
              }
            }
@@ -807,7 +852,7 @@
  
            val += _val
          })
        } else if (data && data.$$empty) {
        } else if (data && data.$$empty && /@.*@/.test(card.formula)) {
          val = ''
        } else if (data) {
          let _val = card.formula
@@ -821,10 +866,8 @@
              // eslint-disable-next-line
              _val = eval(_val)
            } catch (e) {
              if (window.debugger) {
                console.info(_val)
                console.warn(e)
              }
              console.info(_val)
              console.warn(e)
              _val = ''
            }
          }
@@ -875,13 +918,19 @@
        if (card.marks) {
          let mark = getMark(card.marks, data, _style)
  
          _style = mark.style
          if (mark.icon) {
            if (mark.position === 'front') {
              val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span>
            } else {
              val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span>
            }
          } else if (mark.space) {
            val = <><span style={{float: 'left'}} dangerouslySetInnerHTML={{__html: mark.space}}></span>{val}</>
          } else if (mark.point) {
            if (mark.position === 'front') {
              val = <>{mark.point}{val}</>
            } else {
              val = <>{val}{mark.point}</>
            }
          }
          className = mark.signType
@@ -946,6 +995,9 @@
  
        if (data.$$type === 'extendCard') {
          _data = data.$$selectedData || []
          if (card.Ot === 'notRequired' && _data.length === 0) {
            _data = [data]
          }
        } else if (card.$sync) {
          _data = this.props.syncData || []
        } else if (data.$$empty) {