Files
U8-Import/NX.ERP.Webapp/src/views/inventory-po.vue
2021-05-26 17:05:28 +08:00

344 lines
7.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<h4>采购订单表</h4>
<div>
<Row :gutter="16">
<Col span="4">
<label>采购订单编号</label>
<Input autosize type="textarea" v-model="filter.po_codes" />
</Col>
<Col span="3">
<label>采购订单期间</label>
<div>
<DatePicker v-model="filter.dates" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
<label>物料编号</label>
<Input autosize type="textarea" v-model="filter.inv_codes" />
</Col>
<Col span="3">
<label>规格</label>
<Input v-model="filter.inv_std" />
</Col>
<Col span="4">
<label>请购单号</label>
<Input autosize type="textarea" v-model="filter.app_codes" />
</Col>
<Col span="3">
<label>请购订单期间</label>
<div>
<DatePicker v-model="filter.dates2" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
<label>状态</label>
<div>
<Checkbox v-model="filter.by_finish">包含关闭</Checkbox>
</div>
</Col>
<Col span="4">
<Button
size="large"
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
</Col>
</Row>
</div>
<Table
style="margin-top: 20px"
size="small"
border
:loading="loading"
:columns="columns"
:data="pagedData"
>
</Table>
<Page
style="margin-top: 20px"
:current="pageNo"
:page-size="pageSize"
:total="total"
:page-size-opts="PageSizeOpts"
@on-change="handlePagechange"
@on-page-size-change="handlePageSize"
show-elevator
show-sizer
show-total
size="small"
/>
</div>
</template>
<script>
import { getInventorypo } from "@/api/pmc";
import {
pageingData,
export_col_to_excel,
dateFormatFull,
dateFormat,
sortByKey,
getMonth,
} from "@/libs/tools";
export default {
data() {
return {
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
loading: false,
strfilter: "",
multiple: false,
pageSize: 15,
datas: [],
filter: {
inv_codes: "",
inv_std: "",
po_codes: "",
app_codes: "",
dates: [getMonth("s", -6), getMonth("e", 0)],
dates2: [],
by_finish: false,
},
columns: [
{
title: "业务员",
align: "center",
key: "cmaker",
width: 90,
},
{
title: "采购订单号",
align: "center",
key: "cpoid",
width: 135,
},
{
title: "订单日期",
align: "center",
key: "dpodate",
},
{
title: "供应商",
align: "center",
key: "cvenabbname",
},
{
title: "存货编码",
align: "center",
key: "cinvcode",
},
{
title: "存货名称",
align: "center",
key: "cinvname",
className: "demo-table-info-new",
},
{
title: "规格型号",
align: "center",
key: "cinvstd",
},
{
title: "单位",
align: "center",
key: "cinvm_unit",
width: 80,
},
{
title: "订单数量",
align: "center",
key: "iquantity",
width: 100,
},
{
title: "累计到货",
align: "center",
key: "ireceivedqty",
width: 100,
},
{
title: "在途",
align: "center",
key: "rqty2",
},
{
title: "合计在途",
align: "center",
key: "rqty",
width: 100,
},
{
title: "预计到货日期",
align: "center",
key: "darrivedate",
},
{
title: "请购单号",
align: "center",
key: "cupsocode",
width: 135,
},
{
title: "请购日期",
align: "center",
key: "ddate",
},
{
title: "需求日期",
align: "center",
key: "drequirdate",
},
{
title: "行关闭人",
align: "center",
key: "cbcloser",
width: 100,
},
{
title: "订单关闭人",
align: "center",
key: "ccloser",
width: 100,
},
],
};
},
computed: {
total() {
return this.datas.length;
},
pagedData() {
return pageingData(this.datas, this.pageSize, this.pageNo);
},
},
mounted() {
this.loadData();
},
methods: {
handelExport() {
export_col_to_excel(this.columns, this.datas);
},
handleClick() {
this.loadData();
},
async loadData() {
try {
let _beginDate = null;
let _endDate = null;
let _beginDate2 = null;
let _endDate2 = null;
if (
this.filter.dates.length == 2 &&
this.filter.dates[0] !== "" &&
this.filter.dates[0] !== ""
) {
_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,
by_finish: this.filter.by_finish,
};
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;
}
},
handlePagechange(page) {
this.pageNo = page;
},
handlePageSize(pageSize) {
this.pageSize = pageSize;
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>