| | |
| | | import ResetRemark from './resetRemark' |
| | | import ResetAttach from './resetAttach' |
| | | import LoadFromTemp from './loadFromTemp' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const PrintVoucher = asyncComponent(() => import('./printVoucher')) |
| | | const { confirm } = Modal |
| | | |
| | | class VoucherModule extends Component { |
| | |
| | | } |
| | | } |
| | | |
| | | // config.wrap.type = 'checkVoucher' |
| | | // BID = '20230214130744811P0K95RQ155KG0QIQOFV' |
| | | config.wrap.type = 'checkVoucher' |
| | | BID = '20230214130744811P0K95RQ155KG0QIQOFV' |
| | | |
| | | // config.wrap.type = 'checkTemp' |
| | | // BID = '20230214174458780MFR8IA576ON4VKNOLVH' |
| | |
| | | }) |
| | | } |
| | | |
| | | triggerprint = () => { |
| | | |
| | | } |
| | | |
| | | dataChange = (data) => { |
| | | this.setState({ |
| | | status: 'change', |
| | |
| | | _val = parseInt(val) |
| | | } |
| | | |
| | | this.setState({attachments: _val}) |
| | | this.setState({attachments: _val, status: 'change'}) |
| | | } |
| | | |
| | | changeVouDate = (val) => { |
| | | const { type, status, saved } = this.state |
| | | this.setState({vouDate: val}) |
| | | |
| | | this.setState({vouDate: val, status: 'change'}) |
| | | |
| | | if (type === 'createVoucher' && val && !saved && (status === 'empty' || status === 'change')) { |
| | | this.updateVoucherChar(val) |
| | |
| | | num = 0 |
| | | } |
| | | |
| | | this.setState({attachlist: vals, attachments: num}) |
| | | this.setState({status: 'change', attachlist: vals, attachments: num}) |
| | | } |
| | | |
| | | triggermore = () => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { type, status, loading, config, orgcode, typeOptions, tempTypes, charType, charInt, data, vouDate, username, remark, attachments, title, attachlist, tempTypeClass } = this.state |
| | | const { type, status, loading, config, orgcode, orgname, typeOptions, tempTypes, charType, charName, charInt, data, vouDate, username, remark, attachments, title, attachlist, tempTypeClass } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | | {type === 'createVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn" disabled={status === 'empty'} onClick={() => this.triggersave('add')}>保存并新增</Button> |
| | | <Button className="add-background header-btn" disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> |
| | | <Button className="print-background header-btn" disabled={status !== 'saved'} onClick={this.triggerprint}>打印</Button> |
| | | <PrintVoucher ID={config.uuid + 'print'} data={data} orgname={orgname} vouDate={vouDate} charName={charName} charInt={charInt} attachments={attachments} disabled={status !== 'saved'}/> |
| | | <Dropdown overlay={<div className="mk-voucher-dropdown-wrap"> |
| | | <SaveAsTemp tempTypes={tempTypes} onChange={this.triggerTempsave}/> |
| | | <div className="split"></div> |
| | |
| | | </div> : null} |
| | | {type === 'checkVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn" disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> |
| | | <Button className="print-background header-btn" disabled={status !== 'saved'} onClick={this.triggerprint}>打印</Button> |
| | | <PrintVoucher ID={config.uuid + 'print'} data={data} orgname={orgname} vouDate={vouDate} charName={charName} charInt={charInt} attachments={attachments} disabled={status !== 'saved'}/> |
| | | <Button className="out-background header-btn" onClick={this.triggerclose}>关闭</Button> |
| | | </div> : null} |
| | | <div className="voucher-body" style={{padding: `0px ${config.wrap.space || 0}px`}}> |
| | | {type === 'createVoucher' || type === 'checkVoucher' ? <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charName: option.props.charName, charInt: option.props.charint})}> |
| | | <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({status: 'change', charType: val, charName: option.props.charName, charInt: option.props.charint})}> |
| | | {typeOptions.map(option => |
| | | <Select.Option key={option.voucher_char_int} value={option.voucher_class} charName={option.voucher_char} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option> |
| | | )} |
| | | </Select> |
| | | <InputNumber precision={0} min={1} value={charInt} autoComplete="off" onChange={(val) => this.setState({charInt: val})}/> 号 |
| | | <InputNumber precision={0} min={1} value={charInt} autoComplete="off" onChange={(val) => this.setState({status: 'change', charInt: val})}/> 号 |
| | | </div> |
| | | <div className="voucher-date"> |
| | | 日期:<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})}/> |
| | | <Input value={title} placeholder="凭证文本" autoComplete="off" onChange={(e) => this.setState({status: 'change', title: e.target.value})}/> |
| | | </div> |
| | | <div className="voucher-affix"> |
| | | 附单据 <InputNumber precision={0} value={attachments || 0} autoComplete="off" onChange={this.changeAttach}/> 张 |
| | | <ResetAttach config={config} orgcode={orgcode} voucherCode={this.state.voucherCode} attachlist={attachlist} onChange={this.resetAttachList}/> |
| | | <ResetRemark remark={remark} ID={config.uuid + 'remark'} onChange={(val) => this.setState({remark: val})}/> |
| | | <ResetRemark remark={remark} ID={config.uuid + 'remark'} onChange={(val) => this.setState({status: 'change', remark: val})}/> |
| | | </div> |
| | | </div> : null} |
| | | {type === 'createTemp' || type === 'checkTemp' ? <div className="pre-temp-wrap"> |