import Api from "~/service/Api" import commonFunctions from '~/mixin/commonFunctions.js'; import moment from 'moment' import Utils from "~/utils" export default { mixins: [commonFunctions], methods: { async handleSearch() { if (this.model.opndatfrom == null) { this.$notify.error({ title: '错误', message: '查询开始日期必输!' }); return; } if (this.model.opndatto == null) { this.$notify.error({ title: '错误', message: '查询结束日期必输!' }); return; } if(this.model.searol != '' && (this.model.ptyExtkey == '' && this.model.seapty == '') ){ this.$notify.error({ title: '错误', message: '选择ROLE时请先输入Select Single Party或者Party Name/BIC!' }); return } if(this.model.seacur == '' && (this.model.seaamtfr > 0 || this.model.seaamtto > 0)){ this.$notify.error({ title: '错误', message: '输入金额前请先选择币种!' }); return } if(new Date(this.model.opndatfrom).getTime() > new Date(this.model.opndatto).getTime()){ this.$notify.error({ title: '错误', message: '开始日期应小于结束日期!' }); return } console.log('seasta:', this.model.seasta) console.log('isauthorize:', this.model.isauthorize) if(this.model.seasta != '' && this.model.isauthorize == ''){ this.$notify.error({ title: '错误', message: '选择状态时请先选择是否已授权!' }); return } const loading = this.loading(); this.model.branch = JSON.parse(sessionStorage.getItem('currentOrg')).departmentNumber let rtnmsg = await Api.post("/business/infnid/querynid", { ...this.model, pageNum: this.pagination.pageNum, pageSize: this.pagination.pageSize }); if (rtnmsg.respCode == SUCCESS) { this.tableData = rtnmsg.data.list || []; this.pagination = { pageNum: rtnmsg.data.pageNum || 1, pageSize: rtnmsg.data.pageSize || 10, total: rtnmsg.data.total }; } loading.close(); }, //导出excel async exportExcel(){ const loading = this.loading(); this.model.branch = JSON.parse(sessionStorage.getItem('currentOrg')).departmentNumber let res = await Api.post("/business/infnid/exportExcel",{ ...this.model,}); if (res.respCode == SUCCESS) { let name=moment(new Date()).format('yyyy-MM-DD HH:mm:ss') ; Utils.exportToExcel (res.data, "国内保函查询"+name+".xlsx", "国内保函查询") ; } loading.close(); }, 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 = ""; this.model.isGuarantee = ""; this.ptyExtkeyChange(); this.seaptyChange(); }, 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.model.dbCodes[codeNam] = curList } }, getCodelabel(value,codenam) { const codeobj = this.model.dbCodes[codenam].find(obj => obj.value === value) return codeobj ? codeobj.label : value; }, chgFingua(){ if(this.model.fingua == 'Y'){ this.isOnShow = true }else if(this.model.fingua == 'N'){ this.isOnShow = false } }, async claimInfo(inr) { let params = { nidinr: inr } let rtnmsg = await Api.post("/business/infnid/queryNcdByNidinr", params); if (rtnmsg.respCode == SUCCESS) { const data = rtnmsg.data.list || []; const pagination = { pageNum: rtnmsg.data.pageNum || 1, pageSize: rtnmsg.data.pageSize || 10, total: rtnmsg.data.total }; return { data, pagination } } } } }