king
2023-02-01 61ab22d7b6be46c00e8813b00b2352a52cc252f3
src/tabviews/custom/components/module/voucher/index.jsx
@@ -10,6 +10,7 @@
import './index.scss'
const { confirm } = Modal
const { TextArea } = Input
const VoucherTable = asyncComponent(() => import('./voucherTable'))
class VoucherModule extends Component {
@@ -30,6 +31,8 @@
    vouDate: null,
    book: null,
    username: sessionStorage.getItem('User_Name'),
    remark: '',
    remarkVisible: false,
    status: '' // 新建时,empty、change、saved
  }
@@ -310,7 +313,7 @@
  }
  voucherSave = (list, t) => {
    const { BID, config, charInt, charType, book } = this.state
    const { BID, config, charInt, charType, vouDate, book, remark } = this.state
    if (!book) {
      notification.warning({
@@ -326,7 +329,7 @@
      BID: BID,
      voucher_code: '',
      voucher_text: '',
      remark: '',
      remark: remark,
      account_year_code: '',
      voucher_type: '',
      voucher_type_text: '',
@@ -339,40 +342,61 @@
      voucher_char: charType,
      voucher_char_int: charInt,
      account_code: book.account_code || '',
      fibvoucherdate: '',
      fibvoucherdate: vouDate,
      UserName: sessionStorage.getItem('User_Name') || '',
      FullName: sessionStorage.getItem('Full_Name') || '',
      sup_data: '',
      subject_data: ''
    }
    Api.genericInterface(param).then(res => {
      if (!res.status) {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
        return
      }
    console.log(list)
    console.log(param)
    console.log(config)
      if (t === 'add') {
        this.setState({
          status: 'empty',
          tbdata: [],
          charInt: charInt + 1
        })
        MKEmitter.emit('cleartable', config.uuid)
      } else {
        this.setState({
          status: 'saved'
        })
      }
    })
    // Api.genericInterface(param).then(res => {
    //   if (!res.status) {
    //     notification.warning({
    //       top: 92,
    //       message: res.message,
    //       duration: 5
    //     })
    //     return
    //   }
    //   if (t === 'add') {
    //     this.setState({
    //       status: 'empty',
    //       remark: '',
    //       tbdata: [],
    //       charInt: charInt + 1
    //     })
    //     MKEmitter.emit('cleartable', config.uuid)
    //   } else {
    //     this.setState({
    //       status: 'saved'
    //     })
    //   }
    // })
  }
  triggerprint = () => {
    this.setState({remarkVisible: true})
  }
  remarkSubmit = () => {
    const { config } = this.state
    let node = document.getElementById(config.uuid + 'remark')
    let val = node.value
    if (val && val.length > 512) {
      notification.warning({
        top: 92,
        message: '当前内容超长,备注最多512个字符。',
        duration: 5
      })
      return
    }
    this.setState({remark: val, remarkVisible: false})
  }
  dataChange = (data) => {
@@ -383,7 +407,7 @@
  }
  render() {
    const { type, status, loading, config, typeOptions, charType, charInt, data, vouDate, username } = this.state
    const { type, status, loading, config, typeOptions, charType, charInt, data, vouDate, username, remark, remarkVisible } = this.state
    return (
      <div className="menu-voucher-wrap" style={config.style}>
@@ -415,6 +439,17 @@
          <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/>
        </div>
        <div className="user">制单人:{username}</div>
        <Modal
          title="备注"
          visible={remarkVisible}
          width={700}
          maskClosable={false}
          onOk={this.remarkSubmit}
          onCancel={() => { this.setState({ remarkVisible: false })}}
          destroyOnClose
        >
          <TextArea id={config.uuid + 'remark'} defaultValue={remark} rows={6}/>
        </Modal>
      </div>
    )
  }