ttk-app-core
Version:
enterprise develop framework
1,225 lines • 53.4 kB
JavaScript
import React from 'react'
import { Map, fromJS } from 'immutable'
import { action as MetaAction, AppLoader } from 'edf-meta-engine'
import { TableOperate, Select, LoadingMask, Button, Popover, Modal, Input, Checkbox, Icon, Upload, Radio } from 'edf-component'
import extend from './extend'
import config from './config'
import moment from 'moment'
import * as data from './data'
import { consts } from 'edf-consts'
import { fetch, number, history } from 'edf-utils'
import ZlbsxlSelect from './components/zlbsxlSelect'
// 申报清册界面使用场景有本产品、第三方系统
// 故前端上下文不要再使用,否则第三方系统因取不到前段上下文而出现问题
class action {
constructor(option) {
this.metaAction = option.metaAction
this.extendAction = option.extendAction
this.config = config.current
this.webapi = this.config.webapi
}
//初始化
onInit = async ({ component, injections }) => {
this.extendAction.gridAction.onInit({ component, injections })
this.component = component
this.injections = injections
let currentOrg = this.metaAction.context.get('currentOrg'),
option = { periodDate: currentOrg.periodDate }
injections.reduce('init', option)
let addEventListener = this.component.props.addEventListener
if (addEventListener) {
addEventListener('onTabFocus', :: this.onTabFocus)
}
let hasReadSJInfo = await this.webapi.taxapply.hasReadSJInfo({})
if (!hasReadSJInfo) {
// 打开企业信息中的纳税申报设置界面
this.showPayTaxInfoSetPage()
return
}
this.load(false, true, hasReadSJInfo)
}
load = async (reLoad, isQueryOrg, hasReadSJInfo, zsxmDtos) => {
let response
LoadingMask.show()
try {
let selectedYearMonth = this.getSelectedYearMonth(),
option = {
year: selectedYearMonth.year,
month: selectedYearMonth.period,
isReturnValue: true,
reLoad: reLoad || false,
isQueryOrg: isQueryOrg || false
}
response = await this.webapi.taxapply.detailedListQuery(option)
let currentOrg = this.metaAction.context.get('currentOrg')
response.enabledYearMonth = currentOrg.enabledYear + '-' + currentOrg.enabledMonth
if (response.result == false && response.error) {
this.metaAction.toast('error', response.error.message)
} else {
this.injections.reduce('load', response, hasReadSJInfo, zsxmDtos)
}
} catch (e) {
}
LoadingMask.hide()
return response
}
showPayTaxInfoSetPage = async () => {
const ret = await this.metaAction.modal('show', {
height: 325,
width: 500,
okText: '设置',
//closable: false,
title: '纳税设置',
wrapClassName: 'paytaxinfo-tip',
children: this.getSetContent(),
})
if (ret == true) {
this.component.props.setPortalContent &&
this.component.props.setPortalContent('企业信息', 'edfx-app-org', { initData: {activeKey: '2' }})
} else {
this.metaAction.toast('info', '您可以从菜单【基础设置】-【企业信息】中进入设置。')
}
}
getSetContent = () => {
return <div>
<p className='jinggao'><Icon type="jinggao" fontFamily='edficon' style={{color: '#FA954C'}}/><div>请先设置网报帐号,并确认您的纳税人信息!未设置将不能直接申报。</div></p >
</div>
}
onMonthChange = async (path, oldValue, newValue) => {
let oldDate = moment(oldValue),
newDate = moment(newValue)
if (oldDate.year() != newDate.year() || oldDate.month() != newDate.month()) {
this.load(false)
}
}
//当前app的 "tab被点击" (从其他app切换到当前app)
onTabFocus = async (props) => {
let hasReadSJInfo = await this.webapi.taxapply.hasReadSJInfo({})
if (!hasReadSJInfo) {
// 打开企业信息中的纳税申报设置界面
this.showPayTaxInfoSetPage()
return
}
this.load(false)
}
operateCol = (text, record, index) => {
let list = this.metaAction.gf('data.list'),
curItem,
addText = '填写',
financeAddText = '填写',
endDate,
cancelDisabled,
isGetDataDisabled = true,
downloadDisabled = false,
projectType = data.PROJECT_TYPE_TAX,
obj = {}, state, payState, taxProjectCode,
selfSystemDeclare = true, sbywbm,
fiCancelBtnTitle = ''
if (list && list.get(index)) {
let systemDate = moment(new Date()).format('YYYY-MM-DD'),
systemYear = systemDate.split('-')[0],
systemMonth = systemDate.split('-')[1],
systemYearMonth = systemYear + '-' + parseInt(systemMonth),
selectedYearMonth = this.getSelectedYearMonth(),
selectedYM = selectedYearMonth.year + '-' + selectedYearMonth.period,
lastMonth = data.getLastMonth(selectedYearMonth.year, selectedYearMonth.period)
curItem = list.get(index)
endDate = curItem.get('endDate')
state = curItem.get('state')
payState = curItem.get('payState')
addText = state == '0' ? '填写' : '查看'
// 当财报未申报时,可填写
if (state == '0') {
financeAddText = '填写'
// 当财报已申报,但还未过申报期限时,可填写
} else if (state == '1' && systemDate <= endDate ) {
financeAddText = '填写'
// 当财报已申报,但已过申报日期,则只能查看
} else if (state == '1' && systemDate > endDate) {
financeAddText = '查看'
}
downloadDisabled = state == '0' ? true : false
projectType = curItem.get('projectType')
taxProjectCode = curItem.get('taxProjectCode')
selfSystemDeclare = curItem.get('selfSystemDeclare')
// 未申报
if (state == 0) {
//超过申报期
if (systemDate > endDate ) {
//isGetDataDisabled = true 开发阶段,先不控制取数的超期限制 0806 haozhao
isGetDataDisabled = false
} else {
isGetDataDisabled = false
}
//财报已申报但还未过期,【取数】可用
} else if (projectType == data.PROJECT_TYPE_FINANCE &&
state == 1 &&
systemDate <= endDate) {
isGetDataDisabled = false
fiCancelBtnTitle = '财务报表不需作废,可在申报期限前重复提交申报!'
}
sbywbm = curItem.get('sbywbm')
// 已申报且未过期且未交款,作废可用
cancelDisabled = (state == 1 && systemDate <= endDate && payState != 1) ? false : true
}
// taxProjectCode 101:企业会计准则 10101:增值税 ZL1001003、ZL1001010 小企业会计准则的财务报送
// 税报中除去增值税申报、财务报表,其他报表都禁用操作列
// 如果是已申报并且是外系统申报,则禁用操作列
// 一般增值税功能暂不支持,先屏蔽 0718 haozhao sbywbm == 'YBNSRZZS'
if ((taxProjectCode != '10101' && projectType == data.PROJECT_TYPE_TAX)) {
obj = {
children: (
<div style={{width: '100%', display: 'block', 'margin-top': '17px', height: '100%'}} title='该申报表功能暂不支持'>
{this.getOperateColBtn(true, addText)}
{this.getOperateColBtn(true, '取数')}
{this.getOperateColBtn(true, '作废')}
{this.getOperateColBtn(true, '下载')}
</div>
)
}
} else {
if (projectType == data.PROJECT_TYPE_TAX) {
obj = {
children: (
<div style={{width: '100%', display: 'block'}}>
{this.getOperateColBtn(false, addText, () => this.fillOrViewRpt(projectType, index, state, addText))}
{this.getOperateColBtn(isGetDataDisabled, '取数', () => this.getDataFromProduct(projectType, index))}
{this.getOperateColBtn(cancelDisabled, '作废', () => this.declareCancel(index, cancelDisabled))}
{this.getOperateColBtn(downloadDisabled, '下载', () => this.downloadDeclareRtp(index, projectType))}
</div>
)
}
} else {
obj = {
children: (
<div style={{width: '100%', display: 'block'}}>
{this.getOperateColBtn(false, financeAddText, () => this.fillOrViewRpt(projectType, index, state, financeAddText))}
{this.getOperateColBtn(isGetDataDisabled, '取数', () => this.getDataFromProduct(projectType, index))}
{this.getOperateColBtn(true, '作废', () => this.declareCancel(index, cancelDisabled), fiCancelBtnTitle)}
{this.getOperateColBtn(downloadDisabled, '下载', () => this.downloadDeclareRtp(index, projectType))}
</div>
)
}
}
}
return obj
}
getOperateColBtn = (disabled, addText, handleClick, title) => {
let disabledStyle = {'margin-right': '8px', 'cursor': 'not-allowed', 'color': 'rgba(0,0,0,0.25)'},
enabledStyle = {'margin-right': '8px'}
if (disabled) {
return (
<span style={disabledStyle}>{addText}</span>
)
} else {
if (title != '') {
return (
<a onClick={handleClick} style={enabledStyle} title={title}>{addText}</a>
)
} else {
return (
<a onClick={handleClick} style={enabledStyle}>{addText}</a>
)
}
}
}
getSelectedYearMonth = () => {
let selectedYearMonth = moment(this.metaAction.gf('data.form.date')),
year = selectedYearMonth.year(),
period = selectedYearMonth.month() + 1
return { year, period }
}
fillOrViewRpt = async (projectType, rowIndex, state, addText) => {
let selectedYearMonth = this.getSelectedYearMonth(),
year = selectedYearMonth.year,
period = selectedYearMonth.period,
list = this.metaAction.gf('data.list'), curItem,
skssqq, skssqz, declareTime, id, taxProjectId,
accountingStandardsId, kjzdzzDm, zlbsxldm, selfSystemDeclare, sbywbm,
taxProjectCode, taxProjectName, endDate, systemDate
if (list && list.get(rowIndex)) {
curItem = list.get(rowIndex)
skssqq = curItem.get('fromDate')
skssqz = curItem.get('toDate')
declareTime = curItem.get('endDate') // 申报期限
id = curItem.get('id')
taxProjectId = curItem.get('taxProjectId')
accountingStandardsId = curItem.get('accountingStandardsId')
kjzdzzDm = curItem.get('kjzdzzDm')
zlbsxldm = curItem.get('zlbsxlDm')
selfSystemDeclare = curItem.get('selfSystemDeclare') // 0:外系统申报 1:TTK产品申报
sbywbm = curItem.get('sbywbm')
taxProjectCode = curItem.get('taxProjectCode')
taxProjectName = curItem.get('taxProjectName')
endDate = curItem.get('endDate')
systemDate = moment(new Date()).format('YYYY-MM-DD')
}
// if (selfSystemDeclare == false && state == 1) {
// this.metaAction.toast('warning', '非本通道申报,不能打开报表!')
// return
// }
// [申报项目 ]已过申报期限,不能网上申报! 开发阶段,暂时先不做此校验 0806 haozhao
// if (systemDate > endDate && state == 0) {
// this.metaAction.toast('warning', `${taxProjectName}已过申报期限,不能网上申报!`)
// return
// }
if (projectType == data.PROJECT_TYPE_TAX) {
let param = { initData:
{
year: year,
reportId: id,
period: period,
skssqq: skssqq,
skssqz: skssqz,
sbywbm: sbywbm,
declareTime: declareTime,
taxProjectCode: taxProjectCode,
taxProjectName: taxProjectName
}
}
console.log('打开增值税申报表的传参如下:')
console.dir(param)
if (sbywbm == 'XGMZZS') {
this.component.props.setPortalContent &&
this.component.props.setPortalContent('增值税申报', 'ttk-tax-app-vattaxpayer', param)
} else {
//YBNSRZZS
this.component.props.setPortalContent &&
this.component.props.setPortalContent('增值税申报', 'ttk-tax-app-generalvattaxpayer', param)
}
} else {
let sbxx = await this.webapi.taxapply.querySBXX({}),
nsrsbh, nsrmc, zgswskfjDm, cityNo,
systemDate = moment(new Date()).format('YYYY-MM-DD'),
writable
// 超过申报期后,进入填写界面不能填数
if (systemDate > endDate) {
writable = false
} else {
writable = addText == '填写' ? true : false
}
if (sbxx) {
nsrsbh = sbxx.NSRSBH
nsrmc = sbxx.NSRMC
zgswskfjDm = sbxx.ZGSWSKFJDM
cityNo = sbxx.SS
}
// if (!nsrsbh) {
// this.metaAction.toast('warning', '纳税人识别号不能为空!')
// return
// }
let param = { financeParam: {
nsrsbh: nsrsbh,
startPeriod: skssqq,
endPeriod: skssqz,
zgswskfjDm: zgswskfjDm,
nsrmc: nsrmc,
sourceType: 'A04',
cityNo: cityNo,
tmpRvState: state,
id: id,
taxProjectId: taxProjectId,
accountingStandardsId: accountingStandardsId,
writable: writable,
taxProjectName: taxProjectName
} }
// 没有资料报送小类时,弹出小类选择界面
if (!zlbsxldm) {
let response = await this.webapi.taxapply.queryByKjzdzzDm({kjzdzzDm: kjzdzzDm})
const ret = await this.metaAction.modal('show', {
title: '提示',
okText: '保存',
width: 480,
wrapClassName: 'zlbsxl-modal',
children: this.selectDeclareSmallType(response, zlbsxldm, kjzdzzDm)
})
if (ret) {
let newAccountingStandardsId = localStorage.getItem('accountingStandardsId')
if (newAccountingStandardsId != undefined && newAccountingStandardsId != '') {
param.financeParam.accountingStandardsId = newAccountingStandardsId
console.log('打开财务报表的传参如下:')
console.dir(param)
this.component.props.setPortalContent &&
this.component.props.setPortalContent('财务报表', 'ttk-access-app-tranreport', param)
}
}
} else {
console.log('打开财务报表的传参如下:')
console.dir(param)
this.component.props.setPortalContent &&
this.component.props.setPortalContent('财务报表', 'ttk-access-app-tranreport', param)
}
}
}
selectDeclareSmallType = (response, zlbsxldm, kjzdzzDm) => {
return (
<ZlbsxlSelect
value={zlbsxldm}
dataSource={response}
kjzdzzDm={kjzdzzDm}
saveZlbsxl={this.saveZlbsxl}/>
)
}
saveZlbsxl = async (zlbsxlDm, kjzdzzDm) => {
let response = await this.webapi.taxapply.saveZlbsxl({kjzdzzDm: kjzdzzDm, zlbsxlDm: zlbsxlDm})
let option = {
kjzdzzDm: response.kjzdzzDm,
accountingStandardsId: response.accountingStandardsId,
taxProjectCode: response.taxProjectCode,
taxProjectName: response.taxProjectName,
zlbsxlDm: response.zlbsxlDm
}
this.injections.reduce('updateQingceZlbsxlDm', option)
}
getSmallTypeOption(ds) {
return ds ? ds.map((item, index)=>
<Option value={item.get('zlbsxlDm')}>
{item.get('zlbsxlmc')}
</Option>) :
[]
}
getDataFromProduct = async (projectType, index) => {
let curItem = this.metaAction.gf('data.list').get(index),
fromDate = curItem.get('fromDate'),
toDate = curItem.get('toDate'),
id = curItem.get('id'),
accountingStandardsId = curItem.get('accountingStandardsId'),
selfSystemDeclare = curItem.get('selfSystemDeclare'),
state = curItem.get('state'),
sbywbm = curItem.get('sbywbm')
if (selfSystemDeclare == false && state == 1) {
this.metaAction.toast('warning', '非本通道申报,不能取数!')
return
}
if (projectType == data.PROJECT_TYPE_FINANCE) {
if (this.metaAction.gf('data.other.hasReadSJInfo') == false) {
// 打开企业信息中的纳税申报设置界面
this.showPayTaxInfoSetPage()
return
}
let option = {
fromDate: fromDate,
toDate: toDate,
accountingStandardsId: accountingStandardsId
},
kjzdzzDm = curItem.get('kjzdzzDm'),
zlbsxldm = curItem.get('zlbsxlDm')
// 没有资料报送小类时,弹出小类选择界面
if (!zlbsxldm) {
let response = await this.webapi.taxapply.queryByKjzdzzDm({kjzdzzDm: kjzdzzDm})
const ret = await this.metaAction.modal('show', {
title: '提示',
okText: '保存',
width: 480,
wrapClassName: 'zlbsxl-modal',
children: this.selectDeclareSmallType(response, zlbsxldm, kjzdzzDm)
})
if (ret) {
LoadingMask.show()
let newAccountingStandardsId = localStorage.getItem('accountingStandardsId')
option.accountingStandardsId = newAccountingStandardsId
let response = await this.webapi.taxapply.getFiData(option)
if (response) {
this.metaAction.toast('success', '自动取数成功,请核对数据!')
}
}
} else {
LoadingMask.show()
let response = await this.webapi.taxapply.getFiData(option)
if (response) {
this.metaAction.toast('success', '自动取数成功,请核对数据!')
}
}
LoadingMask.hide()
} else {
let selectedYearMonth = this.getSelectedYearMonth(),
option = {
taxParam:{
skssqq: fromDate,
skssqz: toDate,
reportId: id,
year: selectedYearMonth.year,
period: selectedYearMonth.period,
beginMonth: selectedYearMonth.period,
endMonth: selectedYearMonth.period
},
isExternalCall: false
}
LoadingMask.show()
let response
if (sbywbm == 'YBNSRZZS') {
option.taxParam.yzpzzlDm ="BDA0610606"
response = await this.webapi.taxapply.getYbZzsData(option)
} else {
response = await this.webapi.taxapply.getZzsData(option)
}
if (response) {
this.metaAction.toast('success', '自动取数成功,请核对数据!')
}
LoadingMask.hide()
}
}
declareCancel = async (index, cancelDisabled) => {
let selectedYearMonth = this.getSelectedYearMonth(),
zzssbStatus = 0, lastMonth = data.getLastMonth(selectedYearMonth.year, selectedYearMonth.period)
let curItem = this.metaAction.gf('data.list').get(index),
systemDate = moment(new Date()).format('YYYY-MM-DD'),
declareTime = curItem.get('endDate'),
fromDate = curItem.get('fromDate') + ' 00:00:00.0',
toDate = curItem.get('toDate') + ' 00:00:00.0',
voucherDate = curItem.get('voucherDate'),
yzpzzlDm = curItem.get('yzpzzlDm'),
id = curItem.get('id'),
taxProjectCode = curItem.get('taxProjectCode')
let option = {
skssqq: fromDate, // 申报所属期起
skssqz: toDate, // 申报所属期止
reportId: id,
zsxmDm: taxProjectCode,
submitDate: voucherDate != undefined ? voucherDate : moment(new Date()).format('YYYY-MM-DD')
}
const ret = await this.metaAction.modal('show', {
title: '申报作废',
height: 425,
width: 798,
okText: '提交作废',
children: this.metaAction.loadApp('ttk-taxapply-app-declare-cancel', {
store: this.component.props.store,
initData: option
}),
})
if (ret) {
this.load(false)
}
}
renderStatus = (text, record, index) => {
let list = this.metaAction.gf('data.list'), curItem, state = 0, stateName,
fromDate, toDate, pzxh, taxProjectName, projectType, declareUnsuccessMessage,
selfSystemDeclare, popoverStyle
if (list && list.get(index)) {
curItem = list.get(index)
state = curItem.get('state')
stateName = curItem.get('stateName')
pzxh = curItem.get('pzxh')
taxProjectName = curItem.get('taxProjectName')
declareUnsuccessMessage = curItem.get('declareUnsuccessMessage')
projectType = curItem.get('projectType')
fromDate = curItem.get('fromDate')
toDate = curItem.get('toDate')
selfSystemDeclare = curItem.get('selfSystemDeclare')
} else {
return {children: (<div></div>)}
}
if (!!selfSystemDeclare) {
popoverStyle = 'ttk-taxapply-app-taxlist-helpPopover-selfSystem'
} else {
popoverStyle = 'ttk-taxapply-app-taxlist-helpPopover-nonself-system'
}
let obj = {}, content = this.getRowTip(projectType, fromDate, toDate, pzxh, taxProjectName, true, selfSystemDeclare)
if (state == '0' && declareUnsuccessMessage == undefined) {
obj = {children: (<span>{stateName}</span>)}
} else if (state == '0' && declareUnsuccessMessage != undefined){
obj = {
children: (
<div>
<span>{stateName}</span>
<Popover placement="topLeft" content={declareUnsuccessMessage} overlayClassName='ttk-taxapply-app-taxlist-jinggaoPopover'>
<Icon className='ttk-taxapply-app-taxlist-declare-huizhi' style={{color: 'orange'}} fontFamily='edficon' type="jinggao"/>
</Popover>
</div>
)
}
} else {
obj = {
children: (
<div>
<span>{stateName}</span>
<Popover placement="topLeft" content={content} overlayClassName={popoverStyle}>
<Icon className='ttk-taxapply-app-taxlist-declare-huizhi' style={{color: '#8ACA1B'}} fontFamily='edficon' type="huizhi"/>
</Popover>
</div>
)
}
}
return obj
}
renderChargeBackStatus = (text, record, index) => {
let list = this.metaAction.gf('data.list'),
curItem, payState = 0, payStateName, fromDate, toDate, taxProjectName, pzxh
if (list && list.get(index)) {
curItem = list.get(index)
payState = curItem.get('payState')
payStateName = curItem.get('payStateName')
}
if (payState == undefined) {
return {children: (<span>— —</span>)}
}
fromDate = curItem.get('fromDate')
toDate = curItem.get('toDate')
taxProjectName = curItem.get('taxProjectName')
pzxh = curItem.get('pzxh')
let content = this.getRowTip(data.PROJECT_TYPE_TAX, fromDate, toDate, pzxh, taxProjectName, false), obj = {}
if (payState == '0') {
obj = {children: (<span>{payStateName}</span>)}
} else {
obj = {
children: (
<div>
<span>{payStateName}</span>
<Popover placement="topLeft" content={content} overlayClassName='ttk-taxapply-app-taxlist-helpPopover'>
<Icon className='ttk-taxapply-app-taxlist-declare-huizhi' style={{color: '#EFB336'}} fontFamily='edficon' type="huizhi"/>
</Popover>
</div>
)
}
}
return obj
}
// 税款缴纳
taxMoneyPayClick = async () => {
let selectedYearMonth = this.getSelectedYearMonth(),
zzssbStatus = 0, lastMonth = data.getLastMonth(selectedYearMonth.year, selectedYearMonth.period)
let list = this.metaAction.gf('data.list'), taxAmountPayable = 0,
paramDtos = [], item = {}
for (var i = 0; i < list.size; i++) {
if (list.get(i).get('projectType') == data.PROJECT_TYPE_TAX) {
item = {
year: selectedYearMonth.year,
period: selectedYearMonth.period,
skssqq: list.get(i).get('fromDate'),
skssqz: list.get(i).get('toDate'),
reportId: list.get(i).get('id'),
taxProjectCode: list.get(i).get('taxProjectCode'),
yzpzzlDm: list.get(i).get('yzpzzlDm'),
sbywbm: list.get(i).get('sbywbm')
}
paramDtos.push(item)
}
item = {}
}
const ret = await this.metaAction.modal('show', {
title: '税款缴纳',
okText: '立即缴款',
width: 1200,
footer: '',
closeModal: this.close,
closeBack: (back) => {this.closeTip = back},
style: { top: 40 },
bodyStyle: { padding: '24px 12px', height: 490 },
wrapClassName: 'batchchargeback-model',
children: this.metaAction.loadApp('ttk-taxapply-app-batchchargeback', {
store: this.component.props.store,
initData: paramDtos
}),
})
}
close = (ret) => {
this.closeTip()
this.load(false)
}
declareTaxClick = async () => {
const selectedOption = this.getNewData()
if (selectedOption.length == 0) {
this.metaAction.toast('warning', '请选择申报项目')
return
}
let sucessMessage, isDeclareZzs = false, isDeclareFinance = false,
selectedYearMonth = this.getSelectedYearMonth(),
lastMonth = data.getLastMonth(selectedYearMonth.year, selectedYearMonth.period),
systemDate = moment(new Date()).format('YYYY-MM-DD')
let message = [], endDate
for (var i = 0; i < selectedOption.length; i++) {
//增值税已经申报,将不能重复申报
if (selectedOption[i].taxProjectCode == '10101' && selectedOption[i].state == 1) {
message.push(`${selectedOption[i].taxProjectName}已经申报,将不能重复申报!`)
}
if (selectedOption.projectType == data.PROJECT_TYPE_TAX) {
//申报超期检查
endDate = selectedOption[i].endDate
if (systemDate > endDate) {
message.push(`${selectedOption[i].taxProjectName}已过申报期限,不能网上申报!`)
}
}
}
if (message.length > 0) {
let checkStyle = { textAlign: 'left', fontSize: '14px', display: 'inline-block', verticalAlign: 'top' }
this.metaAction.toast('warning',
<div style={checkStyle}>
{message.map((o, index) => <p style={{ marginBottom: '0' }}>{(index + 1) + '.' + o}</p>)}
</div>
)
return
}
// 财报的资料报送小类代码为空检查
let isEmptyZlbsxlDm = false, zlbsxlDm, kjzdzzDm
for (var i = 0; i < selectedOption.length; i++) {
if (selectedOption[i].projectType == data.PROJECT_TYPE_FINANCE) {
kjzdzzDm = selectedOption[i].kjzdzzDm
}
if (selectedOption[i].projectType == data.PROJECT_TYPE_FINANCE &&
!selectedOption[i].zlbsxlDm) {
isEmptyZlbsxlDm = true
kjzdzzDm = selectedOption[i].kjzdzzDm
break
}
}
if (isEmptyZlbsxlDm) {
let response = await this.webapi.taxapply.queryByKjzdzzDm({kjzdzzDm: kjzdzzDm})
const ret = await this.metaAction.modal('show', {
title: '提示',
okText: '保存',
width: 480,
wrapClassName: 'zlbsxl-modal',
children: this.selectDeclareSmallType(response, zlbsxlDm, kjzdzzDm)
})
if (ret) {
this.batchDeclare(selectedOption)
}
} else {
this.batchDeclare(selectedOption)
}
}
batchDeclare = async (selectedOption) => {
const ret = await this.metaAction.modal('confirm', {
title: '申报',
width: 420,
content: this.getDeclareConfirmContent(selectedOption)
})
if (ret) {
let selectedYearMonth = this.getSelectedYearMonth(),
lastMonth = data.getLastMonth(selectedYearMonth.year, selectedYearMonth.period)
LoadingMask.show()
let params = {
year: selectedYearMonth.year,
period: selectedYearMonth.period
}, zsxmDtos = [], item = {}
for (var i = 0; i < selectedOption.length; i++) {
item.reportId = selectedOption[i].id
item.projectType = selectedOption[i].projectType
item.taxProjectCode = selectedOption[i].taxProjectCode
item.taxProjectName = selectedOption[i].taxProjectName
item.yzpzzlDm = selectedOption[i].yzpzzlDm
item.ssqQ = selectedOption[i].fromDate
item.ssqZ = selectedOption[i].toDate
zsxmDtos.push(item)
item = {}
}
params.zsxmDtos = zsxmDtos
params.isReturnValue = true
console.log('批量申报传送的参数如下:')
console.dir(params)
let response = await this.webapi.taxapply.taxDeclare(params)
LoadingMask.hide()
if (response) {
let newList = await this.load(false, undefined, undefined, response.zsxmDtos)
let sbxx = await this.webapi.taxapply.querySBXX({}), nsrsbh, nsrmc
if (sbxx) {
nsrsbh = sbxx.NSRSBH
nsrmc = sbxx.NSRMC
}
const ret = await this.metaAction.modal('show', {
title: '提示',
okText: '确定',
width: 600,
wrapClassName: 'batchchargeback-tip',
children: this.getContent(response.zsxmDtos, newList.list, nsrsbh, nsrmc)
})
if (ret) {
if (localStorage.getItem('taxCompareResult')) {
let taxCompareResult = JSON.parse(localStorage.getItem('taxCompareResult'))
localStorage.removeItem('taxCompareResult')
let response = await this.metaAction.modal('show', {
title: '提示',
children: this.metaAction.loadApp('ttk-tax-app-comparison', {
store: this.component.props.store,
initData: {
data: taxCompareResult,
}
}),
wrapClassName: 'tax-hz-wrap hide-cancelbtn',
okText: '修改数据',
className: 'tax-hz',
width: 830,
height: 466
})
if (response) {
let list = this.metaAction.gf('data.list').toJS()
let newItem = list.find(item => (item.sbywbm == 'YBNSRZZS' && item.projectType == data.PROJECT_TYPE_TAX))
if (newItem) {
let selectedYearMonth = this.getSelectedYearMonth(),
year = selectedYearMonth.year,
period = selectedYearMonth.period
let param = { initData:
{
year: year,
reportId: newItem.id,
period: period,
skssqq: newItem.fromDate,
skssqz: newItem.toDate,
declareTime: newItem.endDate,
taxProjectCode: newItem.taxProjectCode,
taxProjectName: newItem.taxProjectName
}
}
this.component.props.setPortalContent &&
this.component.props.setPortalContent('增值税申报', 'ttk-tax-app-generalvattaxpayer', param)
}
}
}
}
}
}
}
formatMessage = (message) => {
message = message.split('<br>')
return (
<div style={{textAlign: 'left'}}>
{
message.map((o, i) => {
return (
<div>{o}</div>
)
})
}
</div>
)
}
getDeclareConfirmContent = (selectedOption) => {
let checkStyle = { textAlign: 'left', fontSize: '14px', display: 'inline-block', verticalAlign: 'top', marginLeft: '25px' }
return <div>
<p>本次将申报以下项目:</p >
<div style={checkStyle}>
{selectedOption.map((o, index) => <p style={{ marginBottom: '0' }}>{(index + 1) + '.' + o.taxProjectName}</p>)}
</div>
</div>
}
getContent = (zsxmDtos, newList, nsrsbh, nsrmc) => {
let declareSuccessCount = 0, declareFailureCount = 0
for (var i = 0; i < zsxmDtos.length; i++) {
if (zsxmDtos[i].declareStatus == false) {
declareFailureCount++
} else if (zsxmDtos[i].declareStatus == true) {
declareSuccessCount++
}
}
// 全部申报成功
if (declareSuccessCount == zsxmDtos.length) {
return <div>
<p className='chenggongtishi'><Icon type="chenggongtishi" fontFamily='edficon' style={{color: '#00B38A'}}/><span>申报成功</span></p >
<p>以下是税务局回执:</p>
<p>尊敬的{nsrmc} ({nsrsbh}):</p >
{this.getTip(zsxmDtos, newList)}
</div>
}
// 全部申报失败
if (declareFailureCount == zsxmDtos.length) {
return <div>
<p className='chenggongtishi'><Icon type="jinggao" fontFamily='edficon' style={{color: '#E94033'}}/><span>申报失败</span></p >
<p>以下是税务局回执:</p>
<p>尊敬的{nsrmc} ({nsrsbh}):</p >
{this.getTip(zsxmDtos, newList)}
</div>
}
// 部分申报成功
if (declareSuccessCount < zsxmDtos.length &&
declareFailureCount < zsxmDtos.length) {
return <div>
<p className='chenggongtishi'><Icon type="jinggao" fontFamily='edficon' style={{color: '#FA954C'}}/><span>部分申报成功</span></p >
<p>以下是税务局回执:</p>
<p>尊敬的{nsrmc} ({nsrsbh}):</p >
{this.getTip(zsxmDtos, newList)}
</div>
}
}
getTip = (selectedOption, newList) => {
let tip = [], tipHtml
for (var i = 0; i < selectedOption.length; i++) {
if (selectedOption[i].taxProjectCode = '10101' &&
selectedOption[i].projectType == data.PROJECT_TYPE_TAX) {
// 申报成功
if (!!selectedOption[i].declareStatus) {
let newItem = newList.find(item => item.id == selectedOption[i].reportId)
if (newItem) {
if (selectedOption[i].projectType == data.PROJECT_TYPE_TAX) {
selectedOption[i].pzxh = newItem.pzxh == undefined ? '' : newItem.pzxh
selectedOption[i].taxAmount = newItem.taxAmount
//税款金额0.00元,无需缴款。
}
}
if (selectedOption[i].taxAmount == 0) {
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].taxProjectName}(应征凭证序号为:${selectedOption[i].pzxh})已申报成功。税款金额0.00元,无需缴款。`)
} else {
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].taxProjectName}(应征凭证序号为:${selectedOption[i].pzxh})已申报成功。税款金额${selectedOption[i].taxAmount}元,请尽快缴款,以免产生滞纳金。`)
}
// 校验失败或者申报失败
} else {
if (selectedOption[i].yzpzzlDm == 'BDA0610606') {
if (selectedOption[i].declareMessage != undefined) {
if (selectedOption[i].declareMessage.indexOf(selectedOption[i].taxProjectName) < 0) {
selectedOption[i].declareMessage = selectedOption[i].taxProjectName + '的' + selectedOption[i].declareMessage
}
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].declareMessage}`)
} else {
let response = selectedOption[i].declareYbrResponseDto
if (!response.success) {//失败,两种情况,校验信息不通过,第二种直接失败
if (response.formularList) {// 校验未通过
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].taxProjectName},校验有问题,请修正后再申报!`)
} else {//校验通过了失败
if( response.taxCompareResult &&
response.taxCompareResult.SBZzsSaveReturnVO &&
response.taxCompareResult.SBZzsSaveReturnVO.sBSbbdBdjgVO &&
response.taxCompareResult.SBZzsSaveReturnVO.sBSbbdBdjgVO.sfcbs != 'Y' ) {
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].taxProjectName},尚未抄报税,不能进行申报!`)
} else if ( response.taxCompareResult &&
response.taxCompareResult.SBZzsSaveReturnVO &&
response.taxCompareResult.SBZzsSaveReturnVO.bdjgbz == 'N' ) {
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].taxProjectName},比对不成功,不能进行申报!`)
console.log('reportid:' + selectedOption[i].reportId )
console.dir(newList )
let newItem = newList.find(item => item.id == selectedOption[i].reportId),
params = {}
if (newItem) {
let selectedYearMonth = this.getSelectedYearMonth(),
year = selectedYearMonth.year,
period = selectedYearMonth.period
params = {
year: selectedYearMonth.year,
beginMonth: selectedYearMonth.period,
endMonth: selectedYearMonth.period,
taxProjectId: newItem.id,
period: selectedYearMonth.period,
skssqq: newItem.fromDate,
skssqz: newItem.toDate,
reportId: newItem.reportId
}
console.dir(params)
response.taxCompareResult.textInfo = params
response.taxCompareResult.textInfo.nsrmc = response.nsrmc
response.taxCompareResult.textInfo.nsrsbh = response.nsrsbh
response.taxCompareResult.textInfo.tableName = '增值税纳税申报表(使用增值税小规模纳税人)'
localStorage.setItem('taxCompareResult', JSON.stringify(response.taxCompareResult))
}
}
}
}
}
} else {
if (selectedOption[i].declareMessage.indexOf(selectedOption[i].taxProjectName) < 0) {
selectedOption[i].declareMessage = selectedOption[i].taxProjectName + '的' + selectedOption[i].declareMessage
}
tip.push(`您的税款所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].declareMessage}`)
}
}
}
if (selectedOption[i].projectType == data.PROJECT_TYPE_FINANCE) {
if (!!selectedOption[i].declareStatus) {
tip.push(`您所报送的所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].taxProjectName}已成功报送。`)
} else {
if (selectedOption[i].declareMessage.indexOf(selectedOption[i].taxProjectName) < 0) {
selectedOption[i].declareMessage = selectedOption[i].taxProjectName + '的' + selectedOption[i].declareMessage
}
tip.push(`您所报送的所属期为${selectedOption[i].ssqQ}至${selectedOption[i].ssqZ}的${selectedOption[i].declareMessage}`)
}
}
}
let checkStyle = { textAlign: 'left', fontSize: '14px', display: 'inline-block', verticalAlign: 'top' }
return (<div style={checkStyle}>
{tip.map((o, index) => <p style={{ marginBottom: '0' }}> {o}</p>)}
</div>)
}
getRowTip = (projectType, fromDate, toDate, pzxh, sbxmmc, isDeclareStatusReceipt, selfSystemDeclare) => {
let currentOrg
if (this.metaAction.gf('data.other.currentOrg')) {
currentOrg = this.metaAction.gf('data.other.currentOrg').toJS()
} else {
return <div></div>
}
// 显示【非本通道申报】
if (!selfSystemDeclare) {
return (<div style={{'font-size': '12px'}}>
<p>非本通道申报!</p>
</div>)
}
// 申报状态回执信息构造
if (isDeclareStatusReceipt == true) {
if (projectType == data.PROJECT_TYPE_FINANCE) {
return (<div>
<p>尊敬的{currentOrg.dlxxDto.QYMC} ({currentOrg.vatTaxpayerNum}):</p >
<p> 您所报送的所属期为{fromDate}至{toDate}的{sbxmmc}已成功报送。</p >
</div>)
} else {
return (<div>
<p>尊敬的{currentOrg.dlxxDto.QYMC} ({currentOrg.vatTaxpayerNum}):</p >
<p> 您的税款所属期为{fromDate}至{toDate}的{sbxmmc}(应征凭证序号为:{pzxh})已申报成功。</p >
</div>)
}
// 缴款状态回执信息构造
} else {
return (<div>
<p>尊敬的{currentOrg.dlxxDto.QYMC} ({currentOrg.vatTaxpayerNum}):</p >
<p> 您的税款所属期为{fromDate}至{toDate}的{sbxmmc}(应征凭证序号为:{pzxh})已成功缴款。</p >
</div>)
}
return
}
rowSelection = (text, row, index) => {
return undefined
}
checkboxChange = (arr, itemArr) => {
let newArr = []
arr.forEach(item => {
if( item ){
newArr.push(item)
}
})
let newItemArr = []
itemArr.map(item => {
if( item ){
newItemArr.push(item)
}
})
this.injections.reduce('update', {
path: 'data.tableCheckbox',
value: {
checkboxValue: newArr,
selectedOption: newItemArr
}
})
this.selectedOption = newItemArr
}
getNewData = () => {
const checkboxValue = this.metaAction.gf('data.tableCheckbox.checkboxValue').toJS()
const list = this.metaAction.gf('data.list').toJS()
let arr = []
list.map(item => {
// 财务报表、增值税报表以外的申报项目除外
if ( checkboxValue.includes(item.id) &&
(item.taxProjectCode == '10101' ||
item.projectType == data.PROJECT_TYPE_FINANCE)){
arr.push(item)
}
})
return arr
}
downloadDeclareRtp = async (index, projectType) => {
if (projectType != data.PROJECT_TYPE_FINANCE) {
this.metaAction.toast('warning', '该功能正在开发中')
return
}
let list = this.metaAction.gf('data.list'), curItem,
fromDate, toDate, accountingStandardsId, param, selfSystemDeclare, state
if (list && list.get(index)) {
curItem = list.get(index)
fromDate = curItem.get('fromDate')
toDate = curItem.get('toDate')
accountingStandardsId = curItem.get('accountingStandardsId')
selfSystemDeclare = curItem.get('selfSystemDeclare')
state = curItem.get('state')
}
if (selfSystemDeclare == false && state == 1) {
this.metaAction.toast('warning', '非本通道申报,不能下载报表!')
return
}
// if (!this.metaAction.gf('data.other.hasReadSJInfo')) {
// // 打开企业信息中的纳税申报设置界面
// this.showPayTaxInfoSetPage()
// return
// }
param = {
fromDate: fromDate,
toDate: toDate,
accountingStandardsId: accountingStandardsId,
isReturnValue: true
}
const res = await this.webapi.taxapply.downloadPdf(param)
if (res) {
message.success('下载PDF文件成功', 5)
return
}
}
renderDeclareItem = (text, record, index) => {
if (record.projectType == data.PROJECT_TYPE_FINANCE) {
return (<div className='asset-name-edit-cell asset-name-edit-cell-a'>
<div style={{'white-space': 'nowrap', overflow: 'hidden', 'text-overflow': 'ellipsis'}} title={text}>{text}</div>
<Icon
font-family="edficon"
title={'设置资料保送小类'}
className='edficon edficon-bianji cell-icon'
style={{width: '22px',height: '22px',fontSize:'22px'}}
onClick={() => {this.openZlbsxlSelectPage(record.zlbsxlDm, record.kjzdzzDm)}}
/>
</div>)
} else {
return (<div className='asset-name-edit-cell asset-name-edit-cell-a'>
{text}
</div>)
}
}
openZlbsxlSelectPage = async (zlbsxlDm, kjzdzzDm) => {
let response = await this.webapi.taxapply.queryByKjzdzzDm({kjzdzzDm: kjzdzzDm})
const ret = await this.metaAction.modal('show', {
title: '提示',
okText: '保存',
width: 480,
wrapClassName: 'zlbsxl-modal',
children: this.selectDeclareSmallType(response, zlbsxlDm, kjzdzzDm)
})
if (ret) {
this.metaAction.toast('success', '资料报送小类设置成功')
}
}
}
export default function creator(option) {
const metaAction = new MetaAction(option),
extendAction = extend.actionCreator({ ...option, metaAction }),
o = new action({ ...option, metaAction, extendAction }),
ret = { ...metaAction, ...extendAction.gridAction, ...o }
metaAction.config({ metaHandlers: ret })
return ret
}