import Api from '~/service/Api'; import Utils from "~/utils" import moment from 'moment' export default { methods: { async getRef() { if (!this.model.recgrp.bas.ownextkey) { this.$notify({ title: '提示', type: 'warning', message: '请选择地区机构号'}) return; } if (!this.model.recgrp.bas.custype) { this.$notify({ title: '提示', type: 'warning', message: '请选择客户类型'}) return; } if (!this.model.mtabut.paydat) { this.$notify({ title: '提示', type: 'warning', message: '请选择收付汇日期'}) return; } let rtnmsg = await Api.post('/report/bopnew/public/getRef', { ownextkey: this.model.recgrp.bas.ownextkey, paydat: this.model.mtabut.paydat, custype: this.model.recgrp.bas.custype, trnName: this.root.trnName }) if (rtnmsg.respCode === SUCCESS) { let refno = rtnmsg.data this.model.recgrp.bas.rptno = refno this.model.ctlmod.othrptno = refno if (this.model.mtabut.dclflg || this.model.recgrp.dcl && this.model.recgrp.dcl.rptno) { this.model.recgrp.dcl.rptno = refno } if (this.model.mtabut.vrfflg || this.model.recgrp.vrf && this.model.recgrp.vrf.rptno) { this.model.recgrp.vrf.rptno = refno } } }, async basflgChange() { let trsType = this.root.trnName.substring(3, 6).toUpperCase() if (this.model.mtabut.basflg) { // let rtnmsg = this.getNewDblState(this.model.mtabut.oldbasact, this.model.ctlmod.dbl.bassta, trsType) let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType: this.model.mtabut.oldbasact, oldState: this.model.ctlmod.dbl.bassta, transType: trsType }) if (rtnmsg.respCode === SUCCESS) { let newState = rtnmsg.data if (newState.startsWith("@")) { this.$notify({ title: '提示', type: 'warning', message: '不允许的操作:' + newState.substring(1) }) } if (newState == "!!!") { this.$notify({ title: '提示', type: 'error', message: '该记录当前状态无法执行此操作' }) return } if (!newState.includes("/")) { this.$notify({ title: '提示', type: 'error', message: '未识别的更新状态:' + newState }) return } let newActTyp = newState.split("/")[0] this.model.recgrp.bas.actiontype = newActTyp } } else { //还原数据 if (this.model.recgrp.bas.inr) { let parameters = { recgrp: { bas: { inr: this.model.recgrp.bas.inr, } } } let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/loadDataBas`, parameters) if (rtnmsg.respCode === SUCCESS) { Utils.copyValueFromVoData(this.model.recgrp.bas, rtnmsg.data); } } this.model.recgrp.bas.actiontype = this.model.mtabut.oldbasact } }, async dclflgChange() { let trsType = this.root.trnName.substring(3, 6).toUpperCase() if (!(this.model.recgrp.dcl && this.model.recgrp.dcl.hasOwnProperty("actiontype"))) { this.$notify({ title: '错误', type: 'error', message: '无法获取申报信息操作类型' }) return } if (this.model.mtabut.dclflg) { if (!this.model.recgrp.dcl.rptno) { this.model.recgrp.dcl.rptno = this.model.recgrp.bas.rptno } if (!this.model.recgrp.dcl.inr) { trsType = 'ADD' } if(!this.model.recgrp.dcl.rptdate){ this.model.recgrp.dcl.rptdate=moment(new Date()).format("YYYY-MM-DD") } // let rtnmsg = this.getNewDblState(this.model.mtabut.olddclact, this.model.ctlmod.dbl.dclsta, trsType) let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType: this.model.mtabut.olddclact, oldState: this.model.ctlmod.dbl.dclsta, transType: trsType }) if (rtnmsg.respCode === SUCCESS) { let newState = rtnmsg.data if (newState.startsWith("@")) { this.$notify({ title: '提示', type: 'warning', message: '不允许的操作:' + newState.substring(1) }) } if (newState == "!!!") { this.$notify({ title: '提示', type: 'error', message: '该记录当前状态无法执行此操作' }) return } if (!newState.includes("/")) { this.$notify({ title: '提示', type: 'error', message: '未识别的更新状态:' + newState }) return } let newActTyp = newState.split("/")[0] this.model.recgrp.dcl.actiontype = newActTyp } //交易金额1赋值 基础信息中金额 if(this.model.recgrp.dcl.tc1amt!= undefined){ if(this.model.recgrp.dcl.tc1amt == null||this.model.recgrp.dcl.tc1amt == '0'||this.model.recgrp.dcl.tc1amt == ''){ this.model.recgrp.dcl.tc1amt = this.model.recgrp.bas.txamt } } //获取联系人 联系电话 let creuserpara = { custcod: this.model.recgrp.bas.custcod, idcode: this.model.recgrp.bas.idcode, sptinr: this.model.businessInr, dblinr: this.model.ctlmod.dbl.inr, } let crertnmsg = await Api.post(`/report/bopnew/public/getBopCrtuser`, creuserpara) if (crertnmsg.respCode === SUCCESS) { if (this.model.recgrp.dcl.crtuser != undefined && this.model.recgrp.dcl.crtuser == '') { this.model.recgrp.dcl.crtuser = crertnmsg.data.crtuser || ''; } if (this.model.recgrp.dcl.inptelc != undefined && this.model.recgrp.dcl.inptelc == '') { this.model.recgrp.dcl.inptelc = crertnmsg.data.inptelc || ''; } if (this.model.recgrp.dcl.txcode!= undefined && this.model.recgrp.dcl.txcode == '') { this.model.recgrp.dcl.txcode = crertnmsg.data.codext || ''; } } } else { //还原数据 if (this.model.recgrp.dcl.inr) { let parameters = { recgrp: { dcl: { inr: this.model.recgrp.dcl.inr, } } } let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/loadDataDcl`, parameters) if (rtnmsg.respCode === SUCCESS) { Utils.copyValueFromVoData(this.model.recgrp.dcl, rtnmsg.data); } } this.model.recgrp.dcl.actiontype = this.model.mtabut.olddclact } }, async vrfflgChange() { let trsType = this.root.trnName.substring(3, 6).toUpperCase() if (!(this.model.recgrp.vrf && this.model.recgrp.vrf.hasOwnProperty("actiontype"))) { this.$notify({ title: '错误', type: 'error', message: '无法获取申报信息操作类型' }) return } if (this.model.mtabut.vrfflg) { if (!this.model.recgrp.vrf.rptno) { this.model.recgrp.vrf.rptno = this.model.recgrp.bas.rptno } if(!this.model.recgrp.vrf.rptdate){ this.model.recgrp.vrf.rptdate=moment(new Date()).format("YYYY-MM-DD") } if (!this.model.recgrp.vrf.inr) { trsType = 'ADD' } // let rtnmsg = this.getNewDblState(this.model.mtabut.oldvrfact, this.model.ctlmod.dbl.vrfsta, trsType) let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType: this.model.mtabut.oldvrfact, oldState: this.model.ctlmod.dbl.vrfsta, transType: trsType }) if (rtnmsg.respCode === SUCCESS) { let newState = rtnmsg.data if (newState.startsWith("@")) { this.$notify({ title: '提示', type: 'warning', message: '不允许的操作:' + newState.substring(1) }) } if (newState == "!!!") { this.$notify({ title: '提示', type: 'error', message: '该记录当前状态无法执行此操作' }) return } if (!newState.includes("/")) { this.$notify({ title: '提示', type: 'error', message: '未识别的更新状态:' + newState }) return } let newActTyp = newState.split("/")[0] this.model.recgrp.vrf.actiontype = newActTyp } //交易金额1赋值 基础信息中金额 if(this.model.recgrp.vrf.tc1amt!= undefined){ if(!this.model.recgrp.vrf.tc1amt||this.model.recgrp.vrf.tc1amt == '0'||this.model.recgrp.vrf.tc1amt == ''){ this.model.recgrp.vrf.tc1amt = this.model.recgrp.bas.txamt } } //获取合同号 发票号 联系人 联系电话 let creuserpara = { custcod: this.model.recgrp.bas.custcod, idcode: this.model.recgrp.bas.idcode, sptinr: this.model.businessInr, dblinr: this.model.ctlmod.dbl.inr, } let crertnmsg = await Api.post(`/report/bopnew/public/getBopCrtuser`, creuserpara) if (crertnmsg.respCode === SUCCESS) { if (this.model.recgrp.vrf.crtuser!= undefined && this.model.recgrp.vrf.crtuser == '') { this.model.recgrp.vrf.crtuser = crertnmsg.data.crtuser || ''; } if (this.model.recgrp.vrf.inptelc!= undefined && this.model.recgrp.vrf.inptelc == '') { this.model.recgrp.vrf.inptelc = crertnmsg.data.inptelc || ''; } if (this.model.recgrp.vrf.contrno!= undefined && this.model.recgrp.vrf.contrno == '') { this.model.recgrp.vrf.contrno = crertnmsg.data.contrno || ''; } if (this.model.recgrp.vrf.invoino!= undefined && this.model.recgrp.vrf.invoino == '') { this.model.recgrp.vrf.invoino = crertnmsg.data.invoino || ''; } if (this.model.recgrp.vrf.txcode!= undefined && this.model.recgrp.vrf.txcode == '') { this.model.recgrp.vrf.txcode = crertnmsg.data.codext || ''; } } } else { //还原数据 if (this.model.recgrp.vrf.inr) { let parameters = { recgrp: { vrf: { inr: this.model.recgrp.vrf.inr, } } } let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/loadDataVrf`, parameters) if (rtnmsg.respCode === SUCCESS) { Utils.copyValueFromVoData(this.model.recgrp.vrf, rtnmsg.data); } } this.model.recgrp.vrf.actiontype = this.model.mtabut.oldvrfact } }, paydatChange() { if (!this.model.mtabut.paydat) { return } if (moment(this.model.mtabut.paydat).diff(moment().format("YYYY-MM-DD"), 'days') > 0) { this.model.mtabut.paydat = moment().format('yyyy-MM-DD') this.$notify({ title: '提示', type: 'warning', message: '收付汇日期不可超过系统日期' }) return } let datnam = 'rptno' let transName = this.root.trnName if (!transName.endsWith("ame") && !transName.endsWith("add") && !transName.endsWith("reb")) { return } this.model.recgrp.bas[datnam] = "" let traNam = transName.substring(0, 3) if (transName.endsWith("add") && ("dbb" == traNam || 'dbc' == traNam)) { // this.model.recgrp.dcl.rptdate = this.model.mtabut.paydat } if (transName.endsWith("add") && ('dbb' == traNam || 'dbc' == traNam || 'dbe' == traNam || 'dbf' == traNam)) { // this.model.recgrp.vrf.rptdate = this.model.mtabut.paydat } }, ownextkeyChange() { if (this.model.recgrp.dcl && this.model.recgrp.dcl.hasOwnProperty("ownextkey")) { this.model.recgrp.dcl.ownextkey = this.model.recgrp.bas.ownextkey } if (this.model.recgrp.vrf && this.model.recgrp.vrf.hasOwnProperty("ownextkey")) { this.model.recgrp.vrf.ownextkey = this.model.recgrp.bas.ownextkey } this.model.recgrp.bas.rptno = "" }, jwjnChange() { this.model.recgrp.bas.oppuser = this.model.recp.baspp.jwjn; }, custypeChange() { this.model.recgrp.bas.rptno = "" if ("D" == this.model.recgrp.bas.custype || "F" == this.model.recgrp.bas.custype) { this.model.recgrp.bas.custcod = "" } else if ("C" == this.model.recgrp.bas.custype) { this.model.recgrp.bas.idcode = "" } }, async getNewDblState(actionType, oldState, transType) { let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType, oldState, transType }) return rtnmsg }, //预览 printview() { let printparams = { printflg: "0", partflg: "0", }; this.$refs.msgView.bopPdfView(printparams) }, //打印 print() { let printparams = { printflg: "1", partflg: "0", }; this.$refs.msgView.bopPdfPrint(printparams) }, //部分打印 halfprint() { let printparams = { printflg: "1", partflg: "1", }; this.$refs.msgView.bopPdfPrint(printparams) }, //获取试点行标志 N-非试点 Y-试点 async initPilotBchBop() { let params = { ownextkey: "", }; let rtnmsg = await Api.post(`/${this.moduleRouter()}/bopcalcom/pilotbopbch`, params); if (rtnmsg.respCode == SUCCESS) { this.model.enableflg = rtnmsg.data; } }, //获取码表 async getdbCode(codeType, uil, codeNam) { let params = { codeType: codeType, uil: uil ? uil : 'EN' } let rtnmsg = await Api.post("/manager/dic/listDicInfo", params) if (rtnmsg.respCode === SUCCESS) { let curList = rtnmsg.data.map(item => ({ value: item.codeValue, label: item.codeName })); this.dbCodes[codeNam] = curList } }, //获取码值 getCodelabel(value, codenam) { const codeobj = this.dbCodes[codenam].find(obj => obj.value === value) return codeobj ? codeobj.label : value; }, async exportExcel() { let reclst = this.model.reclst; if (reclst.length > 0) { let pre = this.root.trnName.substring(0, 3); let typnam = ""; let indexnum = []; let floatnum = []; switch (pre) { case "dba": typnam = "涉外收入申报单"; indexnum = [16, 18, 20, 22, 27, 29, 36, 39]; floatnum = [17] break; case "dbb": typnam = "境外汇款申请书" indexnum = [16, 18, 20, 22, 31, 34]; floatnum = [17] break case "dbc": typnam = "对外付款承兑通知书" indexnum = [16, 18, 20, 22, 27, 29, 38, 41]; floatnum = [17] break case "dbd": typnam = "境内收入申报单" indexnum = [16, 18, 20, 22, 27, 34, 37]; floatnum = [17] break case "dbe": typnam = "境内汇款申请书" indexnum = [16, 18, 20, 22, 34, 37]; floatnum = [17] break case "dbf": typnam = "境内付款承兑通知书" indexnum = [16, 18, 20, 22, 27, 29, 40, 43]; floatnum = [17] break } const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/exportExcel`, this.model.argmod); if (rtnmsg.respCode == SUCCESS) { rtnmsg.data.forEach((arr, index) => { if (index == 0) return for (let a = 0; a < arr.length; a++) { //金额格式化 if (indexnum.includes(a)) { let num = parseInt(arr[a]) if (isNaN(num)) num = 0 arr[a] = { v: num, t: 'n', z: '#0' } // let num = parseFloat(arr[a]) // if (isNaN(num)) num = 0 // arr[a] = { // v: num, // t: 'n', // z: '#,##0.00' // } } //利率格式化 if (floatnum.includes(a)) { let num = parseInt(arr[a]) if (isNaN(num)) num = 0 arr[a] = { v: num, t: 'n', z: '#0' } // let num = parseFloat(arr[a]) // if (isNaN(num)) num = 0 // arr[a] = { // v: num, // t: 'n', // z: '#,##0.00000000' // } } } }) let name = moment(new Date()).format('yyyy-MM-DD HH:mm:ss'); Utils.exportToExcel(rtnmsg.data, typnam + "_" + name + ".xlsx", typnam); this.$notify({ title: '成功', type: 'success', message: '数据导出成功' }) let res = await Api.post('/report/bopnew/public/saveTrnLog', {fileName:typnam + "_" + name + ".xlsx",trnName:this.root.trnName}); if (res.respCode === SUCCESS) { console.log("导出日志保存成功"); } } return; } else { this.$notify({ title: '提示', type: 'warning', message: '没有可以导出的数据' }) return; } }, async chkbop() { if(this.multipleSelection.length>0){ let boplst = this.multipleSelection.map(inr => { return { recgrp: { bas: { inr } } } }); let params = { boList: boplst, trnName: this.root.trnName, }; const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/checkbop`, params); if (rtnmsg.respCode == SUCCESS) { if (rtnmsg.data.warningMsg) { this.$msgbox({ title: "警告", message: rtnmsg.data.warningMsg, type: "warning" }) } else { this.$msgbox({ title: "检验日志", message: rtnmsg.data.message, type: "success" }) } } else { this.$msgbox({ title: "错误", message: rtnmsg.respMsg, type: "error" }) } this.query(); }else{ this.$notify({ title: '提示', type: 'warning', message: '请选中再检核' }) } }, async piliangchexiao(){ if(this.multipleSelection.length>0){ this.$confirm("是否确认进行撤销?", "提示", { confirmButtonText: "是", cancelButtonText: "否", type: "warning" }).then(async() => { let params={ basInrs: this.multipleSelection, trnName: this.root.trnName, }; const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/delall`, params); if (rtnmsg.respCode == SUCCESS) { this.$notify({ title: '成功', type: 'success', message: '撤销成功' }) this.query(); } // this.multipleSelection=[]; this.$refs.table.clearSelection(); }).catch((e)=>{ console.log(e) }); }else{ this.$notify({ title: '提示', type: 'warning', message: '请选中再撤销' }) } }, chongzhi(){ this.model.argmod={ extinfbop: "", // 业务号码 .recp.argmod.extinfbop rptno: "", // 申报号码 .recp.argmod.rptno datsrc: "", // 数据来源 .recp.argmod.datsrc txccy: "", // 收付汇币种 .recp.argmod.txccy branch: "", // 机构号 .recp.argmod.branch bchcod: "", // 金融机构标识码 .recp.argmod.bchcod custcod: "", // 组织机构代码 .recp.argmod.custcod selsta: "", // 数据状态 .recp.argmod.selsta ywcredat: moment().subtract(1,"days").format("YYYY-MM-DD"), // 业务开始日期 .recp.argmod.ywcredat ywtildat: moment().format("YYYY-MM-DD"), // 业务结束日期 .recp.argmod.ywtildat selectdat: "A", // 日期类型 .recp.argmod.selectdat usr: "", // 员工号 .recp.argmod.usr bchinr: "", // 导入所属机构 .recp.argmod.bchinr impdat: "", // 导入申报日期 .recp.argmod.impdat custnm: "", // 申报主体名称 .recp.argmod.custnm } }, selectableFn(row) { return true; }, // 表格多选 async handleSelectionChange(val) { this.multipleSelection = val.map((item) => { return item.inr }) }, initsel(){ this.model.argmod.ywcredat=moment().subtract(1,"days").format("YYYY-MM-DD"); this.model.argmod.ywtildat=moment().format("YYYY-MM-DD"); this.model.argmod.selectdat='A'; }, // pageSize改变 handleSizeChange(val) { console.log(`每页 ${val} 条`); this.pagination.pageNum = 1; this.pagination.pageSize = val; this.query(); }, // 页码改变 handleCurrentChange(val) { console.log(`当前页: ${val}`); this.pagination.pageNum = val; this.query(); }, async reb(stabas,stadcl,stavrf,actiontype,inr){ this.$confirm('“历史数据重建”交易用于对外汇局已转入历史库的数据进行修改或删除,在操作此交易前,请首先确认您需要修改或删除的数据在外汇局当前数据库中已不存在。是否确认?', '提示', { confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" }).then(async() => { if(stabas=='X'||stadcl=='X'||stavrf=='X'){ this.$msgbox({ title: "提示", message: '该数据记录已经生成报文请等待反馈再进行修改操作', type: "warning" }) return; } if(stabas=='G'||stadcl=='G'){ this.$msgbox({ title: "提示", message: '该数据记录已撤销,不能进行修改操作', type: "warning" }) return; } let xmlsta=stabas; if(this.root.trnName.toLowerCase().startsWith('u')){ xmlsta=stadcl; } let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType: actiontype, oldState: xmlsta, transType: 'REB' }) if (rtnmsg.respCode === SUCCESS) { let newState = rtnmsg.data; if(!newState){ this.$msgbox({ title: "错误", message: '无法获取到新的数据状态!', type: "error" }) return; } if(newState.startsWith("!")){ this.$msgbox({ title: "提示", message: '该记录目前状态无法执行任何操作!', type: "warning" }) return; } this.go(this.root.trnName.substring(0,3)+'reb',{'inr':inr}) } }); }, async del(stabas,stadcl,stavrf,actiontype,inr){ if(stabas=='X'||stadcl=='X'||stavrf=='X'){ this.$msgbox({ title: "提示", message: '该数据记录已经生成报文请等待反馈再进行删除操作', type: "warning" }) return; } if(stabas=='G'||stadcl=='G'){ this.$msgbox({ title: "提示", message: '该数据记录已经丢弃,不能进行删除操作', type: "warning" }) return; } let xmlsta=stabas; if(this.root.trnName.toLowerCase().startsWith('u')){ xmlsta=stadcl; } let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType: actiontype, oldState: xmlsta, transType: 'DEL' }) if (rtnmsg.respCode === SUCCESS) { let newState = rtnmsg.data; if(!newState){ this.$msgbox({ title: "错误", message: '无法获取到新的数据状态!', type: "error" }) return; } if(newState.startsWith("!")){ this.$msgbox({ title: "提示", message: '该记录无法进行报送删除操作!', type: "warning" }) return; } this.go(this.root.trnName.substring(0,3)+'del',{'inr':inr}) } }, async ame(stabas,stadcl,stavrf,actiontype,inr){ if(stabas=='X'||stadcl=='X'||stavrf=='X'){ this.$msgbox({ title: "提示", message: '该数据记录已经生成报文请等待反馈再进行修改操作', type: "warning" }) return; } if(stabas=='G'||stadcl=='G'){ this.$msgbox({ title: "提示", message: '该数据记录已撤销,不能进行修改操作', type: "warning" }) return; } let xmlsta=stabas; if(this.root.trnName.toLowerCase().startsWith('u')){ xmlsta=stadcl; } let rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/getNewDblState`, { actionType: actiontype, oldState: xmlsta, transType: 'AME' }) if (rtnmsg.respCode === SUCCESS) { let newState = rtnmsg.data; if(!newState){ this.$msgbox({ title: "错误", message: '无法获取到新的数据状态!', type: "error" }) return; } if(newState.startsWith("!")){ this.$msgbox({ title: "提示", message: '该记录目前状态无法执行任何操作!', type: "warning" }) return; } this.go(this.root.trnName.substring(0,3)+'ame',{'inr':inr}) } }, exit(){ this.$store.commit('delTagsArry', this.$route.path) this.$router.back() }, getdatelimit(){ return 100; }, selbop(){ let ywcredat=this.model.argmod.ywcredat; let ywtildat=this.model.argmod.ywtildat; if(!ywcredat){ this.$notify({ title: '错误', type: 'error', message: '起始日期不能为空!' }) return false; } if(!ywtildat){ this.$notify({ title: '错误', type: 'error', message: '结束日期不能为空!' }) return false; } var ywd=moment(ywtildat).diff(moment(ywcredat),"days"); var days=this.getdatelimit() if(ywd>days){ this.$notify({ title: '错误', type: 'error', message: '时间跨度不能超过'+ days+'天'}) return false; } return true; }, async initEnableflg(){ let rtnmsg = await Api.post(`/report/bopnew/public/getUserOrgBranch`); if (rtnmsg.respCode === SUCCESS) { if(rtnmsg.data=="1000"){ this.model.enableflg='N'; }else{ this.initPilotBchBop(); } } } }, computed: { refEnable() { if (!this.model.recgrp.bas.ownextkey) { return false } if (!this.model.recgrp.bas.custype) { return false } if (!this.model.mtabut.paydat) { return false } return true } } }