index.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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="type" class="form-control">
  13. <option value="">选择类型</option>
  14. <option value="1">访客登记</option>
  15. <option value="2">现场登记</option>
  16. <option value="3">个人访客登记</option>
  17. </select>
  18. </div>
  19. <div class="input-group">
  20. <select name="service_id" class="form-control">
  21. <option value="">请选择服务</option>
  22. {volist name="$service" id="i"}
  23. <option value="{$i['id']|default=''}">{$i['title']}</option>
  24. {/volist}
  25. </select>
  26. </div>
  27. <div class="input-group">
  28. <span class="input-group-btn">
  29. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  30. </span>&nbsp;
  31. <span class="input-group-btn">
  32. <button class="btn-sm btn-warning " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  33. </span>
  34. </div>
  35. </form>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="ibox-content">
  40. <div class="jqGrid_wrapper">
  41. <table id="table" style="border-collapse: collapse"></table>
  42. <div id="pager"></div>
  43. </div>
  44. </div>
  45. </div>
  46. {/block}
  47. {block name="script"}
  48. <script>
  49. $(function () {
  50. $(window).bind("resize",function(){
  51. var width=$(".jqGrid_wrapper").width();
  52. $("#table").setGridWidth(width);
  53. });
  54. $.jgrid.defaults.styleUI="Bootstrap";
  55. $("#table").jqGrid({
  56. url:"{:url('index')}",
  57. datatype: "json",
  58. colModel:[
  59. {label:'编号',name:'id',index:'id', width:20,sortable: false},
  60. {label:'服务',name:'service_name',index:'service_name', width:40,sortable: false},
  61. {label:'姓名',name:'name',index:'name', width:30,sortable: false},
  62. {label:'电话',name:'phone',index:'phone', width:50,sortable: false},
  63. {label:'类型',name:'type',index:'type',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  64. if(a == 1){
  65. return '<span >访客登记</span>';
  66. } else if(a == 2){
  67. return '<span >现场登记</span>';
  68. }
  69. else if(a == 3){
  70. return '<span >个人访客登记</span>';
  71. }
  72. }},
  73. {label:'日期时间段',name:'time',index:'time',width:50,editable: false,sortable: false},
  74. // {label:'单位',name:'company',index:'company',width:30,editable: false,sortable: false},
  75. // {label:'车牌号',name:'plate_sn',index:'plate_sn',width:30,editable: false,sortable: false},
  76. // {label:'到访事由',name:'content',index:'content',width:40,editable: false,sortable: false},
  77. // {label:'到访时间',name:'book_time',index:'book_time',width:40,editable: false,sortable: false},
  78. // {label:'被拜访人',name:'form_user',index:'form_user',width:40,editable: false,sortable: false},
  79. {label:'状态',name:'status',index:'status',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  80. if(a == 0){
  81. return '<span class="label-success">待审核</span>';
  82. }else if(a == 1){
  83. return '<span class="label-primary">已预约</span>';
  84. }else if(a == 2){
  85. return '<span class="label-warning">已使用</span>';
  86. }else if(a == 3){
  87. return '<span class="label-danger">已过期</span>';
  88. }else if(a == 4){
  89. return '<span class="label-danger">已拒绝</span>';
  90. }
  91. }},
  92. {label:'创建时间',name:'create_time',index:'create_time',width:40,editable: false,sortable: false},
  93. {label:'操作',width:60,sortable: false,formatter: function (a, b, c) {
  94. var changeurl = "{:url('change',[],'')}/id/"+c.id+"?status=1";
  95. var change1url = "{:url('change',[],'')}/id/"+c.id+"?status=4";
  96. var delurl = "{:url('del',[],'')}/id/"+c.id;
  97. var detailsurl = "{:url('details',[],'')}/id/"+c.id;
  98. var btn = '';
  99. if(c.status == 0){
  100. btn += '<a href="'+changeurl+'" class="confirm ajax-get" data-confirm="你确定执行该操作吗?" data-table="1"><span class="label label-success" title="同意">同意</span></a>&nbsp;';
  101. btn += '<a href="'+change1url+'" class="confirm ajax-get" data-confirm="你确定执行该操作吗?" data-table="1"><span class="label label-danger" title="拒绝">拒绝</span></a>&nbsp;';
  102. }
  103. btn += '<a href="'+detailsurl+'"><span class="label label-info" title="详情">详情</span></a>&nbsp;';
  104. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  105. return btn;
  106. }},
  107. ],
  108. rowNum:10,
  109. rowList:[10,20,30,50,100],
  110. pager: '#pager',
  111. sortname: 'id',
  112. viewrecords: true,
  113. autowidth:true,
  114. mtype: 'post',
  115. height: 'auto',
  116. emptyrecords: "暂无数据",
  117. sortorder: "desc",
  118. caption:"访客记录",
  119. loadComplete: function (xhr) {
  120. if(xhr.code==0){
  121. layer.msg(xhr.msg);
  122. return false;
  123. }
  124. },
  125. });
  126. });
  127. </script>
  128. {/block}