From 33e303523ffd8be12df44e4fbb4a942d121d5a20 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 03 八月 2022 14:30:52 +0800
Subject: [PATCH] 2022-08-03

---
 public/options.json                                                  |    2 
 src/views/design/index.jsx                                           |   25 
 src/tabviews/custom/components/module/voucher/assistTable/index.scss |  259 ++++++++++++++
 src/menu/components/table/normal-table/columns/index.jsx             |   16 
 src/tabviews/custom/components/module/voucher/assistTable/index.jsx  |  738 +++++++++++++++++++++++++++++++++++++++++
 src/menu/components/table/edit-table/columns/index.jsx               |   15 
 6 files changed, 1,039 insertions(+), 16 deletions(-)

diff --git a/public/options.json b/public/options.json
index 523da64..79f67c8 100644
--- a/public/options.json
+++ b/public/options.json
@@ -8,7 +8,7 @@
   "filter": "false",
   "defaultApp": "mk",
   "defaultLang": "zh-CN",
-  "WXAppID": "",
+  "WXAppID": "wx4d8a34c8d4494872",
   "WXminiAppID": "",
   "debugger": false,
   "licenseKey": "",
diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx
index 23067de..67057c7 100644
--- a/src/menu/components/table/edit-table/columns/index.jsx
+++ b/src/menu/components/table/edit-table/columns/index.jsx
@@ -18,6 +18,7 @@
 const TableVerify = asyncComponent(() => import('./tableIn'))
 const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
 const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
+const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
 
 class HeaderCol extends Component {
   deleteCol = () => {
@@ -51,7 +52,7 @@
   }
 
   render() {
-    const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props
+    const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props
 
     if (!column) return (
       <th {...restProps} index={index}>
@@ -67,6 +68,7 @@
               <PlusOutlined className="plus" title="娣诲姞" onClick={() => this.props.addElement(column)} /> : null
             }
             <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} />
+            {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null}
             {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null}
             <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} />
             {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
@@ -280,6 +282,16 @@
     this.setState({
       card: fromJS(col).toJS()
     })
+  }
+
+  pasteCell = (col, cell, resolve) => {
+    resolve({status: true})
+    
+    delete cell.copyType
+    cell.uuid = Utils.getuuid()
+    cell.focus = true
+    
+    MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell)
   }
 
   addElement = (col) => {
@@ -554,6 +566,7 @@
           updateCol: this.updateCol,
           addElement: this.addElement,
           editColumn: this.editColumn,
+          pasteCell: this.pasteCell,
           changeStyle: this.changeStyle,
           deleteCol: this.deleteCol,
         }),
diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx
index 8ae474a..d22150a 100644
--- a/src/menu/components/table/normal-table/columns/index.jsx
+++ b/src/menu/components/table/normal-table/columns/index.jsx
@@ -18,6 +18,7 @@
 const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
 const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
 const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination'))
+const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
 
 class HeaderCol extends Component {
   deleteCol = () => {
@@ -51,7 +52,7 @@
   }
 
   render() {
-    const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props
+    const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props
 
     if (index !== undefined) {
       return connectDragSource(
@@ -62,6 +63,7 @@
                 <PlusOutlined className="plus" title="娣诲姞" onClick={() => this.props.addElement(column)} /> : null
               }
               <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} />
+              {column && column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null}
               {column && column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null}
               <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} />
               {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
@@ -80,6 +82,7 @@
                 <PlusOutlined className="plus" title="娣诲姞" onClick={() => this.props.addElement(column)} /> : null
               }
               <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} />
+              {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null}
               <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} />
               {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
             </div>
@@ -303,6 +306,16 @@
     })
   }
 
+  pasteCell = (col, cell, resolve) => {
+    resolve({status: true})
+    
+    delete cell.copyType
+    cell.uuid = Utils.getuuid()
+    cell.focus = true
+    
+    MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell)
+  }
+
   addElement = (col) => {
     const { config } = this.props
     let column = fromJS(col).toJS()
@@ -482,6 +495,7 @@
           updateCol: this.updateCol,
           addElement: this.addElement,
           editColumn: this.editColumn,
+          pasteCell: this.pasteCell,
           changeStyle: this.changeStyle,
           deleteCol: this.deleteCol,
         }),
diff --git a/src/tabviews/custom/components/module/voucher/assistTable/index.jsx b/src/tabviews/custom/components/module/voucher/assistTable/index.jsx
new file mode 100644
index 0000000..9c56276
--- /dev/null
+++ b/src/tabviews/custom/components/module/voucher/assistTable/index.jsx
@@ -0,0 +1,738 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { is, fromJS } from 'immutable'
+import { Table, Modal, Input, InputNumber, notification, message } from 'antd'
+// import { EditOutlined } from '@ant-design/icons'
+
+import Api from '@/api'
+import Utils from '@/utils/utils.js'
+import MKEmitter from '@/utils/events.js'
+import zhCN from '@/locales/zh-CN/main.js'
+import enUS from '@/locales/en-US/main.js'
+import '@/assets/css/table.scss'
+import './index.scss'
+
+class BodyRow extends React.Component {
+  shouldComponentUpdate (nextProps, nextState) {
+    return !is(fromJS(this.props.data), fromJS(nextProps.data))
+  }
+
+  render() {
+    let { data, ...resProps } = this.props
+    let style = {}
+    let className = ''
+
+    return <tr {...resProps} className={className} style={style}/>
+  }
+}
+
+class BodyCell extends React.Component {
+  state = {
+    editing: false,
+  }
+
+  shouldComponentUpdate (nextProps, nextState) {
+    return !is(fromJS(this.props.record), fromJS(nextProps.record)) ||
+      nextState.editing !== this.state.editing
+  }
+
+  componentDidMount () {
+    MKEmitter.addListener('tdFocus', this.tdFocus)
+  }
+
+  /**
+   * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆
+   */
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('tdFocus', this.tdFocus)
+  }
+
+  tdFocus = (id) => {
+    const { col, record } = this.props
+
+    if (id !== col.uuid + record.uuid) return
+
+    this.focus()
+  }
+
+  enterPress = () => {
+    const { col, record } = this.props
+    const { value } = this.state
+
+    this.setState({editing: false})
+
+    if (value !== record[col.field]) {
+      let line = {...record, [col.field]: value}
+
+      if (col.field === 'debtor') {
+        line.creditor = ''
+      } else {
+        line.debtor = ''
+      }
+
+      MKEmitter.emit('changeRecord', col.tableId, line)
+    }
+
+    setTimeout(() => {
+      if (col.field === 'creditor') {
+        MKEmitter.emit('nextLine', col, record)
+      } else {
+        let cl = {remark: 'subject', subject: 'debtor', debtor: 'creditor'}
+        MKEmitter.emit('tdFocus', cl[col.uuid] + record.uuid)
+      }
+    }, 50)
+  }
+
+  focus = () => {
+    const { col, record } = this.props
+
+    if (record.type === 'total') return
+
+    this.setState({editing: true, value: record[col.field]}, () => {
+      let node = document.getElementById(col.uuid + record.uuid)
+      node && node.select()
+    })
+  }
+
+  onBlur = () => {
+    const { col, record } = this.props
+    const { value } = this.state
+
+    this.setState({editing: false})
+
+    if (value !== record[col.field]) {
+      let line = {...record, [col.field]: value}
+
+      if (col.field === 'debtor') {
+        line.creditor = ''
+      } else {
+        line.debtor = ''
+      }
+
+      MKEmitter.emit('changeRecord', col.tableId, line)
+    }
+  }
+  
+  onChange = (val) => {
+    this.setState({value: val})
+  }
+
+  render() {
+    let { col, record, className } = this.props
+    const { editing } = this.state
+
+    let children = null
+    let colSpan = 1
+
+    if (col.field === 'remark') {
+      let val = record.remark || ''
+
+      if (record.type === 'total') {
+        children = <div className="content-wrap" style={{lineHeight: '60px'}}>鍚堣: {val}</div>
+        colSpan = 2
+      } else {
+        if (editing) {
+          children = <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/>
+        } else {
+          children = <div className="content-wrap" onClick={this.focus}>{val}</div>
+        }
+      }
+    } else if (col.field === 'subject') {
+      if (record.type === 'total') {
+        colSpan = 0
+      } else {
+        let val = record.subject || ''
+  
+        if (editing) {
+          children = <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/>
+        } else {
+          children = <div className="content-wrap" onClick={this.focus}>{val}</div>
+        }
+      }
+    } else if (col.field === 'debtor') {
+      let val = record.debtor
+      let down = false
+      let vals = []
+      if (typeof(val) === 'number') {
+        if (val < 0) {
+          down = true
+          val = Math.abs(val)
+        }
+        vals = (val * 100).toFixed(0).split('').reverse()
+      }
+
+      if (editing) {
+        children = <InputNumber id={col.uuid + record.uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/>
+      } else {
+        children = <div className={'money-uint' + (down ? ' down' : '')} onClick={this.focus}>
+          <span>{vals[10] || ''}</span> <span>{vals[9] || ''}</span> <span>{vals[8] || ''}</span> <span>{vals[7] || ''}</span> <span>{vals[6] || ''}</span> <span>{vals[5] || ''}</span>
+          <span>{vals[4] || ''}</span> <span>{vals[3] || ''}</span> <span>{vals[2] || ''}</span> <span>{vals[1] || ''}</span> <span className="last">{vals[0] || ''}</span>
+        </div>
+      }
+    } else if (col.field === 'creditor') {
+      let val = record.creditor
+      let down = false
+      let vals = []
+      if (typeof(val) === 'number') {
+        if (val < 0) {
+          down = true
+          val = Math.abs(val)
+        }
+        vals = (val * 100).toFixed(0).split('').reverse()
+      }
+
+      if (editing) {
+        children = <InputNumber id={col.uuid + record.uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/>
+      } else {
+        children = <div className={'money-uint' + (down ? ' down' : '')} onClick={this.focus}>
+        <span>{vals[10] || ''}</span> <span>{vals[9] || ''}</span> <span>{vals[8] || ''}</span> <span>{vals[7] || ''}</span> <span>{vals[6] || ''}</span> <span>{vals[5] || ''}</span>
+        <span>{vals[4] || ''}</span> <span>{vals[3] || ''}</span> <span>{vals[2] || ''}</span> <span>{vals[1] || ''}</span> <span className="last">{vals[0] || ''}</span>
+      </div>
+      }
+    }
+
+    if (!colSpan) return null
+
+    return (<td colSpan={colSpan} className={className}>{children}</td>)
+  }
+}
+
+class AssistTable extends Component {
+  static propTpyes = {
+    config: PropTypes.object,        // 鑿滃崟Id
+    BID: PropTypes.any,              // 涓昏〃ID
+    data: PropTypes.any,             // 琛ㄦ牸鏁版嵁
+    total: PropTypes.any,            // 鎬绘暟
+    loading: PropTypes.bool,         // 琛ㄦ牸鍔犺浇涓�
+    refreshdata: PropTypes.func,     // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂�
+  }
+
+  state = {
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    data: [],
+    edData: [],
+    edColumns: [],
+    tableId: '',          // 琛ㄦ牸ID
+    pageSize: 10,         // 姣忛〉鏁版嵁鏉℃暟
+    columns: null,        // 鏄剧ず鍒�
+    loading: false,
+  }
+
+  UNSAFE_componentWillMount () {
+    const { config } = this.props
+
+    let data = [
+      {remark: '鎻愮幇', subject: '1001 搴撳瓨鐜伴噾', debtor: 124, creditor: ''},
+      {remark: '璐叆鍥哄畾璧勪骇', subject: '1001 搴撳瓨鐜伴噾', debtor: '', creditor: 124},
+      {remark: '杞粨閿�鍞垚鏈�', subject: '1001 搴撳瓨鐜伴噾', debtor: -524, creditor: ''},
+      {remark: '鎻愮幇', subject: '1001 搴撳瓨鐜伴噾', debtor: 34, creditor: ''},
+    ]
+
+    data = this.initData(data)
+    data.push(this.getTotalLine(data))
+
+    let columns = [
+      {
+        title: '鎽樿',
+        dataIndex: 'remark',
+        key: 'remark',
+        width: '22%',
+        onCell: record => ({
+          record,
+          col: {uuid: 'remark', field: 'remark', tableId: config.uuid},
+        })
+      },
+      {
+        title: '浼氳绉戠洰',
+        dataIndex: 'subject',
+        key: 'subject',
+        width: '34%',
+        onCell: record => ({
+          record,
+          col: {uuid: 'subject', field: 'subject', tableId: config.uuid},
+        })
+      },
+      {
+        title: () => (<>
+          <div className="money-title">鍊熸柟閲戦</div>
+          <div className="money-uint">
+            <span>浜�</span> <span>鍗�</span> <span>鐧�</span> <span>鍗�</span> <span>涓�</span> <span>鍗�</span>
+            <span>鐧�</span> <span>鍗�</span> <span>鍏�</span> <span>瑙�</span> <span className="last">鍒�</span>
+          </div>
+        </>),
+        dataIndex: 'debtor',
+        key: 'debtor',
+        width: '22%',
+        onCell: record => ({
+          record,
+          col: {uuid: 'debtor', field: 'debtor', tableId: config.uuid},
+        })
+      },
+      {
+        title: () => (<>
+          <div className="money-title">璐锋柟閲戦</div>
+          <div className="money-uint">
+            <span>浜�</span> <span>鍗�</span> <span>鐧�</span> <span>鍗�</span> <span>涓�</span> <span>鍗�</span>
+            <span>鐧�</span> <span>鍗�</span> <span>鍏�</span> <span>瑙�</span> <span className="last">鍒�</span>
+          </div>
+        </>),
+        dataIndex: 'creditor',
+        key: 'creditor',
+        width: '22%',
+        onCell: record => ({
+          record,
+          col: {uuid: 'creditor', field: 'creditor', tableId: config.uuid},
+        })
+      }
+    ]
+
+    this.setState({
+      data: data,
+      edData: fromJS(data).toJS(),
+      columns,
+      tableId: config.uuid
+    })
+  }
+
+  shouldComponentUpdate (nextProps, nextState) {
+    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
+  }
+
+  componentDidMount () {
+    MKEmitter.addListener('nextLine', this.nextLine)
+    MKEmitter.addListener('delRecord', this.delRecord)
+    MKEmitter.addListener('changeRecord', this.changeRecord)
+  }
+
+  /**
+   * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
+   */
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('nextLine', this.nextLine)
+    MKEmitter.removeListener('delRecord', this.delRecord)
+    MKEmitter.removeListener('changeRecord', this.changeRecord)
+  }
+
+  UNSAFE_componentWillReceiveProps(nextProps) {
+    if (!is(fromJS(this.props.data), fromJS(nextProps.data))) {
+      this.setState({data: nextProps.data || []})
+    }
+  }
+
+  initData = (data) => {
+    let _data = data.map((item, i) => {
+      item.uuid = Utils.getuuid()
+      item.index = i
+      
+      return item
+    })
+
+    if (_data.length < 4) {
+      for (let i = _data.length - 1; i < 4; i++) {
+        _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''})
+      }
+    }
+    return _data
+  }
+
+  getTotalLine = (data) => {
+    let totalLine = {uuid: Utils.getuuid(), type: 'total'}
+    let debtor = ''
+    let creditor = ''
+
+    data.forEach(item => {
+      if (typeof(item.debtor) === 'number') {
+        if (debtor === '') {
+          debtor = 0
+        }
+
+        debtor += item.debtor
+      } else if (typeof(item.creditor) === 'number') {
+        if (debtor === '') {
+          debtor = 0
+        }
+        if (creditor === '') {
+          creditor = 0
+        }
+        creditor += item.creditor
+      }
+    })
+
+    totalLine.debtor = debtor
+    totalLine.creditor = creditor
+
+    totalLine.remark = this.changeMoneyToChinese(debtor)
+    
+    return totalLine
+  }
+  
+  changeMoneyToChinese = (money) => {
+    let cnNums = ['闆�', '澹�', '璐�', '鍙�', '鑲�', '浼�', '闄�', '鏌�', '鎹�', '鐜�']
+    let cnIntRadice = ['', '鎷�', '浣�', '浠�']
+    let cnIntUnits = ['', '涓�', '浜�', '鍏�']
+    let cnDecUnits = ['瑙�', '鍒�', '姣�', '鍘�']
+    let cnInteger = '鏁�'
+    let cnIntLast = '鍏�'
+    let maxNum = 999999999999999.9999 // 鏈�澶у鐞嗙殑鏁板瓧
+    let IntegerNum = null
+    let DecimalNum = null
+    let ChineseStr = ''
+    let parts = null // 鍒嗙閲戦鍚庣敤鐨勬暟缁勶紝棰勫畾涔�
+    let Symbol = ''  // 姝h礋鍊兼爣璁�
+
+    if (money === '') return ''
+
+    if (money >= maxNum) return '瓒呭嚭鏈�澶у鐞嗘暟瀛�'
+
+    if (money === 0) {
+      ChineseStr = cnNums[0] + cnIntLast + cnInteger;
+      return ChineseStr
+    }
+    if(money < 0) {
+      money = -money
+      Symbol = '璐�'       
+    }
+    money = money.toString() // 杞崲涓哄瓧绗︿覆
+    if (money.indexOf('.') === -1) {
+      IntegerNum = money
+      DecimalNum = ''
+    } else {
+      parts = money.split('.')
+      IntegerNum = parts[0]
+      DecimalNum = parts[1].substr(0, 4)
+    }
+
+    if (parseInt(IntegerNum, 10) > 0) { // 鑾峰彇鏁村瀷閮ㄥ垎杞崲
+      let zeroCount = 0
+      let IntLen = IntegerNum.length
+      for (let i = 0; i < IntLen; i++) {
+        let n = IntegerNum.substr(i, 1)
+        let p = IntLen - i - 1
+        let q = p / 4
+        let m = p % 4
+        
+        if (n === '0') {
+          zeroCount++
+        } else {
+          if (zeroCount > 0) {
+            ChineseStr += cnNums[0]
+          }
+          zeroCount = 0 // 褰掗浂
+          ChineseStr += cnNums[parseInt(n)] + cnIntRadice[m]
+        }
+
+        if (m === 0 && zeroCount < 4) {
+          ChineseStr += cnIntUnits[q]
+        }
+      }
+      ChineseStr += cnIntLast
+    }
+
+    if (DecimalNum !== '') { // 灏忔暟閮ㄥ垎
+      let decLen = DecimalNum.length
+
+      for (let i = 0; i < decLen; i++) {
+        let n = DecimalNum.substr(i, 1)
+        if (n !== '0') {
+          ChineseStr += cnNums[Number(n)] + cnDecUnits[i]
+        }
+      }
+    }
+    if (ChineseStr === '') {
+      ChineseStr += cnNums[0] + cnIntLast + cnInteger
+    } else if (DecimalNum === '') {
+      ChineseStr += cnInteger
+    }
+
+    ChineseStr = Symbol + ChineseStr
+    
+    return ChineseStr
+  }
+
+  nextLine = (col, record) => {
+    const { edData, tableId } = this.state
+
+    if (col.tableId !== tableId) return
+
+    if (record.index < edData.length - 2) {
+      MKEmitter.emit('tdFocus', 'remark' + edData[record.index + 1].uuid)
+    } else {
+      let _data = fromJS(edData).toJS()
+      let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subject: '', debtor: '', creditor: ''}
+
+      _data.splice(_data.length - 1, 0, line)
+
+      this.setState({edData: _data}, () => {
+        MKEmitter.emit('tdFocus', 'remark' + line.uuid)
+      })
+    }
+  }
+
+  plusLine = (initEditLine) => {
+    const { edData } = this.state
+
+    let item = {...edData[edData.length - 1]}
+
+    item.key = item.key + 1
+    item.$$uuid = '$new'
+
+    this.setState({edData: [...edData, item]}, () => {
+      MKEmitter.emit('tdFocus', initEditLine.uuid + item.uuid)
+    })
+  }
+
+  delRecord = (id, record) => {
+    const { tableId, edData } = this.state
+
+    if (id !== tableId) return
+
+    let _data = edData.filter(item => item.uuid !== record.uuid)
+
+    _data.pop()
+
+    if (_data.length < 4) {
+      for (let i = _data.length - 1; i < 4; i++) {
+        _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''})
+      }
+    }
+
+    _data.push(this.getTotalLine(_data))
+
+    this.setState({edData: _data})
+  }
+
+  changeRecord = (tableId, record) => {
+    if (tableId !== this.state.tableId) return
+
+    let _data = this.state.edData.map(item => {
+      if (item.uuid === record.uuid) {
+        return record
+      } else {
+        return item
+      }
+    })
+
+    _data.pop()
+
+    if (record.index === _data.length - 1) {
+      _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subject: '', debtor: '', creditor: ''})
+    }
+
+    _data.push(this.getTotalLine(_data))
+
+    this.setState({edData: _data})
+  }
+
+  addLine = () => {
+    const { BID } = this.props
+    const { edData } = this.state
+
+    let item = {}
+    if (edData.length > 0) {
+      item = {...edData[edData.length - 1]}
+      item.key = item.key + 1
+      item.$$uuid = '$new'
+    } else {
+      item.key = 0
+      item.$$uuid = '$new'
+      item.$$BID = BID || ''
+    }
+
+    this.setState({edData: [...edData, item]})
+  }
+
+  checkData = () => {
+    const { edData } = this.state
+
+    if (edData.length === 0) {
+      notification.warning({
+        top: 92,
+        message: '鎻愪氦鏁版嵁涓嶅彲涓虹┖锛�',
+        duration: 5
+      })
+      return
+    }
+    let err = ''
+    let data = fromJS(edData).toJS().map(item => {
+      // let line = []
+      // fields.forEach(col => {
+      //   if (col.editable !== 'true' || item.$deleted) {
+      //     if (col.type === 'number') {
+      //       item[col.field] = +item[col.field]
+      //       if (isNaN(item[col.field])) {
+      //         item[col.field] = 0
+      //       }
+      //     } else {
+      //       item[col.field] = item[col.field] !== undefined ? (item[col.field] + '') : ''
+      //     }
+      //     return
+      //   }
+      //   if (col.type === 'text') {
+      //     let val = item[col.field] !== undefined ? (item[col.field] + '') : ''
+      //     if (col.required === 'true' && !val) {
+      //       line.push(`${col.label}涓嶅彲涓虹┖`)
+      //     }
+      //     item[col.field] = val
+      //   } else if (col.type === 'number') {
+      //     let val = item[col.field]
+      //     if (!val && val !== 0) {
+      //       line.push(`${col.label}涓嶅彲涓虹┖`)
+      //       return
+      //     }
+      //     val = +val
+      //     if (isNaN(val)) {
+      //       line.push(`${col.label}鏁版嵁鏍煎紡閿欒`)
+      //       return
+      //     }
+
+      //     val = +val.toFixed(col.decimal || 0)
+          
+      //     if (typeof(col.max) === 'number' && val > col.max) {
+      //       line.push(`${col.label}涓嶅彲澶т簬${col.max}`)
+      //     } else if (typeof(col.min) === 'number' && val < col.min) {
+      //       line.push(`${col.label}涓嶅彲灏忎簬${col.min}`)
+      //     }
+
+      //     item[col.field] = val
+      //   }
+      // })
+
+      return item
+    })
+
+    if (err) {
+      notification.warning({
+        top: 92,
+        message: err,
+        duration: 5
+      })
+    } else {
+      this.submit(data)
+    }
+  }
+
+  submit = (data) => {
+    const { BID } = this.props
+
+    let param = {
+      // excel_in: result.lines,
+      BID: BID || ''
+    }
+
+    this.setState({
+      loading: true
+    })
+
+    param.func = 'submit.innerFunc'
+
+    Api.genericInterface(param).then((res) => {
+      if (res.status) {
+        this.execSuccess(res)
+      } else {
+        this.execError(res)
+      }
+    }, () => {
+      this.execError({})
+    })
+  }
+
+  execSuccess = (res) => {
+    const { submit } = this.props
+
+    if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛
+      notification.success({
+        top: 92,
+        message: res.ErrMesg || this.state.dict['main.action.confirm.success'],
+        duration: submit.stime ? submit.stime : 2
+      })
+    } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛
+      Modal.success({
+        title: res.ErrMesg || this.state.dict['main.action.confirm.success']
+      })
+    } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
+
+    }
+
+    this.setState({
+      loading: false
+    })
+
+    if (submit.closetab === 'true') {
+      MKEmitter.emit('popclose')
+    }
+    if (submit.execSuccess !== 'never') {
+      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit)
+    }
+  }
+
+  execError = (res) => {
+    const { submit } = this.props
+
+    if (res.ErrCode === 'E') {
+      Modal.error({
+        title: res.message || res.ErrMesg,
+      })
+    } else if (res.ErrCode === 'N') {
+      notification.error({
+        top: 92,
+        message: res.message || res.ErrMesg,
+        duration: submit.ntime ? submit.ntime : 10
+      })
+    } else if (res.ErrCode === 'F') {
+      notification.error({
+        className: 'notification-custom-error',
+        top: 92,
+        message: res.message || res.ErrMesg,
+        duration: submit.ftime ? submit.ftime : 10
+      })
+    } else if (res.ErrCode === 'NM') {
+      message.error(res.message || res.ErrMesg)
+    }
+    
+    this.setState({
+      loading: false
+    })
+
+    if (submit.execError !== 'never') {
+      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit)
+    }
+  }
+
+  render() {
+    const { edData, columns} = this.state
+
+    const components = {
+      body: {
+        row: BodyRow,
+        cell: BodyCell
+      }
+    }
+
+    return (
+      <div className="voucher-table-wrap">
+        <Table
+          rowKey="uuid"
+          components={components}
+          columns={columns}
+          dataSource={edData}
+          bordered={true}
+          // loading={this.props.loading}
+          onRow={(record, index) => {
+            return {
+              data: record
+            }
+          }}
+          pagination={false}
+        />
+      </div>
+    )
+  }
+}
+
+export default AssistTable
\ No newline at end of file
diff --git a/src/tabviews/custom/components/module/voucher/assistTable/index.scss b/src/tabviews/custom/components/module/voucher/assistTable/index.scss
new file mode 100644
index 0000000..e8175c8
--- /dev/null
+++ b/src/tabviews/custom/components/module/voucher/assistTable/index.scss
@@ -0,0 +1,259 @@
+.voucher-table-wrap {
+  position: relative;
+  padding: 0px;
+
+  .normal-table-footer {
+    padding: 10px 0px;
+    color: rgba(0, 0, 0, 0.65);
+  }
+  .normal-table-footer.pagination {
+    position: absolute;
+    bottom: 10px;
+  }
+  >.ant-table-wrapper {
+    position: relative;
+    z-index: 1;
+  }
+  .ant-table {
+    color: inherit;
+    font-size: inherit;
+  }
+
+  .money-uint {
+    display: flex;
+    span {
+      display: inline-block;
+      flex: 1;
+      text-align: center;
+      font-size: 12px;
+    }
+    span:not(.last) {
+      border-right: 1px solid #e9e9e9;
+    }
+    span:nth-child(3), span:nth-child(6) {
+      border-color: #91d5ff;
+    }
+    span:nth-child(9) {
+      border-color: #ffa39e;
+    }
+  }
+
+  table {
+    max-width: 100%;
+    width: 100%;
+    .ant-table-thead {
+      tr {
+        th {
+          position: relative;
+          background-color: transparent;
+          padding: 0;
+          height: 60px;
+          line-height: 60px;
+          text-align: center;
+
+          .ant-table-header-column {
+            display: block;
+            width: 100%;
+            height: 100%;
+
+            .ant-table-column-title {
+              display: block;
+              width: 100%;
+              height: 100%;
+              font-weight: bold;
+              font-size: 13px;
+            }
+          }
+          .money-title {
+            line-height: 30px;
+            font-weight: bold;
+            font-size: 13px;
+          }
+          .money-uint {
+            line-height: 30px;
+            border-top: 1px solid #dadada;
+          }
+        }
+      }
+    }
+    .ant-table-selection-column {
+      width: 60px;
+      min-width: 60px;
+      max-width: 60px;
+    }
+    .ant-table-tbody {
+      tr td {
+        position: relative;
+        background-color: transparent;
+        padding: 0;
+        height: 60px;
+        vertical-align: top;
+
+        .content-wrap {
+          padding: 5px;
+          height: 100%;
+          font-size: 13px;
+          font-weight: bold;
+        }
+        .money-uint {
+          height: 100%;
+          line-height: 60px;
+
+          span {
+            font-size: 14px;
+            font-weight: bold;
+          }
+        }
+        .money-uint.down {
+          span {
+            color: #ff4d4f;
+          }
+        }
+      }
+    }
+  }
+  .ant-input {
+    height: 60px;
+    border-radius: 0;
+    resize: none;
+  }
+  .ant-input-number {
+    height: 60px;
+    border-radius: 0;
+    
+    .ant-input-number-handler-wrap {
+      display: none;
+    }
+    .ant-input-number-input {
+      border-radius: 0;
+      height: 60px;
+    }
+  }
+  .editing_table_cell {
+    .ant-input {
+      padding: 0px;
+      position: absolute;
+      top: 0px;
+      left: 0px;
+      right: 0px;
+      bottom: 0px;
+      border: 1px solid #1890ff;
+    }
+    .ant-input-number-input {
+      position: absolute;
+      top: 0px;
+      left: 0px;
+      right: 0px;
+      bottom: 0px;
+      border: 1px solid #1890ff;
+    }
+    .anticon {
+      color: #ff4d4f;
+      position: absolute;
+      right: 3px;
+      top: calc(50% - 8px);
+    }
+  }
+  td.pointer {
+    position: relative;
+  }
+  td.pointer {
+    .mk-mask {
+      display: none;
+      cursor: pointer;
+      position: absolute;
+      top: 0;
+      left: 0;
+      bottom: 0;
+      right: 0;
+    }
+  }
+}
+.edit-custom-table.editable {
+  td {
+    background-color: #ffffff!important;
+  }
+  td.pointer .mk-mask {
+    display: block;
+  }
+  .mk-operation {
+    display: none;
+  }
+  .ant-table-placeholder {
+    display: none;
+  }
+}
+.edit-custom-table:not(.fixed-height) {
+  .ant-table-body::-webkit-scrollbar {
+    width: 8px;
+    height: 10px;
+  }
+  ::-webkit-scrollbar-thumb {
+    border-radius: 5px;
+    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13);
+    background: rgba(0, 0, 0, 0.13);
+  }
+  ::-webkit-scrollbar-track {/*婊氬姩鏉¢噷闈㈣建閬�*/
+    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
+    border-radius: 3px;
+    border: 1px solid rgba(0, 0, 0, 0.07);
+    background: rgba(0, 0, 0, 0);
+  }
+}
+.edit-custom-table.fixed-height {
+  .ant-table-body {
+    border-bottom: 1px solid rgba(0, 0, 0, .05);
+    .ant-table-fixed {
+      border-bottom: 0;
+    }
+  }
+}
+.edit-custom-table.hidden {
+  thead {
+    display: none;
+  }
+}
+.edit-custom-table.ghost {
+  .ant-table-thead > tr {
+    > th {
+      color: inherit;
+      background: transparent;
+      .ant-table-column-sorter .ant-table-column-sorter-inner {
+        color: inherit;
+      }
+    }
+    > th:hover {
+      background: transparent;
+    }
+  }
+  .ant-table-body {
+    overflow-x: auto;
+    tr {
+      td {
+        background: transparent!important;
+      }
+    }
+    tr:hover td {
+      background: transparent!important;
+    }
+  }
+}
+.image-scale-modal {
+  width: 70vw;
+  min-height: 80vh;
+  top: 10vh;
+  .ant-modal-body {
+    min-height: calc(80vh - 110px);
+    line-height: calc(80vh - 160px);
+    text-align: center;
+  }
+  .ant-modal-footer {
+    text-align: center;
+    span {
+      display: inline-block;
+      color: #1890ff;
+      padding: 5px 15px;
+      cursor: pointer;
+    }
+  }
+}
\ No newline at end of file
diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx
index d596e2f..2356a2a 100644
--- a/src/views/design/index.jsx
+++ b/src/views/design/index.jsx
@@ -22,8 +22,7 @@
     if (window.GLOB.systemType !== 'production' && window.GLOB.WXAppID && !sessionStorage.getItem('wxTemplates')) {
       Api.wxAccessToken().then(res => {
         let wxtoken = res.oa_access_token || ''
-        wxtoken = '59_DH0hrAp0B8jtdJvU-7BV_-nG01qh2rUU1L8ihj-2pMWlUFLE2eEtVv4zZYAUIKcxCit4SgOTwxvUGdYHltaha3RmgnZqkQSgkxXRm9hz18kGbGhMc5r11W5Iv9Xr50Pz-Sz7FUVHCM-6GZLXJPIjAIAVBU'
-        let minitoken = res.mini_access_token || ''
+        // let minitoken = res.mini_access_token || ''
   
         if (wxtoken) {
           Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => {
@@ -37,17 +36,17 @@
         } else {
           sessionStorage.setItem('wxTemplates', JSON.stringify([]))
         }
-        if (minitoken) {
-          Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => {
-            if (res.errmsg === 'ok' && res.data) {
-              sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data))
-            } else {
-              sessionStorage.setItem('wxMiniTemplates', JSON.stringify([]))
-            }
-          })
-        } else {
-          sessionStorage.setItem('wxMiniTemplates', JSON.stringify([]))
-        }
+        // if (minitoken) {
+        //   Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => {
+        //     if (res.errmsg === 'ok' && res.data) {
+        //       sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data))
+        //     } else {
+        //       sessionStorage.setItem('wxMiniTemplates', JSON.stringify([]))
+        //     }
+        //   })
+        // } else {
+        //   sessionStorage.setItem('wxMiniTemplates', JSON.stringify([]))
+        // }
       })
     }
   }

--
Gitblit v1.8.0