| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>打印包装清单</title>
- <link rel="stylesheet" href="../commons/css/font/iconfont.css"/>
- <link rel="stylesheet" href="../commons/css/awsui.css"/>
- <style>
- .listTable {
- width: 100%;
- border-collapse: collapse;
- }
- .listTable th, .listTable td {
- padding: 5px;
- text-align: center;
- border: 1px solid #ddd;
- }
- .listTable th {
- background-color: darkgrey;
- }
- .listTable tr:nth-child(even) {
- background-color: #f2f2f2;
- }
- .ButtonContainer ul {
- list-style-type: none;
- padding: 0;
- }
- .ButtonContainer li {
- display: inline-block;
- margin-right: 10px;
- cursor: pointer;
- }
- .ButtonContainer span.Text {
- vertical-align: middle;
- }
- @media print {
- .noprint {
- display: none;
- }
- @page {
- size: auto;
- margin: 0mm;
- }
- }
- </style>
- </head>
- <body>
- <div>
- <div class="TitleBar noprint">
- <div class="Title" style=" color: white; background-color: #346a95; font-size: 15pt; margin: 5px;">
- <span>打印包装清单</span>
- </div>
- </div>
- <div class="ButtonContainer header-title noprint" style="margin-left: 10px;">
- <button id="ViewPdfButton" type="button" class="awsui-btn awsui-btn-blue">打印</button>
- <button type="button" class="awsui-btn" onclick="closeDialog()">关闭</button>
- </div>
- <div class="DivSection" style="padding-left: 20px; width: 700px;">
- <div class="noprint" style="margin-top: 10px;">
- <select id="accountId" name="accountId" onchange="accountChange()" style="width: 450px;">
- </select>
- </div>
- <div id="quoteTemplateDiv" style="margin-top: 20px;">
- <div style="width: 100%; height: 50px;">
- <div style="float: right;">
- <span id="time_label"></span>
- <br/>
- <span style="font-weight: bold; font-size: larger;">包装清单</span>
- </div>
- </div>
- <div style="width: 50%; height: 50px; border: 1px solid; padding: 5px;">
- <div>销售目标地址:<span id="SALES_ADDRESS"></span></div>
- <div>配送地址:<span id="SHIP_TO_ADDRESS"></span></div>
- </div>
- <div style="width: 100%; height: 150px; border: 1px solid; padding: 5px; margin-top: 20px;">
- <div style="width: 48%; float: left; height: 100px;" id="accountInfo">
- </div>
- <div style="width: 48%; float: left; height: 100px;" id="otherInfo">
- </div>
- </div>
- <div id="dataTable" style="margin-top: 20px; width: 100%;">
- <table class="listTable">
- <thead>
- <tr>
- <th>产品</th>
- <th>序列号</th>
- <th>数量</th>
- </tr>
- </thead>
- <tbody id="dataTbody">
- <tr>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </body>
- <script language="JavaScript" src="../commons/js/jquery/scripts/jquery.js"></script>
- <script language="JavaScript" src="../commons/js/awsui.js"></script>
- <script type="text/javascript">
- const uid = "<#uid>";
- const sid = "<#sid>";
- const costPdtIds = "<#costPdtIds>";
- const accountListData = '<#accountList>';
- $(function () {
- //初始化
- $("#accountId").append("<option value='0'>请选择</option>");
- let accountList = JSON.parse(accountListData);
- for (let i = 0; i < accountList.length; i++) {
- $("#accountId").append("<option value='" + accountList[i].ACCOUNT_ID + "'>" + accountList[i].ACCOUNT_NAME + "</option>");
- }
- $("#accountId").val(accountList[0].ACCOUNT_ID);
- accountChange();
- // 更新时间函数
- function updateTime() {
- const date = new Date();
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, '0');
- const day = String(date.getDate()).padStart(2, '0');
- const hour = date.getHours();
- const minute = String(date.getMinutes()).padStart(2, '0');
- const second = String(date.getSeconds()).padStart(2, '0');
- const period = hour < 12 ? '上午' : '下午';
- $('#time_label').text(`${year}-${month}-${day} ${period} ${hour}:${minute}:${second}`);
- }
- // 页面加载时先执行一次
- updateTime();
- // 每隔 60 秒更新一次时间
- setInterval(updateTime, 500); // 60 * 1000 毫秒
- });
- //切换客户
- function accountChange() {
- let accountId = $("#accountId").val();
- $("#accountInfo").html("");
- $("#accountInfo").html($("#accountId").find("option:selected").text());
- $("#dataTbody").html("");
- $("#otherInfo").html("");
- awsui.ajax.request({
- type: "POST", async: false, dataType: "json",
- url: "./jd?cmd=com.awspaas.user.apps.donenow_ivt.getCostProductPackList",
- data: "sid=" + sid + "&accountId=" + accountId + "&costPdtIds=" + costPdtIds,
- success: function (res) {
- if (res.result == "ok") {
- var data = res.data;
- if (data.length > 0) {
- for (var i = 0; i < data.length; i++) {
- var row = data[i];
- var packings = row.PACKINGS;
- for (var j = 0; j < packings.length; j++) {
- var packing = packings[j];
- $("#dataTbody").append("<tr><td>" + packing.PRODUCTNAME + "</td><td>" + getValue(packing.SERIALNUMBER) + "</td><td>" + packing.QUANTITY + "</td></tr>")
- }
- $("#otherInfo").append(getValue(row.CONTRACT_INFO) + "<br/>");
- $("#SHIP_TO_ADDRESS").html(getValue(row.SHIP_TO_ADDRESS));
- $("#SALES_ADDRESS").html(getValue(row.SALES_ADDRESS));
- }
- }
- }
- }
- });
- }
- $("#ViewPdfButton").on("click", function () {
- window.print();
- });
- function closeDialog() {
- parent.document.querySelector(".el-overlay>.el-overlay-dialog[aria-label='包装清单']>div.full-center-dialog>.show-close>.el-dialog__headerbtn").click();
- }
- //undefined null 都转成 空字符
- function getValue(value) {
- if (value == undefined || value == null || typeof (value) == "undefined") {
- return "";
- } else {
- return value;
- }
- }
- </script>
- </html>
|