find.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. <style>
  4. h1 {
  5. color: #0d8ddb
  6. }
  7. </style>
  8. @endsection
  9. @section('right')
  10. <form class="row" id="searchForm">
  11. <div class="col-md-6">
  12. <div class="input-group" style="display: flex">
  13. <span class="input-group-btn" style="width: auto">
  14. <button type="button" class="btn btn-md btn-primary"
  15. onclick="units.add(0)" style="margin-left: 10px">
  16. <span class="glyphicon glyphicon-plus"></span> 添加
  17. </button>
  18. <button type="button" class="btn btn-md btn-danger"
  19. onclick="units.delete()" style="margin-left: 10px">
  20. <span class="glyphicon glyphicon-remove"></span> 删除
  21. </button>
  22. </span>
  23. <button type="button" class="btn btn-md btn-success"
  24. onclick="units.batchBeApplicable()" style="margin-left: 10px"> 批量适用
  25. </button>
  26. <button type="button" class="btn btn-md btn-success"
  27. onclick="units.batchNotApplicable()" style="margin-left: 10px"> 批量不适用
  28. </button>
  29. <div class="input-group" style="margin-left: 10px">
  30. <input type="text" placeholder="请输入推送的手机号" class="input-md form-control"
  31. name="mobile" id="mobile" style="width: 150px;float: right" value="{{$mobile}}">
  32. <span class="input-group-btn">
  33. <button type="button" class="btn btn-md btn-success" onclick="units.pushMessage()"> 推送</button>
  34. </span>
  35. </div>
  36. <select name="beApplicable" id="beApplicable" title="" class="form-control"
  37. style="width: 150px;float: inherit;margin-left: 10px;position: relative;"
  38. onchange="tips.selectPage();">
  39. <option value="">请选择</option>
  40. <option value="0">待定</option>
  41. <option value="1">适用</option>
  42. <option value="2">不适用</option>
  43. </select>
  44. <div class="input-group" style="width: 150px;">
  45. <input type="text" placeholder="请输入软文标题" class="input-md form-control"
  46. name="title"
  47. id="title" style="width: 150px;float: right">
  48. <span class="input-group-btn">
  49. <button type="button" class="btn btn-md btn-success" onclick="units.search()"> 搜索</button>
  50. <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px" name="btnReset"> 重置</button>
  51. </span>
  52. </div>
  53. </div>
  54. </div>
  55. </form>
  56. <hr>
  57. <div class="table-responsive">
  58. <table id="table" class="table table-condensed"
  59. data-mobile-responsive="true"></table>
  60. </div>
  61. @endsection
  62. @section('footer_extend')
  63. <script>
  64. $('#bzx').click(function () {
  65. $('.toggle-x-box').toggle();
  66. });
  67. var units = {
  68. search: function () {
  69. tips.selectPage();
  70. },
  71. getIdsBySelections: function () {
  72. var selections = $("#table").bootstrapTable('getSelections');
  73. var ids = [];
  74. $.each(selections, function (inx, val) {
  75. ids.push(val.id);
  76. });
  77. return ids;
  78. },
  79. add: function (id) {
  80. var url = '/admin/articles/' + id + '?siteId={{$siteId}}';
  81. layer.open({
  82. type: 2,
  83. content: [url],
  84. area: ['100%', '100%'],
  85. title: '',
  86. closeBtn: 0
  87. });
  88. },
  89. save: function (id) {
  90. var url = '/admin/articles/' + id + '?siteId={{$siteId}}';
  91. layer.open({
  92. type: 2,
  93. content: [url],
  94. area: ['100%', '100%'],
  95. title: '',
  96. closeBtn: 0
  97. });
  98. },
  99. delete: function () {
  100. var ids = units.getIdsBySelections();
  101. if (ids.length === 0) {
  102. layer.alert('请先选择您所要操作的对象', {icon: 0});
  103. return;
  104. }
  105. layer.confirm('确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  106. layer.close(index);
  107. tips.ajax({
  108. url: '/admin/articles',
  109. type: 'delete',
  110. data: {ids: ids},
  111. tableRefresh: '#table'
  112. });
  113. });
  114. },
  115. batchBeApplicable: function () {
  116. var ids = units.getIdsBySelections();
  117. if (ids.length === 0) {
  118. layer.alert('请先选择您所要操作的对象', {icon: 0});
  119. return;
  120. }
  121. layer.confirm('确定适用吗?', {icon: 3, title: '批量适用'}, function (index, layero) {
  122. layer.close(index);
  123. tips.ajax({
  124. url: '/admin/articles/batch-be-applicable/{{$siteId}}',
  125. type: 'get',
  126. data: {ids: ids, type: 1},
  127. tableRefresh: '#table'
  128. });
  129. });
  130. },
  131. batchNotApplicable: function () {
  132. var ids = units.getIdsBySelections();
  133. if (ids.length === 0) {
  134. layer.alert('请先选择您所要操作的对象', {icon: 0});
  135. return;
  136. }
  137. layer.confirm('确定不适用吗?', {icon: 3, title: '批量不适用'}, function (index, layero) {
  138. layer.close(index);
  139. tips.ajax({
  140. url: '/admin/articles/batch-be-applicable/{{$siteId}}',
  141. type: 'get',
  142. data: {ids: ids, type: 2},
  143. tableRefresh: '#table'
  144. });
  145. });
  146. },
  147. toBeDetermined: function (id) {
  148. layer.confirm('确定待定吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  149. layer.close(index);
  150. tips.ajax({
  151. url: '/admin/articles/to-be-determined/{{$siteId}}',
  152. type: 'get',
  153. data: {id: id, type: 0},
  154. tableRefresh: '#table'
  155. });
  156. });
  157. },
  158. beApplicable: function (id) {
  159. layer.confirm('确定适用吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  160. layer.close(index);
  161. tips.ajax({
  162. url: '/admin/articles/to-be-determined/{{$siteId}}',
  163. type: 'get',
  164. data: {id: id, type: 1},
  165. tableRefresh: '#table'
  166. });
  167. });
  168. },
  169. notApplicable: function (id) {
  170. layer.confirm('确定不适用吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  171. layer.close(index);
  172. tips.ajax({
  173. url: '/admin/articles/to-be-determined/{{$siteId}}',
  174. type: 'get',
  175. data: {id: id, type: 2},
  176. tableRefresh: '#table'
  177. });
  178. });
  179. },
  180. notApplicableWherefore: function (id) {
  181. var notBeApplicableInfo = $('#not_be_applicable_info' + id).val();
  182. if (notBeApplicableInfo.length > 250) {
  183. layer.msg('字符长度过长,请控制在250字符以内');
  184. return;
  185. }
  186. tips.ajax({
  187. url: '/admin/articles/not-applicable-wherefore/{{$siteId}}',
  188. type: 'get',
  189. data: {id: id, notBeApplicableInfo: notBeApplicableInfo},
  190. tableRefresh: '#table'
  191. });
  192. },
  193. pushMessage: function () {
  194. var mobile = $('#mobile').val();
  195. layer.confirm('确定推送吗?', {icon: 3, title: '推送短信'}, function (index, layero) {
  196. layer.close(index);
  197. tips.ajax({
  198. url: '/admin/articles/push-mobile-message',
  199. type: 'put',
  200. data: {mobile: mobile, type: 1,siteId:'{{$siteId}}'},
  201. tableRefresh: '#table'
  202. });
  203. });
  204. },
  205. };
  206. var config = {};
  207. config.url = '/admin/sites/' + "{{$siteId}}" + '/articles-find';
  208. config.columns = [ //字段
  209. {checkbox: true},
  210. {title: '编号', field: 'id', align: 'center'},
  211. {
  212. title: '标题', field: 'title', align: 'center',
  213. formatter: function (value, row) {
  214. return '<a href="javascript:;" onclick="units.save(' + row.id + ')">' + value + '</a>'
  215. }
  216. },
  217. {title: '查找人员', field: 'translator_name', align: 'center'},
  218. {title: '审核状态', field: 'check', align: 'center'},
  219. {
  220. title: '操作', field: '', align: 'center',
  221. formatter: function (value, row) {
  222. var str = '';
  223. if (row.be_applicable === 0) {
  224. //熄灭
  225. str += '<button onclick="units.toBeDetermined(' + row.id + ')" class="btn btn-md btn-info" style="display: none">待定</button>&nbsp;';
  226. //高亮
  227. str += '<button onclick="units.beApplicable(' + row.id + ')" class="btn btn-md btn-success">适用</button>&nbsp;';
  228. //高亮
  229. str += '<button onclick="units.notApplicable(' + row.id + ')" class="btn btn-md btn-danger">不适用</button>&nbsp;';
  230. } else if (row.be_applicable === 1) {
  231. //高亮
  232. str += '<button onclick="units.toBeDetermined(' + row.id + ')" class="btn btn-md btn-info">待定</button>&nbsp;';
  233. //熄灭
  234. str += '<button onclick="units.beApplicable(' + row.id + ')" class="btn btn-md btn-success" style="display: none">适用</button>&nbsp;';
  235. //高亮
  236. str += '<button onclick="units.notApplicable(' + row.id + ')" class="btn btn-md btn-danger">不适用</button>&nbsp;';
  237. } else {
  238. //高亮
  239. str += '<button onclick="units.toBeDetermined(' + row.id + ')" class="btn btn-md btn-info">待定</button>&nbsp;';
  240. //高亮
  241. str += '<button onclick="units.beApplicable(' + row.id + ')" class="btn btn-md btn-success">适用</button>&nbsp;';
  242. //熄灭
  243. str += '<button onclick="units.notApplicable(' + row.id + ')" class="btn btn-md btn-danger" style="display: none">不适用</button>&nbsp;';
  244. }
  245. return str;
  246. }
  247. },
  248. {title: '审核人', field: 'reviewer', align: 'center'},
  249. {title: '更新时间', field: 'updated_at', align: 'center'},
  250. {
  251. title: '不适用原因', field: 'not_be_applicable_info', align: 'center',
  252. formatter: function (value, row) {
  253. var str = '';
  254. if (row.be_applicable === 2) {
  255. 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 + '">';
  256. str += '<button onclick="units.notApplicableWherefore(' + row.id + ')" class="btn btn-md btn-success">确定</button>';
  257. }
  258. return str;
  259. },
  260. cellStyle: function () {
  261. return {css: {'display': 'flex'}};
  262. }
  263. }
  264. ];
  265. tips.bootstrapTable(config);
  266. </script>
  267. @endsection