Files
U8-Import/NX.ERP.Webapp/src/views/inventory-SNDetail.vue
2021-05-11 13:11:56 +08:00

296 lines
6.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="3">
<label>产品入库订单编号</label>
<Input v-model="filter.cprk" />
</Col>
<Col span="3">
<label>销售出库订单编号</label>
<Input v-model="filter.clck" />
</Col>
<Col span="4">
<label>物料编号</label>
<Input autosize type="textarea" v-model="filter.c_inv_codes" />
</Col>
<Col span="4">
<label>序列号</label>
<Input autosize type="textarea" v-model="filter.c_inv_sn" />
</Col>
<Col span="3">
<label>入库单据期间</label>
<div>
<DatePicker v-model="filter.dates" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
<label>出库单据期间</label>
<div>
<DatePicker v-model="filter.dates2" type="daterange"></DatePicker>
</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
: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 { InventorySNDetail } from "@/api/Finance";
import {
pageingData,
export_col_to_excel,
dateFormatFull,
dateFormat,
sortByKey,
} from "@/libs/tools";
export default {
data() {
return {
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
strfilter: "",
multiple: false,
pageSize: 15,
datas: [],
filter: {
cprk: "",
clck: "",
c_inv_codes: "",
c_inv_sn: "",
dates: [],
dates2: [],
},
columns: [
{
title: "存货编码",
align: "center",
key: "cInvCode",
},
{
title: "存货名称",
align: "center",
key: "cInvName",
},
{
title: "入库单号",
align: "center",
key: "Cprk",
className: "demo-table-info-new",
},
{
title: "入库日期",
align: "center",
key: "rkrq",
render: (h, params) => {
return <div> {dateFormat(params.row.rkrq)} </div>;
},
},
{
title: "仓库",
align: "center",
key: "cWhName",
},
{
title: "生产订单号",
align: "center",
key: "cMPoCode",
},
{
title: "生产部门",
align: "center",
key: "cDepName",
},
{
title: "入库序列号",
align: "center",
key: "cInvSN",
},
{
title: "入库金额",
align: "center",
key: "iUnitCost",
},
{
title: "出库库单号",
align: "center",
key: "Clck",
className: "demo-table-info-old",
},
{
title: "出库日期",
align: "center",
key: "ckrq",
render: (h, params) => {
return <div> {dateFormat(params.row.ckrq)} </div>;
},
},
{
title: "客户",
align: "center",
key: "cCusAbbName",
},
{
title: "出库库序列号",
align: "center",
key: "ckcInvSN",
},
],
};
},
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() {
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 = {
begin_date: _beginDate,
end_date: _endDate,
begin_date2: _beginDate2,
end_date2: _endDate2,
cprk:
this.filter.cprk !== "" ? this.filter.cprk.split(/[,\s\n,]/) : null,
clck:
this.filter.clck !== "" ? this.filter.clck.split(/[,\s\n,]/) : null,
c_inv_codes:
this.filter.c_inv_codes !== ""
? this.filter.c_inv_codes.split(/[,\s\n,]/)
: null,
c_inv_sn:
this.filter.c_inv_sn !== ""
? this.filter.c_inv_sn.split(/[,\s\n,]/)
: null,
};
let resp = await InventorySNDetail(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
this.datas = sortByKey(resp.data.data, "Cprk");
},
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>