index.js 4.57 KB
Newer Older
WF1020 committed
1
import Api from '~/service/Api';
WF1020 committed
2
import { getTrnNameByInr } from '~/service/business/common';
WF1020 committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import moment from 'moment';

export default {
  methods: {
    async handleSearch() {
      let opndatfrom = this.model.infcon.opndatfrom;
      if (!opndatfrom || opndatfrom == '') {
        this.$notify.error({ title: '错误', message: '查询开始日期必输!' });
        return;
      }
      let opndatto = this.model.infcon.opndatto;
      if (!opndatto || opndatto == '') {
        this.$notify.error({ title: '错误', message: '查询结束日期必输!' });
        return;
      }
      let params = {
        ...this.model.infcon,
        seadocflg: this.model.seadocflg,
        seagodcod: this.model.seagodcod,
WF1020 committed
22
        inr: this.model.ledgrp.rec.inr,
WF1020 committed
23 24
        pageIndex: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
WF1020 committed
25 26
        opndatfrom: moment(opndatfrom).format('YYYY-MM-DD'),
        opndatto: moment(opndatto).format('YYYY-MM-DD'),
WF1020 committed
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
      };
      let rtnmsg = await Api.post('/service/infbed/getList', params);
      if (rtnmsg.respCode == SUCCESS) {
        this.stmData.data = [];
        this.stmData.data = rtnmsg.data.list;
        // debugger
        this.pagination.total = rtnmsg.data.total;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
    },

    async handleReset() {
      this.model.infcon.chksubcon = '';
      this.model.infcon.opndatfrom = new Date();
      this.model.infcon.opndatto = new Date();
      this.model.infcon.seaownref = '';
      this.model.infcon.seashgref = '';
      this.model.infcon.seaamtfr = '';
      this.model.infcon.seasta = '';
      this.model.infcon.seacur = '';
      this.model.infcon.pty.extkey = '';
      this.model.infcon.pty.nam = '';
      this.model.infcon.usr.extkey = '';
      this.model.infcon.objinr = '';
      this.model.infcon.seaamtto = '';
      this.model.infcon.searol = '';
      this.model.infcon.nam = '';
      this.model.infcon.seapty = '';
      this.model.infcon.searef = '';
WF1020 committed
57
      this.model.ledgrp.rec.inr = '';
WF1020 committed
58 59
      this.model.seagodcod = '';
      this.model.seadocflg = '';
liaoxing committed
60
      this.model.seadoctypcod = '';
WF1020 committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    },

    // 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();
    },

    // 详情
    async details(row) {
      const params = {
        //根据xx字段 查询详情表的数据
WF1020 committed
81
        inr: row.inr,
WF1020 committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
        userId: window.sessionStorage.userId || 'ZL',
        ownref: row.ownref,
      };
      const res = await Api.post('/service/infbed/getDetail', 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;
WF1020 committed
100
      this.currentHandleRow = row;
WF1020 committed
101 102
      const params = {
        //根据xx字段 查询处理的数据
闫泽浩 committed
103
        seaownref: row.seaownref,
WF1020 committed
104 105 106 107
      };
      const res = await Api.post('/service/infbed/dealWithByOwnref', params);
      if (res.respCode === SUCCESS) {
        if (res.data) {
WF1020 committed
108
          this.handlerDataList = [];
WF1020 committed
109 110 111
          Object.keys(res.data).map((item) => {
            this.handlerDataList.push({
              label: item,
WF1020 committed
112 113 114
              value: res.data[item],
            });
          });
WF1020 committed
115 116 117 118
        }
      }
    },

WF1020 committed
119
    handleClick(btn) {
WF1020 committed
120
      if (btn.value === 'N') {
WF1020 committed
121
        return;
WF1020 committed
122 123
      }
      let filterRoute = this.btnRouteMap.filter((item) => {
WF1020 committed
124 125
        return item.label === btn.label;
      });
WF1020 committed
126 127 128
      this.$router.history.push({
        path: filterRoute[0].route,
        query: {
WF1020 committed
129 130
          inr: this.currentHandleRow.inr,
        },
WF1020 committed
131
      });
132
      this.initdialog = false;
WF1020 committed
133 134 135 136 137
    },
    // 关闭处理弹框
    closeHandlerDialog() {
      this.initdialog = false;
    },
WF1020 committed
138
   
WF1020 committed
139 140 141 142 143 144 145 146
    /**
     * 打开详情页面
     * @param {string} inr
     */
    display(inr) {
      getTrnNameByInr({ inr }).then((res) => {
        if (res.respCode == SUCCESS) {
          const trnName = res.data.toLowerCase();
WF1020 committed
147 148 149 150 151 152
          let viewurl = '/#/display/' + trnName + '?trn=' + inr;
          window.open(
            viewurl,
            'newwindow',
            'height=1500,width=1200,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no'
          );
WF1020 committed
153 154 155 156 157
        }
      });
    },
  },
};