index.blade.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. @extends('admin/layout')
  2. @section('content')
  3. <style>
  4. .btn-primary, .btn-info {
  5. background: #009688 !important;
  6. border-color: #009688 !important;
  7. }
  8. </style>
  9. <body class="gray-bg">
  10. <div class="wrapper wrapper-content animated fadeInRight">
  11. <div class="row">
  12. <div class="col-sm-12">
  13. <div class="ibox float-e-margins">
  14. <div class="ibox-content">
  15. <form class="row" id="searchForm">
  16. <div class="col-md-4">
  17. <div class="input-group">
  18. <span class="input-group-btn">
  19. <button type="button" class="btn btn-md btn-primary"
  20. style="margin-left: 10px" onclick="units.edit(0)"> <span
  21. class="glyphicon glyphicon-plus"></span> 添加</button>
  22. <button type="button" class="btn btn-md btn-danger" id="batchDelete"
  23. style="margin-left: 10px" onclick="units.batchDelete()"><span
  24. class="glyphicon glyphicon-remove"></span> 删除</button>
  25. </span>
  26. </div>
  27. </div>
  28. </form>
  29. <hr>
  30. <div class="table-responsive">
  31. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </body>
  39. @endsection
  40. @section('footer')
  41. <script>
  42. var units = {
  43. search: function () {
  44. tips.selectPage();
  45. },
  46. getIdsBySelections: function () {
  47. var selections = $("#table").bootstrapTable('getSelections');
  48. var ids = [];
  49. $.each(selections, function (inx, val) {
  50. ids.push(val.server_id);
  51. });
  52. return ids;
  53. },
  54. edit: function (id) {
  55. var title = '添加';
  56. if (id > 0) {
  57. title = '编辑';
  58. }
  59. layer.open({
  60. type: 2,
  61. content: '/admin/servers/' + id,
  62. area: ['100%', '100%'],
  63. title: title
  64. });
  65. },
  66. batchDelete: function () {
  67. var ids = units.getIdsBySelections();
  68. if (ids.length === 0) {
  69. layer.alert('请先选择您所要操作的对象', {icon: 0});
  70. return;
  71. }
  72. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  73. layer.close(index);
  74. tips.ajax({
  75. url: '/admin/servers',
  76. type: 'delete',
  77. data: {ids: ids},
  78. tableRefresh: '#table'
  79. });
  80. });
  81. },
  82. reload: function (id, ip) {
  83. layer.confirm('您确定要重启' + ip + '服务吗?', {icon: 3, title: '重启'}, function (index, layero) {
  84. layer.close(index);
  85. var config = {
  86. url: '/admin/servers/' + id + '/reload',
  87. type: 'get'
  88. };
  89. tips.ajax(config);
  90. });
  91. }
  92. };
  93. // 月流量 月询盘 月排名 月软文 项目经理 项目进度
  94. var config = {};
  95. config.url = '/admin/servers';
  96. config.columns = [ //字段
  97. /*{checkbox: true},*/
  98. {
  99. title: '序号', align: 'center', formatter: function (value, item, index) {
  100. return index + 1;
  101. }
  102. },
  103. {title: '名称', field: 'server_name', align: 'center'},
  104. {title: 'IP地址', field: 'server_ip', align: 'center'},
  105. {title: '类型', field: 'type_title', align: 'center'},
  106. // {title: '状态', field: 'status', align: 'center'},
  107. {title: '创建时间', field: 'created_at', align: 'center'},
  108. {
  109. title: '操作', field: 'server_id', align: 'center',
  110. formatter: function (value, row) {
  111. return (
  112. '<button onclick="units.edit(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;' +
  113. '<button onclick="units.reload(' + value + ' ,\'' + row.server_ip + '\' )" class="btn btn-xs"><span class="glyphicon glyphicon-repeat"></span>重启</button>&nbsp;'
  114. // '<button onclick="units.reload(\'a\',5)" class="btn btn-xs"><span class="glyphicon glyphicon-repeat"></span>重启</button>&nbsp;'
  115. );
  116. }
  117. }
  118. ];
  119. tips.bootstrapTable(config);
  120. </script>
  121. @endsection