加个加载

This commit is contained in:
杰 朱
2021-05-18 20:46:32 +08:00
parent 13ae9124ae
commit 60e1a2d2d2

View File

@@ -52,6 +52,7 @@
style="margin-top: 20px" style="margin-top: 20px"
size="small" size="small"
border border
:loading="loading"
:columns="columns" :columns="columns"
:data="pagedData" :data="pagedData"
> >
@@ -81,13 +82,14 @@ import {
dateFormatFull, dateFormatFull,
dateFormat, dateFormat,
sortByKey, sortByKey,
getMonth getMonth,
} from "@/libs/tools"; } from "@/libs/tools";
export default { export default {
data() { data() {
return { return {
PageSizeOpts: [10, 15, 20, 30], PageSizeOpts: [10, 15, 20, 30],
pageNo: 1, pageNo: 1,
loading: false,
strfilter: "", strfilter: "",
multiple: false, multiple: false,
pageSize: 15, pageSize: 15,
@@ -97,29 +99,25 @@ export default {
inv_std: "", inv_std: "",
po_codes: "", po_codes: "",
app_codes: "", app_codes: "",
dates: [getMonth("s",-1),getMonth("e",0)], dates: [getMonth("s", -1), getMonth("e", 0)],
dates2: [], dates2: [],
}, },
columns: [ columns: [
{ {
title: "采购订单号", title: "采购订单号",
align: "center", align: "center",
key: "cpoid", key: "cpoid",
}, },
{ {
title: "订单日期", title: "订单日期",
align: "center", align: "center",
key: "dpodate", key: "dpodate",
}, },
{ {
title: "供应商", title: "供应商",
align: "center", align: "center",
key: "cvenabbname", key: "cvenabbname",
}, },
{ {
title: "存货编码", title: "存货编码",
@@ -132,12 +130,11 @@ export default {
key: "cinvname", key: "cinvname",
className: "demo-table-info-new", className: "demo-table-info-new",
}, },
{ {
title: "规格型号", title: "规格型号",
align: "center", align: "center",
key: "cinvstd", key: "cinvstd",
}, },
{ {
title: "单位", title: "单位",
@@ -153,7 +150,6 @@ export default {
title: "订单数量", title: "订单数量",
align: "center", align: "center",
key: "iquantity", key: "iquantity",
}, },
{ {
title: "合计在途", title: "合计在途",
@@ -180,8 +176,6 @@ export default {
align: "center", align: "center",
key: "drequirdate", key: "drequirdate",
}, },
], ],
}; };
}, },
@@ -205,49 +199,55 @@ export default {
this.loadData(); this.loadData();
}, },
async loadData() { async loadData() {
let _beginDate = null; try {
let _endDate = null; let _beginDate = null;
let _beginDate2 = null; let _endDate = null;
let _endDate2 = null; let _beginDate2 = null;
if ( let _endDate2 = null;
this.filter.dates.length == 2 && if (
this.filter.dates[0] !== "" && this.filter.dates.length == 2 &&
this.filter.dates[0] !== "" this.filter.dates[0] !== "" &&
) { this.filter.dates[0] !== ""
_beginDate = this.filter.dates[0]; ) {
_endDate = this.filter.dates[1]; _beginDate = this.filter.dates[0];
_endDate = this.filter.dates[1];
}
if (
this.filter.dates2.length == 2 &&
this.filter.dates2[0] !== "" &&
this.filter.dates2[0] !== ""
) {
_beginDate2 = this.filter.dates2[0];
_endDate2 = this.filter.dates2[1];
}
let _filert = {
inv_codes:
this.filter.inv_codes !== ""
? this.filter.inv_codes.split(/[,\s\n,]/)
: null,
inv_std: this.filter.inv_std,
po_codes:
this.filter.po_codes !== ""
? this.filter.po_codes.split(/[,\s\n,]/)
: null,
app_codes:
this.filter.app_codes !== ""
? this.filter.app_codes.split(/[,\s\n,]/)
: null,
begin_date: _beginDate,
end_date: _endDate,
begin_date2: _beginDate2,
end_date2: _endDate2,
};
this.loading = true;
let resp = await getInventorypo(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
this.datas = sortByKey(resp.data.data, "cpoid");
} catch (error) {
} finally {
this.loading = false;
} }
if (
this.filter.dates2.length == 2 &&
this.filter.dates2[0] !== "" &&
this.filter.dates2[0] !== ""
) {
_beginDate2 = this.filter.dates2[0];
_endDate2 = this.filter.dates2[1];
}
let _filert = {
inv_codes:
this.filter.inv_codes !== ""
? this.filter.inv_codes.split(/[,\s\n,]/)
: null,
inv_std: this.filter.inv_std,
po_codes:
this.filter.po_codes !== ""
? this.filter.po_codes.split(/[,\s\n,]/)
: null,
app_codes:
this.filter.app_codes !== ""
? this.filter.app_codes.split(/[,\s\n,]/)
: null,
begin_date: _beginDate,
end_date: _endDate,
begin_date2: _beginDate2,
end_date2: _endDate2,
};
let resp = await getInventorypo(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
this.datas = sortByKey(resp.data.data, "cpoid");
}, },
handlePagechange(page) { handlePagechange(page) {