king
2020-11-10 a9ac16fecc0cf9bc66dfaefe4e9b35fa3c722812
2020-11-10
13个文件已修改
4个文件已添加
380 ■■■■ 已修改文件
package-lock.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/barcode/index.jsx 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/barcode/index.scss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/qrcode/index.jsx 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/qrcode/index.scss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/dragaction/card.jsx 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/dragaction/index.scss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/elementform/index.jsx 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/formconfig.jsx 113 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/settingform/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/cardcellList/index.jsx 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/cardcellList/index.scss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/prop-card/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/createinterface/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -11395,6 +11395,11 @@
        "esprima": "^4.0.0"
      }
    },
    "jsbarcode": {
      "version": "3.11.3",
      "resolved": "https://registry.npmjs.org/jsbarcode/-/jsbarcode-3.11.3.tgz",
      "integrity": "sha512-TsoeHL/0ASvKE3+sbLuTkT2cGvDV/MsQAQVuGf/1EWKe7SXNYlyzW/3TFeAmqJg/Fhz6pPgrci8o5hR+Ej59Jw=="
    },
    "jsbn": {
      "version": "0.1.1",
      "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
package.json
@@ -53,6 +53,7 @@
    "jest-environment-jsdom-fourteen": "0.1.0",
    "jest-resolve": "24.8.0",
    "jest-watch-typeahead": "0.3.1",
    "jsbarcode": "^3.11.3",
    "md5": "^2.2.1",
    "mini-css-extract-plugin": "0.5.0",
    "moment": "^2.24.0",
public/index.html
@@ -2,6 +2,7 @@
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
src/components/barcode/index.jsx
New file
@@ -0,0 +1,53 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import JsBarcode from 'jsbarcode'
import './index.scss'
class BarCode extends Component {
  static propTpyes = {
    card: PropTypes.object,  // 条码设置
    value: PropTypes.any,    // 条码值
  }
  componentDidMount () {
    this.resetBarcode()
  }
  UNSAFE_componentWillReceiveProps (nextProps) {
    if ((nextProps.value && this.props.value !== nextProps.value) || !is(fromJS(nextProps.card), fromJS(this.props.card))) {
      this.setState({}, () => {
        this.resetBarcode()
      })
    }
  }
  resetBarcode = () => {
    const { value, card } = this.props
    let style = card.style || {}
    JsBarcode(this.barcode, value, {
      displayValue: card.displayValue === 'true',
      width: card.interval || 1,
      height: card.barHeight || 25,
      margin: 0,
      fontOptions: `${style.fontWeight || ''} ${style.fontStyle || ''}`,
      textAlign: style.textAlign || 'left',
      fontSize: (style.fontSize || 14) + 'px',
      lineColor: style.color || '#000000'
    })
  }
  render() {
    return (
      <div className="barcode-box">
        <svg ref={(ref) => { this.barcode = ref }}/>
      </div>
    )
  }
}
export default BarCode
src/components/barcode/index.scss
New file
@@ -0,0 +1,5 @@
.barcode-box {
  svg {
    vertical-align: top;
  }
}
src/components/qrcode/index.jsx
New file
@@ -0,0 +1,53 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import * as QrCode from 'qrcode.react'
import './index.scss'
class BarCode extends Component {
  static propTpyes = {
    card: PropTypes.object,  // 条码设置
    value: PropTypes.any,    // 条码值
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps))
  }
  hexify = (color) => {
    let values = color.replace(/rgba?\(/, '').replace(/\)/, '').replace(/[\s+]/g, '').split(',')
    let a = parseFloat(values[3] || 1)
    let r = Math.floor(a * parseInt(values[0]) + (1 - a) * 255)
    let g = Math.floor(a * parseInt(values[1]) + (1 - a) * 255)
    let b = Math.floor(a * parseInt(values[2]) + (1 - a) * 255)
    return '#' + ('0' + r.toString(16)).slice(-2) + ('0' + g.toString(16)).slice(-2) + ('0' + b.toString(16)).slice(-2)
  }
  render() {
    const { value, card } = this.props
    let color = card.color
    if (/rgb/ig.test(color)) {
      color = this.hexify(color)
    }
    return (
      <div className="qrcode-box">
        <QrCode
          value={value}
          size={card.qrWidth || 50}
          fgColor={color}
          imageSettings={card.url ? {
            src: card.url,
            height: (card.qrWidth || 50) / 4,
            width: (card.qrWidth || 50) / 4,
            excavate: true
          } : null}/>
      </div>
    )
  }
}
export default BarCode
src/components/qrcode/index.scss
New file
@@ -0,0 +1,5 @@
.qrcode-box {
  canvas {
    vertical-align: top;
  }
}
src/menu/components/card/cardcellcomponent/dragaction/card.jsx
@@ -1,13 +1,19 @@
import React from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { Icon, Popover } from 'antd'
import './index.scss'
import moment from 'moment'
import demo1 from '@/assets/img/demo1.jpg'
import demo2 from '@/assets/img/demo2.jpg'
import demo3 from '@/assets/img/demo3.jpg'
import demo4 from '@/assets/img/demo4.jpg'
import demo5 from '@/assets/img/demo5.jpg'
import asyncComponent from '@/utils/asyncComponent'
import './index.scss'
const BarCode = asyncComponent(() => import('@/components/barcode'))
const QrCode = asyncComponent(() => import('@/components/qrcode'))
const Card = ({ id, cardIds, card, moveCard, findCard, editCard, delCard, copyCard, changeStyle }) => {
  const originalIndex = findCard(id).index
@@ -94,9 +100,28 @@
        <div className="ant-mk-picture" style={_imagestyle}></div>
      )
    } else if (card.eleType === 'splitline') {
      let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth
      return (
        <div style={{paddingTop: '1px'}}>
          <div className="ant-mk-splitline" style={{borderColor: card.color}}></div>
          <div className="ant-mk-splitline" style={{borderColor: card.color, borderWidth: _borderWidth}}></div>
        </div>
      )
    } else if (card.eleType === 'barcode') {
      return (
        <div style={{height: card.innerHeight || 25}}>
          <BarCode card={card} value={card.value || 'mksoft'}/>
        </div>
      )
    } else if (card.eleType === 'qrcode') {
      return (
        <div style={{minHeight: card.qrWidth || 50}}>
          <QrCode card={card} value={card.value || 'mksoft'}/>
        </div>
      )
    } else if (card.eleType === 'currentDate') {
      return (
        <div className="ant-mk-date">
          {`${card.prefix || ''}${moment().format(card.dateFormat)}${card.postfix || ''}`}
        </div>
      )
    }
src/menu/components/card/cardcellcomponent/dragaction/index.scss
@@ -92,6 +92,14 @@
    border-left: 0;
    border-right: 0;
  }
  .ant-mk-date {
    white-space: nowrap;
    overflow: hidden;
    word-break: break-word;
    text-overflow: ellipsis;
    font-weight: inherit;
    font-style: inherit;
  }
  .ant-mk-picture {
    background-size: cover;
    background-position: center center;
src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -16,7 +16,10 @@
  icon: ['eleType', 'icon', 'datatype', 'width'],
  link: ['eleType', 'datatype', 'label', 'width', 'height', 'joint'],
  slider: ['eleType', 'datatype', 'width', 'color', 'maxValue'],
  splitline: ['eleType', 'color', 'width'],
  splitline: ['eleType', 'color', 'width', 'borderWidth'],
  barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval'],
  qrcode: ['eleType', 'datatype', 'width', 'qrWidth', 'color', 'url'],
  currentDate: ['eleType', 'width', 'dateFormat', 'prefix', 'postfix'],
}
class MainSearch extends Component {
@@ -73,7 +76,7 @@
  getOptions = (eleType, datatype) => {
    let _options = fromJS(cardTypeOptions[eleType]).toJS() // 选项列表
    
    if (['text', 'number', 'picture', 'link', 'slider'].includes(eleType)) {
    if (['text', 'number', 'picture', 'link', 'slider', 'barcode', 'qrcode'].includes(eleType)) {
      if (datatype === 'dynamic') {
        _options.push('field')
      } else if (eleType !== 'picture') {
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -19,6 +19,9 @@
    { value: 'link', text: '链接'},
    { value: 'slider', text: '进度条'},
    { value: 'splitline', text: '分割线'},
    { value: 'barcode', text: '条形码'},
    { value: 'qrcode', text: '二维码'},
    { value: 'currentDate', text: '当前时间'},
  ]
  if (type === 'table') {
@@ -95,6 +98,14 @@
      options: []
    },
    {
      type: 'text',
      key: 'value',
      min: 0,
      label: '内容',
      initVal: card.value || '',
      required: true
    },
    {
      type: 'file',
      key: 'url',
      label: '图片',
@@ -104,18 +115,38 @@
    },
    {
      type: 'text',
      key: 'value',
      min: 0,
      label: '内容',
      initVal: card.value || '',
      required: true
    },
    {
      type: 'text',
      key: 'label',
      label: '显示信息',
      initVal: card.label || '',
      required: false
    },
    {
      type: 'select',
      key: 'format',
      label: '格式化',
      initVal: card.format || '',
      tooltip: '注:百分数、千分位对于数值类型有效,YYYY-MM-DD对于时间类型的文本有效。',
      required: false,
      options: [
        { value: '', text: '无' },
        { value: 'percent', text: '百分数' },
        { value: 'thdSeparator', text: '千分位' },
        { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }
      ]
    },
    {
      type: 'select',
      key: 'dateFormat',
      label: '格式化',
      initVal: card.dateFormat || 'YYYY-MM-DD',
      required: true,
      options: [
        { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' },
        { value: 'YYYY', text: 'YYYY' },
        { value: 'YYYY-MM', text: 'YYYY-MM' },
        { value: 'YYYY-MM-DD HH:mm', text: 'YYYY-MM-DD HH:mm' },
        { value: 'YYYY-MM-DD HH:mm:ss', text: 'YYYY-MM-DD HH:mm:ss' },
      ]
    },
    {
      type: 'text',
@@ -140,24 +171,10 @@
      required: false
    },
    {
      type: 'select',
      key: 'format',
      label: '格式化',
      initVal: card.format || '',
      tooltip: '注:百分数、千分位对于数值类型有效,YYYY-MM-DD对于时间类型的文本有效。',
      required: false,
      options: [
        { value: '', text: '无' },
        { value: 'percent', text: '百分数' },
        { value: 'thdSeparator', text: '千分位' },
        { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }
      ]
    },
    {
      type: 'color',
      key: 'color',
      label: '颜色',
      initVal: card.color,
      initVal: card.color || 'rgba(0, 0, 0, 0.85)',
      required: true
    },
    {
@@ -175,7 +192,7 @@
      min: 1,
      max: 24,
      precision: 0,
      label: '宽度',
      label: '元素宽度',
      initVal: card.width || 12,
      tooltip: '栅格布局,每行等分为24列。',
      required: true
@@ -190,6 +207,54 @@
      required: true,
    },
    {
      type: 'number',
      key: 'barHeight',
      min: 5,
      max: 50,
      label: '高度',
      initVal: card.barHeight || 25,
      required: true,
    },
    {
      type: 'number',
      key: 'qrWidth',
      min: 5,
      max: 500,
      label: '宽度',
      initVal: card.qrWidth || 50,
      required: true,
    },
    {
      type: 'number',
      key: 'interval',
      min: 0.1,
      max: 10,
      precision: 1,
      label: '线条间隔',
      initVal: card.interval || 1,
      required: true,
    },
    {
      type: 'radio',
      key: 'displayValue',
      label: '显示值',
      initVal: card.displayValue || 'false',
      required: false,
      options: [
        { value: 'true', text: '是' },
        { value: 'false', text: '否' }
      ]
    },
    {
      type: 'number',
      key: 'borderWidth',
      min: 0,
      max: 50,
      label: '线宽',
      initVal: card.borderWidth || 1,
      required: true
    },
    {
      type: 'select',
      key: 'lenWidRadio',
      label: '长宽比',
src/menu/components/card/cardcellcomponent/index.jsx
@@ -146,6 +146,16 @@
      }
      _card.innerHeight = fontSize * lineHeight * line
    } else if (_card.eleType === 'barcode') {
      _card.style = style
      let fontSize = 14
      if (_card.style.fontSize) {
        fontSize = parseInt(_card.style.fontSize)
      }
      _card.innerHeight = _card.barHeight + (_card.displayValue === 'true' ? fontSize + 2 : 0)
    } else if (_card.eleType === 'button') { // 拆分style
      let _style = fromJS(style).toJS()
      _card.style = {}
@@ -415,6 +425,14 @@
            if (res.eleType === 'link' && !res.style.color) {
              res.style.color = 'rgba(24, 144, 255, 1)'
            }
          } else if (res.eleType === 'barcode') {
            let fontSize = 14
            if (res.style && res.style.fontSize) {
              fontSize = parseInt(res.style.fontSize)
            }
            res.innerHeight = res.barHeight + (res.displayValue === 'true' ? fontSize + 2 : 0)
          }
          
          return res
src/menu/datasource/verifycard/settingform/index.jsx
@@ -249,10 +249,6 @@
                  initialValue: setting.varMark || '',
                  rules: [
                    {
                      required: true,
                      message: this.props.dict['form.required.input'] + '变量标识!'
                    },
                    {
                      pattern: /^[a-zA-Z_]*$/ig,
                      message: '请使用字母或_'
                    },
src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -2,10 +2,12 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Icon, Col, Tooltip, notification } from 'antd'
import moment from 'moment'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import asyncComponent from './asyncButtonComponent'
import asyncElementComponent from '@/utils/asyncComponent'
import './index.scss'
@@ -17,6 +19,8 @@
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 BarCode = asyncElementComponent(() => import('@/components/barcode'))
const QrCode = asyncElementComponent(() => import('@/components/qrcode'))
class CardCellComponent extends Component {
  static propTpyes = {
@@ -266,10 +270,55 @@
        </Col>
      )
    } else if (card.eleType === 'splitline') {
      let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth
      return (
        <Col key={card.uuid} span={card.width}>
          <div style={card.style}>
            <div className="ant-mk-splitline" style={{borderColor: card.color}}></div>
            <div className="ant-mk-splitline" style={{borderColor: card.color, borderWidth: _borderWidth}}></div>
          </div>
        </Col>
      )
    } else if (card.eleType === 'barcode') {
      let val = ''
      if (card.datatype === 'static') {
        val = card.value
      } else if (data.hasOwnProperty(card.field)) {
        val = data[card.field]
      }
      return (
        <Col key={card.uuid} span={card.width}>
          <div style={card.style}>
            <div style={{height: card.innerHeight || 25}}>
              {val ? <BarCode card={card} value={val}/> : null}
            </div>
          </div>
        </Col>
      )
    } else if (card.eleType === 'qrcode') {
      let val = ''
      if (card.datatype === 'static') {
        val = card.value
      } else if (data.hasOwnProperty(card.field)) {
        val = data[card.field]
      }
      return (
        <Col key={card.uuid} span={card.width}>
          <div style={card.style}>
            <div style={{minHeight: card.qrWidth || 50}}>
              {val ? <QrCode card={card} value={val}/> : null}
            </div>
          </div>
        </Col>
      )
    } else if (card.eleType === 'currentDate') {
      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}
          </div>
        </Col>
      )
src/tabviews/custom/components/card/cardcellList/index.scss
@@ -97,6 +97,12 @@
    border-left: 0;
    border-right: 0;
  }
  .ant-mk-date {
    white-space: nowrap;
    overflow: hidden;
    word-break: break-word;
    text-overflow: ellipsis;
  }
  .ant-slider {
    margin: 0px;
  }
src/tabviews/custom/components/card/prop-card/index.jsx
@@ -40,7 +40,10 @@
      _sync = _config.setting.sync === 'true'
      if (_config.setting.sync === 'true' && data) {
        _data = data[_config.dataName] || []
        _data = data[_config.dataName]
        if (_data && Array.isArray(_data)) {
          _data = _data[0]
        }
        _sync = false
      }
    } else {
@@ -104,9 +107,12 @@
    const { sync, config } = this.state
    if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
      let _data = []
      let _data = {}
      if (nextProps.data && nextProps.data[config.dataName]) {
        _data = nextProps.data[config.dataName] || []
        _data = nextProps.data[config.dataName]
        if (_data && Array.isArray(_data)) {
          _data = _data[0]
        }
      }
      this.setState({sync: false, loading: false, data: _data})
@@ -144,7 +150,7 @@
    if (config.wrap.datatype === 'static') {
      this.setState({
        loading: false,
        data: []
        data: {}
      })
      return
    } else {
@@ -160,7 +166,7 @@
    if (result.status) {
      this.setState({
        activeKey: '',
        data: result.data,
        data: result.data && result.data[0] ? result.data[0] : {},
        loading: false
      })
    } else {
@@ -214,7 +220,7 @@
        {data ? <div className="card-row-list">
          {config.subcards.map((item, index) => (
            <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} onClick={() => {this.changeCard(index, item)}}>
              <CardItem BID={BID} card={item} cards={config} data={data[0] || {}} updateStatus={this.updateStatus}/>
              <CardItem BID={BID} card={item} cards={config} data={data} updateStatus={this.updateStatus}/>
            </Col>
          ))}
        </div> : null}
src/templates/zshare/createinterface/index.jsx
@@ -709,7 +709,8 @@
    }
    _sql = `/* 系统生成 */
        Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50)${_declarefields}
        select @UserName='',@FullName=''
        select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@
      `