You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdd-order-api/app/views/static/pdd_custom_template.xml

45 lines
2.2 KiB
XML

1 year ago
<?xml version="1.0" encoding="utf-8"?>
<%
var customWidth = data.customAreaWidth * 8;
var customHeight = data.customAreaHeight * 8;
%>
<page height="<%= customHeight %>" width="<%= customWidth %>">
<layout height="<%= customHeight %>" width="<%= customWidth %>">
<% for (var i in data.nodes) { %>
<%
var node = data.nodes[i];
if (!node.nv || !node.style) {
continue;
}
var field = node.nv.field || '';
var value = node.nv.value || '';
var left = node.style.left * 8;
var top = node.style.top * 8;
var width = node.style.width * 8;
var height = node.style.height * 8;
var fontSize = node.style.fontSize * 2.82186949;
var fontWeight = node.fontWeight ? node.fontWeight : 'normal';
var fontFamily = node.fontFamily ? node.fontFamily : 'Microsoft YaHei';
var fontStyle = node.fontStyle ? node.fontStyle : 'normal';
var align = (node.style.textAlign == 'center' || node.style.textAlign == 'right') ? node.style.textAlign : 'left';
%>
<% if (field == 'line') { %>
<% if (node.nv.lineType == 'horizontal') { %>
<line left="<%= left %>" top="<%= top %>" width="<%= width %>" height="2"/>
<% } else if (node.nv.lineType == 'vertical') { %>
<line left="<%= left %>" top="<%= top %>" width="2" height="<%= height %>"/>
<% } %>
<% } else if (field == 'image') { %>
<image value="<%= node.nv.imgSrc %>" width="<%= width %>" height="<%= height %>" left="<%= left %>" top="<%= top %>"/>
<% } else if (field == 'logo') { %>
<image value="<%= node.nv.imgSrc %>" type="2" width="<%= width %>" height="<%= height %>" left="<%= left %>" top="<%= top %>"/>
<% } else if (field.indexOf('Barcode') > -1) { %>
<barcode value="<%= value %>" type="code128b" width="<%= width %>" height="<%= height %>" left="<%= left %>" top="<%= top %>"/>
<% } else if (field == 'customQrCode') { %>
<qrcode value="<%= value %>" width="<%= width %>" height="<%= height %>" left="<%= left %>" top="<%= top %>"/>
<% } else { %>
<text value="<%= value %>" width="<%= width %>" height="<%= height %>" left="<%= left %>" top="<%= top %>" fontSize="<%= fontSize %>" fontFamily="<%= fontFamily %>" fontWeight="<%= fontWeight %>" fontStyle="<%= fontStyle %>" align="<%= align %>"/>
<% } %>
<% } %>
</layout>
</page>