king
2023-01-17 c39acd25c3e8747be16773a003f519e4ef801640
src/tabviews/custom/components/module/voucher/index.jsx
@@ -20,10 +20,11 @@
    BID: '',
    config: null,
    loading: false,
    data: null,
    data: [],
    disableAdd: false,
    disableSave: false,
    typeOptions: [],
    subjects: [],
    charType: '',
    charInt: '',
    vouDate: null,
@@ -77,7 +78,14 @@
    const { config } = this.state
    if (config.wrap.supBook === MenuID) {
      this.setState({ book: data }, () => {
      let month = data.months
      let vouDate = moment()
      if (month && month < moment().format('YYYY-MM')) {
        vouDate = moment(month, 'YYYY-MM').endOf('month')
      }
      this.setState({ book: data, vouDate }, () => {
        this.loadData()
      })
      return
@@ -118,7 +126,26 @@
        typeOptions: typeOptions,
        charType: typeOptions[0] ? typeOptions[0].voucher_class : '',
        charInt: typeOptions[0] ? typeOptions[0].voucher_char_int : '',
        subjects: res.subjects || [],
      })
      setTimeout(() => {
        this.getVoucher()
      }, 200)
    })
  }
  getVoucher = () => {
    let data = [
      {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 124, creditor: ''},
      {remark: '购入固定资产', subjectscode: '1001', subjectsname: '库存现金', debtor: '', creditor: 124},
      {remark: '转结销售成本', subjectscode: '1001', subjectsname: '库存现金', debtor: -524, creditor: ''},
      {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 34, creditor: ''},
    ]
    this.setState({
      data: data
    })
  }
@@ -134,12 +161,8 @@
  }
  changeVoucherDate = () => {
  }
  render() {
    const { config, disableSave, disableAdd, typeOptions, charType, charInt, data } = this.state
    const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, subjects } = this.state
    return (
      <div className="menu-voucher-wrap" style={config.style}>
@@ -153,15 +176,15 @@
        {config.wrap.type === 'edit' ? <div className="voucher-body">
          <div className="pre-wrap">
            <div className="voucher-code">
              <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charInt})}>
              <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charint})}>
                {typeOptions.map(option =>
                  <Select.Option value={option.voucher_class} charInt={option.voucher_char_int}>{option.voucher_char}</Select.Option>
                  <Select.Option key={option.voucher_char_int} value={option.voucher_class} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option>
                )}
              </Select>
              <Input value={charInt} autoComplete="off" onChange={(e) => this.setState({charInt: e.target.value})}/> 号
            </div>
            <div className="voucher-date">
              日期:<DatePicker onChange={this.changeVoucherDate}/>
              日期:<DatePicker value={vouDate} onChange={(val) => this.setState({vouDate: val})}/>
            </div>
            <div className="voucher-affix">
              附单据 <Input autoComplete="off" /> 张
@@ -169,7 +192,7 @@
              <Button type="link" className="" onClick={this.triggerprint}>备注</Button>
            </div>
          </div>
          <VoucherTable config={config} data={data}/>
          <VoucherTable config={config} subjects={subjects} data={data}/>
        </div> : null}
        {config.wrap.type === 'check' ? <div className="voucher-body">
          <div className="pre-wrap">