index.js 6.17 KB
Newer Older
WF1020 committed
1 2 3
import Api from '~/service/Api';
import { getTrnNameByInr } from "~/service/business/common";
import moment from 'moment';
yangxiaolei committed
4
import Utils from "~/utils"; 
WF1020 committed
5 6 7 8
export default {
  methods: {
    async handleSearch() {
      let opndatfrom = this.model.infcon.opndatfrom;
yangxiaolei committed
9 10
      
      if ((!opndatfrom || opndatfrom == '') && !this.$route.query.trn) {
WF1020 committed
11 12 13 14
        this.$notify.error({ title: '错误', message: '查询开始日期必输!' });
        return;
      }
      let opndatto = this.model.infcon.opndatto;
yangxiaolei committed
15
      if ((!opndatto || opndatto == '') && !this.$route.query.trn) {
WF1020 committed
16 17 18
        this.$notify.error({ title: '错误', message: '查询结束日期必输!' });
        return;
      }
yangxiaolei committed
19

WF1020 committed
20 21 22 23 24 25 26 27 28 29
      let params = {
        ...this.model.infcon,
        fenlishi: this.model.fenlishi,
        seapurpos: this.model.seapurpos,
        seagtyp: this.model.seagtyp,
        fromflg: this.model.fromflg,
        cmtflg: this.model.cmtflg,
        fingua: this.model.fingua,
        pageIndex: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
yangxiaolei committed
30 31
        opndatfrom:!opndatfrom ? null : moment(opndatfrom).format('YYYY-MM-DD'),
        opndatto:!opndatto ? null :moment(opndatto).format('YYYY-MM-DD'),
WF1020 committed
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
      };
      let rtnmsg = await Api.post('/service/inflid/getList', params);
      if (rtnmsg.respCode == SUCCESS) {
        this.stmData.data = [];
        this.stmData.data = rtnmsg.data.list;
        this.pagination.total = rtnmsg.data.total;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
    },
    async handleReset() {
      this.model.infcon.seaownref = '';
      this.model.infcon.opndatfrom = new Date();
      this.model.infcon.opndatto = new Date();
      this.isGuarantee = '';
      this.model.infcon.nam = '';
      this.model.infcon.pty.extkey = '';
      this.model.infcon.seapty = '';
      this.model.infcon.searef = '';
      this.model.infcon.pty.nam = '';
      this.model.infcon.searol = '';
      this.model.infcon.usr.extkey = '';
      this.model.infcon.seasta = '';
      this.model.infcon.seacur = '';
      this.model.infcon.seaamtfr = '';
      this.model.infcon.seaamtto = '';
      this.model.seagtyp = '';
      this.model.infcon.relflg = '';
      this.model.infcon.hndtyp = '';
      this.model.infcon.cxmflg = '';
      this.model.seapurpos = '';
      this.model.seahndtyp = '';
      this.model.infcon.segtyp = '';
      this.model.fromflg = '';
      this.model.fenlishi = '';
      this.model.cmtflg = '';
      this.model.fingua = '';
    },
    // pageSize改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagination.pageIndex = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.pageIndex = val;
      this.handleSearch();
    },
    toLitpop() {
      this.$router.history.push('/business/litpop');
    },
    toLitopn() {
      // 点击开立,清空从待经办进来的时候带的行参数
xionglin committed
88 89
      localStorage.setItem('row_litopn', null)
      localStorage.setItem('review_litopn',null)
WF1020 committed
90 91 92 93 94 95 96 97 98
      this.$router.history.push('/business-new/litopn');
    },
    toLetopn() {
      this.$router.history.push('/business-new/letopn');
    },
    // 详情
    async details(row) {
      const params = {
        //根据xx字段 查询详情表的数据
99 100
        inr:row.inr,
        userId: window.sessionStorage.userId || 'ZL',
WF1020 committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
        ownref: row.ownref,
      };
      const res = await Api.post('/service/inflid/getDetailByOwnref', params);
      if (res.respCode === SUCCESS) {
        this.trnData.data = res.data;
      }
    },
    // 关闭详情弹框
    closeDetailsDialog(refId) {
      this.$refs[refId].doClose();
      console.log('close');
    },
    // 处理
    async handler(row) {
      this.initdialog = true;
      this.currentHandleRow = row
      const params = {
        //根据xx字段 查询处理的数据
WF1020 committed
119
        seaownref: row.seaownref,
WF1020 committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133
      };
      const res = await Api.post('/service/inflid/dealWithByOwnref', params);
      if (res.respCode === SUCCESS) {
        if (res.data) {
          this.handlerDataList = []
          Object.keys(res.data).map((item) => {
            this.handlerDataList.push({
              label: item,
              value: res.data[item]
            })
          })
        }
      }
    },
134
    async handleClick (btn) {
WF1020 committed
135 136 137
      if (btn.value === 'N') {
        return
      }
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
      if ( btn.label == '到单' ) {
      const inr = this.currentHandleRow.inr
      const res = await Api.post(`/service/litdck/findLitdck?inr=${inr}`);
      this.dckData = res.data;
      if( res.data.length > 1) {
        this.$confirm('该笔信用证有多笔通知到单单据,是否选择其中一条?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.litdckdialog = true
          
        }).catch(() => {
          this.litdckdialog = false     
        });
        return
      }
      }
WF1020 committed
156 157 158 159 160 161 162 163 164
     let filterRoute = this.btnRouteMap.filter((item) => {
        return item.label === btn.label
      })
      this.$router.history.push({
        path: filterRoute[0].route,
        query: {
          inr: this.currentHandleRow.inr
        }
      });
165
      this.initdialog = false;
WF1020 committed
166 167 168 169 170 171 172 173 174 175 176 177 178 179
    },
    // 关闭处理弹框
    closeHandlerDialog() {
      this.initdialog = false;
    },
    /**
     * 打开详情页面
     * @param {string} inr 
     */
    display(inr) {
      getTrnNameByInr({ inr }).then((res) => {
        if (res.respCode == SUCCESS) {
          const trnName = res.data.toLowerCase();
          let viewurl = "/#/display/" + trnName + "?trn=" + inr
yangxiaolei committed
180 181
          const serial = Utils.generateUUID();
          window.open(viewurl, serial, 'height=1500,width=1200,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no');
WF1020 committed
182 183
        }
      });
184 185 186 187 188 189 190 191
    },
    checkData(row){
      this.$router.history.push({
        path: '/business-new/litdck',
        query: {
          inr: this.currentHandleRow.inr,brdinr:row.inr
        }
      });
192 193
      this.litdckdialog = false  
      this.$options.methods.closeHandlerDialog.call(this);
WF1020 committed
194 195
    }
  },
196

WF1020 committed
197
};