index.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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-1">
  7. </div>
  8. <div class="col-xs-11" style="text-align: right;">
  9. <form class="form-inline" id="form-search" action="{:url('index')}">
  10. <div class="input-group">
  11. <input type="text" class="form-control" name="title" placeholder="名称">
  12. </div>
  13. <div class="input-group">
  14. <span class="input-group-btn">
  15. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  16. </span> &nbsp;
  17. <span class="input-group-btn">
  18. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  19. </span>
  20. </div>
  21. </form>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="ibox-content">
  26. <div class="jqGrid_wrapper">
  27. <table id="table" style="border-collapse: collapse"></table>
  28. <div id="pager"></div>
  29. </div>
  30. </div>
  31. </div>
  32. {/block}
  33. {block name="script"}
  34. <script>
  35. $(function () {
  36. $(window).bind("resize",function(){
  37. var width=$(".jqGrid_wrapper").width();
  38. $("#table").setGridWidth(width);
  39. });
  40. $.jgrid.defaults.styleUI="Bootstrap";
  41. $("#table").jqGrid({
  42. url:"{:url('index')}",
  43. datatype: "json",
  44. colModel:[
  45. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  46. {label:'名称',name:'title',index:'title',width:60,editable: false,sortable: false},
  47. {label:'成功数量',name:'success',index:'success',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  48. if(a > 0){
  49. if(c.type==1){
  50. var url = "{:url('House/index',[],'')}/import_id/"+c.id;
  51. }else if (c.type==2){
  52. var url = "{:url('Owner/index',[],'')}/import_id/"+c.id;
  53. }else {
  54. var url = "{:url('Car/index',[],'')}/import_id/"+c.id;
  55. }
  56. return '<a href="'+url+'" ><span class="label label-primary" >'+a+'</span></a>';
  57. } else{
  58. return 0;
  59. }
  60. }},
  61. {label:'失败数量',name:'error',index:'error',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  62. if(a > 0){
  63. var eUrl = "{:url('errorInfo',[],'')}/id/"+c.id;
  64. var url = '<a url="'+eUrl+'" href="javascript:;" data-title="错误信息" onclick="layer_open(this,1)"><span class="label label-danger" >'+a+'</span></a>&nbsp;';
  65. return url;
  66. } else{
  67. return 0;
  68. }
  69. }},
  70. {label:'导入类型',name:'type',index:'type',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  71. if(a == 1){
  72. return '资源列表导入';
  73. } else if (a==2){
  74. return '业主列表导入';
  75. }else {
  76. return '绑定车辆列表导入';
  77. }
  78. }},
  79. {label:'创建时间',name:'create_time',index:'create_time',width:60,editable: false,sortable: false},
  80. {label:'撤回时间',name:'withdraw_time',index:'withdraw_time',width:60,editable: false,sortable: false},
  81. {label:'状态',name:'status',index:'status',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  82. if(a == 0){
  83. return '正常';
  84. } else{
  85. return '已撤回';
  86. }
  87. }},
  88. {label:'操作',width:40,sortable: false,formatter: function (a, b, c) {
  89. var withdraw = "{:url('withdraw',[],'')}/id/"+c.id;
  90. var delurl = "{:url('del',[],'')}/id/"+c.id;
  91. //var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  92. var btn = '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  93. if(c.status==0 && c.is_ch && c.success >0){
  94. btn+= '&nbsp;<a href="'+withdraw+'" class="confirm ajax-get" data-confirm="确定要撤回此记录吗?" data-table="1"><span class="label label-primary" title="撤回">撤回</span></a>';
  95. }
  96. return btn;
  97. }},
  98. ],
  99. rowNum:10,
  100. rowList:[10,20,30,50,100],
  101. pager: '#pager',
  102. sortname: 'id',
  103. viewrecords: true,
  104. autowidth:true,
  105. mtype: 'post',
  106. height: 'auto',
  107. emptyrecords: "暂无数据",
  108. sortorder: "desc",
  109. caption:"导入记录",
  110. loadComplete: function (xhr) {
  111. if(xhr.code==0){
  112. layer.msg(xhr.msg);
  113. return false;
  114. }
  115. },
  116. });
  117. });
  118. </script>
  119. {/block}