From 49cd775392f5aa1da349703c9128cedf513d4317 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 10 二月 2023 15:57:29 +0800 Subject: [PATCH] 2023-02-10 --- src/tabviews/custom/components/module/voucher/index.jsx | 69 ++++++++++++++++++++++++++++++++-- 1 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 31b0296..b1842ef 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -39,7 +39,8 @@ title: '', orgcode: '', orgname: '', - status: '' // 鏂板缓鏃讹紝empty銆乧hange銆乻aved + status: '', // 鏂板缓鏃讹紝empty銆乧hange銆乻aved + saved: false } UNSAFE_componentWillMount () { @@ -433,10 +434,19 @@ voucherSave = (list, t) => { const { type, data, config, charInt, charType, vouDate, book, remark, charName, attachments, title, orgcode, orgname } = this.state + let err = '' if (!book) { + err = '璇烽�夋嫨璐﹀锛�' + } else if (!vouDate) { + err = '璇烽�夋嫨鏃ユ湡锛�' + } else if (!charName || !charInt) { + err = '璇烽�夋嫨鍑瘉鍙凤紒' + } + + if (err) { notification.warning({ top: 92, - message: '璇烽�夋嫨璐﹀锛�', + message: err, duration: 5 }) return @@ -577,14 +587,16 @@ remark: '', tbdata: [], charInt: res.voucher_char_int + 1, - BID: Utils.getguid() + BID: Utils.getguid(), + saved: false }) MKEmitter.emit('cleartable', config.uuid) } else { this.setState({ status: 'saved', charInt: res.voucher_char_int || charInt, - data: fromJS(list).toJS() + data: fromJS(list).toJS(), + saved: true }) } }) @@ -629,6 +641,53 @@ this.setState({attachments: _val}) } + changeVouDate = (val) => { + const { type, status, saved } = this.state + this.setState({vouDate: val}) + + if (type === 'createVoucher' && val && !saved && (status === 'empty' || status === 'change')) { + this.updateVoucherChar(val) + } + } + + updateVoucherChar = (val) => { + const {book} = this.state + + if (!book) return + + let param = { + func: 's_get_fcc_account_data', + search_type: 'Y', + fcc_date: book.months ? book.months + '-01' : moment().format('YYYY-MM-DD'), + account_year_code: book.account_year_code || '', + months: moment(val).format('YYYY-MM'), + BID: book.id + } + + Api.genericInterface(param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return + } + + // let typeOptions = res.char || [] + // let charInt = typeOptions[0] ? typeOptions[0].voucher_char_int + 1 : 1 + + // this.setState({ + // typeOptions: typeOptions, + // charType: typeOptions[0] ? typeOptions[0].voucher_class : '', + // charName: typeOptions[0] ? typeOptions[0].voucher_char : '', + // charInt: charInt, + // orgcode: res.orgcode, + // orgname: res.orgname, + // }) + }) + } + triggermore = () => { } @@ -668,7 +727,7 @@ <InputNumber precision={0} min={1} value={charInt} autoComplete="off" onChange={(val) => this.setState({charInt: val})}/> 鍙� </div> <div className="voucher-date"> - 鏃ユ湡锛�<DatePicker value={vouDate} onChange={(val) => this.setState({vouDate: val})}/> + 鏃ユ湡锛�<DatePicker value={vouDate} onChange={this.changeVouDate}/> </div> <div className="voucher-text"> <Input value={title} placeholder="鍑瘉鏂囨湰" autoComplete="off" onChange={(e) => this.setState({title: e.target.value})}/> -- Gitblit v1.8.0