bq_process_tpl.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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><a href="/admin/bqTraffic/bqProcess/{{$siteId}}">流程</a></li>
  47. <li class="active"><a>模板</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.addMain()">新增步骤</button>
  53. <button type="button" class="btn btn-info" onclick="utils.saveFlowTpl()">保存</button>
  54. @foreach($tplStageList as $stage)
  55. <div class="mainStep">
  56. <h4 style="display: inline-block">完成步骤:<input type="text" class="form-control mainStepText"
  57. name="step_title" value="{{$stage['title']}}"
  58. data-id="{{$stage['id']}}"
  59. style="width: 260px;display: inline-block"></h4>
  60. {{--<a onclick="utils.addBig(this)">添加大流程</a>--}}
  61. <a onclick="utils.delMain(this)">删除步骤</a>
  62. <div>
  63. @foreach($stage['bq_flow_info'] as $info)
  64. <table class="my-table">
  65. <colgroup>
  66. <col span="3" style="width: 20%">
  67. <col style="width: 12%">
  68. <col style="width: 10%">
  69. <col style="width: 18%">
  70. </colgroup>
  71. <thead>
  72. <tr>
  73. <td>具体流程 <input type="hidden" value="{{$info['id']}}" name="infoId"></td>
  74. <td>备注</td>
  75. <td>完成时间</td>
  76. <td>对接人</td>
  77. <td class="operateAdd">
  78. <a href="javascript:;"
  79. onclick="utils.add(this)">添加</a>
  80. {{--<a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>--}}
  81. </td>
  82. </tr>
  83. </thead>
  84. <tbody class="connectedSortable">
  85. @foreach($info['detail_list'] as $item)
  86. @foreach($item['children'] as $index)
  87. <tr>
  88. <td><input type="text" class="form-control" name="flow_name"
  89. value="{{$index['flow_name']}}"></td>
  90. <td><input type="text" class="form-control" name="flow_remark"
  91. value="{{$index['flow_remark']}}"></td>
  92. <td><input type="text" class="form-control my-date"
  93. onclick="utils.bindDate(this)" name="flow_done_date"
  94. value="{{$index['flow_done_date']}}"></td>
  95. <td>
  96. <select name="duty_man" class="my-select" multiple
  97. data-container="body">
  98. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  99. <option value="{{$roleId}}"
  100. @if(is_array($index['duty_man']) && in_array($roleId,$index['duty_man'])) selected @endif>
  101. {{$roleName}}
  102. </option>
  103. @endforeach
  104. </select>
  105. </td>
  106. <td class="operateDel" onclick="utils.del(this)">删除</td>
  107. </tr>
  108. @endforeach
  109. @endforeach
  110. </tbody>
  111. </table>
  112. @endforeach
  113. </div>
  114. </div>
  115. @endforeach
  116. </main>
  117. </li>
  118. </ul>
  119. @endsection
  120. @section('footer_extend')
  121. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  122. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  123. <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
  124. <script>
  125. $(function () {
  126. $('.my-select').selectpicker({
  127. liveSearch: true
  128. });
  129. $("tbody").sortable({
  130. connectWith: ".connectedSortable"
  131. }).disableSelection();
  132. });
  133. $(function () {
  134. $(".my-date").trigger('click');
  135. $('.my-select').selectpicker();
  136. });
  137. var utils = {
  138. add: function (_this) {
  139. var rowspan = $(_this).parent().next().attr('rowspan');
  140. $(_this).parent().next().attr('rowspan', rowspan + 1)
  141. var str = ' <tr>\n' +
  142. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  143. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  144. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  145. ' <td>\n' +
  146. ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
  147. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  148. ' <option value="{{$roleId}}">{{$roleName}}</option>' +
  149. @endforeach
  150. ' </select>' +
  151. ' </td>\n' +
  152. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  153. ' </tr>';
  154. $(_this).parent().parent().parent().next().append(str);
  155. $(".my-date").trigger('click');
  156. $('.my-select').selectpicker();
  157. },
  158. del: function (_this) {
  159. var mergedTd = $(_this).parent().parent().find(".mergedTd")
  160. var rowspan = mergedTd.attr('rowspan');
  161. mergedTd.attr('rowspan', rowspan - 1);
  162. $(_this).parent().remove();
  163. },
  164. addBig: function (_this) {
  165. var str = '<table class="my-table">\n' +
  166. ' <colgroup>\n' +
  167. ' <col span="3" style="width: 20%">\n' +
  168. ' <col style="width: 12%">\n' +
  169. ' <col style="width: 10%">\n' +
  170. ' <col style="width: 18%">\n' +
  171. ' </colgroup>\n' +
  172. ' <thead>\n' +
  173. ' <tr>\n' +
  174. ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
  175. ' <td>备注</td>\n' +
  176. '\n' +
  177. ' <td>完成时间</td>\n' +
  178. ' <td>对接人</td>\n' +
  179. ' <td class="operateAdd">\n' +
  180. ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
  181. /*' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +*/
  182. ' </td>\n' +
  183. ' </tr>\n' +
  184. ' </thead>\n' +
  185. ' <tbody>\n' +
  186. ' <tr>\n' +
  187. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  188. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  189. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  190. ' <td>\n' +
  191. ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
  192. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  193. ' <option value="{{$roleId}}">{{$roleName}}</option>' +
  194. @endforeach
  195. ' </select>\n' +
  196. ' </td>\n' +
  197. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  198. ' </tr>\n' +
  199. ' </tbody>\n' +
  200. ' </table>';
  201. $(_this).next().next().append(str);
  202. $(".my-date").trigger('click');
  203. $('.my-select').selectpicker();
  204. },
  205. delBig: function (_this) {
  206. $(_this).parent().parent().parent().parent().remove()
  207. },
  208. delMain: function (_this) {
  209. $(_this).parent().remove()
  210. },
  211. addMain: function () {
  212. var str = ' <div class="mainStep">\n' +
  213. ' <h4 style="display: inline-block">建站步骤:<input type="text" class="form-control mainStepText"\n' +
  214. ' name="step_title" data-id="0"></h4>\n' +
  215. /*' <a onclick="utils.addBig(this)">添加大流程</a>\n' +*/
  216. ' <a onclick="utils.delMain(this)">删除步骤</a>\n' +
  217. ' <div>\n' +
  218. ' <table class="my-table">\n' +
  219. ' <colgroup>\n' +
  220. ' <col span="3" style="width: 20%">\n' +
  221. ' <col style="width: 12%">\n' +
  222. ' <col style="width: 10%">\n' +
  223. ' <col style="width: 18%">\n' +
  224. ' </colgroup>\n' +
  225. ' <thead>\n' +
  226. ' <tr>\n' +
  227. ' <td>具体流程 <input type="hidden" value="0" name="infoId"> </td>\n' +
  228. ' <td>备注</td>\n' +
  229. '\n' +
  230. ' <td>完成时间</td>\n' +
  231. ' <td>对接人</td>\n' +
  232. ' <td class="operateAdd">\n' +
  233. ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
  234. /*' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +*/
  235. ' </td>\n' +
  236. ' </tr>\n' +
  237. ' </thead>\n' +
  238. ' <tbody>\n' +
  239. ' <tr>\n' +
  240. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  241. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  242. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  243. ' <td>\n' +
  244. ' <select name="duty_man" class="my-select" multiple data-container="body">\n' +
  245. @foreach(\App\Http\Models\FlowInfoTpl::RoleScope as $roleId=>$roleName)
  246. '<option value="{{$roleId}}">{{$roleName}}</option>' +
  247. @endforeach
  248. ' </select>\n' +
  249. ' </td>\n' +
  250. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  251. ' </tr>\n' +
  252. ' </tbody>\n' +
  253. ' </table>\n' +
  254. '\n' +
  255. ' </div>\n' +
  256. ' </div>';
  257. $("#main").append(str);
  258. $(".my-date").trigger('click');
  259. $('.my-select').selectpicker();
  260. },
  261. saveFlowTpl: function () {
  262. var flowAll = [];
  263. var errMsg = '';
  264. $(".mainStep").each(function () {
  265. var step_title_obj = $(this).find("[name=step_title]")
  266. var step_title = step_title_obj.val();
  267. var stepId = step_title_obj.data('id');
  268. var stepData = {step_title: step_title, step_id: stepId, children: []};
  269. if (!step_title) {
  270. errMsg += '建站步骤不能为空<br>';
  271. }
  272. $(this).find("table").each(function () {
  273. var flowData = {
  274. info_id: $(this).find("[name=infoId]").val(),
  275. children: []
  276. };
  277. $(this).find("tbody tr").each(function () {
  278. var flow_name = $(this).find("[name=flow_name]").val();
  279. var flow_remark = $(this).find("[name=flow_remark]").val();
  280. var flow_done_date = $(this).find("[name=flow_done_date]").val();
  281. var duty_man = $(this).find("[name=duty_man]").val();
  282. if (!flow_name) {
  283. errMsg += '具体流程不能为空<br>';
  284. }
  285. var temp = {
  286. flow_name: flow_name,
  287. flow_remark: flow_remark,
  288. flow_done_date: flow_done_date,
  289. duty_man: duty_man
  290. };
  291. flowData.children.push(temp);
  292. });
  293. stepData.children.push(flowData);
  294. });
  295. flowAll.push(stepData);
  296. });
  297. if (errMsg !== '') {
  298. layer.alert(errMsg, {icon: 5});
  299. return;
  300. }
  301. var ajaxConfig = {
  302. url: '/admin/bqTraffic/bqProcessSave/0',
  303. type: 'post',
  304. data: {
  305. dataList: flowAll
  306. }
  307. };
  308. tips.ajax(ajaxConfig);
  309. },
  310. bindDate: function (that) {
  311. var routeTime = {
  312. type: 'date',
  313. elem: that
  314. };
  315. laydate.render(routeTime);
  316. },
  317. };
  318. </script>
  319. @endsection