king
2020-11-12 7facbed508592e842f9bca085cf0ffaebcbfc571
2020-11-12
2 文件已重命名
11个文件已修改
2个文件已添加
419 ■■■■■ 已修改文件
src/menu/components/card/data-card/wrapsetting/settingform/index.jsx 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/data-card/index.jsx 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/prop-card/index.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/table-card/index.jsx 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/chart/antv-bar-line/index.jsx 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/chart/antv-pie/index.jsx 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/createinterface/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/billprint/index.jsx 196 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/billprint/index.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/menuform/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/menuform/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/printmenuform/index.jsx 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/printmenuform/index.scss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/data-card/wrapsetting/settingform/index.jsx
@@ -172,6 +172,23 @@
                })(<InputNumber min={100} max={2000} precision={0} onPressEnter={this.handleSubmit} />)}
              </Form.Item>
            </Col> : null}
            {MenuType === 'billPrint' && config.subtype === 'propcard' ? <Col span={12}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="选择类型为《页眉/页脚》时,打印的每页里都会带有该组件。">
                  <Icon type="question-circle" />
                  组件类型
                </Tooltip>
              }>
                {getFieldDecorator('printType', {
                  initialValue: wrap.printType || 'content'
                })(
                  <Radio.Group>
                    <Radio value="content">内容</Radio>
                    <Radio value="headerOrfooter">页眉/页脚</Radio>
                  </Radio.Group>
                )}
              </Form.Item>
            </Col> : null}
            {MenuType !== 'billPrint' ? <Col span={12}>
              <Form.Item label="黑名单">
                {getFieldDecorator('blacklist', {
src/menu/datasource/verifycard/index.jsx
@@ -177,9 +177,9 @@
    let _setting = fromJS(config.setting).toJS()
    if (!_setting.varMark) {
      _setting.varMark = this.getMark(Marks)
    }
    // if (!_setting.varMark) {
    //   _setting.varMark = this.getMark(Marks)
    // }
    this.setState({
      columns: fromJS(config.columns).toJS(),
src/tabviews/custom/components/card/data-card/index.jsx
@@ -35,7 +35,7 @@
  }
  UNSAFE_componentWillMount () {
    const { data } = this.props
    const { data, initdata } = this.props
    let _config = fromJS(this.props.config).toJS()
    let _card = _config.subcards[0]
    let _cols = new Map()
@@ -46,6 +46,9 @@
    if (_config.setting.sync === 'true' && data) {
      _data = data[_config.dataName] || []
      _sync = false
    } else if (_config.setting.sync === 'true' && initdata) {
      _data = initdata || []
      _sync = false
    }
    _config.columns.forEach(item => {
src/tabviews/custom/components/card/prop-card/index.jsx
@@ -30,7 +30,7 @@
  }
  UNSAFE_componentWillMount () {
    const { data } = this.props
    const { data, initdata } = this.props
    let _config = fromJS(this.props.config).toJS()
    let _cols = new Map()
@@ -39,15 +39,21 @@
    if (_config.setting && _config.wrap.datatype !== 'static') {
      _sync = _config.setting.sync === 'true'
      if (_config.setting.sync === 'true' && data) {
      if (_sync && data) {
        _data = data[_config.dataName]
        if (_data && Array.isArray(_data)) {
          _data = _data[0]
        }
        _sync = false
      } else if (_sync && initdata) {
        _data = initdata
        if (_data && Array.isArray(_data)) {
          _data = _data[0]
        }
        _sync = false
      }
    } else {
      _data = []
      _data = {}
    }
    _config.columns.forEach(item => {
src/tabviews/custom/components/card/table-card/index.jsx
@@ -34,7 +34,7 @@
  }
  UNSAFE_componentWillMount () {
    const { data } = this.props
    const { data, initdata } = this.props
    let _config = fromJS(this.props.config).toJS()
    let _cols = new Map()
@@ -44,6 +44,9 @@
    if (_config.setting.sync === 'true' && data) {
      _data = data[_config.dataName] || []
      _sync = false
    } else if (_config.setting.sync === 'true' && initdata) {
      _data = initdata || []
      _sync = false
    }
    let showHeader = false
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -45,7 +45,7 @@
  }
  UNSAFE_componentWillMount () {
    const { config, data } = this.props
    const { config, data, initdata } = this.props
    let _config = fromJS(config).toJS()
    let _data = null
@@ -54,6 +54,9 @@
    if (config.setting.sync === 'true' && data) {
      _data = data[config.dataName] || []
      _sync = false
    } else if (config.setting.sync === 'true' && initdata) {
      _data = initdata || []
      _sync = false
    }
    let vFields = []
src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -35,7 +35,7 @@
  }
  UNSAFE_componentWillMount () {
    const { config, data } = this.props
    const { config, data, initdata } = this.props
    let _config = fromJS(config).toJS()
    let _data = null
@@ -44,6 +44,9 @@
    if (config.setting.sync === 'true' && data) {
      _data = data[config.dataName] || []
      _sync = false
    } else if (config.setting.sync === 'true' && initdata) {
      _data = initdata || []
      _sync = false
    }
    let showHeader = false
src/templates/zshare/createinterface/index.jsx
@@ -966,7 +966,7 @@
        if (item.writein === false) return
        keys.push(item.key.toLowerCase())
        values.push('@' + item.key + '@')
        values.push('@' + item.key)
      })
      if (!keys.includes(primaryKey.toLowerCase())) {
@@ -1006,7 +1006,7 @@
        if (item.writein === false) return
        _arr.push(item.key.toLowerCase())
        _form.push(item.key + `=@${item.key}@`)
        _form.push(item.key + `=@${item.key}`)
      })
      
      if (!_arr.includes('modifydate')) {
src/views/billprint/index.jsx
@@ -25,6 +25,7 @@
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    loadingview: true,
    dataManager: false,
    pages: null,
    BID: '',
    data: '',
    tempId: '',
@@ -105,6 +106,48 @@
          return
        }
        config.style = config.style || {}
        if (config.pageSize === 'A0') {
          if (config.pageLayout === 'horizontal') {
            config.style.height = 1305
          } else {
            config.style.height = 1305
          }
        } else if (config.pageSize === 'A1') {
          if (config.pageLayout === 'horizontal') {
            config.style.height = 1305
          } else {
            config.style.height = 1305
          }
        } else if (config.pageSize === 'A2') {
          if (config.pageLayout === 'horizontal') {
            config.style.height = 1305
          } else {
            config.style.height = 1305
          }
        } else if (config.pageSize === 'A3') {
          if (config.pageLayout === 'horizontal') {
            config.style.height = 1305
          } else {
            config.style.height = 1305
          }
        } else if (config.pageSize === 'A5') {
          if (config.pageLayout === 'horizontal') {
            config.style.height = 1305
          } else {
            config.style.height = 1305
          }
        } else {
          if (config.pageLayout === 'horizontal') {
            config.style.height = 895
          } else {
            config.style.height = 1305
          }
        }
        // config.style.height = 895
        let params = []
        let _pars = []
@@ -112,6 +155,7 @@
        config.components = config.components.map(component => {
          if (component.action) component.action = []
          if (component.search) component.search = []
          component.data = [] // 初始化数据为空
    
          if (!component.setting) return component // 不使用系统函数时
          if (!component.format || (component.subtype === 'propcard' && component.wrap.datatype === 'static')) return component // 没有动态数据  数据格式 array 或 object
@@ -186,7 +230,7 @@
          config
        }, () => {
          if (params.length === 0) {
            this.setState({loadingview: false})
            this.setState({loadingview: false, pages: [config.components]})
          } else {
            this.loadmaindata(params)
          }
@@ -272,6 +316,8 @@
   * @description 主表数据加载
   */ 
  loadmaindata = (params) => {
    const { components, everyPCount, firstCount, lastCount } = this.state.config
    let deffers = params.map(item => {
      let componentId = item.componentId
      delete item.componentId
@@ -295,16 +341,124 @@
    Promise.all(deffers).then(results => {
      let _results = results.filter(Boolean)
      this.setState({loadingview: false})
      let comps = components.map(item => {
        if (item.subtype === 'propcard' && item.wrap.datatype === 'static') return item
      if (_results.length === results.length) {
        console.log(_results)
        _results.forEach(res => {
          if (res.componentId === item.uuid && res.data) {
            item.data = res.data
            item.dataArray = fromJS(res.data).toJS()
          } else if (res.componentId === 'union' && res[item.dataName]) {
            item.data = res[item.dataName]
            item.dataArray = fromJS(res[item.dataName]).toJS()
          }
        })
        return item
      })
      let length = comps.length
      let pageIndex = 1
      let pages = []
      let over = false
      if (length === 0) {
        this.setState({loadingview: false, pages})
      }
      // delete result.ErrCode
      // delete result.ErrMesg
      // delete result.message
      // delete result.status
      // everyPCount, firstCount, lastCount
      while (!over) {
        let page = []
        let count = 0
        let _pageover = false
        let pagesover = false
        let limit = pageIndex === 1 ? (firstCount || 20) : (everyPCount || 20)
        comps.forEach((_item, index) => {
          let item = fromJS(_item).toJS()
          if (item.wrap && item.wrap.printType === 'headerOrfooter') { // 页眉页脚
            page.push(item)
          } else if (_pageover) {
            return
          } else if (item.type === 'card' && item.subtype === 'datacard') {
            if (!_item.dataArray || _item.dataArray.length === 0) return
            item.data = []
            while (count < limit && _item.dataArray.length > 0) {
              item.data.push(_item.dataArray.shift())
              count++
            }
            if (count >= limit) {
              _pageover = true
            }
            page.push(item)
          } else {
            page.push(item)
          }
          if (index + 1 === length && !_pageover) {
            pagesover = true
          }
        })
        if (pagesover && lastCount && count > lastCount) {
          pagesover = false
          page = []
          count = 0
          _pageover = false
          if (pageIndex === 1) {
            limit = (everyPCount - firstCount) + (everyPCount - lastCount)
            if (limit <= 0) {
              limit = firstCount
            }
          } else {
            limit = lastCount
          }
          comps.forEach((_item, index) => {
            let item = fromJS(_item).toJS()
            if (item.wrap && item.wrap.printType === 'headerOrfooter') { // 页眉页脚
              page.push(item)
            } else if (_pageover) {
              return
            } else if (item.type === 'card' && item.subtype === 'datacard') {
              if (!_item.dataArray || _item.dataArray.length === 0) return
              item.data = []
              while (count < limit && _item.dataArray.length > 0) {
                item.data.push(_item.dataArray.shift())
                count++
              }
              if (count >= limit) {
                _pageover = true
              }
              page.push(item)
            } else {
              page.push(item)
            }
            if (index + 1 === length && !_pageover) {
              pagesover = true
            }
          })
        }
        pages.push(page)
        pageIndex++
        if (pageIndex >= 2000 || pagesover) {
          over = true
        }
      }
      this.setState({loadingview: false, pages})
    })
  }
@@ -312,7 +466,7 @@
    let bdhtml = window.document.body.innerHTML
    let jubuData = document.getElementById('bill-print').innerHTML
    window.document.body.innerHTML = jubuData
    // document.getElementsByTagName('body')[0].style.zoom = 0.7
    document.getElementsByTagName('body')[0].style.zoom = 0.8
    try {
      if (window.ActiveXObject) {
@@ -366,34 +520,32 @@
    window.location.reload()
  }
  getComponents = () => {
    const { config, BID, data, dataManager } = this.state
  getComponents = (components) => {
    const { dataManager } = this.state
    return config.components.map(item => {
      if (!item) return null
    return components.map(item => {
      if (item.type === 'bar' || item.type === 'line') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={[]} menuType="" dataManager={dataManager} />
            <AntvBarAndLine config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} />
          </Col>
        )
      } else if (item.type === 'pie') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvPie config={item} data={data} BID={BID} mainSearch={[]} menuType="" dataManager={dataManager} />
            <AntvPie config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} />
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'datacard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <DataCard config={item} data={data} BID={BID} mainSearch={[]} menuType="" dataManager={dataManager} />
            <DataCard config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} />
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'propcard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <PropCard config={item} data={data} BID={BID} mainSearch={[]} menuType="" dataManager={dataManager} />
            <PropCard config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} />
          </Col>
        )
      } else {
@@ -403,14 +555,16 @@
  }
  render() {
    const { loadingview, viewlost, config } = this.state
    const { loadingview, viewlost, config, pages } = this.state
    return (
      <div className="bill-print-wrap" >
        {loadingview && <Spin size="large" />}
        {config ? <div id="bill-print" style={config.style}><Row>{this.getComponents()}</Row></div> : null}
        {pages ? <div id="bill-print">
          {pages.map((components, index) => (<div className="print-page" key={index} style={config.style}><Row>{this.getComponents(components)}</Row></div>))}
        </div> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
        {!loadingview && !viewlost ? <div className="print-button"><Button onClick={this.print}>打印</Button></div> : null}
        {pages && !loadingview && !viewlost ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null}
      </div>
    )
  }
src/views/billprint/index.scss
@@ -11,6 +11,10 @@
  .box404 {
    margin-top: 10vh;
  }
  .print-page {
    height: 900px;
    overflow: hidden;
  }
  .print-button {
    position: fixed;
    right: 10px;
src/views/menudesign/index.jsx
@@ -22,8 +22,9 @@
const { confirm } = Modal
const _locale = localStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS
const MenuForm = asyncComponent(() => import('./menuform'))
const PrintMenuForm = asyncComponent(() => import('./printmenuform'))
const Header = asyncComponent(() => import('@/menu/header'))
const MenuForm = asyncComponent(() => import('@/menu/menuform'))
const SourceWrap = asyncComponent(() => import('@/menu/modelsource'))
const MenuShell = asyncComponent(() => import('@/menu/menushell'))
const BgController = asyncComponent(() => import('@/menu/bgcontroller'))
@@ -296,6 +297,9 @@
          config.FstID = 'BillPrintTemp'
          config.SndID = 'BillPrintTemp'
          config.ParentID = 'BillPrintTemp'
          config.firstCount = config.firstCount || 5
          config.everyPCount = config.everyPCount || 5
          config.lastCount = config.lastCount || ''
        }
        this.setState({
@@ -467,6 +471,11 @@
                      initMenuList={this.initMenuList}
                      updateConfig={this.updateConfig}
                    /> : null}
                    {config && MenuType === 'billPrint' ? <PrintMenuForm
                      dict={dict}
                      config={config}
                      updateConfig={this.updateConfig}
                    /> : null}
                    {/* 表名添加 */}
                    {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null}
                  </Panel>
src/views/menudesign/menuform/index.jsx
File was renamed from src/menu/menuform/index.jsx
@@ -4,10 +4,9 @@
import { Form, Row, Col, Input, Select, notification } from 'antd'
import Api from '@/api'
// import { formRule } from '@/utils/option.js'
import './index.scss'
class MainSearch extends Component {
class CustomMenuForm extends Component {
  static propTpyes = {
    dict: PropTypes.object, // 字典项
    config: PropTypes.object,
@@ -226,4 +225,4 @@
  }
}
export default Form.create()(MainSearch)
export default Form.create()(CustomMenuForm)
src/views/menudesign/menuform/index.scss
src/views/menudesign/printmenuform/index.jsx
New file
@@ -0,0 +1,139 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, InputNumber, Select, Radio } from 'antd'
import './index.scss'
class MainSearch extends Component {
  static propTpyes = {
    dict: PropTypes.object, // 字典项
    config: PropTypes.object,
    updateConfig: PropTypes.func
  }
  changeFirstCount = (val) => {
    if (typeof(val) !== 'number') {
      val = ''
    }
    this.props.updateConfig({...this.props.config, firstCount: val})
  }
  changeCount = (val) => {
    if (typeof(val) !== 'number') {
      val = ''
    }
    this.props.updateConfig({...this.props.config, everyPCount: val})
  }
  changeLastCount = (val) => {
    if (typeof(val) !== 'number') {
      val = ''
    }
    this.props.updateConfig({...this.props.config, lastCount: val})
  }
  pageSizeChange = (val) => {
    this.props.updateConfig({...this.props.config, pageSize: val})
  }
  onRadioChange = (val) => {
    this.props.updateConfig({...this.props.config, pageLayout: val})
  }
  render() {
    const { dict, config } = this.props
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      }
    }
    return (
      <Form {...formItemLayout} className="print-menu-form">
        <Row>
          <Col span={24}>
            <Form.Item label="打印尺寸">
              {getFieldDecorator('pageSize', {
                initialValue: config.pageSize || 'A4',
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '打印尺寸!'
                  }
                ]
              })(
                <Select onChange={this.pageSizeChange}>
                  <Select.Option value="A0">A0</Select.Option>
                  <Select.Option value="A1">A1</Select.Option>
                  <Select.Option value="A2">A2</Select.Option>
                  <Select.Option value="A3">A3</Select.Option>
                  <Select.Option value="A4">A4</Select.Option>
                  <Select.Option value="A5">A5</Select.Option>
                </Select>
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="打印布局">
              {getFieldDecorator('pageLayout', {
                initialValue: config.pageLayout || 'vertical',
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '打印布局!'
                  }
                ]
              })(
                <Radio.Group onChange={(e) => {this.onRadioChange(e.target.value)}}>
                  <Radio value="vertical">纵向</Radio>
                  <Radio value="horizontal">横向</Radio>
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="首页数(条)">
              {getFieldDecorator('firstCount', {
                initialValue: config.firstCount,
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '首页数!'
                  }
                ]
              })(<InputNumber min={1} max={1000} precision={0} onChange={this.changeFirstCount}/>)}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="每页数(条)">
              {getFieldDecorator('everyPCount', {
                initialValue: config.everyPCount,
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '每页数!'
                  }
                ]
              })(<InputNumber min={1} max={1000} precision={0} onChange={this.changeCount}/>)}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="尾页数(条)">
              {getFieldDecorator('lastCount', {
                initialValue: config.lastCount
              })(<InputNumber min={1} max={1000} precision={0} onChange={this.changeLastCount}/>)}
            </Form.Item>
          </Col>
        </Row>
      </Form>
    )
  }
}
export default Form.create()(MainSearch)
src/views/menudesign/printmenuform/index.scss
New file
@@ -0,0 +1,5 @@
.print-menu-form {
  .ant-input-number {
    width: 100%;
  }
}