370 lines
8.8 KiB
Vue
370 lines
8.8 KiB
Vue
<template>
|
||
<div>
|
||
<h4>材料出库与品种</h4>
|
||
<div>
|
||
<Row :gutter="16">
|
||
<Col span="8">
|
||
<label>物料编号</label>
|
||
<Input autosize type="textarea" v-model="filter.inv_codes" />
|
||
</Col>
|
||
<Col span="4">
|
||
<label>规格</label>
|
||
<Input v-model="filter.inv_std" />
|
||
</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
|
||
: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 { getInventorymonth } from "@/api/pmc";
|
||
import { pageingData, export_col_to_excel, sortByKey } from "@/libs/tools";
|
||
export default {
|
||
data() {
|
||
return {
|
||
PageSizeOpts: [10, 15, 20, 30],
|
||
pageNo: 1,
|
||
strfilter: "",
|
||
multiple: false,
|
||
pageSize: 15,
|
||
datas: [],
|
||
filter: {
|
||
inv_codes: "",
|
||
inv_std: "",
|
||
so_code: "",
|
||
},
|
||
columns: [
|
||
{
|
||
title: "存货编号",
|
||
align: "center",
|
||
key: "cInvCode",
|
||
width: "110",
|
||
className: "demo-table-info-new",
|
||
},
|
||
{
|
||
title: "存货名称",
|
||
align: "center",
|
||
key: "cInvName",
|
||
width: "120",
|
||
},
|
||
|
||
{
|
||
title: "规格",
|
||
align: "center",
|
||
key: "cInvStd",
|
||
width: "220",
|
||
},
|
||
{
|
||
title: "单位",
|
||
width: 70,
|
||
align: "center",
|
||
key: "cComUnitName",
|
||
},
|
||
{
|
||
title: "属性",
|
||
width: 70,
|
||
align: "center",
|
||
key: "std",
|
||
},
|
||
{
|
||
title: "总需求(未领量)",
|
||
align: "center",
|
||
width: "110",
|
||
key: "wqty",
|
||
},
|
||
{
|
||
title: "现存量",
|
||
align: "center",
|
||
key: "cqty",
|
||
},
|
||
{
|
||
title: "已领(现场)",
|
||
align: "center",
|
||
key: "issqty",
|
||
},
|
||
{
|
||
title: "现存无废品",
|
||
align: "center",
|
||
key: "dqty",
|
||
},
|
||
{
|
||
title: "采购在途",
|
||
align: "center",
|
||
key: "rqty",
|
||
},
|
||
{
|
||
title: "委外在途",
|
||
align: "center",
|
||
key: "rqty1",
|
||
},
|
||
{
|
||
title: "请购",
|
||
align: "center",
|
||
key: "rqty3",
|
||
},
|
||
{
|
||
title: "在制",
|
||
align: "center",
|
||
key: "momqty",
|
||
},
|
||
{
|
||
title:
|
||
new Date().getFullYear() +
|
||
(new Date().getMonth() + 1 < 10
|
||
? "0" + (new Date().getMonth() + 1)
|
||
: new Date().getMonth() + 1),
|
||
align: "center",
|
||
key: "iQuantity00",
|
||
className: "demo-table-info-old",
|
||
},
|
||
{
|
||
title:
|
||
new Date(new Date().setMonth(new Date().getMonth() - 1))
|
||
.getFullYear()
|
||
.toString() +
|
||
(new Date(
|
||
new Date().setMonth(new Date().getMonth() - 1)
|
||
).getMonth() +
|
||
1 <
|
||
10
|
||
? "0" +
|
||
(
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 1)
|
||
).getMonth() + 1
|
||
).toString()
|
||
: (
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 1)
|
||
).getMonth() + 1
|
||
).toString()),
|
||
align: "center",
|
||
key: "iQuantity01",
|
||
className: "demo-table-info-old",
|
||
},
|
||
{
|
||
title:
|
||
new Date(new Date().setMonth(new Date().getMonth() - 2))
|
||
.getFullYear()
|
||
.toString() +
|
||
(new Date(
|
||
new Date().setMonth(new Date().getMonth() - 2)
|
||
).getMonth() +
|
||
1 <
|
||
10
|
||
? "0" +
|
||
(
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 2)
|
||
).getMonth() + 1
|
||
).toString()
|
||
: (
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 2)
|
||
).getMonth() + 1
|
||
).toString()),
|
||
align: "center",
|
||
key: "iQuantity02",
|
||
className: "demo-table-info-old",
|
||
},
|
||
{
|
||
title:
|
||
new Date(new Date().setMonth(new Date().getMonth() - 3))
|
||
.getFullYear()
|
||
.toString() +
|
||
(new Date(
|
||
new Date().setMonth(new Date().getMonth() - 3)
|
||
).getMonth() +
|
||
1 <
|
||
10
|
||
? "0" +
|
||
(
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 3)
|
||
).getMonth() + 1
|
||
).toString()
|
||
: (
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 3)
|
||
).getMonth() + 1
|
||
).toString()),
|
||
align: "center",
|
||
key: "iQuantity03",
|
||
className: "demo-table-info-old",
|
||
},
|
||
{
|
||
title:
|
||
new Date(new Date().setMonth(new Date().getMonth() - 4))
|
||
.getFullYear()
|
||
.toString() +
|
||
(new Date(
|
||
new Date().setMonth(new Date().getMonth() - 4)
|
||
).getMonth() +
|
||
1 <
|
||
10
|
||
? "0" +
|
||
(
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 4)
|
||
).getMonth() + 1
|
||
).toString()
|
||
: (
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 4)
|
||
).getMonth() + 1
|
||
).toString()),
|
||
align: "center",
|
||
key: "iQuantity04",
|
||
className: "demo-table-info-old",
|
||
},
|
||
{
|
||
title:
|
||
new Date(new Date().setMonth(new Date().getMonth() - 5))
|
||
.getFullYear()
|
||
.toString() +
|
||
(new Date(
|
||
new Date().setMonth(new Date().getMonth() - 5)
|
||
).getMonth() +
|
||
1 <
|
||
10
|
||
? "0" +
|
||
(
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 5)
|
||
).getMonth() + 1
|
||
).toString()
|
||
: (
|
||
new Date(
|
||
new Date().setMonth(new Date().getMonth() - 5)
|
||
).getMonth() + 1
|
||
).toString()),
|
||
|
||
align: "center",
|
||
key: "iQuantity04",
|
||
className: "demo-table-info-old",
|
||
},
|
||
],
|
||
};
|
||
},
|
||
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 _filert = {
|
||
inv_codes:
|
||
this.filter.inv_codes !== ""
|
||
? this.filter.inv_codes.split(/[,\s\n,]/)
|
||
: null,
|
||
inv_std: this.filter.inv_std,
|
||
so_code: this.filter.so_code,
|
||
};
|
||
let resp = await getInventorymonth(_filert);
|
||
this.pageNo = 1;
|
||
this.datas = sortByKey(resp.data.data, "cInvCode");
|
||
} catch (error) {}
|
||
},
|
||
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> |