index.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. <input type="hidden" name="ids" id="ids">
  12. <div class="input-group">
  13. <input type="text" class="form-control" name="title" placeholder="名称">
  14. </div>
  15. <div class="input-group">
  16. <select name="type" class="form-control">
  17. <option value="">选择类型</option>
  18. {volist name="types" id="v" key="k"}
  19. <option value="{$k}">{$v}</option>
  20. {/volist}
  21. </select>
  22. </div>
  23. <div class="input-group">
  24. <select name="enable" class="form-control">
  25. <option value="">选择状态</option>
  26. <option value="0">禁用</option>
  27. <option value="1">正常</option>
  28. </select>
  29. </div>
  30. <div class="input-group">
  31. <span class="input-group-btn">
  32. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  33. </span> &nbsp;
  34. <span class="input-group-btn">
  35. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  36. </span>&nbsp;
  37. <span class="input-group-btn">
  38. <button class="btn-sm btn-primary" type="button" id="down">下载二维码</button>
  39. </span>&nbsp;
  40. <span class="input-group-btn">
  41. <button class="btn-sm btn-primary" type="button"url="{:url('import')}" data-title="批量导入" onclick="layer_open(this,1)">批量导入</button>
  42. </span>
  43. </div>
  44. </form>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="ibox-content">
  49. <div class="jqGrid_wrapper">
  50. <table id="table" style="border-collapse: collapse"></table>
  51. <div id="pager"></div>
  52. </div>
  53. </div>
  54. </div>
  55. {/block}
  56. {block name="script"}
  57. <script>
  58. $('#down').click(function () {
  59. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  60. // $("#ids").val(JSON.stringify(rowIds));
  61. $("#ids").val(rowIds);
  62. var params = $("#form-search").serialize();
  63. window.location.href = '{:url("addrdown")}?'+params;
  64. })
  65. $(function () {
  66. $(window).bind("resize",function(){
  67. var width=$(".jqGrid_wrapper").width();
  68. $("#table").setGridWidth(width);
  69. });
  70. $.jgrid.defaults.styleUI="Bootstrap";
  71. $("#table").jqGrid({
  72. url:"{:url('index')}",
  73. datatype: "json",
  74. colModel:[
  75. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  76. {label:'名称',name:'title',index:'title',width:100,editable: false,sortable: false},
  77. {label:'二维码',name:'id',index:'id',width:40,sortable: false,formatter:function (a,b,c){
  78. var editurl = "{:url('qrcode',[],'')}/id/"+c.id;
  79. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="二维码" onclick="layer_open(this,1)"><span class="label label-primary" title="查看">查看</span></a>';
  80. return btn;
  81. }},
  82. {label:'设备编号',name:'sn',index:'sn',width:60,sortable: false},
  83. {label:'类型',name:'types_text',index:'types_text',width:150,sortable: false},
  84. {label:'备注',name:'remark',index:'remark',width:60,sortable: true},
  85. {label:'状态',name:'enable',index:'enable',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  86. if(a == 0){
  87. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  88. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  89. } else{
  90. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  91. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  92. }
  93. }},
  94. {label:'操作',width:120,sortable: false,formatter: function (a, b, c) {
  95. var editurl = "{:url('add',[],'')}/id/"+c.id;
  96. var delurl = "{:url('del',[],'')}/id/"+c.id;
  97. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑地点" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  98. if(c.org_id == 17){
  99. var turl = "{:url('three',[],'')}/id/"+c.id;
  100. btn += '<a url="'+turl+'" href="javascript:;" data-title="模型标注" data-width="100%" data-height="100%" onclick="layer_open(this,0)"><span class="label label-primary" title="模型标注">模型标注</span></a>&nbsp;';
  101. }
  102. btn += '<a {if !btnAuth(session("user_auth.id"),"Address/del")} style="display:none" {/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  103. return btn;
  104. }},
  105. ],
  106. rowNum:10,
  107. rowList:[10,20,30,50,100],
  108. pager: '#pager',
  109. sortname: 'id',
  110. viewrecords: true,
  111. autowidth:true,
  112. mtype: 'post',
  113. height: 'auto',
  114. emptyrecords: "暂无数据",
  115. sortorder: "desc",
  116. caption:"地点列表",
  117. multiselect: true,//可多选
  118. loadComplete: function (xhr) {
  119. if(xhr.code==0){
  120. layer.msg(xhr.msg);
  121. return false;
  122. }
  123. },
  124. });
  125. });
  126. </script>
  127. {/block}