| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Col, Tooltip, notification } from 'antd' |
| | | import { Col, Tooltip, notification, Typography } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | // import Api from '@/api' |
| | | import asyncComponent from './asyncButtonComponent' |
| | | import asyncElementComponent from '@/utils/asyncComponent' |
| | | import { getMark } from '@/utils/utils.js' |
| | |
| | | import LostPng from '@/assets/img/lost.png' |
| | | import './index.scss' |
| | | |
| | | const { Paragraph } = Typography |
| | | const NormalButton = asyncComponent(() => import('@/tabviews/zshare/actionList/normalbutton')) |
| | | const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) |
| | | const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) |
| | |
| | | const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton')) |
| | | const ChangeUserButton = asyncComponent(() => import('@/tabviews/zshare/actionList/changeuserbutton')) |
| | | const PrintButton = asyncComponent(() => import('@/tabviews/zshare/actionList/printbutton')) |
| | | const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) |
| | | const BarCode = asyncElementComponent(() => import('@/components/barcode')) |
| | | const QrCode = asyncElementComponent(() => import('@/components/qrcode')) |
| | | const MkProgress = asyncElementComponent(() => import('@/components/mkProgress')) |
| | |
| | | openNewView = (e, card) => { |
| | | const { cardCell, data, cards } = this.props |
| | | |
| | | if (data.$disabled) return |
| | | |
| | | if (card.anchors && card.anchors.length > 0) { |
| | | let id = card.anchors[card.anchors.length - 1] |
| | | let node = document.getElementById('anchor' + id) |
| | | node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) |
| | | } |
| | | |
| | | if (!card.link) return |
| | | e.stopPropagation() |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | if (/^sso$/ig.test(url)) { |
| | | if (!data.LinkUrl1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '链接地址不存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | // positecgroup |
| | | // 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 + '/' |
| | | // } |
| | | |
| | | url = _url + '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 || '' |
| | | }))) |
| | | // 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 |
| | | // } |
| | | |
| | | // 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 |
| | | // } |
| | | |
| | | let Id = '' |
| | | let con = '?' |
| | | |
| | | if (/\?/ig.test(url)) { |
| | | con = '&' |
| | | } |
| | | |
| | | if (cards.subtype === 'propcard' && cardCell) { |
| | | Id = cardCell.setting.primaryId || '' |
| | | } 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') || ''}` |
| | | } |
| | | 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) |
| | |
| | | } |
| | | |
| | | if (val !== '') { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | let orival = val |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | if (card.copyable === 'true') { |
| | | val = <Paragraph copyable={{ text: orival }}>{val}</Paragraph> |
| | | } |
| | | } |
| | | |
| | | if (card.marks) { |
| | |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | | val = <span><MkIcon style={{color: mark.color}} type={mark.icon} /> {val}</span> |
| | | val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> |
| | | } else { |
| | | val = <span>{val} <MkIcon style={{color: mark.color}} type={mark.icon} /></span> |
| | | val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (card.link) { |
| | | if (card.link || (card.anchors && card.anchors.length > 0)) { |
| | | _style.cursor = 'pointer' |
| | | } |
| | | |
| | | if (card.bgImage && data[card.bgImage]) { |
| | | _style.backgroundImage = `url('${data[card.bgImage]}')` |
| | | } |
| | | |
| | | return ( |
| | |
| | | val = data[card.field] |
| | | } |
| | | |
| | | if (val !== '' && typeof(val) === 'number') { |
| | | if (!val && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | | if (typeof(val) === 'number') { |
| | | if (card.format === 'percent') { |
| | | val = val * 100 |
| | | } else if (card.format === 'abs') { |
| | | val = Math.abs(val) |
| | | } |
| | | |
| | | if (card.col && card.col.type === 'number') { |
| | | let decimal = card.col.decimal || 0 |
| | | if (typeof(card.decimal) === 'number') { |
| | | let decimal = card.decimal |
| | | |
| | | if (card.format === 'percent') { |
| | | decimal = decimal - 2 |
| | |
| | | } |
| | | |
| | | if (val !== '') { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | } |
| | | |
| | | if (card.marks) { |
| | |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | | val = <span><MkIcon style={{color: mark.color}} type={mark.icon} /> {val}</span> |
| | | val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> |
| | | } else { |
| | | val = <span>{val} <MkIcon style={{color: mark.color}} type={mark.icon} /></span> |
| | | val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> |
| | | } |
| | | } |
| | | } |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | {val ? <Tooltip title={val}> |
| | | <MkIcon type={card.icon}/> |
| | | </Tooltip> : <MkIcon type={card.icon}/>} |
| | | <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/>} |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | return null |
| | | } |
| | | |
| | | let poster = '' |
| | | |
| | | if (card.posterType === 'dynamic') { |
| | | poster = data[card.posterField] || '' |
| | | } else { |
| | | poster = card.posterUrl || '' |
| | | } |
| | | |
| | | return ( |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <Video card={card} value={url}/> |
| | | <div className="video-wrap" style={card.style}> |
| | | <Video card={card} poster={poster} value={url}/> |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | </Col> |
| | | ) |
| | | } else if (card.eleType === 'currentDate') { |
| | | let val = moment().format(card.dateFormat || 'YYYY-MM-DD') |
| | | |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | |
| | | return ( |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div className="ant-mk-date" style={card.style}> |
| | | {card.dateFormat ? `${card.prefix || ''}${moment().format(card.dateFormat)}${card.postfix || ''}` : null} |
| | | {val} |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | } |
| | | } |
| | | |
| | | if (!val) return |
| | | // if (!val) return |
| | | |
| | | val += _val |
| | | }) |
| | |
| | | val = _val === undefined ? '' : _val |
| | | } |
| | | |
| | | if (val === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | | if (val !== '') { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | if (card.eval === 'false' && /\s/ig.test(val)) { |
| | | val = val.replace(/\s/ig, ' ') |
| | | if (val && typeof(val) === 'string') { |
| | | val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') |
| | | val = <span dangerouslySetInnerHTML={{__html: val}}></span> |
| | | } |
| | | |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | | val = <span><MkIcon style={{color: mark.color}} type={mark.icon} /> {val}</span> |
| | | val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> |
| | | } else { |
| | | val = <span>{val} <MkIcon style={{color: mark.color}} type={mark.icon} /></span> |
| | | val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> |
| | | } |
| | | } |
| | | } |
| | |
| | | </Col> |
| | | ) |
| | | } else if (card.eleType === 'button') { |
| | | let _disabled = data.$disabled |
| | | if (card.control === 'hidden') { |
| | | let s = data[card.controlField] |
| | | let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' |
| | | if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { |
| | | return null |
| | | } |
| | | } else if (card.control === 'disabled') { |
| | | let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' |
| | | if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { |
| | | _disabled = true |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (data.$$type === 'extendCard') { |
| | | _data = data.$$selectedData || [] |
| | | } else if (data.$$empty) { |
| | | _data = [] |
| | | } else if (card.$sync) { |
| | | _data = this.props.syncData |
| | | } else if (data.$$empty) { |
| | | _data = [] |
| | | } |
| | | |
| | | if (['exec', 'prompt', 'pop'].includes(card.OpenType)) { |
| | | if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <NormalButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | columns={cards.columns} |
| | | selectedData={_data} |
| | |
| | | ) |
| | | } else if (card.OpenType === 'excelIn') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <ExcelInButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | |
| | | ) |
| | | } else if (card.OpenType === 'excelOut') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <ExcelOutButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | ) |
| | | } else if (card.OpenType === 'popview') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <PopupButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | |
| | | ) |
| | | } else if (card.OpenType === 'tab') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <TabButton |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | BData={data.$$BData || ''} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | |
| | | ) |
| | | } else if (card.OpenType === 'innerpage') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <NewPageButton |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | BData={data.$$BData || ''} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | |
| | | } else if (card.OpenType === 'funcbutton') { |
| | | if (card.funcType === 'changeuser' || card.funcType === 'closetab') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <ChangeUserButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | |
| | | ) |
| | | } else if (card.funcType === 'print') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <PrintButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={data.$disabled} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | ) |
| | | } else if (card.funcType === 'megvii') { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> |
| | | <FuncMegvii |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | | BID={data.$$BID} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |