到货单

This commit is contained in:
杰 朱
2021-05-31 17:06:19 +08:00
parent aa9153e25b
commit 504e915b52
17 changed files with 733 additions and 31 deletions

View File

@@ -6,7 +6,7 @@
<Icon type="ios-stats" />
ERP查询
</template>
<MenuGroup title="库存">
<MenuGroup title="报表">
<MenuItem to="/inventory" name="3-2">物料在途在制查询表</MenuItem>
<MenuItem to="/inventoryMom" name="3-3">跟单记录表</MenuItem>
<MenuItem to="/InventoryMonth" name="3-4">材料出库数据与品种</MenuItem>
@@ -18,6 +18,16 @@
<MenuItem to="/Purchasesum" name="3-99">采购查询汇总</MenuItem>
</MenuGroup>
</Submenu>
<Submenu name="4">
<template slot="title">
<Icon type="ios-stats" />
ERP单据
</template>
<MenuGroup title="单据">
<MenuItem to="/inventoryrrival" name="4-2">到货单</MenuItem>
</MenuGroup>
</Submenu>
</Menu>
<div class="contain">
<router-view></router-view>

View File

@@ -21,3 +21,9 @@ export const Purchasesummom = (info) => {
return axios.post('/api/Purchase/Purchasesummom', info)
}
export const ArrivalGet = (info) => {
return axios.post('/api/Whreport/ArrivalGet', info)
}

View File

@@ -0,0 +1,385 @@
<template>
<div>
<h4>到货单</h4>
<div>
<Row :gutter="16">
<Col span="4">
<label>订单编号</label>
<Input autosize type="textarea" v-model="filter.ar_codes" />
</Col>
<Col span="4">
<label>物料编号</label>
<Input v-model="filter.inv_codes" />
</Col>
<Col span="4">
<Button
size="large"
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
<Button size="large" type="success" @click="print">打印</Button>
</Col>
</Row>
</div>
<div id="tb">
<Table
style="margin-top: 20px"
:loading="loading"
size="small"
border
:columns="columns"
:data="pagedData"
>
</Table>
</div>
<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"
/>
<Modal width="1366" v-model="modal1" title="单据详情" @on-cancel="cancel">
<Button size="large" type="primary" @click="print">打印</Button>
<div id="tb2">
<div>
<Row :gutter="16">
<Col span="7">
<label></label>
</Col>
<Col span="6">
<h1>采购到货单</h1>
</Col>
</Row>
</div>
<div>
<Row :gutter="16">
<Col span="8">
{{"到货单号:"+this.ccode}}
</Col>
<Col span="6">
{{"到货时间:"+this.ArrivalDate}}
</Col>
<Col span="4">
{{"业务员:"+this.cpersonname}}
</Col>
</Row>
</div>
<Table
style="margin-top: 20px"
height="700"
size="small"
border
:columns="columns2"
:data="datas2"
>
</Table>
</div>
</Modal>
</div>
</template>
<script>
import { ArrivalGet } from "@/api/Purchase";
//import vUpLoad from "@/bill/PrintView";
import { pageingData, export_col_to_excel, sortByKey } from "@/libs/tools";
export default {
//components:{vUpLoad},
data() {
return {
loading: false,
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
modal1: false,
printing: false,
strfilter: "",
multiple: false,
pageSize: 15,
datas: [],
ccode:"",
ArrivalDate:"",
cpersonname:"",
datas2: [],
filter: {
inv_codes: "",
inv_std: "",
ar_codes: "",
},
dom: "",
ranges: [
{
type: "price",
ccode: "",
// low: "", //区间的最小值
// height: "", //区间的最大值
},
],
columns: [
{
title: "到货单号",
align: "center",
key: "ArrivalCode",
className: "demo-table-info-old",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.ArrivalCode, //添加title属性
},
on: {
click: () => {
this.handleShow(params.row.ArrivalCode); //点击事件
},
},
},
params.row.ArrivalCode
),
]);
},
},
{
title: "到货日期",
align: "center",
key: "ArrivalDate",
},
{
title: "业务员",
align: "center",
key: "cpersonname",
},
{
title: "存货编码",
align: "center",
key: "MaterialCode",
},
{
title: "存货名称",
align: "center",
key: "cinvname",
},
{
title: "规格型号",
align: "center",
key: "cinvstd",
},
{
title: "单位",
align: "center",
key: "cinvm_unit",
},
{
title: "到货数量",
align: "center",
key: "Quantity",
},
{
title: "现存库位",
align: "center",
key: "cPosName",
width: 200,
},
],
columns2: [
{
title: "存货编码",
align: "center",
key: "MaterialCode",
width: 110,
className: "demo-table-info-new",
},
{
title: "存货名称",
align: "center",
key: "cinvname",
width: 130,
className: "demo-table-info-nom",
},
{
title: "规格型号",
align: "center",
key: "cinvstd",
width: 135,
className: "demo-table-info-nom",
},
{
title: "单位",
align: "center",
key: "cinvm_unit",
width: 80,
className: "demo-table-info-nom",
},
{
title: "数量",
align: "center",
key: "Quantity",
width: 80,
className: "demo-table-info-nom",
},
{
title: "现存库位",
align: "center",
key: "cPosName",
width: 160,
align: "left",
className: "demo-table-info-nom",
},
],
};
},
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();
},
print() {
this.dom = document.getElementById("tb2");
// console.log(this.dom);
this.$print(this.dom);
},
inventory(ranges) {
const skus = new Array();
//筛选条件
this.datas.map((Item, index) => {
if (Item.ArrivalCode == this.ranges[0].ccode) {
skus.push({
...Item,
});
}
});
return skus;
},
cancel() {
this.datas2 = [];
this.modal1 = false;
},
async handleShow(h) {
this.ranges[0].ccode = h;
this.datas2 = this.inventory(this.ranges);
this.ccode=h;
this.ArrivalDate=this.datas2[0].ArrivalDate;
this.cpersonname=this.datas2[0].cpersonname;
this.modal1 = true;
},
async loadData() {
try {
let _filert = {
c_inv_code: this.filter.inv_codes,
inv_std: this.filter.inv_std,
arrival_nolist:
this.filter.ar_codes !== ""
? this.filter.ar_codes.split(/[,\s\n,]/)
: null,
};
this.loading = true;
let resp = await ArrivalGet(_filert);
this.pageNo = 1;
this.datas = sortByKey(resp.data.data, "ArrivalCode");
// this.datas = resp.data.data;
} 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;
font-size: 12px;
}
.ivu-table td.demo-table-info-nom {
font-size: 11px;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>

View File

@@ -12,7 +12,9 @@ import VueRouter from "vue-router";
import routes from '@/route'
import print from './print'
Vue.use(print);
// const routes=[
// {

View File

@@ -0,0 +1,134 @@
// 打印类属性、方法定义
/* eslint-disable */
const Print = function (dom, options) {
if (!(this instanceof Print)) return new Print(dom, options);
this.options = this.extend({
'noPrint': '.no-print'
}, options);
if ((typeof dom) === "string") {
this.dom = document.querySelector(dom);
} else {
this.isDOM(dom);
this.dom = this.isDOM(dom) ? dom : dom.$el;
}
this.init();
};
Print.prototype = {
init: function () {
var content = this.getStyle() + this.getHtml();
this.writeIframe(content);
},
extend: function (obj, obj2) {
for (var k in obj2) {
obj[k] = obj2[k];
}
return obj;
},
getStyle: function () {
var str = "",
styles = document.querySelectorAll('style,link');
for (var i = 0; i < styles.length; i++) {
str += styles[i].outerHTML;
}
str += "<style>" + (this.options.noPrint ? this.options.noPrint : '.no-print') + "{display:none;}</style>";
str += '<style>html,body,div{height: auto!important;}</style>';
return str;
},
getHtml: function () {
var inputs = document.querySelectorAll('input');
var textareas = document.querySelectorAll('textarea');
var selects = document.querySelectorAll('select');
for (var k = 0; k < inputs.length; k++) {
if (inputs[k].type == "checkbox" || inputs[k].type == "radio") {
if (inputs[k].checked == true) {
inputs[k].setAttribute('checked', "checked")
} else {
inputs[k].removeAttribute('checked')
}
} else if (inputs[k].type == "text") {
inputs[k].setAttribute('value', inputs[k].value)
} else {
inputs[k].setAttribute('value', inputs[k].value)
}
}
for (var k2 = 0; k2 < textareas.length; k2++) {
if (textareas[k2].type == 'textarea') {
textareas[k2].innerHTML = textareas[k2].value
}
}
for (var k3 = 0; k3 < selects.length; k3++) {
if (selects[k3].type == 'select-one') {
var child = selects[k3].children;
for (var i in child) {
if (child[i].tagName == 'OPTION') {
if (child[i].selected == true) {
child[i].setAttribute('selected', "selected")
} else {
child[i].removeAttribute('selected')
}
}
}
}
}
return this.dom.outerHTML;
},
writeIframe: function (content) {
var w, doc, iframe = document.createElement('iframe'),
f = document.body.appendChild(iframe);
iframe.id = "myIframe";
//iframe.style = "position:absolute;width:0;height:0;top:-10px;left:-10px;";
iframe.setAttribute('style', 'position:absolute;width:0;height:0;top:-10px;left:-10px;');
w = f.contentWindow || f.contentDocument;
doc = f.contentDocument || f.contentWindow.document;
doc.open();
doc.write(content);
doc.close();
var _this = this
iframe.onload = function(){
_this.toPrint(w);
setTimeout(function () {
document.body.removeChild(iframe)
}, 100)
}
},
toPrint: function (frameWindow) {
try {
setTimeout(function () {
frameWindow.focus();
try {
if (!frameWindow.document.execCommand('print', false, null)) {
frameWindow.print();
}
} catch (e) {
frameWindow.print();
}
frameWindow.close();
}, 10);
} catch (err) {
console.log('err', err);
}
},
isDOM: (typeof HTMLElement === 'object') ?
function (obj) {
return obj instanceof HTMLElement;
} :
function (obj) {
return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string';
}
};
const MyPlugin = {}
MyPlugin.install = function (Vue, options) {
// 4. 添加实例方法
Vue.prototype.$print = Print
};
export default MyPlugin

View File

@@ -8,6 +8,7 @@ import inventorybu from '@/views/inventory-bu.vue'
import inventorypo from '@/views/inventory-po.vue'
import inventorypoc from '@/views/inventory-poc.vue'
import Purchasesum from '@/views/Purchasesum.vue'
import inventoryrrival from '@/bill/inventory-arrival.vue'
export default [
{
@@ -24,5 +25,6 @@ export default [
{ path: '/inventorybu', component: inventorybu },
{ path: '/inventorypo', component: inventorypo },
{ path: '/inventorypoc', component: inventorypoc },
{ path: '/Purchasesum', component: Purchasesum }
{ path: '/Purchasesum', component: Purchasesum },
{ path: '/inventoryrrival', component: inventoryrrival },
]