| | |
| | | "display": "standalone", |
| | | "theme_color": "#000000", |
| | | "background_color": "#ffffff", |
| | | "mk_version": "20231201" |
| | | "mk_version": "20240102" |
| | | } |
| | |
| | | } |
| | | if (card.eleType === 'picture' && card.maxWidth) { |
| | | _style.maxWidth = card.maxWidth |
| | | let left = _style.marginLeft && _style.marginLeft !== '0px' ? _style.marginLeft : 'auto' |
| | | let right = _style.marginRight && _style.marginRight !== '0px' ? _style.marginRight : 'auto' |
| | | let left = _style.marginLeft || 'auto' |
| | | let right = _style.marginRight || 'auto' |
| | | |
| | | if (_style.marginLeft === '0px' && _style.marginRight === '0px') { |
| | | left = 'auto' |
| | | right = 'auto' |
| | | } |
| | | |
| | | _style.margin = (_style.marginTop || 0) + ' ' + right + ' ' + (_style.marginBottom || 0) + ' ' + left |
| | | delete _style.marginLeft |
| | | delete _style.marginRight |
| | |
| | | } else if (_funcType === 'refund') { |
| | | shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') |
| | | reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) |
| | | // } else if (_funcType === 'expPdf') { |
| | | // shows.push('exportType') |
| | | } |
| | | } |
| | | |
| | |
| | | shows.push('reason') |
| | | } |
| | | } |
| | | } else { |
| | | } else if (!(openType === 'funcbutton' && this.record.funcType === 'expPdf')) { |
| | | if (openType !== 'excelOut') { |
| | | reOptions.control = [ |
| | | { value: '', text: '无' }, |
| | |
| | | } |
| | | }) |
| | | } |
| | | } else if (values.OpenType === 'funcbutton' && values.funcType === 'expPdf') { |
| | | values.Ot = 'notRequired' |
| | | } |
| | | |
| | | if (values.outerBlacklist) { |
| | |
| | | { value: 'print', text: '标签打印' }, |
| | | { value: 'refund', text: '退款' }, |
| | | { value: 'closetab', text: '标签关闭' }, |
| | | // { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'megvii', text: '旷视面板机' }, |
| | | { value: 'filezip', text: '文件压缩包' }, |
| | | ] |
| | |
| | | { value: 'reAuth', text: '切换系统(清空缓存-小程序)' }, |
| | | { value: 'clearCache', text: '清空本地配置' }, |
| | | { value: 'copyurl', text: '复制链接地址' }, |
| | | { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'logout', text: '退出' }, |
| | | { value: 'goBack', text: '返回' }, |
| | | ] |
| | |
| | | forbid: type !== 'card', |
| | | required: true |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'exportType', |
| | | // label: '导出方式', |
| | | // initVal: card.exportType || 'download', |
| | | // tooltip: '', |
| | | // required: true, |
| | | // options: [{ |
| | | // value: 'download', |
| | | // text: '下载本地' |
| | | // }, { |
| | | // value: 'link', |
| | | // text: '生成链接' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | |
| | | { value: 'print', text: '标签打印' }, |
| | | { value: 'refund', text: '退款' }, |
| | | { value: 'closetab', text: '标签关闭' }, |
| | | // { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'megvii', text: '旷视面板机' }, |
| | | { value: 'filezip', text: '文件压缩包' }, |
| | | ] |
| | |
| | | text: '不重置' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'exportType', |
| | | // label: '导出方式', |
| | | // initVal: card.exportType || 'download', |
| | | // tooltip: '', |
| | | // required: true, |
| | | // options: [{ |
| | | // value: 'download', |
| | | // text: '下载本地' |
| | | // }, { |
| | | // value: 'link', |
| | | // text: '生成链接' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | |
| | | 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 ExportPdf = asyncComponent(() => import('@/tabviews/zshare/actionList/exportPdf')) |
| | | const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) |
| | | const BarCode = asyncComponent(() => import('@/components/barcode')) |
| | | const QrCode = asyncComponent(() => import('@/components/qrcode')) |
| | |
| | | let url = '' |
| | | if (card.maxWidth) { |
| | | _style.maxWidth = card.maxWidth |
| | | if (_style.marginLeft === '0px') { |
| | | if (_style.marginLeft === '0px' && _style.marginRight === '0px') { |
| | | delete _style.marginLeft |
| | | } |
| | | if (_style.marginRight === '0px') { |
| | | delete _style.marginRight |
| | | } |
| | | } |
| | |
| | | MkButton = <FuncZip |
| | | btn={card} |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | disabled={_disabled} |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | } else if (card.funcType === 'expPdf') { |
| | | MkButton = <ExportPdf |
| | | btn={card} |
| | | /> |
| | | } else if (card.funcType === 'addline' || card.funcType === 'delline') { |
| | | MkButton = <EditLine |
| | | btn={card} |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button } from 'antd' |
| | | import html2Canvas from 'html2canvas' |
| | | import moment from 'moment' |
| | | import JsPDF from 'jspdf' |
| | | |
| | | import Api from '@/api' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | |
| | | // import './index.scss' |
| | | |
| | | class ExportPDF extends Component { |
| | | static propTpyes = { |
| | | btn: PropTypes.object |
| | | } |
| | | |
| | | state = { |
| | | loading: false, |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId) => { |
| | | const { btn } = this.props |
| | | const { loading } = this.state |
| | | |
| | | if (loading) return |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }, () => { |
| | | this.getCanvas() |
| | | }) |
| | | } |
| | | |
| | | getCanvas = () => { |
| | | const { btn } = this.props |
| | | |
| | | let wrap = document.getElementById('menu' + btn.$MenuID) |
| | | |
| | | const opts = { |
| | | scale: 1.5, // 缩放比例,提高生成图片清晰度 |
| | | useCORS: false, // 允许加载跨域的图片 |
| | | allowTaint: false, // 允许图片跨域,和 useCORS 二者不可共同使用 |
| | | tainttest: false, // 检测每张图片已经加载完成 |
| | | logging: false // 日志开关,发布的时候记得改成 false |
| | | } |
| | | |
| | | // eslint-disable-next-line |
| | | html2Canvas(wrap, opts).then(canvas => { |
| | | // const contentWidth = parseInt(canvas.style.width) * 2 |
| | | // const contentHeight = parseInt(canvas.style.height) * 2 |
| | | const contentWidth = canvas.width |
| | | const contentHeight = canvas.height |
| | | const pageHeight = (contentWidth / 592.28) * 841.89 |
| | | let leftHeight = contentHeight |
| | | |
| | | const imgWidth = 595.28 |
| | | const imgHeight = (592.28 / contentWidth) * contentHeight |
| | | const pageData = canvas.toDataURL('image/jpeg', 1.0) |
| | | let position = 0 |
| | | |
| | | let title = btn.logLabel + moment().format('YYYYMMDDHHmmss') |
| | | const PDF = new JsPDF('', 'pt', 'a4') |
| | | |
| | | if (leftHeight < pageHeight) { |
| | | PDF.addImage(pageData, 'JPEG', 10, 0, imgWidth - 20, imgHeight) |
| | | } else { |
| | | while (leftHeight > 0) { |
| | | PDF.addImage(pageData, 'JPEG', 10, position, imgWidth - 20, imgHeight) |
| | | |
| | | leftHeight -= pageHeight |
| | | position -= 841.89 |
| | | |
| | | if (leftHeight > 0) { |
| | | PDF.addPage() |
| | | } |
| | | } |
| | | } |
| | | |
| | | PDF.save(title + '.pdf') |
| | | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getInnerData = (params) => { |
| | | let param = params.shift() |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.downloadZipImage(res.data, this.props.btn.urlkey).then((res) => { |
| | | if (params.length === 0) { |
| | | if (res) { |
| | | this.execError({ErrCode: res}) |
| | | } else { |
| | | this.execSuccess() |
| | | } |
| | | } else { |
| | | this.getInnerData(params) |
| | | } |
| | | }, (err) => { |
| | | if (params.length === 0) { |
| | | this.execError({ErrCode: err}) |
| | | } else { |
| | | this.getInnerData(params) |
| | | } |
| | | }) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loading } = this.state |
| | | |
| | | let label = '' |
| | | let icon = '' |
| | | let type = 'link' |
| | | let className = '' |
| | | let style = {...btn.style} |
| | | |
| | | if (loading) { |
| | | style.opacity = 0 |
| | | } |
| | | |
| | | if (btn.show === 'button') { |
| | | label = btn.label |
| | | icon = btn.icon || '' |
| | | } else if (btn.show === 'link') { |
| | | label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> |
| | | icon = '' |
| | | } else if (btn.show === 'icon') { |
| | | icon = btn.icon || '' |
| | | } else if (!btn.$toolbtn) { |
| | | icon = btn.icon || '' |
| | | label = btn.label |
| | | className = 'mk-btn mk-' + btn.class |
| | | } else { |
| | | type = '' |
| | | icon = btn.icon || '' |
| | | label = btn.label |
| | | className = 'mk-btn mk-' + btn.class |
| | | } |
| | | |
| | | return ( |
| | | <Button |
| | | type={type} |
| | | title={btn.show === 'icon' ? btn.label : ''} |
| | | style={style} |
| | | icon={icon} |
| | | className={className} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{label}</Button> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default ExportPDF |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message, Progress } from 'antd' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import JSZip from 'jszip' |
| | | import { saveAs } from 'file-saver' |
| | | |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class FuncZip extends Component { |
| | | static propTpyes = { |
| | |
| | | state = { |
| | | loading: false, |
| | | disabled: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | hidden: false, |
| | | visible: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | const { btn } = this.props |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '' |
| | | loading: false |
| | | }) |
| | | |
| | | if (btn.execSuccess !== 'never') { |
| | |
| | | const { btn } = this.props |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '' |
| | | loading: false |
| | | }) |
| | | |
| | | if (res.ErrCode === '01') { |
| | |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state |
| | | const { loading, disabled, hidden } = this.state |
| | | |
| | | if (hidden) return null |
| | | |
| | |
| | | className = 'mk-btn mk-' + btn.class |
| | | } |
| | | |
| | | if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) { |
| | | label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Button |
| | |
| | | className={className} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{label}</Button> |
| | | {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null} |
| | | </> |
| | | ) |
| | | } |
| | |
| | | .ip-list-modal { |
| | | .ip-item { |
| | | display: inline-block; |
| | | border: 1px solid #d9d9d9; |
| | | padding: 10px; |
| | | height: 100px; |
| | | width: calc(33% - 20px); |
| | | margin: 10px; |
| | | cursor: pointer; |
| | | .ip { |
| | | color: #000000; |
| | | } |
| | | .remark { |
| | | word-break: break-all; |
| | | text-overflow: ellipsis; |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | | -webkit-line-clamp: 2; |
| | | overflow: hidden; |
| | | } |
| | | } |
| | | .ip-item.active { |
| | | border-color: var(--mk-sys-color); |
| | | box-shadow: 0 0 2px var(--mk-sys-color); |
| | | } |
| | | } |
| | |
| | | const FuncMegvii = asyncComponent(() => import('./funcMegvii')) |
| | | const FuncZip = asyncComponent(() => import('./funczip')) |
| | | const EditLine = asyncComponent(() => import('./editLine')) |
| | | const ExportPdf = asyncComponent(() => import('./exportPdf')) |
| | | |
| | | class ActionList extends Component { |
| | | static propTpyes = { |
| | |
| | | return ( |
| | | <FuncZip |
| | | key={item.uuid} |
| | | show={item.show || 'actionList'} |
| | | disabled={false} |
| | | BID={BID} |
| | | btn={item} |
| | | BData={BData} |
| | | setting={setting} |
| | | selectedData={selectedData} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'expPdf') { |
| | | return ( |
| | | <ExportPdf |
| | | key={item.uuid} |
| | | btn={item} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'addline' || item.funcType === 'delline') { |
| | | return ( |
| | | <EditLine |