Files
U8-Import/NX.ERP.Webapp/src/views/Purchasesum.vue

533 lines
13 KiB
Vue
Raw Normal View History

2021-05-25 00:40:12 +08:00
<template>
<div>
<h4>采购查询汇总</h4>
<div>
<Row :gutter="16">
2021-05-25 11:59:26 +08:00
<Col span="3">
2021-05-25 12:09:57 +08:00
<label>第一生产期间</label>
2021-05-25 11:59:26 +08:00
<div>
<DatePicker v-model="filter.dates" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
2021-05-25 12:09:57 +08:00
<label>第二生产期间</label>
2021-05-25 11:59:26 +08:00
<div>
<DatePicker v-model="filter.dates2" type="daterange"></DatePicker>
</div>
2021-05-25 00:40:12 +08:00
</Col>
<Col span="4">
<Button
size="large"
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
</Col>
2021-05-25 11:59:26 +08:00
<Col span="10">
<Modal
width="1366"
v-model="modal1"
title="请购详情"
@on-cancel="cancel"
>
<Table
style="margin-top: 20px"
2021-05-26 08:50:35 +08:00
height="700"
2021-05-25 11:59:26 +08:00
size="small"
border
:columns="columnsDetail"
:data="dataDetail"
>
</Table>
</Modal>
</Col>
<Col span="20">
<Modal
width="1366"
v-model="modal2"
title="缺件详情"
@on-cancel="cancel"
>
<Table
style="margin-top: 20px"
2021-05-26 08:50:35 +08:00
height="700"
2021-05-25 11:59:26 +08:00
size="small"
border
:columns="columnsDetail2"
:data="dataDetail2"
>
</Table>
</Modal>
</Col>
2021-05-25 00:40:12 +08:00
</Row>
</div>
<Table
style="margin-top: 20px"
size="small"
2021-05-25 11:59:26 +08:00
show-summary
2021-05-25 00:40:12 +08:00
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>
2021-05-25 11:59:26 +08:00
import { Purchasesum, Purchasesumpuapp, Purchasesummom } from "@/api/Purchase";
2021-05-25 00:40:12 +08:00
import {
pageingData,
export_col_to_excel,
dateFormatFull,
dateFormat,
sortByKey,
getMonth,
} from "@/libs/tools";
export default {
data() {
return {
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
modal1: false,
2021-05-25 11:59:26 +08:00
modal2: false,
2021-05-25 00:40:12 +08:00
loading: false,
strfilter: "",
multiple: false,
pageSize: 15,
2021-05-25 11:59:26 +08:00
dataDetail: [],
dataDetail2: [],
2021-05-25 00:40:12 +08:00
datas: [],
filter: {
inv_codes: "",
inv_std: "",
po_codes: "",
app_codes: "",
2021-05-25 11:59:26 +08:00
dates: [getMonth("s", -1), getMonth("e", 0)],
dates2: [getMonth("s", -1), getMonth("e", 1)],
2021-05-25 00:40:12 +08:00
by_finish: false,
},
columnsDetail: [
{
title: "业务员",
align: "center",
key: "cMaker",
},
{
title: "请购单号",
align: "center",
key: "ccode",
},
2021-05-25 11:59:26 +08:00
{
2021-05-25 00:40:12 +08:00
title: "请购日期",
align: "center",
key: "dDatel",
},
{
title: "存货编码",
align: "center",
key: "cInvCode",
},
{
title: "存货名称",
align: "center",
key: "cinvname",
},
{
title: "规格型号",
align: "center",
key: "cinvstd",
},
{
title: "数量",
align: "center",
key: "RQTY",
},
],
2021-05-25 11:59:26 +08:00
columnsDetail2: [
{
title: "业务员",
align: "center",
key: "cpersonname",
},
{
title: "存货编码",
align: "center",
key: "CINVCODE",
},
{
title: "存货名称",
align: "center",
key: "cInvName",
},
{
title: "规格型号",
align: "center",
key: "cInvStd",
},
{
title: "需求数量",
align: "center",
key: "iqty",
},
{
title: "现存量",
align: "center",
key: "iQuantity",
},
{
title: "补料量",
align: "center",
key: "bull",
},
],
2021-05-25 00:40:12 +08:00
columns: [
{
title: "业务员",
align: "center",
key: "cpersonname",
},
{
2021-05-25 11:59:26 +08:00
title: "请购未下单记录",
2021-05-25 00:40:12 +08:00
align: "center",
key: "puappnumall",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.puappnumall, //添加title属性
},
on: {
click: () => {
this.handleShow(params.row.cpersonname); //点击事件
},
},
},
params.row.puappnumall
),
]);
},
},
{
title: "请购三天后未下单记录",
align: "center",
key: "puappnum03",
2021-05-25 11:59:26 +08:00
render: (h, params) => {
2021-05-25 00:40:12 +08:00
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.puappnum03, //添加title属性
},
on: {
click: () => {
this.handleShow2(params.row.cpersonname); //点击事件
},
},
},
params.row.puappnum03
),
]);
},
},
{
2021-05-25 12:09:57 +08:00
title: "第一期间内计划工单缺件品种数",
2021-05-25 00:40:12 +08:00
align: "center",
key: "mommouth02",
2021-05-25 11:59:26 +08:00
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.mommouth02, //添加title属性
},
on: {
click: () => {
this.handleShow3(params.row.cpersonname); //点击事件
},
},
},
params.row.mommouth02
),
]);
},
2021-05-25 00:40:12 +08:00
},
{
2021-05-25 12:09:57 +08:00
title: "第二期间内计划工单缺件品种数",
2021-05-25 00:40:12 +08:00
align: "center",
key: "mommouth04",
2021-05-25 11:59:26 +08:00
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.mommouth04, //添加title属性
},
on: {
click: () => {
this.handleShow4(params.row.cpersonname); //点击事件
},
},
},
params.row.mommouth04
),
]);
},
2021-05-25 00:40:12 +08:00
},
],
};
},
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 handleShow(h) {
2021-05-25 11:59:26 +08:00
let _filert2 = {
2021-05-25 00:40:12 +08:00
cpersonname: h,
cInvCode: null,
2021-05-25 11:59:26 +08:00
cday: 0,
2021-05-25 00:40:12 +08:00
};
let respd = await Purchasesumpuapp(_filert2);
2021-05-25 11:59:26 +08:00
this.dataDetail = sortByKey(respd.data.data, "ccode");
2021-05-25 00:40:12 +08:00
this.modal1 = true;
},
async handleShow2(h) {
2021-05-25 11:59:26 +08:00
let _filert2 = {
2021-05-25 00:40:12 +08:00
cpersonname: h,
cInvCode: null,
2021-05-25 11:59:26 +08:00
cday: 3,
2021-05-25 00:40:12 +08:00
};
let respd = await Purchasesumpuapp(_filert2);
2021-05-25 11:59:26 +08:00
this.dataDetail = sortByKey(respd.data.data, "ccode");
2021-05-25 00:40:12 +08:00
this.modal1 = true;
},
2021-05-25 11:59:26 +08:00
async handleShow3(h) {
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 = {
cpersonname: h,
cInvCode: null,
begin_date: _beginDate,
end_date: _endDate,
};
let respd = await Purchasesummom(_filert);
this.dataDetail2 = sortByKey(respd.data.data, "CINVCODE");
this.modal2 = true;
},
async handleShow4(h) {
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 = {
cpersonname: h,
cInvCode: null,
begin_date: _beginDate2,
end_date: _endDate2,
};
let respd = await Purchasesummom(_filert);
this.dataDetail2 = sortByKey(respd.data.data, "CINVCODE");
this.modal2 = true;
},
2021-05-25 00:40:12 +08:00
cancel() {
this.dataDetail = [];
2021-05-25 11:59:26 +08:00
this.dataDetail2 = [];
2021-05-25 00:40:12 +08:00
this.modal1 = false;
2021-05-25 11:59:26 +08:00
this.modal2 = false;
2021-05-25 00:40:12 +08:00
},
async loadData() {
2021-05-25 11:59:26 +08:00
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,
};
2021-05-25 00:40:12 +08:00
try {
this.loading = true;
2021-05-25 11:59:26 +08:00
let resp = await Purchasesum(_filert);
2021-05-25 00:40:12 +08:00
this.pageNo = 1;
this.datas = resp.data.data;
// this.datas = sortByKey(resp.data.data, "cordercode");
} 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>