chinese_article.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. @extends('admin/layout')
  2. @section('content')
  3. <div class="wrapper wrapper-content animated fadeInRight">
  4. <form class="row" id="searchForm">
  5. <div class="col-md-6">
  6. <div class="input-group" style="display: flex">
  7. <select name="status" id="status" title="" class="form-control"
  8. style="width: 150px;float: inherit;margin-left: 10px;position: relative;"
  9. onchange="tips.selectPage();">
  10. <option value="">请选择发布状态</option>
  11. <option value="1" >待翻译</option>
  12. </select>
  13. <select name="beApplicable" id="beApplicable" title="" class="form-control"
  14. style="width: 150px;float: inherit;margin-left: 10px;position: relative;"
  15. onchange="tips.selectPage();">
  16. <option value="">请选择审核状态</option>
  17. <option value="0" selected="selected">待定</option>
  18. <option value="1">适用</option>
  19. <option value="2">不适用</option>
  20. </select>
  21. <div class="input-group">
  22. <input type="text" placeholder="请输入软文标题" class="input-md form-control"
  23. name="title"
  24. id="title" style="width: 300px;float: right">
  25. <span class="input-group-btn">
  26. <button type="button" class="btn btn-md btn-primary" onclick="units.search()"> 搜索</button>
  27. <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px" name="btnReset"> 重置</button>
  28. </span>
  29. </div>
  30. </div>
  31. </div>
  32. </form>
  33. <hr>
  34. </div>
  35. <div class="table-responsive">
  36. <table id="table" class="table table-condensed"
  37. data-mobile-responsive="true"></table>
  38. </div>
  39. @endsection
  40. @section('footer')
  41. <script>
  42. $('#bzx').click(function () {
  43. $('.toggle-x-box').toggle();
  44. });
  45. var units = {
  46. search: function () {
  47. tips.selectPage();
  48. },
  49. getIdsBySelections: function () {
  50. var selections = $("#table").bootstrapTable('getSelections');
  51. var ids = [];
  52. $.each(selections, function (inx, val) {
  53. ids.push(val.id);
  54. });
  55. return ids;
  56. },
  57. add: function (id) {
  58. var url = '/admin/articles/' + id + '?siteId={{$siteId}}';
  59. layer.open({
  60. type: 2,
  61. content: [url],
  62. area: ['100%', '100%'],
  63. title: '',
  64. closeBtn: 0
  65. });
  66. },
  67. save: function (id, status) {
  68. if (status !== 1) {
  69. layer.alert('只允许修改待翻译状态文章', {icon: 0});
  70. return;
  71. }
  72. var url = '/admin/articles/' + id + '?siteId={{$siteId}}';
  73. layer.open({
  74. type: 2,
  75. content: [url],
  76. area: ['100%', '100%'],
  77. title: '',
  78. closeBtn: 0
  79. });
  80. },
  81. toBeDetermined: function (id, status) {
  82. if (status !== 1) {
  83. layer.alert('只允许修改待翻译状态文章', {icon: 0});
  84. return;
  85. }
  86. layer.confirm('确定待定吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  87. layer.close(index);
  88. tips.ajax({
  89. url: '/admin/articles/to-be-determined/{{$siteId}}',
  90. type: 'get',
  91. data: {id: id, type: 0},
  92. tableRefresh: '#table'
  93. });
  94. });
  95. },
  96. beApplicable: function (id, status) {
  97. if (status !== 1) {
  98. layer.alert('只允许修改待翻译状态文章', {icon: 0});
  99. return;
  100. }
  101. layer.confirm('确定适用吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  102. layer.close(index);
  103. tips.ajax({
  104. url: '/admin/articles/to-be-determined/{{$siteId}}',
  105. type: 'get',
  106. data: {id: id, type: 1},
  107. tableRefresh: '#table'
  108. });
  109. });
  110. },
  111. notApplicable: function (id, status) {
  112. if (status !== 1) {
  113. layer.alert('只允许修改待翻译状态文章', {icon: 0});
  114. return;
  115. }
  116. layer.confirm('确定不适用吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  117. layer.close(index);
  118. tips.ajax({
  119. url: '/admin/articles/to-be-determined/{{$siteId}}',
  120. type: 'get',
  121. data: {id: id, type: 2},
  122. tableRefresh: '#table'
  123. });
  124. });
  125. },
  126. notApplicableWherefore: function (id, status) {
  127. if (status !== 1) {
  128. layer.alert('只允许修改待翻译状态文章', {icon: 0});
  129. return;
  130. }
  131. var notBeApplicableInfo = $('#not_be_applicable_info' + id).val();
  132. if (notBeApplicableInfo.length > 250) {
  133. layer.msg('字符长度过长,请控制在250字符以内');
  134. return;
  135. }
  136. tips.ajax({
  137. url: '/admin/articles/not-applicable-wherefore/{{$siteId}}',
  138. type: 'get',
  139. data: {id: id, notBeApplicableInfo: notBeApplicableInfo},
  140. tableRefresh: '#table'
  141. });
  142. }
  143. };
  144. var config = {};
  145. config.url = '/admin/sites/' + "{{$siteId}}" + '/articles-find';
  146. config.columns = [ //字段
  147. {
  148. title: '序号', align: 'center', formatter: function (value, item, index) {
  149. return index + 1;
  150. },
  151. width: '120px'
  152. },
  153. {
  154. title: '标题', field: 'title', align: 'center',
  155. formatter: function (value, row) {
  156. return '<a href="javascript:;" onclick="units.save(' + row.id + ',' + row.status + ')">' + value + '</a>'
  157. }
  158. },
  159. {title: '发布状态', field: 'status_title', align: 'center'},
  160. {title: '审核状态', field: 'check', align: 'center'},
  161. {
  162. title: '操作', field: '', align: 'center',
  163. formatter: function (value, row) {
  164. var str = '';
  165. if (row.be_applicable === 0) {
  166. //熄灭
  167. str += '<button onclick="units.toBeDetermined(' + row.id + ',' + row.status + ')" class="btn btn-md btn-info" style="display: none">待定</button>&nbsp;';
  168. //高亮
  169. str += '<button onclick="units.beApplicable(' + row.id + ',' + row.status + ')" class="btn btn-md btn-success">适用</button>&nbsp;';
  170. //高亮
  171. str += '<button onclick="units.notApplicable(' + row.id + ',' + row.status + ')" class="btn btn-md btn-danger">不适用</button>&nbsp;';
  172. } else if (row.be_applicable === 1) {
  173. //高亮
  174. str += '<button onclick="units.toBeDetermined(' + row.id + ',' + row.status + ')" class="btn btn-md btn-info">待定</button>&nbsp;';
  175. //熄灭
  176. str += '<button onclick="units.beApplicable(' + row.id + ',' + row.status + ')" class="btn btn-md btn-success" style="display: none">适用</button>&nbsp;';
  177. //高亮
  178. str += '<button onclick="units.notApplicable(' + row.id + ',' + row.status + ')" class="btn btn-md btn-danger">不适用</button>&nbsp;';
  179. } else {
  180. //高亮
  181. str += '<button onclick="units.toBeDetermined(' + row.id + ',' + row.status + ')" class="btn btn-md btn-info">待定</button>&nbsp;';
  182. //高亮
  183. str += '<button onclick="units.beApplicable(' + row.id + ',' + row.status + ')" class="btn btn-md btn-success">适用</button>&nbsp;';
  184. //熄灭
  185. str += '<button onclick="units.notApplicable(' + row.id + ',' + row.status + ')" class="btn btn-md btn-danger" style="display: none">不适用</button>&nbsp;';
  186. }
  187. return str;
  188. }
  189. },
  190. {title: '更新时间', field: 'updated_at', align: 'center'},
  191. {
  192. title: '不适用原因', field: 'not_be_applicable_info', align: 'center',
  193. formatter: function (value, row) {
  194. var str = '';
  195. if (row.be_applicable === 2) {
  196. str += '<input type="text" class="form-control" id="not_be_applicable_info' + row.id + '" name="not_be_applicable_info" value="' + row.not_be_applicable_info + '">';
  197. str += '<button onclick="units.notApplicableWherefore(' + row.id + ',' + row.status + ')" class="btn btn-md btn-success">确定</button>';
  198. }
  199. return str;
  200. },
  201. cellStyle: function () {
  202. return {css: {'display': 'flex'}};
  203. }
  204. }
  205. ];
  206. tips.bootstrapTable(config);
  207. </script>
  208. @endsection