bq_process.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. <link rel="stylesheet"
  4. href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
  5. <style>
  6. .ul-content {
  7. margin: 0;
  8. padding: 0;
  9. list-style-type: none;
  10. }
  11. .ul-content li {
  12. padding: 20px 10px 10px;
  13. display: none;
  14. }
  15. .ul-content .active {
  16. display: block;
  17. }
  18. .my-table {
  19. margin-top: 10px;
  20. width: 100%;
  21. }
  22. .my-table tr {
  23. border: 1px solid #f1f1f1;
  24. }
  25. .my-table td {
  26. padding: 8px;
  27. }
  28. .operateAdd, .operateDel {
  29. font-weight: 600;
  30. cursor: pointer;
  31. text-align: center;
  32. }
  33. .mainStep {
  34. border: 1px solid #999;
  35. padding: 12px;
  36. margin-top: 20px;
  37. }
  38. .mainStepText {
  39. display: inline-block;
  40. width: 180px;
  41. }
  42. </style>
  43. @endsection
  44. @section('right')
  45. <ul class="nav nav-tabs">
  46. <li class="active"><a>流程</a></li>
  47. <li><a href="/admin/bqTraffic/bqProcessTpl/{{$siteId}}">模板</a></li>
  48. </ul>
  49. <ul class="ul-content">
  50. <li class="active">
  51. <main id="main">
  52. <button type="button" class="btn btn-success" onclick="utils.initFlow()">初始化模版</button>
  53. {{--<button type="button" class="btn btn-success" onclick="utils.addMain()">新增步骤</button>--}}
  54. <button type="button" class="btn btn-success" onclick="utils.flowReport()" style="margin-left:4px">
  55. 流程报表
  56. </button>
  57. <button type="button" class="btn btn-info" onclick="utils.saveFlowTpl()">保存</button>
  58. @foreach($tplStageList as $stage)
  59. <div class="mainStep">
  60. <h4 style="display: inline-block">完成步骤:<input type="text" class="form-control mainStepText"
  61. name="step_title" value="{{$stage['title']}}"
  62. data-id="{{$stage['id']}}"
  63. style="width: 260px;display: inline-block"></h4>
  64. <h4 style="display: inline-block">预计时间:
  65. <input type="text" class="form-control my-date" name="expected_date"
  66. value="{{substr($stage['expected_date']??'',0,10)}}"
  67. style="width: 110px;display: inline-block" onclick="utils.bindDate(this)"></h4>
  68. {{--<a onclick="utils.addBig(this)">添加大流程</a>--}}
  69. <a onclick="utils.delMain(this)">删除步骤</a>
  70. <div>
  71. @foreach($stage['bq_flow_info'] as $info)
  72. <table class="my-table">
  73. <colgroup>
  74. <col span="3" style="width: 20%">
  75. <col style="width: 12%">
  76. <col style="width: 10%">
  77. <col style="width: 18%">
  78. </colgroup>
  79. <thead>
  80. <tr>
  81. <td>具体流程 <input type="hidden" value="{{$info['id']}}" name="infoId"></td>
  82. <td>备注</td>
  83. <td>完成时间</td>
  84. <td>对接人</td>
  85. <td class="operateAdd">
  86. <a href="javascript:;"
  87. onclick="utils.add(this)">添加</a>
  88. {{--<a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>--}}
  89. </td>
  90. </tr>
  91. </thead>
  92. <tbody class="connectedSortable">
  93. @foreach($info['detail_list'] as $item)
  94. @foreach($item['children'] as $index)
  95. <tr>
  96. <td><input type="text" class="form-control" name="flow_name"
  97. value="{{$index['flow_name']}}"></td>
  98. <td><input type="text" class="form-control" name="flow_remark"
  99. value="{{$index['flow_remark']}}"></td>
  100. <td><input type="text" class="form-control my-date"
  101. onclick="utils.bindDate(this)" name="flow_done_date"
  102. value="{{$index['flow_done_date']}}"></td>
  103. <td>
  104. <select name="duty_user" class="my-select" multiple
  105. data-container="body" data-live-search="true"
  106. data-man="{{json_encode($index['duty_man']??[])}}">
  107. @foreach($userList as $user)
  108. @if(!in_array($user['role_id'],$index['duty_man']??[])) @continue @endif
  109. <option value="{{$user['id']}}"
  110. @if(is_array($index['duty_user']??'') && in_array($user['id'],$index['duty_user'])) selected @endif>
  111. {{$user['nickname']}}
  112. 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}
  113. </option>
  114. @endforeach
  115. </select>
  116. <span style="font-weight: 600;">
  117. @foreach($index['duty_man']??[] as $v)
  118. {{\App\Http\Models\FlowInfoTpl::RoleScope[$v]??''}}
  119. @endforeach
  120. </span>
  121. </td>
  122. <td class="operateDel" onclick="utils.del(this)">删除</td>
  123. </tr>
  124. @endforeach
  125. @endforeach
  126. </tbody>
  127. </table>
  128. @endforeach
  129. </div>
  130. </div>
  131. @endforeach
  132. </main>
  133. </li>
  134. </ul>
  135. @endsection
  136. @section('footer_extend')
  137. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  138. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  139. <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
  140. <script>
  141. $(function () {
  142. $('.my-select').selectpicker({
  143. liveSearch: true
  144. });
  145. $("tbody").sortable({
  146. connectWith: ".connectedSortable"
  147. }).disableSelection();
  148. });
  149. $(function () {
  150. $(".my-date").trigger('click');
  151. $('.my-select').selectpicker();
  152. });
  153. var utils = {
  154. add: function (_this) {
  155. var rowspan = $(_this).parent().next().attr('rowspan');
  156. $(_this).parent().next().attr('rowspan', rowspan + 1)
  157. var str = ' <tr>\n' +
  158. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  159. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  160. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  161. ' <td>\n' +
  162. ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
  163. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  164. ' <option value="{{$roleId}}">{{$roleName}}</option>' +
  165. @endforeach
  166. ' </select>' +
  167. ' </td>\n' +
  168. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  169. ' </tr>';
  170. $(_this).parent().parent().parent().next().append(str);
  171. $(".my-date").trigger('click');
  172. $('.my-select').selectpicker();
  173. },
  174. del: function (_this) {
  175. var mergedTd = $(_this).parent().parent().find(".mergedTd")
  176. var rowspan = mergedTd.attr('rowspan');
  177. mergedTd.attr('rowspan', rowspan - 1);
  178. $(_this).parent().remove();
  179. },
  180. addBig: function (_this) {
  181. var str = '<table class="my-table">\n' +
  182. ' <colgroup>\n' +
  183. ' <col span="3" style="width: 20%">\n' +
  184. ' <col style="width: 12%">\n' +
  185. ' <col style="width: 10%">\n' +
  186. ' <col style="width: 18%">\n' +
  187. ' </colgroup>\n' +
  188. ' <thead>\n' +
  189. ' <tr>\n' +
  190. ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
  191. ' <td>备注</td>\n' +
  192. '\n' +
  193. ' <td>完成时间</td>\n' +
  194. ' <td>对接人</td>\n' +
  195. ' <td class="operateAdd">\n' +
  196. ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
  197. /*' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +*/
  198. ' </td>\n' +
  199. ' </tr>\n' +
  200. ' </thead>\n' +
  201. ' <tbody>\n' +
  202. ' <tr>\n' +
  203. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  204. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  205. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  206. ' <td>\n' +
  207. ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
  208. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  209. ' <option value="{{$roleId}}">{{$roleName}}</option>' +
  210. @endforeach
  211. ' </select>\n' +
  212. ' </td>\n' +
  213. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  214. ' </tr>\n' +
  215. ' </tbody>\n' +
  216. ' </table>';
  217. $(_this).next().next().append(str);
  218. $(".my-date").trigger('click');
  219. $('.my-select').selectpicker();
  220. },
  221. delBig: function (_this) {
  222. $(_this).parent().parent().parent().parent().remove()
  223. },
  224. delMain: function (_this) {
  225. $(_this).parent().remove()
  226. },
  227. addMain: function () {
  228. var str = ' <div class="mainStep">\n' +
  229. ' <h4 style="display: inline-block">建站步骤:<input type="text" class="form-control mainStepText"\n' +
  230. ' name="step_title" data-id="0"></h4>\n' +
  231. /*' <a onclick="utils.addBig(this)">添加大流程</a>\n' +*/
  232. ' <a onclick="utils.delMain(this)">删除步骤</a>\n' +
  233. ' <div>\n' +
  234. ' <table class="my-table">\n' +
  235. ' <colgroup>\n' +
  236. ' <col span="3" style="width: 20%">\n' +
  237. ' <col style="width: 12%">\n' +
  238. ' <col style="width: 10%">\n' +
  239. ' <col style="width: 18%">\n' +
  240. ' </colgroup>\n' +
  241. ' <thead>\n' +
  242. ' <tr>\n' +
  243. ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
  244. ' <td>备注</td>\n' +
  245. '\n' +
  246. ' <td>完成时间</td>\n' +
  247. ' <td>对接人</td>\n' +
  248. ' <td class="operateAdd">\n' +
  249. ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
  250. /*' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +*/
  251. ' </td>\n' +
  252. ' </tr>\n' +
  253. ' </thead>\n' +
  254. ' <tbody>\n' +
  255. ' <tr>\n' +
  256. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  257. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  258. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  259. ' <td>\n' +
  260. ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
  261. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  262. '<option value="{{$roleId}}">{{$roleName}}</option>' +
  263. @endforeach
  264. ' </select>\n' +
  265. ' </td>\n' +
  266. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  267. ' </tr>\n' +
  268. ' </tbody>\n' +
  269. ' </table>\n' +
  270. '\n' +
  271. ' </div>\n' +
  272. ' </div>';
  273. $("#main").append(str);
  274. $(".my-date").trigger('click');
  275. $('.my-select').selectpicker();
  276. },
  277. initFlow: function () {
  278. var ajaxConfig = {
  279. url: '/admin/bqTraffic/bqProcessReset/{{$siteId}}',
  280. type: 'post',
  281. success: function () {
  282. window.location.reload();
  283. }
  284. };
  285. tips.ajax(ajaxConfig);
  286. },
  287. flowReport: function () {
  288. window.open('/wap/{{base64_encode($siteId)}}/optimizationFlow');
  289. },
  290. saveFlowTpl: function () {
  291. var flowAll = [];
  292. var errMsg = '';
  293. $(".mainStep").each(function () {
  294. var step_title_obj = $(this).find("[name=step_title]");
  295. var step_title = step_title_obj.val();
  296. var expected_date_obj = $(this).find("[name=expected_date]");
  297. var expected_date = expected_date_obj.val();
  298. var stepId = step_title_obj.data('id');
  299. var stepData = {
  300. step_title: step_title,
  301. expected_date: expected_date,
  302. step_id: stepId,
  303. children: []
  304. };
  305. if (!step_title) {
  306. errMsg += '建站步骤不能为空<br>';
  307. }
  308. $(this).find("table").each(function () {
  309. var flowData = {
  310. info_id: $(this).find("[name=infoId]").val(),
  311. children: []
  312. };
  313. $(this).find("tbody tr").each(function () {
  314. var flow_name = $(this).find("[name=flow_name]").val();
  315. var flow_remark = $(this).find("[name=flow_remark]").val();
  316. var flow_done_date = $(this).find("[name=flow_done_date]").val();
  317. var duty_user = $(this).find("[name=duty_user]").val();
  318. var duty_man = $(this).find("[name=duty_user]").data('man');
  319. if (!duty_man) {
  320. duty_man = [];
  321. }
  322. if (!duty_user) {
  323. duty_user = [];
  324. }
  325. if (!flow_name) {
  326. errMsg += '具体流程不能为空<br>';
  327. }
  328. var temp = {
  329. flow_name: flow_name,
  330. duty_man: duty_man,
  331. flow_remark: flow_remark,
  332. flow_done_date: flow_done_date,
  333. duty_user: duty_user
  334. };
  335. flowData.children.push(temp);
  336. });
  337. stepData.children.push(flowData);
  338. });
  339. flowAll.push(stepData);
  340. });
  341. if (errMsg !== '') {
  342. layer.alert(errMsg, {icon: 5});
  343. return;
  344. }
  345. var ajaxConfig = {
  346. url: '/admin/bqTraffic/bqProcessSave/{{$siteId}}',
  347. type: 'post',
  348. data: {
  349. dataList: flowAll
  350. }
  351. };
  352. tips.ajax(ajaxConfig);
  353. },
  354. bindDate: function (that) {
  355. var routeTime = {
  356. type: 'date',
  357. elem: that
  358. };
  359. laydate.render(routeTime);
  360. },
  361. };
  362. </script>
  363. @endsection