king
2024-01-02 84aa4415e0702faf99a20efbedadd6ab36d7a962
2023-01-02
8个文件已修改
2个文件已添加
1个文件已删除
331 ■■■■ 已修改文件
public/manifest.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/dragaction/card.jsx 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/actioncomponent/actionform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/actioncomponent/formconfig.jsx 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/cardcellList/index.jsx 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/exportPdf/index.jsx 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/exportPdf/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/funczip/index.jsx 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/funczip/index.scss 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/funczip/mock.js 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/index.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/manifest.json
@@ -6,5 +6,5 @@
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff",
  "mk_version": "20231201"
  "mk_version": "20240102"
}
src/menu/components/card/cardcellcomponent/dragaction/card.jsx
@@ -65,8 +65,14 @@
  }
  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
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -505,6 +505,8 @@
      } 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')
      }
    }
    
@@ -523,7 +525,7 @@
          shows.push('reason')
        }
      }
    } else {
    } else if (!(openType === 'funcbutton' && this.record.funcType === 'expPdf')) {
      if (openType !== 'excelOut') {
        reOptions.control = [
          { value: '', text: '无' },
@@ -1083,6 +1085,8 @@
                }
              })
            }
          } else if (values.OpenType === 'funcbutton' && values.funcType === 'expPdf') {
            values.Ot = 'notRequired'
          }
          
          if (values.outerBlacklist) {
src/menu/components/share/actioncomponent/formconfig.jsx
@@ -161,7 +161,7 @@
    { value: 'print', text: '标签打印' },
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    // { value: 'expPdf', text: '导出PDF' },
    { value: 'expPdf', text: '导出PDF' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
@@ -204,6 +204,7 @@
      { value: 'reAuth', text: '切换系统(清空缓存-小程序)' },
      { value: 'clearCache', text: '清空本地配置' },
      { value: 'copyurl', text: '复制链接地址' },
      { value: 'expPdf', text: '导出PDF' },
      { value: 'logout', text: '退出' },
      { value: 'goBack', text: '返回' },
    ]
@@ -776,6 +777,21 @@
      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',
@@ -1444,7 +1460,7 @@
    { value: 'print', text: '标签打印' },
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    // { value: 'expPdf', text: '导出PDF' },
    { value: 'expPdf', text: '导出PDF' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
@@ -1900,6 +1916,21 @@
        text: '不重置'
      }]
    },
    // {
    //   type: 'radio',
    //   key: 'exportType',
    //   label: '导出方式',
    //   initVal: card.exportType || 'download',
    //   tooltip: '',
    //   required: true,
    //   options: [{
    //     value: 'download',
    //     text: '下载本地'
    //   }, {
    //     value: 'link',
    //     text: '生成链接'
    //   }]
    // },
    {
      type: 'number',
      key: 'width',
src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -23,6 +23,7 @@
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'))
@@ -656,10 +657,8 @@
        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
          }
        }
@@ -1099,10 +1098,15 @@
            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}
src/tabviews/zshare/actionList/exportPdf/index.jsx
New file
@@ -0,0 +1,183 @@
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
src/tabviews/zshare/actionList/exportPdf/index.scss
src/tabviews/zshare/actionList/funczip/index.jsx
@@ -1,7 +1,7 @@
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'
@@ -10,7 +10,7 @@
import MKEmitter from '@/utils/events.js'
import MkIcon from '@/components/mk-icon'
import './index.scss'
// import './index.scss'
class FuncZip extends Component {
  static propTpyes = {
@@ -21,10 +21,7 @@
  state = {
    loading: false,
    disabled: false,
    loadingNumber: '',
    loadingTotal: '',
    hidden: false,
    visible: false
  }
  UNSAFE_componentWillMount () {
@@ -340,9 +337,7 @@
    const { btn } = this.props
    this.setState({
      loading: false,
      loadingNumber: '',
      loadingTotal: ''
      loading: false
    })
    
    if (btn.execSuccess !== 'never') {
@@ -361,9 +356,7 @@
    const { btn } = this.props
    this.setState({
      loading: false,
      loadingNumber: '',
      loadingTotal: ''
      loading: false
    })
    if (res.ErrCode === '01') {
@@ -411,7 +404,7 @@
  render() {
    const { btn } = this.props
    const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state
    const { loading, disabled, hidden } = this.state
    if (hidden) return null
@@ -439,10 +432,6 @@
      className = 'mk-btn mk-' + btn.class
    }
    
    if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) {
      label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label
    }
    return (
      <>
        <Button
@@ -455,7 +444,6 @@
          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}
      </>
    )
  }
src/tabviews/zshare/actionList/funczip/index.scss
@@ -1,26 +0,0 @@
.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);
  }
}
src/tabviews/zshare/actionList/funczip/mock.js
File was deleted
src/tabviews/zshare/actionList/index.jsx
@@ -18,6 +18,7 @@
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 = {
@@ -180,14 +181,21 @@
          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