read.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <style>
  2. table{
  3. table-layout: fixed;
  4. }
  5. th{
  6. text-align: center;
  7. }
  8. </style>
  9. <div class="panel panel-default panel-intro">
  10. <div class="panel-body">
  11. <div id="myTabContent" class="tab-content">
  12. <div class="tab-pane fade active in" id="one">
  13. <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  14. width="100%">
  15. <tr>
  16. <th></th>
  17. <th>产品名称</th>
  18. <!--<th>产品编号</th>-->
  19. <th>专色墨批次号</th>
  20. <th>专色墨颜色</th>
  21. <!--<th>是否下机墨</th>-->
  22. <!--<th>是否报废</th>-->
  23. <th>重量(g)</th>
  24. <!--<th>库位</th>-->
  25. <!--<th>保质期(m)</th>-->
  26. <th>入库时间</th>
  27. </tr>
  28. {volist name="result" id="vo" key="key"}
  29. <tr align="center">
  30. <td>
  31. <a href="javascript:small_v2_print()" data-id="{$vo.id}" class="btn btn-primary btn-refresh print" title="打印条码">打印条码</a>
  32. </td>
  33. <td style=" white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{$vo.product_name}</td>
  34. <td>{$vo.bach_number}</td>
  35. <td>{$vo.color}</td>
  36. <td>{$vo.weight}</td>
  37. <td>{$vo.create}</td>
  38. </tr>
  39. {/volist}
  40. </table>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <!--<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>-->
  47. <script src="__CDN__/assets/js/jquery.min.js"></script>
  48. <script language="javascript" src="__CDN__/assets/js/LodopFuncs.js"></script>
  49. <!--<script src='http://20.0.3.164:18000/CLodopfuncs.js'></script>-->
  50. <script language="javascript" src="__CDN__/assets/js/tg_small_v2.js"></script>
  51. <script language="javascript" src="__CDN__/assets/js/template.js"></script>
  52. <script language="javascript" type="text/javascript">
  53. var LODOP; //声明为全局变量
  54. function prn1_print(html,barcode) {
  55. CreateOneFormPage(html,barcode);
  56. console.log(html);
  57. LODOP.PRINT();
  58. };
  59. function prn1_preview(html,barcode) {
  60. CreateOneFormPage(html,barcode);
  61. LODOP.PREVIEW();
  62. };
  63. function CreateOneFormPage(html,barcode){
  64. LODOP.SET_LICENSES("","152A06E8F6CBD6AC1F213ABFCB0D8604","C94CEE276DB2187AE6B65D56B3FC2848","");
  65. LODOP=getLodop();
  66. LODOP.PRINT_INIT("专色墨库存二维码打码");
  67. //LODOP.SET_PRINT_STYLE("FontSize",8);
  68. LODOP.SET_PRINT_STYLE("Bold",0);
  69. LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
  70. //LODOP.ADD_PRINT_TEXT(30,40,350,45,"浙江美浓世纪集团有限公司");
  71. LODOP.ADD_PRINT_HTM(12,10,350,500,html);
  72. LODOP.SET_PRINT_STYLEA(1,"AngleOfPageInside",270);
  73. LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","L");
  74. LODOP.ADD_PRINT_BARCODE(56,18,'180mm','30mm',"QRCode",barcode);
  75. };
  76. // function dateFamite(date) {
  77. // return '20'+date.substr(0, 2)+'/'+date.substr(2, 2)+'/'+date.substr(4, 2);
  78. // }
  79. // function changetime(time) {
  80. // var gtime=20000000;
  81. // var times=parseInt(time)+parseInt(gtime);
  82. // return times;
  83. // }
  84. // function getBathINo(code_cp1,bath_id) {
  85. // var bath_no;
  86. // if(bath_id.length<6){
  87. // bath_no=code_cp1.substr(0, 6);
  88. // for(i=0;i<(6-bath_id.length);i++){
  89. // bath_no=bath_no+'0';
  90. // }
  91. // }
  92. // bath_no= bath_no+bath_id;
  93. // return bath_no;
  94. //
  95. // }
  96. //小件云打印数据处理
  97. function small_v2_print(result) {
  98. $('.print').click(function () {
  99. var bach = $(this).parent().siblings(':first').next().text();
  100. // console.log(bach);return false;
  101. var product_number = bach.substring(0,9);
  102. var bach_number = bach.substring(9);
  103. // console.log($(this).parent().siblings(':first').text());
  104. // console.log($(this).parent().siblings(':first').next().next().next().text());
  105. // console.log($(this).parent().siblings(':first').next().next().text());
  106. // return false;
  107. var html = template(document.getElementById('tpl').innerHTML, {
  108. product_name:$(this).parent().siblings(':first').text(),
  109. product_number:product_number,
  110. color:$(this).parent().siblings(':first').next().next().text(),
  111. bach_number:bach_number,
  112. });
  113. var barcode=bach;
  114. // var barcode='1904119-149-001';
  115. for(i=0;i<1;i++){
  116. if(false){
  117. //为测试服务器,预览
  118. prn1_preview(html,barcode);//预览
  119. }else if(window.location.host=="ink.7in6.com"){
  120. //为正式服务器,打印
  121. prn1_print(html,barcode);//打印
  122. }else{
  123. prn1_preview(html,barcode);//打印
  124. }
  125. }
  126. })
  127. }
  128. // function toSubmit(){
  129. // console.log('ok');
  130. // //请求接口
  131. // $.ajax({
  132. // type:"POST",
  133. // url:"2.php",
  134. // success: function(result){
  135. // //判断返回值,弹出用户提示
  136. // small_v2_print(result);
  137. // },
  138. // error: function(e){
  139. // swal("","网络延迟,稍后操作.");
  140. // }
  141. // })
  142. // };
  143. </script>
  144. <script id="tpl" type="text/html">
  145. <style type="text/css">
  146. .tg {width:320px;margin-top:38px;position: absolute;}
  147. .tg td{text-align:left;font-family:"方正俊黑简体_粗";font-size:12px;padding:5px 2px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
  148. .tg th{font-family:"方正俊黑简体_粗";font-size:12px;font-weight:normal;padding:5px 2px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
  149. .tg .tg-s6z2{ font-size:13px;width: 200px;}
  150. .tg .tg-s6z1{ width:60px;}
  151. .tg .code{font-size:12px;}
  152. .tg .tg-031e{text-align:left;}
  153. .tg .tg-s6z2 img{}
  154. .tg .font_bold{ font-size: 75px; }
  155. </style>
  156. <table class="tg" cellpadding='0' cellspacing="0" width="100%" style="border:1px solid #000000;">
  157. <tr>
  158. <td class="tg-s6z1" rowspan="4" colspan="2">
  159. </td>
  160. <td class="tg-s6z2 " colspan="4" ><%=product_name%></td>
  161. </tr>
  162. <tr>
  163. <td class="tg-s6z2" colspan="2"><%=product_number%></td>
  164. </tr>
  165. <tr>
  166. <td class="tg-s6z2" colspan="2"><%=bach_number%></td>
  167. </tr>
  168. <tr>
  169. <td class="tg-s6z2" colspan="2"><%=color%></td>
  170. </tr>
  171. </table>
  172. </script>