| | |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const { TextArea } = Input |
| | | const VoucherTable = asyncComponent(() => import('./voucherTable')) |
| | | |
| | | class VoucherModule extends Component { |
| | |
| | | vouDate: null, |
| | | book: null, |
| | | username: sessionStorage.getItem('User_Name'), |
| | | remark: '', |
| | | remarkVisible: false, |
| | | status: '' // 新建时,empty、change、saved |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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({ |
| | |
| | | BID: BID, |
| | | voucher_code: '', |
| | | voucher_text: '', |
| | | remark: '', |
| | | remark: remark, |
| | | account_year_code: '', |
| | | voucher_type: '', |
| | | voucher_type_text: '', |
| | |
| | | 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) => { |
| | |
| | | } |
| | | |
| | | 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}> |
| | |
| | | <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> |
| | | ) |
| | | } |