index.blade.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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. .dropdown {
  43. height: 34px;
  44. position: relative;
  45. top: -2px;
  46. }
  47. </style>
  48. @endsection
  49. @section('right')
  50. <ul class="nav nav-tabs">
  51. <li class="active"><a>流程</a></li>
  52. @if(in_array($authUser->role_id,[\App\Http\Models\Role::TYPE_MANAGE_LEADER]) || $authUser->is_super)
  53. <li><a href="/admin/flow-tpl/sites/{{$siteId}}">模板</a></li>
  54. @endif
  55. </ul>
  56. <ul class="ul-content">
  57. <li class="active">
  58. <form id="form">
  59. <main id="main">
  60. @if($stageList->isEmpty())
  61. <button type="button" class="btn btn-success" onclick="utils.initFlow()">根据模板初始化流程</button>
  62. @endif
  63. <button type="button" class="btn btn-success" onclick="utils.addMain()">新增步骤</button>
  64. <button type="button" class="btn btn-info" onclick="utils.saveFlow()">保存</button>
  65. <button type="button" class="btn btn-warning" onclick="utils.clearFlow()">清除</button>
  66. <button type="button" class="btn btn-success" onclick="utils.flowReport()" style="margin-left:4px">
  67. 流程报表
  68. </button>
  69. <button type="button" class="btn btn-success" onclick="utils.deploy({{$siteId}})">网站部署</button>
  70. <a onclick="utils.open()">{{$domain}}</a>
  71. @foreach($stageList as $stage)
  72. <div class="mainStep">
  73. <h4 style="display: inline-block">建站步骤:
  74. <input type="text" class="form-control mainStepText" name="step_title"
  75. value="{{$stage->title}}" data-id="{{$stage->id}}"></h4>
  76. <h4 style="display: inline-block">预计时间:
  77. <input type="text" class="form-control my-date" name="expected_date"
  78. value="{{$stage->expected_date??''}}"
  79. style="width: 110px;display: inline-block" onclick="utils.bindDate(this)"></h4>
  80. <h4 style="display: inline-block">实际完成时间:
  81. <input type="text" class="form-control my-date" name="complete_date"
  82. value="{{$stage->complete_date??''}}"
  83. style="width: 110px;display: inline-block" onclick="utils.bindDate(this)"></h4>
  84. <h4 style="display: inline-block">逾期原因:
  85. <select name="extension" id="extension" class="my-select" multiple
  86. data-container="body" data-live-search="true">
  87. <option value="1" @if(in_array(1,$stage->extension)) selected @endif>客户原因</option>
  88. <option value="2" @if(in_array(2,$stage->extension)) selected @endif>采编原因</option>
  89. <option value="3" @if(in_array(3,$stage->extension)) selected @endif>策划师原因</option>
  90. <option value="4" @if(in_array(4,$stage->extension)) selected @endif>设计原因</option>
  91. <option value="5" @if(in_array(5,$stage->extension)) selected @endif>项目经理原因</option>
  92. <option value="6" @if(in_array(6,$stage->extension)) selected @endif>其他原因</option>
  93. </select>
  94. </h4>
  95. <a onclick="utils.addBig(this)">添加大流程</a>
  96. <a onclick="utils.delMain(this)">删除步骤</a>
  97. <div>
  98. @foreach($stage->infoList as $info)
  99. <table class="my-table">
  100. <colgroup>
  101. <col style="width: 20%">
  102. <col style="width: 20%">
  103. <col style="width: 10%">
  104. <col style="width: 8%">
  105. <col style="width: 10%">
  106. <col style="width: 10%">
  107. <col style="width: 10%">
  108. <col style="width: 10%">
  109. </colgroup>
  110. <thead>
  111. <tr>
  112. <td>具体流程</td>
  113. <td>备注</td>
  114. <td>完成时间</td>
  115. <td>工时(小时)</td>
  116. <td>预计时间</td>
  117. <td>延误时间及原因</td>
  118. <td>
  119. 对接人 预计时间:
  120. <input type="text" class="form-control my-date"
  121. name="except_range_date"
  122. value="{{$info->except_range_date}}" data-id="{{$info->id}}"
  123. style="width: 110px;display: inline-block"
  124. onclick="utils.bindDate(this)">
  125. </td>
  126. <td class="operateAdd">
  127. <a href="javascript:;" onclick="utils.add(this)">添加</a>
  128. <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>
  129. </td>
  130. </tr>
  131. </thead>
  132. <tbody class="connectedSortable">
  133. @foreach($info->detail_list as $item)
  134. <tr>
  135. <td><input type="text" class="form-control" name="flow_name"
  136. value="{{$item['flow_name']??''}}"></td>
  137. <td><input type="text" class="form-control" name="flow_remark"
  138. value="{{$item['flow_remark']??''}}"></td>
  139. <td><input type="text" class="form-control my-date"
  140. onclick="utils.bindDate(this)" name="flow_done_date"
  141. value="{{$item['flow_done_date']}}"></td>
  142. <td><input type="text" class="form-control" name="man_hour"
  143. value="{{$item['man_hour']??''}}"></td>
  144. <td><input type="text" class="form-control my-date"
  145. onclick="utils.bindDate(this)" name="flow_except_date"
  146. value="{{$item['flow_except_date']??''}}"></td>
  147. <td><input type="text" class="form-control" name="reason"
  148. value="{{$item['reason']??''}}"></td>
  149. <td>
  150. @if(empty($item['duty_man']))
  151. <select name="duty_user" class="my-select" multiple
  152. data-container="body" data-live-search="true"
  153. data-man="{{json_encode($item['duty_man']??[])}}">
  154. @foreach($userList as $user)
  155. <option value="{{$user['id']}}"
  156. @if(is_array($item['duty_user']??'') && in_array($user['id'],$item['duty_user'])) selected @endif>
  157. {{$user['nickname']}}
  158. 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】
  159. </option>
  160. @endforeach
  161. </select>
  162. @else
  163. <select name="duty_user" class="my-select" multiple
  164. data-container="body" data-live-search="true"
  165. data-man="{{json_encode($item['duty_man']??[])}}">
  166. @foreach($userList as $user)
  167. @if(!in_array($user['role_id'],$item['duty_man']??[])) @continue @endif
  168. <option value="{{$user['id']}}"
  169. @if(is_array($item['duty_user']??'') && in_array($user['id'],$item['duty_user'])) selected @endif>
  170. {{$user['nickname']}}
  171. 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}
  172. </option>
  173. @endforeach
  174. </select>
  175. @endif
  176. <span style="font-weight: 600;">
  177. @foreach($item['duty_man']??[] as $item)
  178. {{\App\Http\Models\FlowInfoTpl::RoleScope[$item]??''}}
  179. @endforeach
  180. </span>
  181. </td>
  182. <td class="operateDel" onclick="utils.del(this)">删除</td>
  183. </tr>
  184. @endforeach
  185. </tbody>
  186. </table>
  187. @endforeach
  188. </div>
  189. </div>
  190. @endforeach
  191. </main>
  192. </form>
  193. </li>
  194. <li>123</li>
  195. </ul>
  196. @endsection
  197. @section('footer_extend')
  198. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  199. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  200. <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
  201. <script>
  202. $(function () {
  203. $('.my-select').selectpicker({
  204. liveSearch: true
  205. });
  206. $("tbody").sortable({
  207. connectWith: ".connectedSortable"
  208. }).disableSelection();
  209. });
  210. $(function () {
  211. $(".my-date").trigger('click'); //触发laydate绑定
  212. $('.my-select').selectpicker();
  213. });
  214. var utils = {
  215. flowReport: function () {
  216. window.open('/wap/{{base64_encode($siteId)}}/flow');
  217. },
  218. clearFlow: function () {
  219. layer.confirm('是否确认清除流程', {icon: 3, title: '提示'}, function (index) {
  220. //do something
  221. var ajaxConfig = {
  222. url: '/admin/flow-clear/sites/{{$siteId}}',
  223. type: 'delete',
  224. success: function () {
  225. window.location.reload();
  226. }
  227. };
  228. tips.ajax(ajaxConfig);
  229. });
  230. },
  231. add: function (_this) {
  232. var rowspan = $(_this).parent().next().attr('rowspan');
  233. $(_this).parent().next().attr('rowspan', rowspan + 1)
  234. var str = ' <tr>\n' +
  235. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  236. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  237. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  238. ' <td><input type="text" class="form-control" name="man_hour"></td>\n' +
  239. ' <td><input type="text" class="form-control my-date" name="flow_except_date" onclick="utils.bindDate(this)"></td>\n' +
  240. ' <td><input type="text" class="form-control" name="reason"></td>\n' +
  241. ' <td>\n' +
  242. ' <select name="duty_user" class="my-select" multiple data-container="body" data-live-search="true">\n' +
  243. @foreach($userList as $user)
  244. ' <option value="{{$user['id']}}"> {{$user['nickname']}}【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】 </option>' +
  245. @endforeach
  246. ' </select>\n' +
  247. ' </td>\n' +
  248. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  249. ' </tr>';
  250. $(_this).parent().parent().parent().next().append(str);
  251. $(".my-date").trigger('click');
  252. $('.my-select').selectpicker();
  253. },
  254. del: function (_this) {
  255. $(_this).parent().remove();
  256. },
  257. addBig: function (_this) {
  258. var str = '<table class="my-table">\n' +
  259. ' <colgroup>\n' +
  260. ' <col style="width: 20%">\n' +
  261. ' <col style="width: 20%">\n' +
  262. ' <col style="width: 10%">\n' +
  263. ' <col style="width: 8%">\n' +
  264. ' <col style="width: 10%">\n' +
  265. ' <col style="width: 10%">\n' +
  266. ' <col style="width: 10%">\n' +
  267. ' <col style="width: 10%">\n' +
  268. ' </colgroup>\n' +
  269. ' <thead>\n' +
  270. ' <tr>\n' +
  271. ' <td>具体流程</td>\n' +
  272. ' <td>备注</td>\n' +
  273. ' <td>完成时间</td>\n' +
  274. ' <td>工时(小时)</td>\n' +
  275. ' <td>预计时间</td>\n' +
  276. ' <td>延误时间及原因</td>\n' +
  277. ' <td>对接人 预计时间' +
  278. ' <input type="text" class="form-control my-date" name="except_range_date"\n' +
  279. ' style="width: 110px;display: inline-block" onclick="utils.bindDate(this)">' +
  280. ' </td>\n' +
  281. ' <td class="operateAdd">\n' +
  282. ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
  283. ' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +
  284. ' </td>\n' +
  285. ' </tr>\n' +
  286. ' </thead>\n' +
  287. ' <tbody>\n' +
  288. ' <tr>\n' +
  289. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  290. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  291. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  292. ' <td><input type="text" class="form-control" name="man_hour"></td>\n' +
  293. ' <td><input type="text" class="form-control my-date" name="flow_except_date" onclick="utils.bindDate(this)"></td>\n' +
  294. ' <td><input type="text" class="form-control" name="reason"></td>\n' +
  295. ' <td>\n' +
  296. ' <select name="duty_user" class="my-select" multiple data-container="body" data-live-search="true">\n' +
  297. @foreach($userList as $user)
  298. ' <option value="{{$user['id']}}"> {{$user['nickname']}}【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】 </option>' +
  299. @endforeach
  300. ' </select>\n' +
  301. ' </td>\n' +
  302. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  303. ' </tr>\n' +
  304. ' </tbody>\n' +
  305. ' </table>';
  306. $(_this).next().next().append(str);
  307. $(".my-date").trigger('click');
  308. $('.my-select').selectpicker();
  309. },
  310. delBig: function (_this) {
  311. $(_this).parent().parent().parent().parent().remove()
  312. },
  313. delMain: function (_this) {
  314. $(_this).parent().remove()
  315. },
  316. addMain: function () {
  317. var str = ' <div class="mainStep">\n' +
  318. ' <h4 style="display: inline-block">建站步骤:' +
  319. ' <input type="text" class="form-control mainStepText"\n' +
  320. ' name="step_title" data-id="0"></h4>\n' +
  321. ' <h4 style="display: inline-block">预计时间:\n' +
  322. ' <input type="text" class="form-control my-date" name="expected_date" value=""\n' +
  323. ' style="width: 110px;display: inline-block" onclick="utils.bindDate(this)"></h4>\n' +
  324. ' <h4 style="display: inline-block">实际完成时间:\n' +
  325. ' <input type="text" class="form-control my-date" name="complete_date" value=""\n' +
  326. ' style="width: 110px;display: inline-block" onclick="utils.bindDate(this)"></h4>\n' +
  327. ' <h4 style="display: inline-block">逾期原因:\n' +
  328. ' <select name="extension" id="extension" class="my-select" multiple\n' +
  329. ' data-container="body" data-live-search="true">\n' +
  330. ' <option value="1" >客户原因</option>\n' +
  331. ' <option value="2" >采编原因</option>\n' +
  332. ' <option value="3" >策划师原因</option>\n' +
  333. ' <option value="4" >设计原因</option>\n' +
  334. ' <option value="5" >项目经理原因</option>\n' +
  335. ' <option value="6" >其他原因</option>\n' +
  336. ' </select>\n' +
  337. ' </h4>' +
  338. ' <a onclick="utils.addBig(this)">添加大流程</a>\n' +
  339. ' <a onclick="utils.delMain(this)">删除步骤</a>\n' +
  340. ' <div>\n' +
  341. ' <table class="my-table">\n' +
  342. ' <colgroup>\n' +
  343. ' <col style="width: 20%">\n' +
  344. ' <col style="width: 20%">\n' +
  345. ' <col style="width: 10%">\n' +
  346. ' <col style="width: 8%">\n' +
  347. ' <col style="width: 10%">\n' +
  348. ' <col style="width: 10%">\n' +
  349. ' <col style="width: 10%">\n' +
  350. ' <col style="width: 10%">\n' +
  351. ' </colgroup>\n' +
  352. ' <thead>\n' +
  353. ' <tr>\n' +
  354. ' <td>具体流程</td>\n' +
  355. ' <td>备注</td>\n' +
  356. ' <td>完成时间</td>\n' +
  357. ' <td>工时(小时)</td>\n' +
  358. ' <td>预计时间</td>\n' +
  359. ' <td>延误时间及原因</td>\n' +
  360. ' <td>对接人 预计时间' +
  361. ' <input type="text" class="form-control my-date" name="except_range_date"\n' +
  362. ' style="width: 110px;display: inline-block" onclick="utils.bindDate(this)">' +
  363. ' </td>\n' +
  364. ' <td class="operateAdd">\n' +
  365. ' <a href="javascript:;" onclick="utils.add(this)">添加</a>\n' +
  366. ' <a href="javascript:" onclick="utils.delBig(this)">删除大流程</a>\n' +
  367. ' </td>\n' +
  368. ' </tr>\n' +
  369. ' </thead>\n' +
  370. ' <tbody>\n' +
  371. ' <tr>\n' +
  372. ' <td><input type="text" class="form-control" name="flow_name"></td>\n' +
  373. ' <td><input type="text" class="form-control" name="flow_remark"></td>\n' +
  374. ' <td><input type="text" class="form-control my-date" name="flow_done_date" onclick="utils.bindDate(this)"></td>\n' +
  375. ' <td><input type="text" class="form-control" name="man_hour"></td>\n' +
  376. ' <td><input type="text" class="form-control my-date" name="flow_except_date" onclick="utils.bindDate(this)"></td>\n' +
  377. ' <td><input type="text" class="form-control" name="reason"></td>\n' +
  378. ' <td>\n' +
  379. ' <select name="duty_user" class="my-select" multiple data-container="body" data-live-search="true">\n' +
  380. @foreach($userList as $user)
  381. ' <option value="{{$user['id']}}">{{$user['nickname']}} 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】 </option>' +
  382. @endforeach
  383. ' </select>\n' +
  384. ' </td>\n' +
  385. ' <td class="operateDel" onclick="utils.del(this)">删除</td>\n' +
  386. ' </tr>\n' +
  387. ' </tbody>\n' +
  388. ' </table>\n' +
  389. '\n' +
  390. ' </div>\n' +
  391. ' </div>';
  392. $("#main").append(str);
  393. $(".my-date").trigger('click');
  394. $('.my-select').selectpicker();
  395. },
  396. saveFlow: function () {
  397. var flowAll = [];
  398. var errMsg = '';
  399. $(".mainStep").each(function () {
  400. var step_title_obj = $(this).find("[name=step_title]");
  401. var step_title = step_title_obj.val();
  402. var stepId = step_title_obj.data('id');
  403. var expected_date_obj = $(this).find("[name=expected_date]");
  404. var expected_date = expected_date_obj.val();
  405. var complete_date_obj = $(this).find("[name=complete_date]");
  406. var complete_date = complete_date_obj.val();
  407. var extension_obj = $(this).find("[name=extension]");
  408. var extension = extension_obj.val();
  409. var stepData = {
  410. step_title: step_title,
  411. step_id: stepId,
  412. expected_date: expected_date,
  413. complete_date: complete_date,
  414. extension: extension,
  415. children: []
  416. };
  417. if (!step_title) {
  418. errMsg += '建站步骤不能为空<br>';
  419. }
  420. $(this).find("table").each(function () {
  421. var exceptObj = $(this).find("[name=except_range_date]");
  422. var except_range_date = exceptObj.val();
  423. if (!except_range_date) {
  424. errMsg += '预计时间不能为空<br>';
  425. }
  426. var flowData = {
  427. except_range_date: except_range_date,
  428. info_id: exceptObj.data('id'),
  429. children: []
  430. };
  431. $(this).find("tbody tr").each(function () {
  432. var flow_name = $(this).find("[name=flow_name]").val();
  433. var flow_remark = $(this).find("[name=flow_remark]").val();
  434. var flow_done_date = $(this).find("[name=flow_done_date]").val();
  435. var man_hour = $(this).find("[name=man_hour]").val();
  436. var flow_except_date = $(this).find("[name=flow_except_date]").val();
  437. var reason = $(this).find("[name=reason]").val();
  438. var duty_user = $(this).find("[name=duty_user]").val();
  439. var duty_man = $(this).find("[name=duty_user]").data('man');
  440. if (!duty_man) {
  441. duty_man = [];
  442. }
  443. if (!duty_user) {
  444. duty_user = [];
  445. }
  446. if (!flow_name) {
  447. errMsg += '具体流程不能为空<br>';
  448. }
  449. var temp = {
  450. flow_name: flow_name,
  451. flow_remark: flow_remark,
  452. flow_done_date: flow_done_date,
  453. man_hour: man_hour,
  454. flow_except_date: flow_except_date,
  455. reason: reason,
  456. duty_user: duty_user,
  457. duty_man: duty_man
  458. };
  459. flowData.children.push(temp);
  460. });
  461. stepData.children.push(flowData);
  462. });
  463. flowAll.push(stepData);
  464. });
  465. if (errMsg !== '') {
  466. layer.alert(errMsg, {icon: 5});
  467. return;
  468. }
  469. var ajaxConfig = {
  470. url: '/admin/flow-save/sites/{{$siteId}}',
  471. type: 'post',
  472. data: {
  473. dataList: flowAll
  474. },
  475. success: function () {
  476. layer.msg('操作成功', {
  477. icon: 1,
  478. time: 1500 //2秒关闭(如果不配置,默认是3秒)
  479. }, function () {
  480. window.location.reload()
  481. });
  482. }
  483. };
  484. tips.ajax(ajaxConfig);
  485. },
  486. initFlow: function () {
  487. var ajaxConfig = {
  488. url: '/admin/flow-init/sites/{{$siteId}}',
  489. type: 'post',
  490. success: function () {
  491. window.location.reload();
  492. }
  493. };
  494. tips.ajax(ajaxConfig);
  495. },
  496. bindDate: function (that) {
  497. var routeTime = {
  498. type: 'date',
  499. elem: that
  500. };
  501. laydate.render(routeTime);
  502. },
  503. deploy: function (siteId) { //部署
  504. layer.confirm('是否确认部署?', {icon: 3, title: '是否确认部署'}, function () {
  505. var config = {
  506. type: 'GET',
  507. url: '/admin/process/deploy/' + siteId
  508. };
  509. config.success = function (result) {
  510. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  511. window.location.reload();
  512. });
  513. };
  514. tips.ajax(config);
  515. });
  516. },
  517. open: function () {
  518. window.open("http://{{$domain}}");
  519. }
  520. };
  521. </script>
  522. @endsection