| | |
| | | } |
| | | } |
| | | |
| | | 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) => { |
| | |
| | | ) |
| | | } else if (card.eleType === 'text') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value |
| | |
| | | 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 |
| | |
| | | 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> |
| | | ) |
| | |
| | | ) |
| | | } else if (card.eleType === 'picture') { |
| | | let _imagestyle = {} |
| | | let _style = card.style ? {...card.style} : {} |
| | | |
| | | if (card.url) { |
| | | _imagestyle = {backgroundImage: `url('${card.url}')`} |
| | |
| | | _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> |