all_print.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. {extend name="common/common2" /}
  2. <link rel="stylesheet" href="/static/bootstrap-multiselect-0.9.15/dist/css/bootstrap-multiselect.css">
  3. {block name="main"}
  4. <style>
  5. .printerbox{
  6. border:1px solid #ccc;
  7. margin: 0 auto;
  8. background-color: #fff;
  9. padding: 10px;
  10. }
  11. .printerbox img{
  12. width: 100%;
  13. }
  14. .printerbox p{
  15. padding-top: 10px;
  16. }
  17. .duoxuan span.multiselect-native-select{
  18. position:relative;
  19. }
  20. .duoxuan span.multiselect-native-select select {
  21. left: 50%;
  22. top: 30px;
  23. clip: rect(0px, 0px, 0px, 0px) !important;
  24. height: 1px !important;
  25. position: absolute !important;
  26. width: 1px !important;
  27. border-width: 0px !important;
  28. border-style: initial !important;
  29. border-color: initial !important;
  30. border-image: initial !important;
  31. margin: -1px -1px -1px -3px !important;
  32. overflow: hidden !important;
  33. padding: 0px !important;
  34. }
  35. </style>
  36. <div class="ibox">
  37. <div class="ibox-content">
  38. <div class="row">
  39. <div class="col-xs-4">
  40. <a href="javascript:;" class="btn btn-sm btn-primary" onclick="print()"><i class="glyphicon glyphicon-print"> 打印</i></a>
  41. </div>
  42. <div class="col-xs-8" style="text-align: right;">
  43. <form class="form-inline" action="{:url('allPrint')}" method="get" id="form-search">
  44. <div class="input-group">
  45. <select name="colNum" class="form-control">
  46. <option value="4" {if $colNum== 4}selected{/if}>一行三列</option>
  47. <option value="6" {if $colNum== 6}selected{/if}>一行两列</option>
  48. <option value="3" {if $colNum== 3}selected{/if}>一行四列</option>
  49. </select>
  50. </div>
  51. <div class="input-group duoxuan">
  52. <select id="dids" name="ids[]" multiple="multiple">
  53. {volist name="deviceList" id="v"}
  54. <option value="{$v['id']}" {if condition="isset($ids) and in_array($v['id'],$ids)"}selected{/if}>{$v['title']}</option>
  55. {/volist}
  56. </select>
  57. </div>
  58. <div class="input-group">
  59. <span class="input-group-btn">
  60. <button class="btn-sm btn-primary" title="搜索" type="button" id ="searchBtn" ><i class="fa fa-search"></i></button>
  61. </span>&nbsp;
  62. </div>
  63. </form>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <div id="printer" class="text-center">
  69. {foreach $list as $key => $value}
  70. <div class="col-xs-{$colNum} printerbox">
  71. <img src="{:url('Qrcode/qrcode')}?code={$value['qCode']}" alt="二维码">
  72. <p class="text-center">{$value['title']}</p>
  73. </div>
  74. {/foreach}
  75. </div>
  76. <div class="text-center">
  77. <br>
  78. </div>
  79. <script src="/static/jquery-1.11.3.min.js"></script>
  80. <script src="/static/browser.js"></script>
  81. <script src="/static/jquery.jqprint-0.3.js"></script>
  82. <script src="/static/bootstrap-multiselect-0.9.15/dist/js/bootstrap-multiselect.js"></script>
  83. <script>
  84. function print(){
  85. $("#printer").jqprint();
  86. }
  87. </script>
  88. <script>
  89. // var index = layer.load(1, {
  90. // shade: [0.1,'#fff'] //0.1透明度的白色背景
  91. // });
  92. // document.onreadystatechange = function()   //当页面加载状态改变的时候执行function
  93. // {
  94. // if(document.readyState == "complete") {   //当页面加载状态为完全结束时进入
  95. // layer.closeAll();
  96. // window.print();
  97. // }
  98. // }
  99. $('#dids').multiselect({
  100. buttonText: function(options, select) {
  101. if (options.length === 0) {
  102. return '请选择设备';
  103. }
  104. else if (options.length > 2) {
  105. return '已选择'+options.length+'项';
  106. }
  107. else {
  108. var labels = [];
  109. options.each(function() {
  110. if ($(this).attr('label') !== undefined) {
  111. labels.push($(this).attr('label'));
  112. }
  113. else {
  114. labels.push($(this).html());
  115. }
  116. });
  117. return labels.join(', ') + '';
  118. }
  119. },
  120. filterPlaceholder: '搜索',
  121. includeSelectAllOption: true, // 显示全选
  122. selectAllText: '全选',
  123. maxHeight: 300,
  124. // enableClickableOptGroups: true, // 分组可选
  125. // enableCollapsibleOptGroups: true, // 分组可折叠
  126. enableFiltering: true, // 开启搜索
  127. buttonClass: 'btn btn-primary',
  128. onChange: function(option, checked) {
  129. console.log(option.length + ' options ' + (checked ? 'selected' : 'deselected'));
  130. }
  131. });
  132. //搜索
  133. $('#searchBtn').on('click', function() {
  134. var that = this;
  135. var self = $("#form-search").serialize();
  136. var url = "{:url('Device/allPrint')}?"+self;
  137. window.location.href = url;
  138. });
  139. </script>
  140. {/block}