0
0

index.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox">
  4. <div class="ibox-content">
  5. <div class="row">
  6. <div class="col-xs-3">
  7. <a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>
  8. </div>
  9. <div class="col-xs-9" style="text-align: right;">
  10. <form class="form-inline" id="form-search" action="{:url('index')}">
  11. <div class="input-group">
  12. <input type="text" class="form-control" name="title" placeholder="地点名称">
  13. </div>
  14. <div class="input-group">
  15. <select name="enable" class="form-control">
  16. <option value="">选择状态</option>
  17. <option value="0">禁用</option>
  18. <option value="1">正常</option>
  19. </select>
  20. </div>
  21. <div class="input-group">
  22. <span class="input-group-btn">
  23. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  24. </span>
  25. <span class="input-group-btn">
  26. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  27. </span>
  28. <span class="input-group-btn">
  29. <button class="btn-sm btn-primary" title="批量打印" id="allPrint" type="button" ><i class="fa fa-print"></i></button>
  30. </span>
  31. &nbsp;
  32. <span class="input-group-btn">
  33. <button class="btn-sm btn-primary" type="button" id="down">下载二维码</button>
  34. </span>
  35. </div>
  36. </form>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="ibox-content">
  41. <div class="jqGrid_wrapper">
  42. <table id="table" style="border-collapse: collapse"></table>
  43. <div id="pager"></div>
  44. </div>
  45. </div>
  46. </div>
  47. {/block}
  48. {block name="script"}
  49. <script>
  50. $('#down').click(function () {
  51. window.location.href = '{:url("addrdown")}'
  52. })
  53. $(function () {
  54. $(window).bind("resize",function(){
  55. var width=$(".jqGrid_wrapper").width();
  56. $("#table").setGridWidth(width);
  57. });
  58. $.jgrid.defaults.styleUI="Bootstrap";
  59. $("#table").jqGrid({
  60. url:"{:url('index')}",
  61. datatype: "json",
  62. colModel:[
  63. {label:'编号',name:'id',index:'id', width:40,sortable: false},
  64. {label:'任务地点名称',name:'title',index:'title', width:60,sortable: false},
  65. // {label:'工作人员',name:'user_name',index:'user_name', width:100,sortable: false},
  66. {label:'二维码',name:'id',index:'id',width:60,editable: false,sortable: false,formatter:function (a,b,c){
  67. var url = "{:url('qrcode',[],'')}/fn/id/fv/1/id/"+c.id;
  68. return '<a href="'+url+'"><span class="label label-danger" title="查看">查看</span></a>';
  69. }},
  70. {label:'创建时间',name:'create_time',index:'create_time', width:60,sortable: false},
  71. {label:'状态',name:'enable',index:'enable',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  72. if(a == 0){
  73. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  74. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  75. } else{
  76. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  77. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  78. }
  79. }},
  80. {label:'操作',width:60,sortable: false,formatter: function (a, b, c) {
  81. var editurl = "{:url('add',[],'')}/id/"+c.id;
  82. var delurl = "{:url('del',[],'')}/id/"+c.id;
  83. var btn = '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  84. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  85. return btn;
  86. }},
  87. ],
  88. rowNum:10,
  89. rowList:[10,20,30,50,100],
  90. pager: '#pager',
  91. sortname: 'id',
  92. viewrecords: true,
  93. autowidth:true,
  94. mtype: 'post',
  95. height: 'auto',
  96. emptyrecords: "暂无数据",
  97. sortorder: "desc",
  98. caption:"{$meta_title}",
  99. multiselect: true,//可多选
  100. loadComplete: function (xhr) {
  101. if(xhr.code==0){
  102. layer.msg(xhr.msg);
  103. return false;
  104. }
  105. },
  106. });
  107. $('#allPrint').click(function () {
  108. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  109. var ids = rowIds.join(',');
  110. console.log(ids);
  111. var url = "{:url('allPrint')}?ids="+ids;
  112. layer.open({
  113. type: 2,
  114. title: '批量打印二维码',
  115. shadeClose: true,
  116. shade: 0.3,
  117. maxmin: true,
  118. area: ['90%', '90%'],
  119. content: url,
  120. });
  121. })
  122. });
  123. </script>
  124. {/block}