keyword.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. @extends('admin/layout')
  2. @section('header')
  3. <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. @php $authUser=auth()->user() @endphp
  7. <body class="gray-bg">
  8. <div class="wrapper wrapper-content animated fadeInRight">
  9. <div class="row">
  10. <div class="col-sm-12">
  11. <div class="ibox float-e-margins">
  12. <div class="ibox-content">
  13. <form class="row" id="searchForm" onsubmit="units.search();return false;">
  14. <div class="input-group">
  15. <select name="optimizerId" id="optimizerId" title="" class="form-control"
  16. style="width: 150px;float: right"
  17. onchange="units.selectPage();">
  18. <option value="">请选择优化组长</option>
  19. @foreach($optimizers as $item)
  20. <option value="{{$item->id}}">{{$item->nickname}}</option>
  21. @endforeach
  22. </select>
  23. <select name="sellerId" id="sellerId" title="" class="form-control"
  24. style="width: 150px;float: right"
  25. onchange="units.selectPage();">
  26. <option value="">请选择销售</option>
  27. @foreach($seller as $item)
  28. <option value="{{$item->id}}">{{$item->nickname}}</option>
  29. @endforeach
  30. </select>
  31. <select name="enable" id="enable" title="" class="form-control"
  32. style="width: 150px;float: right"
  33. onchange="units.selectPage();">
  34. <option value="">请选择关键状态</option>
  35. <option value="0">启用</option>
  36. <option value="1">禁用</option>
  37. </select>
  38. <input type="text" placeholder="请输入关键词" class="input-md form-control"
  39. name="keyword" id="keyword" style="width: 150px;float: right">
  40. <span class="input-group-btn">
  41. <button type="button" class="btn btn-md btn-primary"
  42. onclick="units.search()"> 搜索</button>
  43. <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px"
  44. name="btnReset"> 重置</button>
  45. <button type="button" class="btn btn-md btn-primary"
  46. onclick="units.importKeyword()" style="margin-left: 10px">
  47. 导入关键词
  48. </button>
  49. </span>
  50. </div>
  51. </form>
  52. <hr>
  53. <span style="font-weight:bold">总数:{{$disabled+$enable}} 禁用:{{$disabled}} 启用:{{$enable}}</span>
  54. <div class="table-responsive">
  55. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </body>
  63. @endsection
  64. @section('footer')
  65. <script>
  66. var units = {
  67. importKeyword: function () {
  68. var str =
  69. '<div class="ibox-content" id="importLayer">' +
  70. '<form class="form-horizontal">' +
  71. '<div class="form-group">' +
  72. '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
  73. '<div class="col-sm-6">' +
  74. '<input type="file" id="excel_file" class="form-control">' +
  75. '<input type="hidden" id="excel_path">' +
  76. '</div>' +
  77. '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUpload()">上传</button></div>' +
  78. '</div>' +
  79. ' <div class="form-group">' +
  80. '<div class="col-sm-6 col-sm-offset-3">' +
  81. '<a href="{{asset('tpl/google_trends_keyword_template.xls')}}">请下载导入模板</a>' +
  82. '</div>' +
  83. '</div>' +
  84. '</form>' +
  85. '</div>';
  86. openIndex = layer.open({
  87. type: 1,
  88. content: str,
  89. area: ['60%', '30%'],
  90. title: '导入关键词'
  91. });
  92. },
  93. fileUpload: function () {
  94. var config = {
  95. url: '/admin/tool/excel-upload'
  96. };
  97. config.success = function (result) {
  98. var data = {excel_path: result.data.file_url};
  99. var config = {
  100. url: '/admin/googleTrends/importKeyWord',
  101. type: 'post',
  102. data: data,
  103. success: function (result) {
  104. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  105. layer.close(openIndex);
  106. window.location.reload();
  107. });
  108. }
  109. };
  110. tips.ajax(config);
  111. };
  112. tips.fileUpload($("#excel_file"), config);
  113. },
  114. save: function (id) {
  115. layer.open({
  116. type: 2,
  117. content: ['/admin/googleTrends/keywordSave/' + id],
  118. area: ['65%', '65%'],
  119. title: '保存'
  120. });
  121. },
  122. selectPage: function () {
  123. tips.selectPage();
  124. },
  125. search: function () {
  126. tips.selectPage();
  127. },
  128. taskUpdate: function (id) {
  129. var userId = $('#userId' + id).val();
  130. var url = '/admin/googleTrends/keywordTask';
  131. var type = 'post';
  132. var ajaxConfig = {
  133. url: url,
  134. type: type,
  135. data: {userId: userId, taskId: id},
  136. success: function (result) {
  137. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  138. tips.tableRefresh('#table');
  139. });
  140. }
  141. };
  142. tips.ajax(ajaxConfig);
  143. },
  144. deleteKeyword: function (id) {
  145. layer.confirm('确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  146. layer.close(index);
  147. var url = '/admin/googleTrends/deleteKeyword';
  148. var type = 'post';
  149. var ajaxConfig = {
  150. url: url,
  151. type: type,
  152. data: {taskId: id},
  153. success: function (result) {
  154. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  155. tips.tableRefresh('#table');
  156. });
  157. }
  158. };
  159. tips.ajax(ajaxConfig);
  160. });
  161. },
  162. detail: function (keyWold) {
  163. window.open("/admin/googleTrends/index?keyWold=" + keyWold, "_blank");
  164. }
  165. };
  166. var config = {};
  167. config.url = '/admin/googleTrends/keyword';
  168. config.pageSize = 20;
  169. config.showColumns = true;
  170. config.columns = [
  171. {
  172. title: '序号', align: 'center', formatter: function (value, item, index) {
  173. return index + 1;
  174. },
  175. width: '10px'
  176. },
  177. {
  178. title: '英文关键词', field: 'keyword', align: 'center',
  179. formatter: function (value, row) {
  180. return "<a href='javascript:;' onclick='units.detail(\"" + value + "\")'>" + value + "</a>"
  181. }
  182. },
  183. {title: '中文关键词', field: 'cn_keyword', align: 'center'},
  184. {
  185. title: '状态', field: 'enable', align: 'center',
  186. formatter: function (value, row) {
  187. if (row.enable === 1) {
  188. return '<span style="color:#d0648a">禁用</span>';
  189. } else {
  190. return '<span style="color:#009688">启用</span>';
  191. }
  192. }
  193. },
  194. {title: '客户网站', field: 'website', align: 'center'},
  195. {title: '接单条件', field: 'order_conditions', align: 'center'},
  196. {title: '每月搜索量', field: 'monthly_searches', align: 'center'},
  197. {title: '搜索结果数', field: 'mumber_of_search_results', align: 'center'},
  198. {title: '竞争指数', field: 'competition_index', align: 'center'},
  199. {title: '提交人', field: 'user', align: 'center'},
  200. {title: '创建时间', field: 'created_at', align: 'center'},
  201. {title: '更新时间', field: 'updated_at', align: 'center'},
  202. {
  203. title: '操作', field: 'id', align: 'center',
  204. formatter: function (value, row) {
  205. return '<button onclick="units.save(' + row.id + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';
  206. }
  207. },
  208. {
  209. title: '任务状态', field: 'taskStatus', align: 'center',
  210. formatter: function (value, row) {
  211. if (row.taskStatus === '完成') {
  212. return '<span style="color:#009688">完成</span>';
  213. }
  214. if (row.taskStatus === '未完成') {
  215. return '<span style="color:#d0648a">未完成</span>';
  216. }
  217. return '<span style="color:#d0648a"></span>';
  218. }
  219. },
  220. {
  221. title: '任务分配', field: 'id', align: 'center', width: '260px',
  222. formatter: function (value, row) {
  223. return '' +
  224. '<select class="form-control" id="userId' + row.id + '">' +
  225. '<option value="0">请选择优化师</option>' +
  226. @foreach($optimizers as $item)
  227. '<option value="{{$item->id}}">{{$item->nickname??''}}</option>' +
  228. @endforeach
  229. '</select>' +
  230. '<button onclick="units.taskUpdate(' + row.id + ')" class="btn btn-md btn-primary">确定</button>' +
  231. '<button onclick="units.deleteKeyword(' + row.id + ')" class="btn btn-md btn-danger">删除</button>' +
  232. '<script>' +
  233. '$("#userId' + row.id + '").val(' + row.principal + ')' +
  234. '<\/script>';
  235. },
  236. cellStyle: function () {
  237. return {css: {'display': 'flex'}};
  238. }
  239. }
  240. ];
  241. tips.bootstrapTable(config);
  242. </script>
  243. @endsection