546 lines
12 KiB
Vue
546 lines
12 KiB
Vue
<template>
|
||
<div>
|
||
<h2>销售未发货明细表</h2>
|
||
<div>
|
||
<Row :gutter="16">
|
||
<!--
|
||
<Col span="4">
|
||
<label>销售订单编号</label>
|
||
<Input v-model="filter.so_code" />
|
||
</Col>
|
||
|
||
<Col span="4">
|
||
<label>物料编号</label>
|
||
<Input autosize type="textarea" v-model="filter.inv_codes" />
|
||
</Col>
|
||
|
||
<Col span="4">
|
||
<label>时间预警</label>
|
||
<div>
|
||
<Select v-model="filter.flag" multiple>
|
||
<Option
|
||
v-for="item in stateList"
|
||
:value="item.value"
|
||
:key="item.value"
|
||
>{{ item.label }}</Option>
|
||
</Select>
|
||
</div>
|
||
</Col>
|
||
-->
|
||
<Col span="4">
|
||
<div class="search_div">
|
||
<i-input
|
||
@on-change="pageNo=1"
|
||
clearable
|
||
placeholder="输入关键词筛选,多个用空格分隔"
|
||
v-model="strfilter"
|
||
>
|
||
<Icon slot="suffix" type="ios-search" />
|
||
</i-input>
|
||
</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>-->
|
||
|
||
<filter-table @on-search="onSearch" :data="pagedData" :columns="columns"></filter-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 { getInventorySale } from "@/api/pmc";
|
||
import FilterTable from "./FilterTable";
|
||
import {
|
||
pageingData,
|
||
export_col_to_excel,
|
||
dateFormatFull,
|
||
dateFormat,
|
||
sortByKey
|
||
} from "@/libs/tools";
|
||
|
||
const isqj = {
|
||
1: {
|
||
value: 1,
|
||
name: "是",
|
||
color: "red"
|
||
},
|
||
2: {
|
||
value: 2,
|
||
name: "否",
|
||
color: "green"
|
||
}
|
||
};
|
||
const stateListq = {
|
||
0: {
|
||
value: "1",
|
||
name: "15天内发货"
|
||
},
|
||
1: {
|
||
value: "2",
|
||
name: "15天以上发货"
|
||
},
|
||
2: {
|
||
value: "3",
|
||
name: "超期"
|
||
}
|
||
};
|
||
export default {
|
||
components: { FilterTable },
|
||
data() {
|
||
return {
|
||
PageSizeOpts: [9999],
|
||
pageNo: 1,
|
||
strfilter: "",
|
||
multiple: false,
|
||
pageSize: 9999,
|
||
datas: [],
|
||
filter: {
|
||
inv_codes: "",
|
||
inv_std: "",
|
||
so_code: "",
|
||
dates: [],
|
||
flag: []
|
||
},
|
||
stateList: [
|
||
{
|
||
value: "1",
|
||
label: "15天内发货"
|
||
},
|
||
{
|
||
value: "2",
|
||
label: "15天以上发货"
|
||
},
|
||
{
|
||
value: "3",
|
||
label: "超期"
|
||
}
|
||
],
|
||
columns: [
|
||
{
|
||
type: "index",
|
||
title: "序号",
|
||
width: 70,
|
||
align: "center"
|
||
},
|
||
{
|
||
title: "客户",
|
||
align: "center",
|
||
key: "cCusAbbName",
|
||
width: 145,
|
||
filter: {
|
||
type: "AutoComplete"
|
||
}
|
||
},
|
||
{
|
||
title: "订单日期",
|
||
align: "center",
|
||
width: 145,
|
||
key: "dDate",
|
||
render: (h, params) => {
|
||
return <div> {dateFormat(params.row.dDate)} </div>;
|
||
},
|
||
filter: {
|
||
type: "DatePicker"
|
||
}
|
||
},
|
||
{
|
||
title: "销售单号",
|
||
align: "center",
|
||
key: "cSOCode",
|
||
width: "160",
|
||
filter: {
|
||
type: "AutoComplete"
|
||
}
|
||
},
|
||
|
||
{
|
||
title: "产品编码",
|
||
align: "center",
|
||
key: "cInvCode",
|
||
width: "120",
|
||
className: "demo-table-info-new",
|
||
filter: {
|
||
type: "Input"
|
||
}
|
||
},
|
||
{
|
||
title: "产品名称",
|
||
align: "center",
|
||
width: "150",
|
||
key: "cInvName",
|
||
filter: {
|
||
type: "AutoComplete"
|
||
}
|
||
},
|
||
{
|
||
title: "规格型号",
|
||
align: "center",
|
||
key: "cInvStd",
|
||
width: "220",
|
||
filter: {
|
||
type: "AutoComplete",
|
||
}
|
||
},
|
||
{
|
||
title: "未发数量",
|
||
align: "center",
|
||
width: "120",
|
||
issum:true,
|
||
key: "wfiQuantity",
|
||
filter: {
|
||
type: "Input"
|
||
}
|
||
},
|
||
{
|
||
title: "欠货量",
|
||
align: "center",
|
||
width: "120",
|
||
key: "kcyl",
|
||
filter: {
|
||
type: "Input"
|
||
}
|
||
},
|
||
{
|
||
title: "现存量",
|
||
align: "center",
|
||
width: "120",
|
||
key: "xcl",
|
||
filter: {
|
||
type: "Input"
|
||
}
|
||
},
|
||
{
|
||
title: "预计发货日期",
|
||
align: "center",
|
||
width: 145,
|
||
key: "dPreDate",
|
||
filter: {
|
||
type: "DatePicker"
|
||
}
|
||
},
|
||
|
||
{
|
||
title: "技术要求",
|
||
align: "center",
|
||
key: "cMemo",
|
||
width: "300",
|
||
filter: {
|
||
type: "Input"
|
||
}
|
||
},
|
||
{
|
||
title: "时间预警",
|
||
align: "center",
|
||
width: 130,
|
||
key: "datewaring",
|
||
filter: {
|
||
type: "Select",
|
||
option: stateListq
|
||
}
|
||
},
|
||
{
|
||
title: "超期天数",
|
||
align: "center",
|
||
key: "jandate",
|
||
width: "120",
|
||
filter: {
|
||
type: "Input"
|
||
}
|
||
},
|
||
{
|
||
title: "是否欠机",
|
||
align: "center",
|
||
width: "120",
|
||
key: "kcyl2",
|
||
render: (h, params) => {
|
||
return <div> {this.Formatkcyl(params.row.kcyl)} </div>;
|
||
},
|
||
filter: {
|
||
type: "Select",
|
||
option: isqj
|
||
}
|
||
}
|
||
]
|
||
};
|
||
},
|
||
computed: {
|
||
filertData() {
|
||
let data = this.datas;
|
||
if (this.strfilter && this.strfilter !== "") {
|
||
let filterKey = this.strfilter
|
||
.toLowerCase()
|
||
.trim()
|
||
.split(/\s+/);
|
||
if (filterKey.length > 0) {
|
||
data = data.filter(item => {
|
||
return Object.keys(item).some(key => {
|
||
return filterKey.some(filter => {
|
||
return (
|
||
String(item[key])
|
||
.toLowerCase()
|
||
.indexOf(filter) > -1
|
||
);
|
||
});
|
||
});
|
||
});
|
||
}
|
||
}
|
||
return data;
|
||
},
|
||
usePage() {
|
||
if (this.page) {
|
||
return this.page;
|
||
} else {
|
||
return this.filertData.length > 15;
|
||
}
|
||
},
|
||
total() {
|
||
return this.filertData.length;
|
||
},
|
||
pagedData() {
|
||
if (this.usePage) {
|
||
return pageingData(this.filertData, this.pageSize, this.pageNo);
|
||
} else {
|
||
return this.filertData;
|
||
}
|
||
} /*
|
||
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();
|
||
},
|
||
Formatkcyl(kcyl) {
|
||
if (kcyl > 0) {
|
||
return "否";
|
||
} else {
|
||
return "是";
|
||
}
|
||
},
|
||
async loadData() {
|
||
let _beginDate = null;
|
||
let _endDate = 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];
|
||
}
|
||
|
||
let _filert = {
|
||
inv_codes:
|
||
this.filter.inv_codes !== ""
|
||
? this.filter.inv_codes.split(/[,\s\n,]/)
|
||
: null,
|
||
inv_std: this.filter.inv_std,
|
||
so_codes:
|
||
this.filter.so_code !== ""
|
||
? this.filter.so_code.split(/[,\s\n,]/)
|
||
: null,
|
||
begin_date: _beginDate,
|
||
end_date: _endDate,
|
||
flag: this.filter.flag
|
||
};
|
||
let resp = await getInventorySale(_filert);
|
||
this.pageNo = 1;
|
||
this.datas = resp.data.data;
|
||
this.datas = sortByKey(resp.data.data, "dDate");
|
||
this.datas.forEach(item => {
|
||
if (item.datewaring === "15天内发货") {
|
||
item.cellClassName = {
|
||
datewaring: "demo-table-info-cell-address"
|
||
};
|
||
} else if (item.datewaring === "超期") {
|
||
item.cellClassName = {
|
||
datewaring: "demo-table-info-cell-age"
|
||
};
|
||
} else {
|
||
item.cellClassName = {
|
||
datewaring: "demo-table-info-cell-name"
|
||
};
|
||
}
|
||
});
|
||
},
|
||
async onSearch(search) {
|
||
//模拟数据库查询数据
|
||
//这个search应该是传到后台,然后台来根据条件查询数据库
|
||
//alert("查询条件:" + JSON.stringify(search, null, 4));
|
||
//console.log(JSON.stringify(search, null, 4));
|
||
|
||
//console.log(search);
|
||
|
||
if (JSON.stringify(search.cCusAbbName) == "{}") {
|
||
search.cCusAbbName = "";
|
||
}
|
||
if (JSON.stringify(search.cSOCode) == "{}") {
|
||
search.cSOCode = "";
|
||
}
|
||
if (JSON.stringify(search.cInvCode) == "{}") {
|
||
search.cInvCode = "";
|
||
}
|
||
if (JSON.stringify(search.cInvName) == "{}") {
|
||
search.cInvName = "";
|
||
}
|
||
if (JSON.stringify(search.cInvStd) == "{}") {
|
||
|
||
search.cInvStd = "";
|
||
}
|
||
if (JSON.stringify(search.wfiQuantity) == "{}") {
|
||
search.wfiQuantity = "";
|
||
}
|
||
if (JSON.stringify(search.kcyl) == "{}") {
|
||
search.kcyl = "";
|
||
}
|
||
if (JSON.stringify(search.datewaring) == "{}") {
|
||
search.datewaring = "";
|
||
}
|
||
if (JSON.stringify(search.cMemo) == "{}") {
|
||
search.cMemo = "";
|
||
}
|
||
|
||
let _filert = {
|
||
c_cus_abb_name: search.cCusAbbName,
|
||
d_date: search.dDate,
|
||
c_so_code: search.cSOCode,
|
||
c_inv_code: search.cInvCode,
|
||
c_inv_name: search.cInvName,
|
||
c_inv_std: search.cInvStd,
|
||
wfi_quantity: search.wfiQuantity,
|
||
kcyl: search.kcyl,
|
||
d_pre_date: search.dPreDate,
|
||
datewaring: search.datewaring,
|
||
c_memo: search.cMemo,
|
||
jandate: search.jandate,
|
||
kcyl2: search.kcyl2
|
||
};
|
||
|
||
let resp = await getInventorySale(_filert);
|
||
this.pageNo = 1;
|
||
this.datas = resp.data.data;
|
||
this.datas = sortByKey(resp.data.data, "dDate");
|
||
this.datas.forEach(item => {
|
||
if (item.datewaring === "15天内发货") {
|
||
item.cellClassName = {
|
||
datewaring: "demo-table-info-cell-address"
|
||
};
|
||
} else if (item.datewaring === "超期") {
|
||
item.cellClassName = {
|
||
datewaring: "demo-table-info-cell-age"
|
||
};
|
||
} else {
|
||
item.cellClassName = {
|
||
datewaring: "demo-table-info-cell-name"
|
||
};
|
||
}
|
||
});
|
||
},
|
||
|
||
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;
|
||
}
|
||
|
||
.ivu-table .demo-table-info-cell-name {
|
||
background-color: #2db7f5;
|
||
color: #fff;
|
||
}
|
||
.ivu-table .demo-table-info-cell-age {
|
||
background-color: #ff6600;
|
||
color: #fff;
|
||
}
|
||
.ivu-table .demo-table-info-cell-address {
|
||
background-color: #187;
|
||
color: #fff;
|
||
}
|
||
body {
|
||
padding: 10px 1;
|
||
}
|
||
|
||
.ivu-select-dropdown-transfer {
|
||
width: 165px;
|
||
max-height: 160px;
|
||
}
|
||
|
||
.ivu-auto-complete.ivu-select-dropdown {
|
||
max-height: 500px;
|
||
}
|
||
</style> |