index.js 17.6 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import Utils from "~/utils"
import moment from 'moment'
export default {
	mixins: [commonFunctions],
	methods: {
    isHeadCenter(){
      let roleName = JSON.parse(window.sessionStorage.curRole).name;
      let roleId=JSON.parse(window.sessionStorage.curRole).id;
      if ("-单证中心-总行业务管理员-".indexOf(roleName)>0 || roleName==="押汇中心经办" ||roleName==="押汇中心复核"){
              return true;
      }
       if ("-10253-10255-10256-10245-".indexOf(roleId)>0 ){
              return true;
      }
      return false;
    },
		//重置
		handleReset() {
			this.model.bchcon = '';
			this.model.trncorco.ownref = '';
            this.model.usrcon = '';
            this.model.relflg = [];
            this.model.minamt='';
            this.model.maxamt='';
			this.model.atp.cod = '';
			this.model.trncorco.dflg = [];
			this.model.atptxt = '';
      this.model.searchAllUsers = false;
      this.model.codeLev = "01";
      this.sortObj={};
		},
		// 机构列表
		async getBranchList() {
			const loading = this.loading();
			let res = await Api.post('/public/quesel/getActBranchList');
			if (res.respCode == SUCCESS) {
				this.bchtypList = res.data.list;
			}
			loading.close();
		},

		//经办柜员列表
		async getUserList() {
      const loading = this.loading();
      let param={};
      if(this.model.bchcon){
        param.bchcon=this.model.bchcon
      }
      let res = await Api.post("/public/quesel/getActUserList",param);
      if (res.respCode == SUCCESS) {
        this.userList = res.data.list;
      }
      loading.close();
    },
    
    sortChange(obj) {
      let order = "";
      let prop = "";
      let column = "";
      if(obj && obj.order){
        order=obj.order === 'descending' ? 'desc' : 'asc';
        prop=obj.prop;
      }
      let rolebool=this.isHeadCenter();
      if(rolebool){
        switch (prop) {
          case 'inifrm':
            column = "q.frm";
            break;
          case 'inifrmName':
            column = "q.frm";
            break;
          case 'ownref':
            column = "q.objref";
            break;
          case 'relflgName':
            column = "dealRelflg";
            break;
          case 'reloricur':
            column = "q.relcur";
            break;
          case 'reloriamt':
            column = "q.relamt";
            break;
          case 'inidattim':
            column = "q.tardattim";
            break;
          case 'iniusr':
            column = "q.usrcon";
            break;
          case 'relusr3':
              column = "q.usr";
              break;
          case 'objnam':
            column = "q.objnam";
            break;
          case 'bchname':
            column = "q.bchkeyinr";
            break;
          case 'relreqCom':
            column = "relreqCom";
            break;
          case 'relresCom':
            column = "relresCom";
            break;
        }
      }else{
        switch (prop) {
          case 'inifrm':
            column = "t.inifrm";
            break;
          case 'inifrmName':
            column = "stb.txt";
            break;
          case 'ownref':
            column = "t.ownref";
            break;
          case 'relflgName':
            column = "t.relflg";
            break;
          case 'reloricur':
            column = "t.reloricur";
            break;
          case 'reloriamt':
            column = "t.reloriamt";
            break;
          case 'inidattim':
            column = "t.inidattim";
            break;
          case 'iniusr':
            column = "t.iniusr";
            break;
          case 'relusr3':
              column = "t.relusr3";
              break;
          case 'objnam':
            column = "t.objnam";
            break;
          case 'bchname':
            column = "t.bchkeyinr";
            break;
          case 'relreqCom':
            column = "relreqCom";
            break;
          case 'relresCom':
            column = "relresCom";
            break;
        }
      }
      let orderObj = {
        order: order,
        column: column
      }
      this.sortObj=orderObj;
			this.handleSearch(orderObj);
    },

    getTrninr(row){
        let trninr=row.objtyp==='TRN'?row.objinr:row.inr;
        if(row.creobjtyp==='TRN' && '-assigned-new-correct-pending-'.indexOf(row.status)>0){
          trninr=row.creobjinr;
      }
      return trninr;
    },

        selectableFn(row) {
            return true;
        },

        async handleSelectionChange(val) {
            this.multipleSelection = val.map((item) => {
                return item.inr
            })
            this.multipleSelectionObj = val.map((item) => {
                return item
            })
            this.multipleSelectionRow = val.map((item) => {
                return item
            })[0]
        },

        async reBackMethod() {
            if(this.multipleSelectionObj && this.multipleSelectionObj.length>10){
                this.$notify.error({title: '错误', message: '请勿批量选中业务行数超过10条!'});
                return;
            }
            this.$confirm('您确定批量退回选中的业务交易?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(async () => {
                this.batchflg = "Y";
                let array = this.multipleSelectionObj;
                for (let i = 0; i < array.length; i++) {
                    this.onReturn(i + 1, array[i]);
                }
            });
        },

    handleSearch(orderObj){
      if(this.searchModel==="OWN"){
         this.handleSearchOwn(orderObj);
      }else{
        this.handleSearchAll(orderObj);
      }
    },
		//查询列表
		async handleSearchOwn(orderObj) {
          this.model.tranType=["02"];
          this.searchLoading=true;
          this.searchModel="OWN";
			let inidatfro = this.model.trncorco.inidatfro;
			if (!inidatfro) {
				this.$notify.error({title: '错误', message: '查询开始日期必输!'});
                this.searchLoadingAll=false;
                this.searchLoading=false;
				return;
			}
			let inidattil = this.model.trncorco.inidattil;
			if (!inidattil) {
				this.$notify.error({title: '错误', message: '查询结束日期必输!'});
                this.searchLoadingAll=false;
                this.searchLoading=false;
				return;
			}
            if (Number(this.model.minamt)>Number(this.model.maxamt)) {
                this.$notify.error({title: '错误', message: '业务金额区间错误!'});
                return;
            }
    let params = {
        ownref: this.model.trncorco.ownref?this.model.trncorco.ownref.trim():this.model.trncorco.ownref,
        inidatfro: moment(inidatfro).format('YYYY-MM-DD') + ' 00:00:00',
        inidattil: moment(inidattil).format('YYYY-MM-DD') + ' 23:59:59',
        usrcon: this.model.usrcon,
        bchcon: this.model.bchcon,
        inifrm: this.model.atp.cod,
        minamt: this.model.minamt,
        maxamt: this.model.maxamt,
        bustypList: this.model.trncorco.dflg,
        relflgList: this.model.relflg,
        pageNum: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
        codeLev: this.model.codeLev,
        searchModel:this.searchModel,
      };
      if (orderObj) {
				params.orderStr = orderObj.order;
				params.columnStr = orderObj.column
      }
      if(this.roleTypeName==="单证中心" && this.model.tranTypeStr){
          params.tranTypeStr=this.model.tranTypeStr;
      }
      const loading = this.loading();
      let rolebool=this.isHeadCenter();
      if(rolebool){
        const res = await Api.post('/public/quesel/listIncomplete', params);
        if (res.respCode === SUCCESS) {
          this.stmData.data = res.data.list;
          this.pagination.total = Number(res.data.total);
        }
      }else{
        const res = await Api.post('/public/trnrel/getUnDataList', params);
        if (res.respCode === SUCCESS) {
          this.stmData.data = res.data.list;
          this.pagination.total = Number(res.data.total);
        }
      }
      this.searchLoading=false;
			loading.close();
    },

    async handleSearchAll(orderObj) {
      this.searchLoadingAll=true;
      this.searchModel="ALL";
        let inidatfro = this.model.trncorco.inidatfro;
        if (!inidatfro) {
            this.$notify.error({title: '错误', message: '查询开始日期必输!'});
            this.searchLoadingAll=false;
            this.searchLoading=false;
            return;
        }
        let inidattil = this.model.trncorco.inidattil;
        if (!inidattil) {
            this.$notify.error({title: '错误', message: '查询结束日期必输!'});
            this.searchLoadingAll=false;
            this.searchLoading=false;
            return;
        }
        if (Number(this.model.minamt)>Number(this.model.maxamt)) {
            this.$notify.error({title: '错误', message: '业务金额区间错误!'});
            return;
        }
        let params = {
            ownref: this.model.trncorco.ownref?this.model.trncorco.ownref.trim():this.model.trncorco.ownref,
            inidatfro: moment(inidatfro).format('YYYY-MM-DD') + ' 00:00:00',
            inidattil: moment(inidattil).format('YYYY-MM-DD') + ' 23:59:59',
            usrcon: this.model.usrcon,
            bchcon: this.model.bchcon,
            inifrm: this.model.atp.cod,
            minamt: this.model.minamt,
            maxamt: this.model.maxamt,
            bustypList: this.model.trncorco.dflg,
            relflgList: this.model.relflg,
            pageNum: this.pagination.pageIndex,
            pageSize: this.pagination.pageSize,
            codeLev: this.model.codeLev,
            searchModel:this.searchModel,
      };
      if (orderObj) {
				params.orderStr = orderObj.order;
				params.columnStr = orderObj.column
      }
      if(this.roleTypeName==="单证中心" && this.model.tranTypeStr){
          params.tranTypeStr=this.model.tranTypeStr;
      }
      const loading = this.loading();
      let rolebool=this.isHeadCenter();
      if(rolebool){
        const res = await Api.post('/public/quesel/listIncomplete', params);
        if (res.respCode === SUCCESS) {
          this.stmData.data = res.data.list;
          this.pagination.total = Number(res.data.total);
        }
      }else{
        const res = await Api.post('/public/trnrel/getUnDataList', params);
        if (res.respCode === SUCCESS) {
          this.stmData.data = res.data.list;
          this.pagination.total = Number(res.data.total);
        }
      }
      this.searchLoadingAll=false;
			loading.close();
    },

    handleToggleSearch: function () {
      this.searchToggle = !this.searchToggle
      this.$emit('search-toggle', this.searchToggle)
    },

    async exportExcel(){
      let inidatfro = this.model.trncorco.inidatfro;
			if (!inidatfro) {
				this.$notify.error({
					title: '错误',
					message: '查询开始日期必输!'
				});
				return;
			}
			let inidattil = this.model.trncorco.inidattil;
			if (!inidattil) {
				this.$notify.error({
					title: '错误',
					message: '查询结束日期必输!'
				});
				return;
      }
      const loading = this.loading();
      let params = {
                ownref: this.model.trncorco.ownref?this.model.trncorco.ownref.trim():this.model.trncorco.ownref,
				inidatfro: moment(inidatfro).format('YYYY-MM-DD') + ' 00:00:00',
				inidattil: moment(inidattil).format('YYYY-MM-DD') + ' 23:59:59',
				usrcon: this.model.usrcon,
				bchcon: this.model.bchcon,
				inifrm: this.model.atp.cod,
                minamt: this.model.minamt,
                maxamt: this.model.maxamt,
                bustypList: this.model.trncorco.dflg,
                relflgList: this.model.relflg,
				pageNum: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
        codeLev: this.model.codeLev,
        searchModel:this.searchModel,
      };
      let res ={};
      let rolebool=this.isHeadCenter();
      if(rolebool){
        res=await Api.post('/public/quesel/exportUnFinishExcel',params);
      }else{
        res=await Api.post('/public/trnrel/exportUnFinishExcel',params);
      }
      if (res.respCode == SUCCESS) {
        res.data.forEach((arr,index)=>{
          if(index == 0) return
          let num = parseFloat(arr[4])
          if(isNaN(num)) num = 0
          arr[4] = {
            v: num,
            t:'n',
            z:'#,##0.00'
          }
        })
        let name=moment(new Date()).format('yyyy-MM-DD HH:mm:ss') ;
        Utils.exportToExcel (res.data, "未完成列表_"+name+".xlsx", "未完成列表") ;
      }
      loading.close();
    },

		//交易代码
		async onSeainf() {
			this.dialogTitle = `交易列表`;
			this.dialogTableVisible = true;
			// 分层取值
			this.loadingFlag = true;
			this.tableList = [];
			this.currentPage = 1;
			this.pageSize = 10000;
			this.total = 0;
			// 获取table的表格数据
			let params = {
				cod: this.model.atp.cod,
				pageNo: this.currentPage,
				pageSize: this.pageSize
			};
			const res = await Api.post('/public/quesel/getFrameList', params);
			if (res.respCode === SUCCESS) {
				if (res.data && res.data.list) {
					this.total = res.data.total;
					res.data.list.forEach((item, i) => {
						item.index = i + 1;
					});
					this.tableList = res.data.list;
				}
			}
			this.loadingFlag = false; //接口调完变成false
		},

		currentChange(num) {
			this.currentPage = num;
			this.getTableData();
		},

		async dbClickRow(row, column, event) {
			// 此处为了回填数据时回调
			this.$emit('handleChange')
			// 回填数据
			this.model.atp.cod = row.cod;
			this.dialogTableVisible = false;
		},
		beforeClose(done) {
			this.dialogTableVisible = false;
			this.currentPage = 1;
			done();
    },
      async onReturnOne(ind,row){
          this.batchflg = "N";
          this.onReturn(ind, row);
      },
    

    async onReturn(ind, row) {
      //云平台退回
      //单证中心退回
      let objtyp=row.objtyp;
      let objinr=row.objinr;
      if(objtyp!=='TRN' && this.currentOrg!=='1000'){
          objtyp='TRN';
          objinr=row.inr;
      }
      let rtnmsg = await Api.post("/business/lock/getSptAccessible", { objInr: objinr, objType: objtyp, trnName: row.inifrm.toUpperCase() })
      if (rtnmsg.respCode===SUCCESS && rtnmsg.data && rtnmsg.data.usrId) {
        let msg = '该笔待办数据已被锁定!' + "锁定人为" + rtnmsg.data.usrId + ",锁定交易为[" + rtnmsg.data.trnLabel+"]"
        this.$notify.error({ title: '错误', message: msg });
        return
      }
      let trninr=this.getTrninr(row);
      if(row.relflg.indexOf("W")>=0 ){
            if (this.batchflg!=='Y') {
              this.$confirm('您确定退回该笔交易?', '提示', {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  type: 'warning',
              }).then(async () => {
                  let params = {
                      trninr: trninr,
                      remark: ''
                  }
                  let res = await Api.post("/public/trnrel/reprow", params);
                  if (res.respCode == SUCCESS) {
                      this.$notify({
                          title: '成功',
                          message: '退回成功',
                          type: 'success',
                      });
                      this.handleSearch();
                  } else {
                      this.$notify({title: "错误", message: res.respMsg, type: "error",});
                  }
              })
          }else{
                let params = {
                    trninr: trninr,
                    remark: ''
                }
                let res = await Api.post("/public/trnrel/reprow", params);
                if (res.respCode == SUCCESS) {
                    this.$notify({
                        title: '成功',
                        message: '退回成功',
                        type: 'success',
                    });
                    this.handleSearch();
                } else {
                    this.$notify({title: "错误", message: res.respMsg, type: "error",});
                }
            }
      }else{
          this.$notify({title: "错误",message: "请选择正确的数据退回!",type: "error",});
      }
    },
  

		//详情
		async onWaitDetail(idx, row) {
      let trninr=this.getTrninr(row);
      let res = await Api.post("/public/trnrel/getFinTrnInfo", {trninr:trninr});
			if (res.respCode == SUCCESS) {
        let inifrm=row.inifrm;
        if(res.data.finTrninr){
          trninr = res.data.finTrninr;
          inifrm = res.data.finInifrm;
        }
        this.routerPush({
          path: '/business/trnselDetail',
          query: {
            inr: trninr,
            inifrm: inifrm.toLocaleLowerCase(),
            businessType: row['objtyp']
          }
        });
      }
		},
		//快照
		async onHandle(idx, row) {
      let trninr=this.getTrninr(row);
      let res = await Api.post("/public/trnrel/getFinTrnInfo", {trninr:trninr});
			if (res.respCode == SUCCESS) {
        let inifrm=row.inifrm;
        if(res.data.finTrninr){
          trninr = res.data.finTrninr;
          inifrm = res.data.finInifrm;
        }
        inifrm=inifrm.toLocaleLowerCase();
        this.routerPush({
          path: `/review/review-${inifrm}`,
          query: {
            businessInr: trninr,
            businessType: "TRN",
            type: 'view'
          }
        });
      }
			
		},

		// pageSize改变
		handleSizeChange(val) {
			this.pagination.pageIndex = 1;
			this.pagination.pageSize = val;
			this.handleSearch(this.sortObj);
		},
		// 页码改变
		handleCurrentChange(val) {
			this.pagination.pageIndex = val;
			this.handleSearch(this.sortObj);
		},
	},
};