到货单

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

@@ -7,6 +7,13 @@ namespace NX.ERP.Model.Request
{
public class Arrival:BaseModel
{
public List<string> ArrivalNolist { get; set; }
public string ArrivalNo { get; set; }
public string cInvCode { get; set; }
}
}

View File

@@ -23,6 +23,8 @@ namespace NX.ERP.Model.Purchase
public string PreparedBy { get; set; }
public string SupplierCode { get => supplierCode; set => supplierCode = value; }
public double ExchRate { get; set; }
public string ExchName { get; set; }

View File

@@ -19,6 +19,7 @@ namespace NX.ERP.Model.Purchase
public string UnitCode { get => unitCode; set => unitCode = value; }
public double Qty { get => quantity; set => quantity = value; }
public double RealQuantity { get; set; }
public string cPosName { get; set; }
/// <summary>
/// 审批状态2 说明已经审核过了
/// </summary>

View File

@@ -207,9 +207,10 @@ namespace U8AppMain
body.inventorycode = row["存货编码"].ToString().Trim();
body.taxrate = InvInfo[body.inventorycode].TaxRate;
body.requiredate = purchase.purchaseapp.header.date;
// body.requiredate = purchase.purchaseapp.header.date;
body.define25 = row["用料工位"].ToString().Trim();
body.quantity = decimal.Parse(row["数量"].ToString());
body.requiredate = row["需求日期"].ToString().Trim();
purchase.purchaseapp.body.Add(body);
}
}

View File

@@ -48,6 +48,7 @@
<Compile Include="FormatHelp.cs" />
<Compile Include="Mom\BomDAL.cs" />
<Compile Include="Mom\MomOrderDAL.cs" />
<Compile Include="Pmc\WarehouseQuery.cs" />
<Compile Include="Pmc\FinanceQuery.cs" />
<Compile Include="Pmc\PmcQuery.cs" />
<Compile Include="Pmc\PurchaseQuery.cs" />

View File

@@ -0,0 +1,85 @@
using NX.ERP.U8.Purchase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dapper;
namespace NX.ERP.U8.Finance
{
public class WarehouseQuery
{
/// <summary>
///
/// </summary>
/// <param name="strWhere"></param>
/// <param name="param"></param>
/// <returns></returns>
public IEnumerable<object> ArrivalGet(NX.ERP.Model.Request.Arrival arrival)
{
string sql = @"select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,CONVERT(varchar(100), a.dDate, 23) as ArrivalDate,A.cVenCode AS SupplierCode,
B.Autoid as id,b.ID as ArrivalID,b.cinvname,b.cinvstd,
b.cInvCode AS MaterialCode,
b.cBatch AS BatchNo,
b.fvalidinquan as RealQuantity,
b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum,
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate,
Pos.cPosName
FROM pu_ArrBody b WITH (NOLOCK) inner join pu_ArrHead a WITH (NOLOCK) on a.id=b.id
inner join (select cinvcode as cinvcode1,iId from inventory WITH (NOLOCK)) inventory on b.cinvcode=inventory.cinvcode1
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID ,
(SELECT cinvcode,
STUFF(
(
SELECT ','+ cPosName FROM ( select b.cPosName,a.cInvCode,a.iQuantity from InvPositionSum a WITH (NOLOCK) left join Position b WITH (NOLOCK) on a.cPosCode=b.cPosCode
where a.iQuantity <>0) a WHERE b.cinvcode = a.cinvcode order by a.iQuantity desc FOR XML PATH('')
),1 ,1, '') cPosName
FROM InvPositionSum b
GROUP BY cinvcode
) Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>''
And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1
";
List<string> where = new List<string>();
//处理-
if (!string.IsNullOrEmpty(arrival.cInvCode))
{
where.Add(" b.cinvcode = @cinvcode");
}
if (arrival.ArrivalNolist != null && arrival.ArrivalNolist.Count > 0)
{
where.Add(" a.cCode in @cCodelist");
}
if (!string.IsNullOrEmpty(arrival.ArrivalNo))
{
where.Add(" a.cCode = @cCode");
}
var aa = string.Join(" and ", where.ToArray());
if (!string.IsNullOrEmpty(aa))
{
sql += " and " + aa;
}
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{
return conn.Query<object>(sql, new { cCodelist = arrival.ArrivalNolist, cinvcode = arrival.cInvCode, cCode = arrival.ArrivalNo });
}
}
}
}

View File

@@ -7,7 +7,7 @@ namespace NX.ERP.U8.Purchase
{
public class ArrivalDAL
{
public IEnumerable<Model.Purchase.Arrival> GetList(string strWhere = "", object param = null)
public IEnumerable<Model.Purchase.Arrival> GetList(List<string> strWhere , object param = null)
{
using (var conn = U8LoginContext.Instance.Connection)
{
@@ -17,18 +17,35 @@ namespace NX.ERP.U8.Purchase
b.cBatch AS BatchNo,
b.fvalidinquan as RealQuantity,
b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum,
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate,
Pos.cPosName
FROM pu_ArrBody b inner join pu_ArrHead a on a.id=b.id
inner join (select cinvcode as cinvcode1,iId from inventory) inventory on b.cinvcode=inventory.cinvcode1
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工')
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID ,
(SELECT cinvcode,
STUFF(
(
SELECT ','+ cPosName FROM ( select b.cPosName,a.cInvCode,a.iQuantity from InvPositionSum a WITH (NOLOCK) left join Position b WITH (NOLOCK) on a.cPosCode=b.cPosCode
where a.iQuantity <>0) a WHERE b.cinvcode = a.cinvcode order by a.iQuantity desc FOR XML PATH('')
),1 ,1, '') cPosName
FROM InvPositionSum b
GROUP BY cinvcode
) Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>''
And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1";
if (!string.IsNullOrEmpty(strWhere))
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1
";
var aa = string.Join(" and ", strWhere.ToArray());
if (!string.IsNullOrEmpty(aa))
{
strSQL += $" and {strWhere} ";
strSQL += " and " + aa;
}
var lookup = new Dictionary<int, Model.Purchase.Arrival>();
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
var list = conn.Query<Model.Purchase.Arrival, Model.Purchase.ArrivalDetail, Model.Purchase.Arrival>(strSQL, (arrival, ArrivalDetail) =>
@@ -51,32 +68,54 @@ namespace NX.ERP.U8.Purchase
public Model.Purchase.Arrival GetModel(int id)
{
return this.GetList(" a.id=@Id ", new { id }).FirstOrDefault();
List<string> where = new List<string>();
where.Add("a.id=@Id");
return this.GetList(where, new { id }).FirstOrDefault();
}
public IEnumerable<Model.Purchase.Arrival> Query(NX.ERP.Model.Request.Arrival arrival)
{
var where = "";
List<string> where = new List<string>();
//处理-
if (!string.IsNullOrEmpty(arrival.cInvCode) )
{
where.Add(" b.cinvcode = @cinvcode");
}
if (arrival.ArrivalNolist != null && arrival.ArrivalNolist.Count > 0)
{
where.Add(" a.cCode in @cCodelist");
}
if (!string.IsNullOrEmpty(arrival.ArrivalNo))
{
where = " a.cCode like @Code ";
where.Add(" a.cCode = @cCode");
}
return this.GetList(where, new { Code = $"%{arrival.ArrivalNo}%" });
return this.GetList(where, new { cCodelist = arrival.ArrivalNolist, cinvcode= arrival.cInvCode, cCode = arrival.ArrivalNo });
}
public IEnumerable<Model.Purchase.Arrival> GetListByLastId(int Id)
{
List<string> where = new List<string>();
return this.GetList(" a.id>=@Id ", new { Id });
where.Add(" a.id>=@Id ");
return this.GetList(where, new { Id });
}
public Model.Purchase.Arrival GetModel(string Code)
{
return this.GetList(" a.cCode=@Code ", new { Code }).FirstOrDefault();
List<string> where = new List<string>();
where.Add(" a.cCode=@Code ");
return this.GetList(where, new { Code }).FirstOrDefault();
}

View File

@@ -0,0 +1,26 @@
using NX.ERP.U8.Purchase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers
{
public class WhreportController : ApiController
{
[Obsolete]
[HttpPost]
[Route("api/Whreport/ArrivalGet")]
public IEnumerable<object> ArrivalGet(NX.ERP.Model.Request.Arrival info)
{
var FinanceQuery = new NX.ERP.U8.Finance.WarehouseQuery();
return FinanceQuery.ArrivalGet(info);
}
}
}

View File

@@ -9,15 +9,15 @@ namespace NX.ERP.WebAPi.Controllers
{
public class ArrivalController : ApiController
{
[Obsolete]
[Route("api/Arrival/List")]
// GET api/values
[HttpGet]
public IEnumerable<Model.Purchase.Arrival> List()
{
var customerDAL = new ArrivalDAL();
return customerDAL.GetList();
}
//[Obsolete]
//[Route("api/Arrival/List")]
//// GET api/values
//[HttpGet]
//public IEnumerable<Model.Purchase.Arrival> List()
//{
// var customerDAL = new ArrivalDAL();
// return customerDAL.GetList();
//}
[Route("api/Arrival/Query")]
// GET api/values
@@ -37,7 +37,7 @@ namespace NX.ERP.WebAPi.Controllers
var customerDAL = new ArrivalDAL();
return customerDAL.GetModel(Code);
}
[Obsolete]
[Route("api/Arrival/list/{id}")]
[HttpGet]
public IEnumerable<Model.Purchase.Arrival> GetListByLastID(int id)

View File

@@ -160,6 +160,7 @@
<Compile Include="Controllers\AP\ApVouchController.cs" />
<Compile Include="Controllers\MOM\BomController.cs" />
<Compile Include="Controllers\MOM\MomOrderController.cs" />
<Compile Include="Controllers\Pmc\WhreportController.cs" />
<Compile Include="Controllers\Pmc\PurchaseController.cs" />
<Compile Include="Controllers\Pmc\FinanceController.cs" />
<Compile Include="Controllers\Pmc\PmcController.cs" />

View File

@@ -5,11 +5,11 @@
-->
<configuration>
<appSettings>
<add key="server" value="192.168.1.167" />
<add key="AccId" value="002" />
<add key="UserId" value="wx995" />
<add key="Password" value="1" />
<add key="EaiPort" value="80" />
<add key="server" value="10.0.0.12" />
<add key="AccId" value="u8-2@001" />
<add key="UserId" value="wx994" />
<add key="Password" value="1" />
<add key="EaiPort" value="80" />
<add key="EaiPath" value="U8EAI/import.asp" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />

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 },
]