| | |
| | | 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 { |
| | |
| | | username: sessionStorage.getItem('User_Name'), |
| | | remark: '', |
| | | attachments: 0, |
| | | vouAduited: false, |
| | | vouReadOnly: false, |
| | | attachlist: [], |
| | | oriAttachs: [], |
| | | tempTypes: [], |
| | |
| | | |
| | | let BID = '' |
| | | let BData = '' |
| | | |
| | | |
| | | if (config.wrap.supModule) { |
| | | BData = window.GLOB.CacheData.get(config.wrap.supModule) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | config.wrap.type = 'checkVoucher' |
| | | BID = '20230214130744811P0K95RQ155KG0QIQOFV' |
| | | // config.wrap.type = 'checkVoucher' |
| | | // BID = '20230228173542370E2F4FC1773704C29A6A4' |
| | | |
| | | // config.wrap.type = 'checkTemp' |
| | | // BID = '20230214174458780MFR8IA576ON4VKNOLVH' |
| | |
| | | let employee = [] |
| | | let cash_flow = [] |
| | | let others = [] |
| | | let logistics = [] |
| | | let lessor = [] |
| | | |
| | | res.sup && res.sup.forEach(item => { |
| | | names[item.sup_type_code] = item.sup_type_name |
| | |
| | | |
| | | res.supplier && res.supplier.forEach(item => { |
| | | supplier.push({value: item.suppliercode, label: item.suppliername}) |
| | | }) |
| | | |
| | | res.logistics && res.logistics.forEach(item => { |
| | | logistics.push({value: item.logistics_code, label: item.logistics_name}) |
| | | }) |
| | | |
| | | res.lessor && res.lessor.forEach(item => { |
| | | lessor.push({value: item.lessor_code, label: item.lessor_name}) |
| | | }) |
| | | |
| | | res.customer && res.customer.forEach(item => { |
| | |
| | | subjects: res.subjects || [], |
| | | names: names, |
| | | supplier: supplier, |
| | | logistics: logistics, |
| | | lessor: lessor, |
| | | customer: customer, |
| | | department: department, |
| | | project: project, |
| | |
| | | |
| | | let data = [] |
| | | if (res.voucher) { |
| | | let disabled = res.voucher_status === 'true' |
| | | data = res.voucher.map(line => { |
| | | line.uuid = line.subject_id || '' |
| | | |
| | |
| | | line.exratename = line.foreign_exratename || '' |
| | | line.local_currency = line.local_exratecode || '' |
| | | line.foreign_currency_type = line.foreign_type || '' |
| | | line.$disabled = disabled |
| | | |
| | | if (line.sup) { |
| | | line.supAccounts = line.sup.map(cell => { |
| | |
| | | data: data, |
| | | attachlist: files, |
| | | vouDate: res.fibvoucherdate ? moment(res.fibvoucherdate, 'YYYY-MM-DD') : null, |
| | | charType: res.voucher_class, |
| | | charType: res.voucher_class || 'keeping', |
| | | vouAduited: res.voucher_status === 'true' || res.read_only === 'true', |
| | | vouReadOnly: res.read_only === 'true', |
| | | charName: res.voucher_char, |
| | | charInt: res.voucher_char_int, |
| | | // orgcode: res.orgcode, |
| | |
| | | attachments: res.attachments_int, |
| | | title: res.voucher_text || '', |
| | | remark: res.remark || '', |
| | | status: 'saved' |
| | | status: res.copy_type === 'true' ? 'copy' : 'saved' |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | line.supAccounts.forEach(item => { |
| | | if (item.sup_acc_type === 'supplier') { |
| | | if (!item.suppliercode || !item.suppliername) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'logistics') { |
| | | if (!item.logistics_code || !item.logistics_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'lessor') { |
| | | if (!item.lessor_code || !item.lessor_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'customer') { |
| | |
| | | } |
| | | |
| | | if (tip) { |
| | | const _this = this |
| | | const that = this |
| | | confirm({ |
| | | content: tip + '确认要保存吗?', |
| | | onOk() { |
| | | _this.voucherSave(list, t) |
| | | that.voucherSave(list, t) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | let sup_data = [] |
| | | let voucherMap = new Map() |
| | | let supMap = new Map() |
| | | let extract = localStorage.getItem(window.GLOB.host + '_voucher_extract') |
| | | let extract = localStorage.getItem(window.GLOB.sysSign + '_voucher_extract') |
| | | extract = extract ? JSON.parse(extract) : [] |
| | | |
| | | data.forEach(item => { |
| | |
| | | supMap.delete(item.uuid + n.sup_acc_type) |
| | | } |
| | | |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0`) |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) |
| | | }) |
| | | } |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'` |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` |
| | | }) |
| | | |
| | | if (type === 'createVoucher') { |
| | |
| | | if (extract.length > 20) { |
| | | extract.length = 20 |
| | | } |
| | | localStorage.setItem(window.GLOB.host + '_voucher_extract', JSON.stringify(extract)) |
| | | localStorage.setItem(window.GLOB.sysSign + '_voucher_extract', JSON.stringify(extract)) |
| | | } |
| | | |
| | | voucherMap.forEach(item => { |
| | |
| | | let curr = item.foreign_currency_type === 'Y' |
| | | let direct = item.debit ? 'debit' : 'credit' |
| | | |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'`) |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) |
| | | }) |
| | | |
| | | supMap.forEach(n => { |
| | | sup_data.push(`'${n.uuid}','${n.sup_voucher_code}','${n.sup_voucher_lp}','${n.voucher_sup_lp || ''}','${n.sup_subject_code}','${n.sup_subject_name}','${n.sup_voucher_text || ''}','${n.sup_direct}',${n.sup_net_amount},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${n.sup_bid}',1`) |
| | | sup_data.push(`'${n.uuid}','${n.sup_voucher_code}','${n.sup_voucher_lp}','${n.voucher_sup_lp || ''}','${n.sup_subject_code}','${n.sup_subject_name}','${n.sup_voucher_text || ''}','${n.sup_direct}',${n.sup_net_amount},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${n.sup_bid}',1,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) |
| | | }) |
| | | |
| | | let attachments_data = [] |
| | |
| | | saved: true |
| | | }) |
| | | } |
| | | |
| | | let tabId = '' |
| | | if (config.wrap.linkmenu && config.wrap.linkmenu.length > 0) { |
| | | tabId = config.wrap.linkmenu[config.wrap.linkmenu.length - 1] |
| | | } |
| | | |
| | | if (tabId) { |
| | | MKEmitter.emit('reloadMenuView', tabId) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | line.supAccounts.forEach(item => { |
| | | if (item.sup_acc_type === 'supplier') { |
| | | if (!item.suppliercode || !item.suppliername) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'logistics') { |
| | | if (!item.logistics_code || !item.logistics_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'lessor') { |
| | | if (!item.lessor_code || !item.lessor_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'customer') { |
| | |
| | | } |
| | | |
| | | voucherTempSave = (list, name, typeChar, typeName) => { |
| | | const { type, BID, data, book, title, orgcode, orgname, tempTypeClass, tempTypeName } = this.state |
| | | const { type, config, BID, data, book, title, orgcode, orgname, tempTypeClass, tempTypeName } = this.state |
| | | |
| | | if (!book) { |
| | | notification.warning({ |
| | |
| | | supMap.delete(item.uuid + n.sup_acc_type) |
| | | } |
| | | |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit || 0},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0`) |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit || 0},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) |
| | | }) |
| | | } |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'` |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` |
| | | }) |
| | | |
| | | voucherMap.forEach(item => { |
| | |
| | | let curr = item.foreign_currency_type === 'Y' |
| | | let direct = !item.credit ? 'debit' : 'credit' |
| | | |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'`) |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : ''}','${curr ? item.exratename : ''}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) |
| | | }) |
| | | |
| | | supMap.forEach(n => { |
| | | sup_data.push(`'${n.uuid}','${n.sup_voucher_code}','${n.sup_voucher_lp}','${n.voucher_sup_lp || ''}','${n.sup_subject_code}','${n.sup_subject_name}','${n.sup_voucher_text || ''}','${n.sup_direct}',${n.sup_net_amount},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${n.sup_bid}',1`) |
| | | sup_data.push(`'${n.uuid}','${n.sup_voucher_code}','${n.sup_voucher_lp}','${n.voucher_sup_lp || ''}','${n.sup_subject_code}','${n.sup_subject_name}','${n.sup_voucher_text || ''}','${n.sup_direct}',${n.sup_net_amount},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${n.sup_bid}',1,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) |
| | | }) |
| | | |
| | | param.subject_data = window.btoa(window.encodeURIComponent(subject_data.join(';un'))) |
| | |
| | | status: 'saved', |
| | | data: fromJS(list).toJS(), |
| | | }) |
| | | } |
| | | |
| | | let tabId = '' |
| | | if (config.wrap.linkmenu && config.wrap.linkmenu.length > 0) { |
| | | tabId = config.wrap.linkmenu[config.wrap.linkmenu.length - 1] |
| | | } |
| | | |
| | | if (tabId) { |
| | | MKEmitter.emit('reloadMenuView', tabId) |
| | | } |
| | | }) |
| | | } |
| | |
| | | this.setState({status: 'change', attachlist: vals, attachments: num}) |
| | | } |
| | | |
| | | triggermore = () => { |
| | | |
| | | } |
| | | |
| | | triggerclose = () => { |
| | | const { config, status } = this.state |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { type, status, loading, config, orgcode, orgname, typeOptions, tempTypes, charType, charName, charInt, data, vouDate, username, remark, attachments, title, attachlist, tempTypeClass } = this.state |
| | | triggerPrint = () => { |
| | | const { config, BID } = 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> |
| | | <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> |
| | | <LoadFromTemp tempTypes={tempTypes} onChange={this.triggerTempLoad}/> |
| | | </div>} trigger={['click']}> |
| | | <Button className="out-background header-btn" onClick={this.triggermore}>更多</Button> |
| | | </Dropdown> |
| | | </div> : null} |
| | | {type === 'checkVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn" disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</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({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({status: 'change', charInt: val})}/> 号 |
| | | if (!config.wrap.printTemp) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未设置打印模板!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: BID, tempId: config.wrap.printTemp, pageId: config.$pageId || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | } |
| | | |
| | | triggerAduit = () => { |
| | | const { book, BID, voucherCode, username } = this.state |
| | | |
| | | if (!book) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择账套!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_fcc_voucher_sub', |
| | | ID: BID, |
| | | status: 10, |
| | | statusname: '已审核', |
| | | voucher_code: voucherCode || '', |
| | | username: username, |
| | | fullname: sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确定要审核吗?', |
| | | onOk() { |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '已经通过审核', |
| | | duration: 2 |
| | | }) |
| | | |
| | | that.getVoucher() |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | triggerUnAduit = () => { |
| | | const { book, BID, voucherCode, username } = this.state |
| | | |
| | | if (!book) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择账套!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_fcc_voucher_sub', |
| | | ID: BID, |
| | | status: 0, |
| | | statusname: '取消审核', |
| | | voucher_code: voucherCode || '', |
| | | username: username, |
| | | fullname: sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | |
| | | const that = this |
| | | |
| | | confirm({ |
| | | content: '确认要取消审核吗?', |
| | | onOk() { |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '审核已取消', |
| | | duration: 2 |
| | | }) |
| | | |
| | | that.getVoucher() |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { type, status, loading, config, orgcode, typeOptions, tempTypes, charType, charInt, data, vouDate, username, remark, attachments, title, attachlist, tempTypeClass, vouAduited, vouReadOnly, voucherCode } = this.state |
| | | |
| | | if (type === 'checkVoucher') { |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | | <div className="voucher-header" style={{padding: `10px ${config.wrap.space || 0}px`}}> |
| | | {!vouAduited ? <Button disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> : null} |
| | | {/* <PrintVoucher ID={config.uuid + 'print'} data={data} orgname={orgname} vouDate={vouDate} charName={charName} charInt={charInt} attachments={attachments} disabled={status !== 'saved'}/> */} |
| | | <Button disabled={status !== 'saved'} onClick={this.triggerPrint}>打印</Button> |
| | | {vouAduited && !vouReadOnly ? <Button onClick={this.triggerUnAduit}>取消审核</Button> : null} |
| | | {!vouAduited && !vouReadOnly ? <Button onClick={this.triggerAduit}>审核</Button> : null} |
| | | <Button onClick={this.triggerclose}>关闭</Button> |
| | | </div> |
| | | <div className="voucher-body" style={{padding: `0px ${config.wrap.space || 0}px`}}> |
| | | <div className="pre-wrap"> |
| | | <div className="voucher-number"> |
| | | 凭证号:{voucherCode} |
| | | </div> |
| | | <div className="voucher-code"> |
| | | <Select value={charType} disabled={vouAduited} 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.id} value={option.voucher_class} charname={option.voucher_char} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option> |
| | | )} |
| | | </Select> |
| | | <InputNumber precision={0} min={1} disabled={vouAduited} value={charInt} autoComplete="off" onChange={(val) => this.setState({status: 'change', charInt: val})}/> 号 |
| | | </div> |
| | | <div className="voucher-date"> |
| | | 日期:<DatePicker value={vouDate} disabled={vouAduited} onChange={this.changeVouDate}/> |
| | | </div> |
| | | <div className="voucher-text"> |
| | | <Input value={title} placeholder={vouAduited ? '' : '凭证文本'} disabled={vouAduited} autoComplete="off" onChange={(e) => this.setState({status: 'change', title: e.target.value})}/> |
| | | </div> |
| | | <div className="voucher-affix"> |
| | | 附单据 <InputNumber precision={0} disabled={vouAduited} value={attachments || 0} autoComplete="off" onChange={this.changeAttach}/> 张 |
| | | <ResetAttach config={config} disabled={vouAduited} orgcode={orgcode} voucherCode={this.state.voucherCode} attachlist={attachlist} onChange={this.resetAttachList}/> |
| | | <ResetRemark remark={remark} disabled={vouAduited} ID={config.uuid + 'remark'} onChange={(val) => this.setState({status: 'change', remark: val})}/> |
| | | </div> |
| | | </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({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({status: 'change', remark: val})}/> |
| | | </div> |
| | | </div> : null} |
| | | {type === 'createTemp' || type === 'checkTemp' ? <div className="pre-temp-wrap"> |
| | | <div className="temp-text"> |
| | | <span>模板名称:</span><Input value={title} placeholder="模板名称" autoComplete="off" onChange={(e) => this.setState({title: e.target.value})}/> |
| | | </div> |
| | | <div className="temp-text"> |
| | | <span>模板类型:</span> |
| | | <Select value={tempTypeClass} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({tempTypeClass: val, tempTypeName: option.props.children})}> |
| | | {tempTypes.map(option => |
| | | <Select.Option key={option.data_code} value={option.data_code}>{option.data_name}</Select.Option> |
| | | )} |
| | | </Select> |
| | | </div> |
| | | <div className="temp-action"> |
| | | <Button className="add-background header-btn" onClick={() => this.triggerTempsave()}>保存</Button> |
| | | <Button className="out-background header-btn" onClick={this.triggerclose}>关闭</Button> |
| | | </div> |
| | | </div> : null} |
| | | <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/> |
| | | <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/> |
| | | </div> |
| | | <div className="user" style={{paddingLeft: `${config.wrap.space || 0}px`}}>制单人:{username}</div> |
| | | </div> |
| | | {type === 'createVoucher' || type === 'checkVoucher' ? <div className="user">制单人:{username}</div> : null} |
| | | </div> |
| | | ) |
| | | ) |
| | | } else if (type === 'createVoucher') { |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | | <div className="voucher-header" style={{padding: `10px ${config.wrap.space || 0}px`}}> |
| | | <Button disabled={status === 'empty'} onClick={() => this.triggersave('add')}>保存并新增</Button> |
| | | <Button disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> |
| | | <Button disabled={status !== 'saved'} onClick={this.triggerPrint}>打印</Button> |
| | | <Dropdown overlay={<div className="mk-voucher-dropdown-wrap"> |
| | | <SaveAsTemp tempTypes={tempTypes} onChange={this.triggerTempsave}/> |
| | | <div className="split"></div> |
| | | <LoadFromTemp tempTypes={tempTypes} onChange={this.triggerTempLoad}/> |
| | | </div>} trigger={['hover']} placement="bottomCenter"> |
| | | <Button>更多</Button> |
| | | </Dropdown> |
| | | </div> |
| | | <div className="voucher-body" style={{padding: `0px ${config.wrap.space || 0}px`}}> |
| | | <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <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.id} 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({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({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({status: 'change', remark: val})}/> |
| | | </div> |
| | | </div> |
| | | <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/> |
| | | </div> |
| | | <div className="user" style={{paddingLeft: `${config.wrap.space || 0}px`}}>制单人:{username}</div> |
| | | </div> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | | <div className="voucher-body" style={{padding: `0px ${config.wrap.space || 0}px`}}> |
| | | <div className="pre-temp-wrap"> |
| | | <div className="temp-text"> |
| | | <span>模板名称:</span><Input value={title} placeholder="模板名称" autoComplete="off" onChange={(e) => this.setState({title: e.target.value})}/> |
| | | </div> |
| | | <div className="temp-text"> |
| | | <span>模板类型:</span> |
| | | <Select value={tempTypeClass} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({tempTypeClass: val, tempTypeName: option.props.children})}> |
| | | {tempTypes.map(option => |
| | | <Select.Option key={option.data_code} value={option.data_code}>{option.data_name}</Select.Option> |
| | | )} |
| | | </Select> |
| | | </div> |
| | | <div className="temp-action"> |
| | | <Button onClick={() => this.triggerTempsave()}>保存</Button> |
| | | <Button onClick={this.triggerclose}>关闭</Button> |
| | | </div> |
| | | </div> |
| | | <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/> |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | } |
| | | |