import Api from "~/service/Api"; import moment from "moment"; import Oftopn from '../model'; export default { 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/oftopn/query", { ...this.model.oftp.rel, pageNum: this.pagination.pageNum, pageSize: this.pagination.pageSize, rsptims: moment(rsptims).format("YYYY-MM-DD"), rsptime: moment(rsptime).format("YYYY-MM-DD"), }); if (rtnmsg.respCode == SUCCESS) { this.load = false; this.stmData.data = []; const { list } = rtnmsg.data; const { codes: { kpasta, sta, stacod, offsta } } = this; list.forEach(v => { for (let i in kpasta) { if (kpasta[i].value == v.typ) { v.typ = kpasta[i].label; } } for (let i in sta) { if (sta[i].value == v.sta) { v.sta = sta[i].label; } } 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; } } }) 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 Oftopn().data; }, // pageSize改变 handleSizeChange (val) { this.pagination.pageNum = 1; this.pagination.pageSize = val; this.handleSearch(); }, // 页码改变 handleCurrentChange (val) { this.pagination.pageNum = val; this.handleSearch(); }, handleSelectionChange (val) { this.multipleSelection = val; } }, };