index.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. @php $notCustomerBool=false @endphp
  10. @notCustomer
  11. @php $notCustomerBool=true @endphp
  12. @endNotCustomer
  13. <body class="gray-bg">
  14. <div class="wrapper wrapper-content animated fadeInRight">
  15. <div class="row">
  16. <div class="col-sm-12">
  17. <div class="ibox float-e-margins">
  18. <div class="ibox-content">
  19. <form class="row" id="searchForm" onsubmit="units.search();return false;">
  20. @notCustomer
  21. <div class="col-md-2">
  22. <div class="input-group">
  23. <span class="input-group-btn">
  24. {{--<button type="button" class="btn btn-md btn-info" id="on" ><span class="glyphicon glyphicon-hand-up"></span> 启用</button>--}}
  25. {{--<button type="button" class="btn btn-md btn-warning" id="off" style="margin-left: 10px"><span class="glyphicon glyphicon-hand-down"></span> 禁用</button>--}}
  26. <button type="button" class="btn btn-md btn-primary" onclick="units.save(0)"
  27. style="margin-left: 10px"> <span
  28. class="glyphicon glyphicon-plus"></span> 添加</button>
  29. <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
  30. style="margin-left: 10px"><span
  31. class="glyphicon glyphicon-remove"></span> 删除</button>
  32. </span>
  33. </div>
  34. </div>
  35. @endNotCustomer
  36. <div class="col-md-6">
  37. <input type="hidden" name="status" id="status">
  38. <input type="hidden" name="be_applicable" id="be_applicable">
  39. <div class="btn-group" role="group">
  40. <button type="button" class="btn btn-info" onclick="units.status(0,this)">
  41. 全部
  42. </button>
  43. <button type="button" class="btn btn-info" style="margin-left: 10px"
  44. onclick="units.status(1,this)">
  45. 待翻译
  46. </button>
  47. <button type="button" class="btn btn-info" style="margin-left: 10px"
  48. onclick="units.status(2,this)">
  49. 翻译中
  50. </button>
  51. <button type="button" class="btn btn-info" style="margin-left: 10px"
  52. onclick="units.status(3,this)">
  53. 待审核
  54. </button>
  55. <button type="button" class="btn btn-info" style="margin-left: 10px"
  56. onclick="units.status(4,this)">
  57. 未通过
  58. </button>
  59. <button type="button" class="btn btn-info" style="margin-left: 10px"
  60. onclick="units.status(5,this)">
  61. 已通过
  62. </button>
  63. <button type="button" class="btn btn-info" style="margin-left: 10px"
  64. onclick="units.status(7,this)">
  65. 未使用
  66. </button>
  67. <button type="button" class="btn btn-info" style="margin-left: 10px"
  68. onclick="units.toBeDetermined(0,this)">
  69. 待定
  70. </button>
  71. <button type="button" class="btn btn-info" style="margin-left: 10px"
  72. onclick="units.toBeDetermined(1,this)">
  73. 适用
  74. </button>
  75. <button type="button" class="btn btn-info" style="margin-left: 10px"
  76. onclick="units.toBeDetermined(2,this)">
  77. 不适用
  78. </button>
  79. @notCustomer
  80. <button type="button" class="btn btn-warning"
  81. style="margin-left: 10px;display: none"
  82. onclick="units.translate()" id="auto-translate">
  83. 翻译
  84. </button>
  85. @endNotCustomer
  86. </div>
  87. </div>
  88. <div class="col-md-4 pull-right">
  89. <div class="input-group">
  90. <input type="text" placeholder="请输入标题" class="input-md form-control" name="keyword"
  91. id="keyword" style="width: 200px;float: right">
  92. @notCustomer
  93. <input type="text" placeholder="请输入站点名称" class="input-md form-control"
  94. name="site_title" id="site_title" style="width: 200px;float: right">
  95. @endNotCustomer
  96. <span class="input-group-btn">
  97. <button type="button" class="btn btn-md btn-primary" onclick="units.search()"> 搜索</button>
  98. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"
  99. name="resetBtn"> 重置</button>
  100. </span>
  101. </div>
  102. </div>
  103. {{--<div class="col-sm-2 pull-right" style="text-align: right">--}}
  104. {{--<button type="button" class="btn btn-md btn-primary" id="addBtn"> 添加</button>--}}
  105. {{--</div>--}}
  106. </form>
  107. <hr>
  108. <div class="table-responsive">
  109. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </body>
  117. @endsection
  118. @section('footer')
  119. <script>
  120. var units = {
  121. search: function () {
  122. tips.selectPage();
  123. },
  124. getIdsBySelections: function () {
  125. var selections = $("#table").bootstrapTable('getSelections');
  126. var ids = [];
  127. $.each(selections, function (inx, val) {
  128. ids.push(val.id);
  129. });
  130. return ids;
  131. },
  132. save: function (id) {
  133. layer.open({
  134. type: 2,
  135. content: ['/admin/articles/' + id],
  136. area: ['100%', '100%'],
  137. title: '',
  138. closeBtn: 0
  139. });
  140. },
  141. status: function (status, _this) {
  142. $(_this).addClass('dim');
  143. $(_this).siblings().removeClass('dim');
  144. $("#status").val(status);
  145. if (status === 1) {
  146. $("#auto-translate").css('display', '');
  147. } else {
  148. $("#auto-translate").css('display', 'none');
  149. }
  150. tips.tableRefresh();
  151. },
  152. toBeDetermined: function (be_applicable, _this) {
  153. $(_this).addClass('dim');
  154. $(_this).siblings().removeClass('dim');
  155. $("#be_applicable").val(be_applicable);
  156. if (be_applicable === 1) {
  157. $("#auto-translate").css('display', '');
  158. } else {
  159. $("#auto-translate").css('display', 'none');
  160. }
  161. tips.tableRefresh();
  162. },
  163. translate: function () {
  164. var ids = units.getIdsBySelections();
  165. if (ids.length === 0) {
  166. layer.alert('请先选择您所要操作的对象', {icon: 0});
  167. return;
  168. }
  169. layer.confirm('您确定要翻译以下内容吗?', {icon: 3, title: '有道翻译'}, function () {
  170. var config = {url: '/admin/articles/auto-translate', type: 'put', data: {ids: ids}};
  171. tips.ajax(config);
  172. });
  173. },
  174. delete: function () {
  175. var ids = units.getIdsBySelections();
  176. if (ids.length === 0) {
  177. layer.alert('请先选择您所要操作的对象', {icon: 0});
  178. return;
  179. }
  180. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  181. layer.close(index);
  182. tips.ajax({
  183. url: '/admin/articles',
  184. type: 'delete',
  185. data: {ids: ids},
  186. tableRefresh: '#table'
  187. });
  188. });
  189. },
  190. detail: function (id) {
  191. layer.open({
  192. type: 2,
  193. content: ['/admin/articles-detail/' + id],
  194. area: ['100%', '100%'],
  195. title: '',
  196. closeBtn: 0
  197. });
  198. }
  199. };
  200. var config = {};
  201. config.url = '/admin/articles';
  202. config.columns = [ //字段
  203. {checkbox: true},
  204. {title: '编号', field: 'id', align: 'center'},
  205. {
  206. title: '标题', field: 'title', align: 'center',
  207. formatter: function (value, row) {
  208. return '<a href="javascript:;" onclick="units.detail(' + row.id + ')">' + value + '</a>'
  209. }
  210. },
  211. @if($notCustomerBool)
  212. {
  213. title: '翻译人员', field: 'translator_name', align: 'center'
  214. },
  215. @endif
  216. {title: '站点名称', field: 'site_title', align: 'center'},
  217. {title: '审核人员', field: 'auditor_name', align: 'center'},
  218. {title: '质量分', field: 'pass_score', align: 'center'},
  219. {title: '已翻词数', field: 'translate_words', align: 'center'},
  220. {title: '状态', field: 'status_title', align: 'center'},
  221. {title: '审核时间', field: 'audit_at', align: 'center'},
  222. {title: '是否适用', field: 'be_applicable', align: 'center'},
  223. {title: '创建时间', field: 'created_at', align: 'center'},
  224. {
  225. title: '操作', field: 'id', align: 'center',
  226. formatter: function (value, row) {
  227. var str = '';
  228. // if (row.status === 1) {
  229. str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';
  230. // }
  231. return str;
  232. }
  233. }
  234. ];
  235. tips.bootstrapTable(config);
  236. </script>
  237. @endsection