| | |
| | | import { Col, Tooltip, notification, Typography, message } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | // import Api from '@/api' |
| | | import Api from '@/api' |
| | | import asyncComponent from './asyncButtonComponent' |
| | | import asyncElementComponent from '@/utils/asyncComponent' |
| | | import { getMark } from '@/utils/utils.js' |
| | |
| | | const PrintButton = asyncComponent(() => import('@/tabviews/zshare/actionList/printbutton')) |
| | | const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) |
| | | const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) |
| | | const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) |
| | | const BarCode = asyncElementComponent(() => import('@/components/barcode')) |
| | | const QrCode = asyncElementComponent(() => import('@/components/qrcode')) |
| | | const MkProgress = asyncElementComponent(() => import('@/components/mkProgress')) |
| | |
| | | '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%' |
| | | } |
| | | |
| | | class TextCell extends Component { |
| | | componentDidMount() { |
| | | if (this.node && this.node.scrollHeight > this.node.offsetHeight) { |
| | | this.node.style.display = 'block' |
| | | } |
| | | } |
| | | |
| | | componentDidUpdate() { |
| | | if (this.node) { |
| | | if (this.node.scrollHeight > this.node.offsetHeight) { |
| | | this.node.style.display = 'block' |
| | | } else { |
| | | this.node.style.display = 'flex' |
| | | } |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { card, className, value } = this.props |
| | | |
| | | let lineStyle = {height: card.innerHeight} |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = card.style.textAlign || 'left' |
| | | |
| | | return ( |
| | | <div ref={ref => this.node = ref} className={className} style={lineStyle}>{value}</div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | class CardCellComponent extends Component { |
| | | static propTpyes = { |
| | | cards: PropTypes.object, // 菜单配置信息 |
| | |
| | | elements: PropTypes.array, // 元素集 |
| | | } |
| | | |
| | | state = {} |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps)) |
| | | return !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | /** |
| | |
| | | node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) |
| | | } |
| | | |
| | | if (!card.link) return |
| | | if (!card.link || (card.linkType === 'qywx' || card.linkType === 'linkmenu')) return |
| | | e.stopPropagation() |
| | | |
| | | let url = '' |
| | |
| | | } |
| | | window.open(_url) |
| | | return |
| | | } else if (card.linkType === 'other' && /^@menuid@/ig.test(url)) { |
| | | return |
| | | } |
| | | |
| | | // 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 |
| | | // }))) |
| | | 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 |
| | | // } |
| | | window.open(href) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '信息缺失,请联系管理员!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let Id = '' |
| | | let con = '?' |
| | |
| | | ) |
| | | } else if (card.eleType === 'text') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | let _style = {...card.style} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value || '' |
| | |
| | | val = data[card.field] |
| | | } |
| | | |
| | | if (val === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | if (!val && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | |
| | | val = <Paragraph copyable={{ text: orival }}>{val}</Paragraph> |
| | | } |
| | | } |
| | | } else if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <span style={_s}>{card.prefix || ''}{card.postfix || ''}</span> |
| | | } |
| | | |
| | | let className = '' |
| | |
| | | if (card.bgImage && data[card.bgImage]) { |
| | | _style.backgroundImage = `url('${data[card.bgImage]}')` |
| | | } |
| | | |
| | | let lineStyle = {height: card.innerHeight || 'auto'} |
| | | if (card.alignItems) { |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = _style.textAlign || 'left' |
| | | } |
| | | |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> |
| | | {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'number') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | let _style = {...card.style} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value |
| | |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | } else if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <span style={_s}>{card.prefix || ''}{card.postfix || ''}</span> |
| | | } |
| | | |
| | | let className = '' |
| | |
| | | className = mark.signType |
| | | } |
| | | |
| | | let lineStyle = {height: card.innerHeight || 'auto'} |
| | | if (card.alignItems) { |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = _style.textAlign || 'left' |
| | | } |
| | | |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={_style}> |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> |
| | | {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'icon') { |
| | | let val = '' |
| | | let icon = '' |
| | | let height = card.innerHeight |
| | | |
| | | if (card.datatype === 'dynamic') { |
| | | icon = data[card.field] || '' |
| | |
| | | |
| | | if (!icon && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | | if (!height) { // 兼容 |
| | | let fontSize = 14 |
| | | let lineHeight = 1.5 |
| | | |
| | | if (card.style.fontSize) { |
| | | fontSize = parseInt(card.style.fontSize) |
| | | } |
| | | if (card.style.lineHeight) { |
| | | lineHeight = parseFloat(card.style.lineHeight) |
| | | } |
| | | |
| | | height = fontSize * lineHeight |
| | | } |
| | | |
| | | if (data.hasOwnProperty(card.tooltip)) { |
| | |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | {val ? <Tooltip title={val}> |
| | | <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/>} |
| | | <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>} |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | ) |
| | | } else if (card.eleType === 'picture') { |
| | | let _imagestyle = {} |
| | | let _style = card.style ? {margin: '0 auto', ...card.style} : {} |
| | | let _style = {margin: '0 auto', ...card.style} |
| | | let url = '' |
| | | if (card.maxWidth) { |
| | | _style.maxWidth = card.maxWidth |
| | |
| | | val = data[card.field] || '' |
| | | } |
| | | |
| | | if (val === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | if (!val && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | |
| | | url = data[card.field] || '' |
| | | } |
| | | |
| | | if (url === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | if (!url && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | |
| | | val = data[card.field] || '' |
| | | } |
| | | |
| | | if (val === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | if (!val && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | |
| | | ) |
| | | } else if (card.eleType === 'formula') { |
| | | let val = 0 |
| | | let _style = card.style ? {...card.style} : {} |
| | | let _style = {...card.style} |
| | | |
| | | if (card.$sync) { |
| | | if (card.eval === 'false') { |
| | |
| | | // eslint-disable-next-line |
| | | _val = eval(_val) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(_val) |
| | | console.warn(e) |
| | | } |
| | | _val = 0 |
| | | } |
| | | } |
| | |
| | | |
| | | val += _val |
| | | }) |
| | | } else if (data && data.$$empty) { |
| | | val = '' |
| | | } else if (data) { |
| | | let _val = card.formula |
| | | Object.keys(data).forEach(key => { |
| | |
| | | // eslint-disable-next-line |
| | | _val = eval(_val) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(_val) |
| | | console.warn(e) |
| | | } |
| | | _val = '' |
| | | } |
| | | } |
| | |
| | | val = _val === undefined ? '' : _val |
| | | } |
| | | |
| | | if (val === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | if (!val && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | | if (card.round && typeof(val) === 'number') { |
| | | val = Math.round(val * card.round) / card.round |
| | | val = val.toFixed(card.decimal) |
| | | } |
| | | |
| | | if (val !== '') { |
| | |
| | | } else { |
| | | val = <>{card.prefix || ''}{val}{card.postfix || ''}</> |
| | | } |
| | | } else if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <span style={_s}>{card.prefix || ''}{card.postfix || ''}</span> |
| | | } |
| | | |
| | | let className = '' |
| | |
| | | className = mark.signType |
| | | } |
| | | |
| | | let lineStyle = {height: card.innerHeight || 'auto'} |
| | | if (card.alignItems) { |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = _style.textAlign || 'left' |
| | | } |
| | | |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={_style}> |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> |
| | | {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | color = data[card.field] || '' |
| | | } |
| | | |
| | | if (color === '' && card.noValue === 'hide') { // 空值隐藏 |
| | | if (!color && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | |
| | | /> |
| | | </div> |
| | | ) |
| | | } else if (card.funcType === 'addline' || card.funcType === 'delline') { |
| | | contents.push( |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <EditLine |
| | | btn={card} |
| | | disabled={_disabled} |
| | | selectedData={_data} |
| | | /> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | } |