index.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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="title" placeholder="名称">
  13. </div>
  14. <div class="input-group">
  15. <span class="input-group-btn">
  16. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  17. </span> &nbsp;
  18. <span class="input-group-btn">
  19. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  20. </span>
  21. </div>
  22. </form>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="ibox-content">
  27. <div class="jqGrid_wrapper">
  28. <table id="table" style="border-collapse: collapse"></table>
  29. <div id="pager"></div>
  30. </div>
  31. </div>
  32. </div>
  33. {/block}
  34. {block name="script"}
  35. <script>
  36. $(function () {
  37. $(window).bind("resize",function(){
  38. var width=$(".jqGrid_wrapper").width();
  39. $("#table").setGridWidth(width);
  40. });
  41. $.jgrid.defaults.styleUI="Bootstrap";
  42. $("#table").jqGrid({
  43. url:"{:url('index')}",
  44. datatype: "json",
  45. colModel:[
  46. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  47. {label:'计划名称',name:'name',index:'name',width:80,editable: false,sortable: false},
  48. {label:'循环人员',name:'real_name',index:'real_name',width:40,sortable: true},
  49. {label:'备注',name:'remark',index:'remark',width:40,sortable: true},
  50. {label:'状态',name:'enable',index:'enable',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  51. if(a == 0){
  52. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  53. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  54. } else{
  55. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  56. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  57. }
  58. }},
  59. {label:'创建时间',name:'create_time',index:'create_time',width:40,sortable: true},
  60. {label:'操作',width:80,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 lx_url = "{:url('ConveyPlanAddr/index',[],'')}/id/"+c.id;
  64. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑部门" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  65. btn+= '<a href="'+lx_url+'" data-title="循环路线" ><span class="label label-primary" title="循环路线">循环路线</span></a>&nbsp;';
  66. btn += '<a {if !btnAuth(session("user_auth.id"),"ConveyPlan/del")} style="display:none" {/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  67. return btn;
  68. }},
  69. ],
  70. rowNum:10,
  71. rowList:[10,20,30,50,100],
  72. pager: '#pager',
  73. sortname: 'id',
  74. viewrecords: true,
  75. autowidth:true,
  76. mtype: 'post',
  77. height: 'auto',
  78. emptyrecords: "暂无数据",
  79. sortorder: "desc",
  80. caption:"循环计划列表",
  81. loadComplete: function (xhr) {
  82. if(xhr.code==0){
  83. layer.msg(xhr.msg);
  84. return false;
  85. }
  86. },
  87. });
  88. });
  89. </script>
  90. {/block}