task_for_site.blade.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. @endsection
  4. @section('right')
  5. @php $hasEdit=0; @endphp
  6. @hasAuth('sites-links-edit')
  7. @php $hasEdit=1; @endphp
  8. @endHasAuth
  9. <form class="row" id="searchForm">
  10. @if($hasEdit)
  11. <div class="col-md-2">
  12. <div class="input-group">
  13. <span class="input-group-btn">
  14. {{--<button type="button" class="btn btn-md btn-info" id="on" ><span class="glyphicon glyphicon-hand-up"></span> 启用</button>--}}
  15. {{--<button type="button" class="btn btn-md btn-warning" id="off" style="margin-left: 10px"><span class="glyphicon glyphicon-hand-down"></span> 禁用</button>--}}
  16. <button type="button" class="btn btn-md btn-primary" onclick="units.save(0)"
  17. style="margin-left: 10px"> <span class="glyphicon glyphicon-plus"></span> 添加</button>
  18. <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
  19. style="margin-left: 10px"><span
  20. class="glyphicon glyphicon-remove"></span> 删除</button>
  21. </span>
  22. </div>
  23. </div>
  24. @endif
  25. <div class="col-md-8">
  26. <input type="hidden" name="status" id="status">
  27. <div class="btn-group" role="group">
  28. <button type="button" class="btn btn-info" onclick="units.status(0,this)">
  29. 全部
  30. </button>
  31. <button type="button" class="btn btn-info" style="margin-left: 10px"
  32. onclick="units.status(2,this)">
  33. 任务中
  34. </button>
  35. <button type="button" class="btn btn-info" style="margin-left: 10px"
  36. onclick="units.status(3,this)">
  37. 待审核
  38. </button>
  39. <button type="button" class="btn btn-info" style="margin-left: 10px"
  40. onclick="units.status(4,this)">
  41. 未通过
  42. </button>
  43. <button type="button" class="btn btn-info" style="margin-left: 10px"
  44. onclick="units.status(5,this)">
  45. 已通过
  46. </button>
  47. <button type="button" class="btn btn-warning"
  48. style="margin-left: 10px;display: none"
  49. onclick="units.translate()" id="auto-translate">
  50. 翻译
  51. </button>
  52. </div>
  53. </div>
  54. </form>
  55. <hr>
  56. <div class="table-responsive">
  57. <table id="table" class="table table-condensed"
  58. data-mobile-responsive="true"></table>
  59. </div>
  60. @endsection
  61. @section('footer_extend')
  62. <script>
  63. // parent.window.open('http://www.baidu.com', '_blank');
  64. var units = {
  65. getIdsBySelections: function () {
  66. var selections = $("#table").bootstrapTable('getSelections');
  67. var ids = [];
  68. $.each(selections, function (inx, val) {
  69. ids.push(val.id);
  70. });
  71. return ids;
  72. },
  73. save: function (id) {
  74. layer.open({
  75. type: 2,
  76. content: ['/admin/link/task/' + id + '/save?siteId={{$siteId}}'],
  77. area: ['90%', '100%'],
  78. title: '保存'
  79. });
  80. },
  81. status: function (status, _this) {
  82. $(_this).addClass('dim');
  83. $(_this).siblings().removeClass('dim');
  84. $("#status").val(status);
  85. if (status === 1) {
  86. $("#auto-translate").css('display', '');
  87. } else {
  88. $("#auto-translate").css('display', 'none');
  89. }
  90. tips.tableRefresh();
  91. },
  92. delete: function () {
  93. var ids = units.getIdsBySelections();
  94. if (ids.length === 0) {
  95. layer.alert('请先选择您所要操作的对象', {icon: 0});
  96. return;
  97. }
  98. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function () {
  99. tips.ajax({url: '/admin/link/tasks', type: 'delete', data: {ids: ids}});
  100. tips.tableRefresh('#table');
  101. });
  102. },
  103. detail: function (id) {
  104. layer.open({
  105. type: 2,
  106. content: ['/admin/link/task/' + id],
  107. area: ['90%', '100%'],
  108. title: '',
  109. closeBtn: 0
  110. });
  111. }
  112. };
  113. var config = {};
  114. config.url = '/admin/link/tasks?siteId=' + "{{$siteId}}";
  115. config.columns = [ //字段
  116. {checkbox: true},
  117. {
  118. title: '序号', align: 'center', formatter: function (value, item, index) {
  119. return index + 1;
  120. }
  121. },
  122. {
  123. title: '标题', field: 'title', align: 'center',
  124. formatter: function (value, row) {
  125. return '<a href="javascript:;" onclick="units.detail(' + row.id + ')">' + value + '</a>'
  126. }
  127. },
  128. {title: '兼职人员', field: 'worker_name', align: 'center'},
  129. {title: '站点名称', field: 'site_title', align: 'center'},
  130. {title: '质量分', field: 'totalScore', align: 'center'},
  131. {title: '外链数', field: 'linkUrlsCount', align: 'center'},
  132. // {title: '平台链接', field: 'translate_words', align: 'center'},
  133. {title: '状态', field: 'status_title', align: 'center'},
  134. {title: '未发布', field: 'un_release_at', align: 'center'},
  135. {title: '审核时间', field: 'audit_at', align: 'center'},
  136. {title: '创建时间', field: 'created_at', align: 'center'},
  137. {
  138. title: '操作', field: 'id', align: 'center',
  139. formatter: function (value, row) {
  140. var str = '', title = '查看';
  141. if (row.status === 1 || row.status === 2) {
  142. title = '编辑'
  143. }
  144. @if($hasEdit)
  145. str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>'+title+'</button>';
  146. @endif
  147. // }
  148. return str;
  149. }
  150. }
  151. ];
  152. tips.bootstrapTable(config);
  153. </script>
  154. @endsection