index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. <select name="status" class="form-control">
  13. <option value="">选择状态</option>
  14. <option value="0">盘库中</option>
  15. <option value="1">完成</option>
  16. </select>
  17. </div>
  18. <div class="input-group">
  19. <span class="input-group-btn">
  20. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  21. </span>
  22. <span class="input-group-btn">
  23. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  24. </span>
  25. </div>
  26. </form>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="ibox-content">
  31. <div class="jqGrid_wrapper">
  32. <table id="table" style="border-collapse: collapse"></table>
  33. <div id="pager"></div>
  34. </div>
  35. </div>
  36. </div>
  37. {/block}
  38. {block name="script"}
  39. <script>
  40. $(function () {
  41. $(window).bind("resize",function(){
  42. var width=$(".jqGrid_wrapper").width();
  43. $("#table").setGridWidth(width);
  44. });
  45. $.jgrid.defaults.styleUI="Bootstrap";
  46. $("#table").jqGrid({
  47. url:"{:url('index')}",
  48. datatype: "json",
  49. colModel:[
  50. {label:'盘点人',name:'user_name',index:'user_name', width:70,sortable: false},
  51. {label:'盘点说明',name:'remark',index:'remark', width:70,sortable: false},
  52. {label:'盘点开始时间',name:'create_time',index:'create_time', width:70,sortable: false},
  53. {label:'盘点结束时间',name:'finish_time',index:'finish_time', width:70,sortable: false},
  54. {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  55. if(a == 0){
  56. return '<span >盘库中</span>';
  57. } else if(a == 1){
  58. return '<span >已完成</span>';
  59. }
  60. }},
  61. {label:'操作',width:60,sortable: false,formatter: function (a, b, c) {
  62. var report_url = "{:url('report',[],'')}/id/"+c.id;
  63. var detail_url = "{:url('detail',[],'')}/id/"+c.id;
  64. var finish_url = "{:url('finish',[],'')}/id/"+c.id;
  65. var del_url = "{:url('del',[],'')}/id/"+c.id;
  66. var btn = '<a url="'+report_url+'" href="javascript:;" data-title="报表" onclick="layer_open(this,1)" data-width="800px" ><span class="label label-primary" title="报表">报表</span></a>&nbsp;';
  67. btn += '<a href="'+detail_url+'" ><span class="label label-primary" title="明细">明细</span></a>&nbsp;';
  68. if(c.status == 0){
  69. btn += '<a href="'+finish_url+'" class="confirm ajax-get" data-confirm="确定要标记为完成状态吗?" data-table="1"><span class="label label-success" title="完成">完成</span></a>&nbsp;';
  70. }
  71. btn += '<a href="'+del_url+'" class="confirm ajax-get" data-confirm="确定要标记为删除吗?" data-table="1"><span class="label label-warning" title="删除">删除</span></a>';
  72. return btn;
  73. }},
  74. ],
  75. rowNum:10,
  76. rowList:[10,20,30,50,100],
  77. pager: '#pager',
  78. sortname: 'sort',
  79. viewrecords: true,
  80. autowidth:true,
  81. mtype: 'post',
  82. height: 'auto',
  83. emptyrecords: "暂无数据",
  84. sortorder: "asc",
  85. caption:"盘库列表",
  86. loadComplete: function (xhr) {
  87. if(xhr.code==0){
  88. layer.msg(xhr.msg);
  89. return false;
  90. }
  91. },
  92. });
  93. });
  94. </script>
  95. {/block}