index.js 3.21 KB
Newer Older
zenghuan committed
1
import Api from "~/service/Api";
李少勇 committed
2
import getSubtyp from '~/page/Frontend/Rcvsel/event/getSubtyp.js';
zenghuan committed
3
import moment from "moment";
李少勇 committed
4 5

export default {
李少勇 committed
6
  mixins: [getSubtyp],
niewei committed
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
  methods: {
    async handleSearch () {
      let rsptims = this.model.oftp.rel.rsptims;
      if (!rsptims || rsptims === "") {
        this.$notify.error({
          title: this.$t("financing.错误"),
          message: this.$t("financing.查询开始日期必输!"),
        });
        return;
      }
      let rsptime = this.model.oftp.rel.rsptime;
      if (!rsptime || rsptime === "") {
        this.$notify.error({
          title: this.$t("financing.错误"),
          message: this.$t("financing.查询结束日期必输!"),
        });
        return;
      }

      this.load = true;
      // TODO rewrite url
      let rtnmsg = await Api.post("/frontend/oftsel/query", {
        ...this.model.oftp.rel,
        pageNum: this.pagination.pageNum,
        pageSize: this.pagination.pageSize,
32 33
        rsptims: rsptims ? moment(rsptims).format("YYYY-MM-DD") + ' 00:00:00' : "",
        rsptime: moment(rsptime).format("YYYY-MM-DD") + ' 23:59:59',
niewei committed
34 35 36 37 38 39
      });
      if (rtnmsg.respCode == SUCCESS) {
        this.load = false;
        this.stmData.data = [];
        const { list } = rtnmsg.data;

niewei committed
40
        const { codes: { kpasta, zfqzsta, stacod, offsta, chncod } } = this;
niewei committed
41 42 43 44 45 46 47
        list.forEach(v => {
          for (let i in kpasta) {
            if (kpasta[i].value == v.typ) {
              v.typ = kpasta[i].label;
            }
          }

48 49 50
          for (let i in zfqzsta) {
            if (zfqzsta[i].value == v.sta) {
              v.sta = zfqzsta[i].label;
niewei committed
51 52 53 54 55 56 57 58 59 60 61 62
            }
          }
          for (let i in stacod) {
            if (stacod[i].value == v.area) {
              v.area = stacod[i].label;
            }
          }
          for (let i in offsta) {
            if (offsta[i].value == v.offsta) {
              v.offsta = offsta[i].label;
            }
          }
niewei committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
          for (let i in chncod) {
            if (chncod[i].value == v.multimsg) {
              v.multimsg = chncod[i].label;
            }
          }
          for (let i in chncod) {
            if (chncod[i].value == v.chk) {
              v.chk = chncod[i].label;
            }
          }
          for (let i in chncod) {
            if (chncod[i].value == v.kpatyp) {
              v.kpatyp = chncod[i].label;
            }
          }

niewei committed
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
        })



        this.stmData.data = list;
        this.pagination = {
          pageNum: rtnmsg.data.pageNum || 1,
          pageSize: rtnmsg.data.pageSize || 10,
          total: parseInt(rtnmsg.data.total),
        };
      } else {
        this.$notify.error({
          title: this.$t("financing.错误"),
          message: this.$t("financing.服务请求失败!"),
        });
      }
      this.load = false;
    },
    async handleReset () {
      this.model = new Oftsel().data;
    },
    // pageSize改变
    handleSizeChange (val) {
      this.pagination.pageNum = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange (val) {
      this.pagination.pageNum = val;
      this.handleSearch();
zenghuan committed
110
    },
niewei committed
111 112 113 114
    handleSelectionChange (val) {
      this.multipleSelection = val;
    }
  },
zenghuan committed
115
};