

export const printingTemplate = (data) => {
hiprint.init();
const hiprintTemplate = new hiprint.PrintTemplate({
template: {
panels: [
{
// index: 0,
// paperType: 'A4',
height: 210,
width: 297,
paperHeader: 76.5,
paperFooter: 546,
printElements: [
{
options: {
left: 64.5,
top: 4.5,
height: 72,
width: 115.5,
src: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.58cdn.com.cn%2Fenterprise%2Fappearance%2Fbig%2Fn_v218105d1538b94b59b70b9d6ab23d6d40.jpg&refer=http%3A%2F%2Fpic1.58cdn.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1657260979&t=35c2237273dbfb393cc989a102f4adee',
},
printElementType: { type: 'image' },
},
{
options: {
left: 243,
top: 15,
height: 51,
width: 397.5,
title: '入库日报表',
fontSize: 21.75,
fontWeight: 'bolder',
textAlign: 'center',
textContentVerticalAlign: 'middle',
},
printElementType: { type: 'text' },
},
{
options: {
left: 64.5,
top: 96,
height: 36,
width: 706.5,
textAlign: 'center',
field: 'tableData',
columns: [
[
{
title: '仓库编号',
field: 'warehouseid',
width: 100.92,
colspan: 1,
rowspan: 1,
checked: true,
columnId: 'warehouseid',
},
{
title: '客户',
field: 'customerid',
width: 100.92,
colspan: 1,
rowspan: 1,
checked: true,
columnId: 'customerid',
},
{
title: '箱码',
field: 'alternativesku',
width: 303,
colspan: 1,
rowspan: 1,
checked: true,
columnId: 'alternativesku',
},
{
title: '入库日期',
field: 'receivedtime',
width: 100.92,
colspan: 1,
rowspan: 1,
checked: true,
columnId: 'receivedtime',
},
{
title: '质量状态',
field: 'qcstatus',
width: 100.92,
colspan: 1,
rowspan: 1,
checked: true,
columnId: 'qcstatus',
},
],
],
},
printElementType: { title: '表格', type: 'tableCustom' },
},
{
options: {
left: 64.5,
top: 555,
height: 18,
width: 120,
title: '制单人(签名/日期):',
},
printElementType: { type: 'text' },
},
{
options: {
left: 682,
top: 555,
height: 16.5,
width: 120,
field: 'printTime',
},
printElementType: { type: 'text' },
},
{
options: { left: 63, top: 546, height: 9, width: 708 },
printElementType: { type: 'hline' },
},
],
paperNumberLeft: 403.5,
paperNumberTop: 553.5,
rotate: true,
// paperNumberFormat: 'paperNo/paperCount',
},
],
},
});
hiprintTemplate.print({
printTime: new Date().toLocaleString(),
tableData: data,
});
};