CommonEvent.js 26.2 KB
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 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
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
    }
  }
}