index.blade.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. @extends('admin/layout')
  2. @section('content')
  3. <body class="gray-bg">
  4. <div class="wrapper wrapper-content animated fadeInRight">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <div class="ibox float-e-margins">
  8. <div class="ibox-title"></div>
  9. <div class="ibox-content">
  10. <form class="row" id="searchForm">
  11. <div class="col-md-4">
  12. <div class="input-group">
  13. <span class="input-group-btn">
  14. <button type="button" class="btn btn-md btn-info"
  15. onclick="units.audit(2)"><span
  16. class="glyphicon glyphicon-hand-up"></span> 通过</button>
  17. <button type="button" class="btn btn-md btn-warning"
  18. onclick="units.audit(3)"
  19. style="margin-left: 10px"><span
  20. class="glyphicon glyphicon-hand-down"></span> 失败</button>
  21. <button type="button" class="btn btn-md btn-primary"
  22. style="margin-left: 10px" onclick="units.edit(0)"> <span
  23. class="glyphicon glyphicon-plus"></span> 添加</button>
  24. <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
  25. style="margin-left: 10px"><span
  26. class="glyphicon glyphicon-remove"></span> 删除</button>
  27. </span>
  28. </div>
  29. </div>
  30. <div class="col-md-6 pull-right">
  31. <div class="input-group">
  32. <input type="text" placeholder="请输入名称" class="input-md form-control"
  33. name="keyword"
  34. id="keyword">
  35. <span class="input-group-btn">
  36. <button type="button" class="btn btn-md btn-primary"
  37. onclick="units.search()"> 搜索</button>
  38. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"
  39. name="resetBtn"> 重置</button> </span>
  40. </div>
  41. </div>
  42. </form>
  43. <hr>
  44. <div class="table-responsive">
  45. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </body>
  53. @endsection
  54. @section('footer')
  55. <script>
  56. var units = {
  57. audit: function (status) {
  58. var ids = units.getIdsBySelections();
  59. if (ids.length === 0) {
  60. layer.alert('请先选择您所要操作的对象', {icon: 0});
  61. return;
  62. }
  63. var config = {
  64. url: '/admin/lading-bills/audit',
  65. type: 'put',
  66. data: {ids: ids, auditStatus: status}
  67. };
  68. config.success = function () {
  69. tips.tableRefresh('#table');
  70. };
  71. tips.ajax(config);
  72. },
  73. search: function () {
  74. tips.selectPage();
  75. },
  76. getIdsBySelections: function () {
  77. var selections = $("#table").bootstrapTable('getSelections');
  78. var ids = [];
  79. $.each(selections, function (inx, val) {
  80. ids.push(val.id);
  81. });
  82. return ids;
  83. },
  84. edit: function (id) {
  85. var title = '添加';
  86. if (id > 0) {
  87. title = '编辑';
  88. }
  89. layer.open({
  90. type: 2,
  91. content: ['/admin/lading-bills/' + id],
  92. area: ['100%', '100%'],
  93. title: title
  94. });
  95. },
  96. delete: function () {
  97. var ids = units.getIdsBySelections();
  98. if (ids.length === 0) {
  99. layer.alert('请先选择您所要操作的对象', {icon: 0});
  100. return;
  101. }
  102. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  103. layer.close(index);
  104. tips.ajax({
  105. url: '/admin/lading-bills',
  106. type: 'delete',
  107. data: {ids: ids},
  108. tableRefresh: '#table'
  109. });
  110. });
  111. }
  112. };
  113. var config = {};
  114. config.url = '/admin/lading-bills';
  115. config.columns = [ //字段
  116. {checkbox: true},
  117. {
  118. title: '序号', align: 'center', formatter: function (value, item, index) {
  119. return index + 1;
  120. }
  121. },
  122. {title: '名称', field: 'title', align: 'center'},
  123. {title: '金额', field: 'amount', align: 'center'},
  124. {title: '关联项目', field: 'relate_site', align: 'center'},
  125. {title: '用户姓名', field: 'username', align: 'center'},
  126. {
  127. title: '审核状态', field: 'audit', align: 'center', formatter: function (value, row) {
  128. switch (value) {
  129. case 1:
  130. return '<button class="btn btn-xs btn-info">审核中</button>';
  131. case 2:
  132. return '<button class="btn btn-xs btn-success">已通过</button>';
  133. case 3:
  134. return '<button class="btn btn-xs btn-warning">未通过</button>';
  135. default:
  136. return '';
  137. }
  138. }
  139. },
  140. {title: '创建时间', field: 'created_at', align: 'center'},
  141. {
  142. title: '操作', field: 'id', align: 'center',
  143. formatter: function (value, row) {
  144. return (
  145. '<button onclick="units.edit(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;'
  146. );
  147. }
  148. }
  149. ];
  150. tips.bootstrapTable(config);
  151. </script>
  152. @endsection