You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

205 lines
6.2 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width" />
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6. <title>CardPrint</title>
  7. @Html.AppendJsFile("/Content/jquery/jquery-1.10.2.min.js", "/Content/jquery/plugin/jqprint/jquery.jqprint-0.3.js", "/Content/js/qrcode.min.js")
  8. <link href="~/Content/cardprint/CardPrint.css" rel="stylesheet" />
  9. <script>
  10. function request(d) {
  11. for (var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) {
  12. var b = c[a].split("=");
  13. if (b[0] == d)
  14. if ("undefined" == unescape(b[1])) break;
  15. else return unescape(b[1]);
  16. }
  17. return "";
  18. };
  19. </script>
  20. <style>
  21. body {
  22. border: 0;
  23. padding: 0 0 0px 0;
  24. margin: 0;
  25. /* font-family: Arial, Helvetica, sans-serif!important; */
  26. /* font-weight: bold; */
  27. }
  28. #qrcodeBox {
  29. width: 390px;
  30. margin: 0 auto;
  31. }
  32. .qrcodeBox {
  33. padding: 18px 5px 0;
  34. /* margin-top:20px; */
  35. }
  36. .qrcodeBox > div {
  37. margin: 0 auto 5px;
  38. }
  39. .qrcodes {
  40. float: left;
  41. font-size: 12px;
  42. }
  43. #roghtDiv {
  44. margin-top: -2px;
  45. margin-left: 70px;
  46. text-align: left;
  47. }
  48. #roghtDiv div {
  49. height: 20px;
  50. line-height: 20px;
  51. font-size: 13px;
  52. }
  53. #top {
  54. overflow: hidden;
  55. }
  56. #bottom {
  57. line-height: 24px;
  58. font-size: 14x;
  59. padding-top: 10px;
  60. }
  61. #bottom div {
  62. height: 24px;
  63. overflow: hidden;
  64. }
  65. </style>
  66. </head>
  67. <body style="">
  68. <div id="qrcodeBox">
  69. </div>
  70. <div id="btnprint" type="button" class="btns" value="打印">打印</div>
  71. <script>
  72. var keyValue = request('keyValue');
  73. var aName = request('aName');
  74. var AIId = request('AIId');
  75. $(function () {
  76. $.ajax({
  77. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetFormData?keyValue=' + AIId,
  78. type: "GET",
  79. dataType: "json",
  80. async: true,
  81. success: function (res) {
  82. var data = res.data.Ass_AssetsInfoItem;
  83. var arr = [];
  84. if(!Array.isArray(data)){
  85. arr.push(data)
  86. }else{
  87. arr = data
  88. }
  89. var html = '';
  90. $.each(arr, function(i, n){
  91. var AIDepartment = "部门:";
  92. top.learun.clientdata.getAsync('department', {
  93. key: n.AIDepartment,
  94. callback: function (_data) {
  95. AIDepartment += _data.name;
  96. }
  97. });
  98. var AIUsePeople = "姓名:";
  99. if (n.AIUsePeople) {
  100. top.learun.clientdata.getAsync('custmerData',
  101. {
  102. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  103. key: n.AIUsePeople,
  104. keyId: 'f_userid',
  105. callback: function(_data) {
  106. AIUsePeople += _data['f_realname'];
  107. }
  108. });
  109. } else
  110. AIUsePeople += "暂无";
  111. var AIIStorage = "位置:";
  112. top.learun.clientdata.getAsync('custmerData',
  113. {
  114. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
  115. key: n.AIIStorageId,
  116. keyId: 'sid',
  117. callback: function (_data) {
  118. AIIStorage += _data['sname'];
  119. }
  120. });
  121. var AIIStoragePosition = "";
  122. top.learun.clientdata.getAsync('custmerData',
  123. {
  124. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room',
  125. key: n.AIIStoragePosition,
  126. keyId: 'rid',
  127. callback: function (_data) {
  128. AIIStoragePosition = _data['rcode'];
  129. }
  130. });
  131. var AIIStorageStr = ''
  132. if (AIIStoragePosition) {
  133. AIIStorageStr = AIIStorage + "-" + AIIStoragePosition;
  134. } else {
  135. AIIStorageStr = AIIStorage;
  136. }
  137. html += '<div class="qrcodeBox" style="page-break-before: auto;page-break-after: always;"><div style="">'+
  138. '<div id="top">'+
  139. '<div id="qrcode'+ i +'" class="qrcodes" val="'+ n.AICodeNumJY +'"></div>'+
  140. '<div id="roghtDiv" style="">'+
  141. '<div id="AIDepartment">'+ AIDepartment +'</div>'+
  142. '<div id="AIUsePeople">'+ AIUsePeople +'</div>'+
  143. '<div id="AIIStorageAndRoom">'+ AIIStorageStr +'</div>'+
  144. '</div>'+
  145. '</div>'+
  146. '<div id="bottom">'+
  147. '<div id="AICodeNumJY">编号:'+ n.AICodeNumJY +'</div>'+
  148. '<div id="AIASSName">名称:'+ n.AIASSName +'</div>'+
  149. '</div>'+
  150. '</div></div>';
  151. // $('#AIDepartment').html(AIDepartment);
  152. // $('#AIUsePeople').html(AIUsePeople);
  153. // if (AIIStoragePosition) {
  154. // $('#AIIStorageAndRoom').html(AIIStorage + "-" + AIIStoragePosition);
  155. // } else {
  156. // $('#AIIStorageAndRoom').html(AIIStorage);
  157. // }
  158. // $('#AICodeNumJY').html("编号:"+data.AICodeNumJY);
  159. // $('#AIASSName').html("名称:"+data.AIASSName);
  160. })
  161. $('#qrcodeBox').html(html);
  162. $('.qrcodes').each(function(i, n){
  163. var id = $(n).attr('id');
  164. var val = $(n).attr('val')
  165. var qrcode = new QRCode(document.getElementById(id), {
  166. width: 60,
  167. height: 60
  168. });
  169. qrcode.makeCode(val);
  170. })
  171. }
  172. });
  173. $("#btnprint").on("click", function () {
  174. $('#qrcodeBox').jqprint();
  175. });
  176. });
  177. function AddPrintContent3() {
  178. // $('#btnprint').css('display', 'none');
  179. // window.print();
  180. // $('#btnprint').css('display', 'block');
  181. $('.tableBox').jqprint();
  182. }
  183. </script>
  184. </body>
  185. </html>