index.html 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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="javascript:;" url="{:url('add')}" data-title="新增" onclick="layer_open(this,1)" 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="sn" placeholder="编号">
  13. </div>
  14. <div class="input-group">
  15. <select name="type" class="form-control">
  16. <option value="">选择类型</option>
  17. {foreach $typeList as $k=>$v}
  18. <option value="{$k}">{$v}</option>
  19. {/foreach}
  20. </select>
  21. </div>
  22. <div class="input-group">
  23. <span class="input-group-btn">
  24. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  25. </span> &nbsp;
  26. <span class="input-group-btn">
  27. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  28. </span>&nbsp;
  29. <span class="input-group-btn">-->
  30. <button class="btn-sm btn-primary" data-url="{:url('import')}" type="button" id ="upload" ><i class="fa fa-upload"></i></button>
  31. </span>
  32. </div>
  33. </form>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="ibox-content">
  38. <div class="jqGrid_wrapper">
  39. <table id="table" style="border-collapse: collapse"></table>
  40. <div id="pager"></div>
  41. </div>
  42. </div>
  43. </div>
  44. {/block}
  45. {block name="script"}
  46. <script>
  47. $(function () {
  48. $(window).bind("resize",function(){
  49. var width=$(".jqGrid_wrapper").width();
  50. $("#table").setGridWidth(width);
  51. });
  52. $.jgrid.defaults.styleUI="Bootstrap";
  53. $("#table").jqGrid({
  54. url:"{:url('index')}",
  55. datatype: "json",
  56. colModel:[
  57. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  58. {label:'编号',name:'sn',index:'sn',width:150,editable: false,sortable: false},
  59. {label:'类型',name:'typeName',index:'typeName',width:150,editable: false,sortable: false},
  60. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  61. var editurl = "{:url('add',[],'')}/id/"+c.id;
  62. var delurl = "{:url('del',[],'')}/id/"+c.id;
  63. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  64. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  65. return btn;
  66. }},
  67. ],
  68. rowNum:10,
  69. rowList:[10,20,30,50,100],
  70. pager: '#pager',
  71. sortname: 'id',
  72. viewrecords: true,
  73. autowidth:true,
  74. mtype: 'post',
  75. height: 'auto',
  76. emptyrecords: "暂无数据",
  77. sortorder: "desc",
  78. caption:"设备记录列表",
  79. loadComplete: function (xhr) {
  80. if(xhr.code==0){
  81. layer.msg(xhr.msg);
  82. return false;
  83. }
  84. },
  85. });
  86. });
  87. </script>
  88. {/block}