From c39acd25c3e8747be16773a003f519e4ef801640 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 17 一月 2023 16:44:16 +0800 Subject: [PATCH] 2023-01-17 --- src/tabviews/custom/components/module/voucher/index.jsx | 45 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 2eb3f9c..1b18806 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/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"> -- Gitblit v1.8.0