import Api from "~/service/Api" export default { async handleSearch() { if (this.activeTab === "bs") { if ((this.model.seaownref == '' || this.model.seaownref == null) && this.model.opndatfrom == null) { this.$notify.error({ title: '错误', message: '开立开始日期必输!' }); return; } if ((this.model.seaownref == '' || this.model.seaownref == null) && this.model.opndatto == null) { this.$notify.error({ title: '错误', message: '开立结束日期必输!' }); return; } if (this.model.opndatfrom != null && this.model.opndatto != null) { if (new Date(this.model.opndatfrom).getTime() > new Date(this.model.opndatto).getTime()) { this.$notify.error({ title: '错误', message: '开立开始日期应小于结束日期!' }); return } if (new Date(this.model.opndatto).getTime() - new Date(this.model.opndatfrom).getTime() > 365 * 24 * 60 * 60 * 1000 * 5) { this.$notify.error({ title: '错误', message: '开立时间跨度不应超过5年!' }); return } } if (this.model.hndtyps == null || this.model.hndtyps.length == 0) { this.model.hndtyps = ["OL", "OC", "OT", ""]; } if (this.model.gidopentyps == null || this.model.gidopentyps.length == 0) { this.model.gidopentyps = ["GJBH", "GNBH", "HGBH"]; } this.load = true; this.model.branch = JSON.parse(sessionStorage.getItem('currentOrg')).departmentNumber this.model.searol = 'APL' let rtnmsg = await Api.post("/business/gitsel/listId", { ...this.model, pageNum: this.pagination.pageNum, pageSize: this.pagination.pageSize }); if (rtnmsg.respCode == SUCCESS) { this.load = false; this.tableData = rtnmsg.data.list || []; this.pagination = { pageNum: rtnmsg.data.pageNum || 1, pageSize: rtnmsg.data.pageSize || 10, total: rtnmsg.data.total }; } } else if (this.activeTab === "sp") { if ((this.model.claimownref == '' || this.model.claimownref == null) && this.model.claimdatfrom == null) { this.$notify.error({ title: '错误', message: '索赔开始日期必输!' }); return; } if ((this.model.claimownref == '' || this.model.claimownref == null) && this.model.claimdatto == null) { this.$notify.error({ title: '错误', message: '索赔结束日期必输!' }); return; } if (this.model.claimdatfrom != null && this.model.claimdatto != null) { if (new Date(this.model.claimdatfrom).getTime() > new Date(this.model.claimdatto).getTime()) { this.$notify.error({ title: '错误', message: '索赔开始日期应小于结束日期!' }); return } if (new Date(this.model.claimdatto).getTime() - new Date(this.model.claimdatfrom).getTime() > 365 * 24 * 60 * 60 * 1000 * 5) { this.$notify.error({ title: '错误', message: '索赔时间跨度不应超过5年!' }); return } } if (this.model.hndtyps == null || this.model.hndtyps.length == 0) { this.model.hndtyps = ["OL", "OC", "OT", ""]; } if (this.model.gidopentyps == null || this.model.gidopentyps.length == 0) { this.model.gidopentyps = ["GJBH", "GNBH", "HGBH"]; } this.load = true; this.model.branch = JSON.parse(sessionStorage.getItem('currentOrg')).departmentNumber this.model.searol = 'APL' let rtnmsg = await Api.post("/business/gitsel/listGcd", { ...this.model, pageNum: this.spPagination.pageNum, pageSize: this.spPagination.pageSize }); if (rtnmsg.respCode == SUCCESS) { this.load = false; this.spTableData = rtnmsg.data.list || []; this.spPagination = { pageNum: rtnmsg.data.pageNum || 1, pageSize: rtnmsg.data.pageSize || 5, total: rtnmsg.data.total }; } } }, async handleReset() { this.model.seaownref = "" this.model.opndatfrom = new Date(); this.model.opndatto = new Date(); this.isGuarantee = ""; this.model.nam = ""; this.model.ptyExtkey = ""; this.model.seapty = ""; this.model.searef = ""; this.model.ptyNam = ""; this.model.searol = ""; this.model.usrExtkey = ""; this.model.seasta = ""; this.model.seacur = ""; this.model.seaamtfr = ""; this.model.seaamtto = ""; this.model.seagtyp = ""; this.model.relflg = ""; this.model.hndtyp = ""; this.model.cxmflg = ""; this.model.seapurpos = ""; this.model.seahndtyp = ""; this.model.segtyp = ""; this.model.fromflg = ""; this.model.fenlishi = ""; this.model.cmtflg = ""; this.model.fingua = ""; }, async claimInfo(inr, opentyp) { let params = { gidinr: inr, opentyp } let rtnmsg = await Api.post("/business/gitsel/listCd", params); if (rtnmsg.respCode == SUCCESS) { const data = rtnmsg.data.list || []; const pagination = { pageNum: rtnmsg.data.pageNum || 1, pageSize: rtnmsg.data.pageSize || 5, total: rtnmsg.data.total }; return { data, pagination } } }, formSubmit() { this.handleSearch(); }, // pageSize改变 handleSizeChange(val) { this.pagination.pageNum = 1; this.pagination.pageSize = val; this.formSubmit(); }, async currentChange(num) { this.pagination.pageNum = num; this.formSubmit(); }, // pageSize改变 sphandleSizeChange(val) { this.spPagination.pageNum = 1; this.spPagination.pageSize = val; this.formSubmit(); }, async spcurrentChange(num) { this.spPagination.pageNum = num; this.formSubmit(); }, columnSetting(cols) { this.showDig = false; this.digColumns = []; this.columnGroup = []; this.selectAll = false; // 点击自定义按钮 this.digColumns = cols; this.showDig = true; this.columnGroup = cols.filter(item => item.isShow).map(it => it.label); this.selectAll = cols.length === this.columnGroup.length; }, async handleColumnChange() { this.selectAll = this.digColumns.length === this.columnGroup.length; }, setAll(val) { this.columnGroup = val ? this.digColumns.map(item => item.label) : []; }, saveColumnEvent() { // 保存 const list = []; this.digColumns.forEach(item => { if (!this.columnGroup.includes(item.label)) { list.push({ ...item, isShow: false }); } else { list.push({ ...item, isShow: true }); } }); if (this.activeTab === "bs") { this.tableColumns = list; } else { this.spDefaultColumns = list; } this.showDig = false; }, //保函开立跳转 toGitpop() { this.routerPush("/business/gitpop"); }, toGitopn() { this.routerPush("/business/gitopn"); }, toGetopn() { this.routerPush("/business/getopn"); }, buttonClick(key) { let orInr = this.handleModel.inr || this.handleModel.inr; let name = key.toUpperCase().substring(0, 1) + key.toLowerCase().substring(1); this.routerPush({ name, query: { orInr } }); this.handleVisible = false }, async TableDblRow(row) { this.getButtons(row, 'getGitselTrnCode') }, async TableSpDblRow(row) { this.getButtons(row, 'getGcdTrnCode') }, async handleClick() { if (this.selectedModel.inr) { if (this.activeTab == 'sp') { this.spload = true; const { data = [], pagination = {} } = await this.claimInfo(this.selectedModel.inr, this.selectedModel.opentyp); this.spTableData = data; this.spPagination = pagination; this.spload = false; } } else { this.handleSearch(); } }, async getButtons(row, queryCode) { this.handleModel = row; this.buttonsList = []; this.handleVisible = true; this.queryCode = queryCode; this.branch = JSON.parse( sessionStorage.getItem("currentOrg") ).departmentNumber; }, async onChoose(code, row) { //跳转交易 // if ("gitame|gitpam|nitame|nitpam".indexOf(code) > 0 && row.clsgcdcnt > 0) { // console.log("进入") // this.$confirm('该笔交易存在未结清索赔,确定继续?', '提示', { // confirmButtonText: '确定', // cancelButtonText: '取消', // type: 'warning', // }).then(() => { // this.routerPush({ // path: "/business/" + code, // query: { inr: row.inr, gidinr: row.gidinr } // }) // }) // this.handleVisible = false; // } else { let apiCode = '' if('GJBH|GNBH|HGBH'.includes(row.opentyp)){ apiCode = 'getGitselTrnCode' }else { apiCode = 'getGcdTrnCode' } let res = await Api.post("/business/gitsel/" + apiCode, row) if(res.respCode == SUCCESS){ const length = res.data.length let btnStr = res.data; for (let i = 0; i < length; i++) { let arr = btnStr[i].split("|"); if(arr[0] == code.toUpperCase() && arr[1] == 'N'){ this.$notify.error({ title: '错误', message: arr[2] }); this.handleVisible = false; return } } } let gcdinr = ""; let gidinr = ""; let gidtyp = ""; let gcdtyp = ""; if (code.startsWith("n")) { gidtyp = "NID"; gcdtyp = "NCD"; } else { gidtyp = "GID"; gcdtyp = "GCD"; } if (row.gidinr) { gidinr = row.gidinr gcdinr = row.inr } else { gidinr = row.inr } let rtnmsg = await Api.post("/business/lock/isAccessible", { objInr: gidinr, objType: gidtyp, trnName: code.toUpperCase() }) if (rtnmsg.respCode != SUCCESS) { let msg = '该笔保函数据已被锁定!' if (rtnmsg.data && rtnmsg.data.usrId) { msg = this.convertLockMsg(rtnmsg,msg) } this.handleVisible = false; this.$notify.error({ title: '错误', message: msg }); return } if (gcdinr) { rtnmsg = await Api.post("/business/lock/isAccessible", { objInr: gcdinr, objType: gcdtyp, trnName: code.toUpperCase() }) if (rtnmsg.respCode != SUCCESS) { let msg = '该笔保函索赔数据已被锁定!' if (rtnmsg.data && rtnmsg.data.usrId) { msg = this.convertLockMsg(rtnmsg,msg) } this.handleVisible = false; this.$notify.error({ title: '错误', message: msg }); return } } let sptData = [] if (gidinr) { let rtnmsg = await Api.post("/business/lock/checkPending", { objinr: gidinr, objtyp: gidtyp, transName: code.toUpperCase() }) if (rtnmsg.data) { if (rtnmsg.data.penSptList && rtnmsg.data.penSptList.length) { //依次提示 sptData = [...sptData, ...rtnmsg.data.penSptList] } if (rtnmsg.data.ameSptList && rtnmsg.data.ameSptList.length) { sptData = [...sptData, ...rtnmsg.data.ameSptList] } if (rtnmsg.data.canSptList && rtnmsg.data.canSptList.length) { sptData = [...sptData, ...rtnmsg.data.canSptList] } } } if (gcdinr) { let rtnmsg = await Api.post("/business/lock/checkPending", { objinr: gcdinr, objtyp: gcdtyp, transName: code.toUpperCase() }) if (rtnmsg.data) { if (rtnmsg.data.penSptList && rtnmsg.data.penSptList.length) { //依次提示 sptData = [...sptData, ...rtnmsg.data.penSptList] } if (rtnmsg.data.ameSptList && rtnmsg.data.ameSptList.length) { sptData = [...sptData, ...rtnmsg.data.ameSptList] } if (rtnmsg.data.canSptList && rtnmsg.data.canSptList.length) { sptData = [...sptData, ...rtnmsg.data.canSptList] } } } //去重 let tempObj = {} sptData = sptData.filter(spt => { if (tempObj[spt.inr]) { return false } else { tempObj[spt.inr] = 'X' return true } }) if (sptData.length) { this.dealSptData = sptData this.sptVisible = true this.handleVisible = false //传递一个临时跳转函数 this.$goRoute = () => { this.sptVisible = false this.routerPush({ path: "/business/" + code, query: { inr: row.inr, gidinr: row.gidinr } }); this.$goRoute = null; } return } this.routerPush({ path: "/business/" + code, query: { inr: row.inr, gidinr: row.gidinr } }); this.handleVisible = false; // } }, 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 } }, async getInitButtons() { // let rtnmsg = await Api.post( // "/business/gitsel/getInitButtons", // this.model // ); //新建模拟数据 let rtnmsg = {respCode:SUCCESS,data:['NITOPN','GITOPN','HITOPN']} if (rtnmsg.respCode == SUCCESS) { const length = rtnmsg.data.length; let btnStr = rtnmsg.data; for (let i = 0; i < length; i++) { if (btnStr[i].substr(0, 1) == "G") { this.gopnCode = btnStr[i].toLowerCase(); } else if (btnStr[i].substr(0, 1) == "N") { this.nopnCode = btnStr[i].toLowerCase(); } else if (btnStr[i].substr(0, 1) == "H") { this.hopnCode = btnStr[i].toLowerCase(); } } } }, handleReset: function () { this.model = { instNo: "", instName: "" }; }, async showDisplayDialog(row) { let res = await Api.post("/manager/trn/queryByOwnref", { ownref: row.ownref }); if (res.respCode == SUCCESS) { if (res.data.list.length === 1) { if (this.oldinr && this.$refs[`popover-${this.oldinr}`]) { this.$refs[`popover-${this.oldinr}`].showPopper = false } this.goDisplay(res.data.list[0]) } else { if (this.oldinr && this.$refs[`popover-${this.oldinr}`]) { this.$refs[`popover-${this.oldinr}`].showPopper = false } this.oldinr = row.inr this.$refs[`popover-${row.inr}`].showPopper = true this.infoTableData = res.data.list } } }, closeDisplayDialog() { if (this.oldinr && this.$refs[`popover-${this.oldinr}`]) { this.$refs[`popover-${this.oldinr}`].showPopper = false } }, handleCloseInfo(row) { this.$refs[`popover-${row.inr}`].showPopper = false }, goDisplay(row) { if (this.oldinr && this.$refs[`popover-${this.oldinr}`]) { this.$refs[`popover-${this.oldinr}`].showPopper = false } // 历史快照 if (row.inr.length == 8) { this.routerPush({ path: '/business/HistoryRecord', query: { businessInr: row.inr, businessType: 'TRN', type:'view' } }) } else if (row.inr.length == 16) { this.routerPush({ path: `/display/${row.inifrm.toLowerCase()}`, query: { businessInr: row.inr, businessType: 'TRN' } }); } }, // goDisplay(row) { // this.$refs[`popover-${row.objinr}`].showPopper = false // this.routerPush({ // path: `/display/${row.inifrm.toLowerCase()}`, // query: { // businessInr: row.inr, // businessType: 'TRN' // } // }); // }, toDetailOth(row) { if (row.opentyp == "GCBH") { this.routerPush({ path: "/business/gcdinf", query: { row: row } }); } else { this.routerPush({ path: "/business/ncdinf", query: { row: row } }); } }, clickInfo(row) { // if (row.opentyp == "GJBH") { this.routerPush({ path: "/business/gidinf", query: { inr: row.inr, opentyp: row.opentyp, hndtyp: row.hndtyp, inifrm: row.opnfrm } }); // } else { // this.routerPush({ // path: "/business/nidinf", // query: { inr: row.inr,opentyp: row.opentyp } // }); // } }, clearOpnCode() { this.gopnCode = ""; this.nopnCode = ""; this.hopnCode = ""; }, toOpn(code) { if (code) { this.routerPush(`/business/` + code) // this.routerPush(`/business/` + code); } }, codFormat(value, codlst) { const codeobj = codlst.filter(item => item.codevalue === value ); return codeobj ? codeobj.label : value; }, TableRowClick(row) { this.selectedModel = row }, }