| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | if (card.field) { |
| | | __param.$searchkey = card.field.toLowerCase() |
| | | __param.$searchkey = card.field |
| | | __param.$searchval = data[card.field] || '' |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // 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) |
| | |
| | | |
| | | 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]) |
| | | }) |
| | |
| | | } |
| | | if (card.format === 'percent') { |
| | | val = val * 100 |
| | | if (!card.round) { |
| | | val = +val.toFixed(2) |
| | | } |
| | | } else if (card.format === 'abs') { |
| | | val = Math.abs(val) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | 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>} |
| | |
| | | } 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}/>} |
| | |
| | | } |
| | | } else { |
| | | url = data[card.field] || '' |
| | | url = url.replace(/@mywebsite@\//ig, window.GLOB.baseurl) |
| | | } |
| | | |
| | | if (url === '' && card.noValue === 'hide') { // 空值隐藏 |
| | |
| | | // eslint-disable-next-line |
| | | _val = eval(_val) |
| | | } catch (e) { |
| | | console.info(_val) |
| | | window.mkInfo(_val) |
| | | console.warn(e) |
| | | _val = 0 |
| | | } |
| | |
| | | val = '' |
| | | } else if (data) { |
| | | let _val = card.formula |
| | | 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') { |
| | |
| | | // eslint-disable-next-line |
| | | _val = eval(_val) |
| | | } catch (e) { |
| | | console.info(_val) |
| | | window.mkInfo(_val) |
| | | console.warn(e) |
| | | _val = '' |
| | | } |
| | |
| | | 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, ' ') |
| | |
| | | name={name} |
| | | BID={data.$$BID} |
| | | LID={lid} |
| | | columns={cards.columns} |
| | | BData={data.$$BData || ''} |
| | | disabled={_disabled} |
| | | selectedData={_data} |
| | |
| | | disabled={_disabled} |
| | | LID={lid} |
| | | btn={card} |
| | | columns={cards.columns} |
| | | selectedData={_data} |
| | | /> |
| | | } |