plan.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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: 10px 0;
  20. width: 100%;
  21. }
  22. .my-table tr {
  23. border: 1px solid #f1f1f1;
  24. }
  25. .my-table td {
  26. padding: 8px;
  27. }
  28. </style>
  29. @endsection
  30. @section('right')
  31. <ul class="nav nav-tabs">
  32. <li class="active"><a>当周</a></li>
  33. <li><a>下周</a></li>
  34. <li><a>历史</a></li>
  35. </ul>
  36. <ul class="ul-content">
  37. <li class="active">
  38. <table class="my-table">
  39. <thead>
  40. <colgroup>
  41. <col style="width: 150px">
  42. <col>
  43. <col style="width: 200px">
  44. <col>
  45. <col style="width: 200px">
  46. </colgroup>
  47. <tr>
  48. <td>完成时间</td>
  49. <td>事项</td>
  50. <td>临时人员</td>
  51. <td>编内人员</td>
  52. <td>备注</td>
  53. <td style="cursor: pointer" onclick="utils.addNow()">添加</td>
  54. </tr>
  55. </thead>
  56. <tbody id="nowTBody">
  57. @foreach($nowPlanList as $items)
  58. <tr>
  59. <td><input type="text" class="form-control my-date" name="done_date"
  60. onclick="utils.bindDate(this)" value="{{$items->done_date}}">
  61. </td>
  62. <td><input type="text" class="form-control" name="title" value="{{$items->title}}"></td>
  63. <td><input type="text" class="form-control" name="username" value="{{$items->username}}"></td>
  64. <td>
  65. <select name="user_ids" class="my-select" multiple
  66. data-container="body" data-live-search="true">
  67. @foreach($userList as $user)
  68. <option value="{{$user['id']}}"
  69. @if(is_array($items->user_ids??'') && in_array($user['id'],$items->user_ids)) selected @endif>
  70. {{$user['nickname']}}
  71. 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】
  72. </option>
  73. @endforeach
  74. </select>
  75. </td>
  76. <td><input type="text" class="form-control" name="remark" value="{{$items->remark}}"></td>
  77. <td style="cursor: pointer" onclick="utils.delNow(this)">
  78. 删除<input type="hidden" name="id" value="{{$items->id}}">
  79. </td>
  80. <td style="cursor: pointer" onclick="utils.moveNow(this)">
  81. 迁移到下周<input type="hidden" name="id" value="{{$items->id}}">
  82. </td>
  83. </tr>
  84. @endforeach
  85. </tbody>
  86. </table>
  87. <button class="btn btn-success" type="button" onclick="utils.saveNow()"> 保存</button>
  88. </li>
  89. <li>
  90. <table class="my-table">
  91. <thead>
  92. <colgroup>
  93. <col style="width: 150px">
  94. <col style="width: 150px">
  95. <col style="width: 150px">
  96. <col style="width: 150px">
  97. <col style="width: 200px">
  98. <col style="width: 150px">
  99. </colgroup>
  100. <tr>
  101. <td>预计时间</td>
  102. <td>事项</td>
  103. <td>临时人员</td>
  104. <td>编内人员</td>
  105. <td>备注</td>
  106. <td style="cursor: pointer" onclick="utils.addNext()">添加</td>
  107. </tr>
  108. </thead>
  109. <tbody id="nextTBody">
  110. @foreach($nextPlanList as $items)
  111. <tr>
  112. <td><input type="text" class="form-control my-date" name="done_date"
  113. onclick="utils.bindDate(this)" value="{{$items->done_date}}">
  114. </td>
  115. <td><input type="text" class="form-control" name="title" value="{{$items->title}}"></td>
  116. <td><input type="text" class="form-control" name="username"
  117. value="{{str_replace('、',' ',$items->username)}}"></td>
  118. <td>
  119. <select name="user_ids" class="my-select" multiple
  120. data-container="body" data-live-search="true">
  121. @foreach($userList as $user)
  122. <option value="{{$user['id']}}"
  123. @if(is_array($items->user_ids??'') && in_array($user['id'],$items->user_ids)) selected @endif>
  124. {{$user['nickname']}}
  125. 【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】
  126. </option>
  127. @endforeach
  128. </select>
  129. </td>
  130. <td><input type="text" class="form-control" name="remark" value="{{$items->remark}}"></td>
  131. <td style="cursor: pointer" onclick="utils.delNext(this)">
  132. 删除<input type="hidden" name="id" value="{{$items->id}}">
  133. </td>
  134. </tr>
  135. @endforeach
  136. </tbody>
  137. </table>
  138. <button class="btn btn-success" type="button" onclick="utils.saveNext()"> 保存</button>
  139. </li>
  140. <li>
  141. @foreach($historyList as $inx=>$history)
  142. <table class="my-table">
  143. <caption
  144. style="text-align: center;font-size: 20px;font-weight: 600">{{substr($inx,0,4).'年'.substr($inx,4,2).'周'}}</caption>
  145. <thead>
  146. <colgroup>
  147. <col style="width: 150px">
  148. <col>
  149. <col style="width: 200px">
  150. <col>
  151. </colgroup>
  152. <tr>
  153. <td>完成时间</td>
  154. <td>事项</td>
  155. <td>人员</td>
  156. <td>备注</td>
  157. <td>操作</td>
  158. </tr>
  159. </thead>
  160. <tbody id="historyTBody">
  161. @foreach($history as $item)
  162. <tr>
  163. <td class="doneDate">{{$item['done_date']}}</td>
  164. <td class="title">{{$item['title']}}</td>
  165. <td class="username">{{$item['username']}}</td>
  166. <td class="remark">{{$item['remark']}}</td>
  167. <td>
  168. <button type="button"
  169. onclick='utils.editHistory("{{$item['id']}}")'>修改
  170. </button>
  171. <button type="button"
  172. onclick='utils.destroyHistory(this,"{{$item['id']}}")'>删除
  173. </button>
  174. </td>
  175. </tr>
  176. @endforeach
  177. </tbody>
  178. </table>
  179. @endforeach
  180. </li>
  181. </ul>
  182. @endsection
  183. @section('footer_extend')
  184. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  185. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  186. <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
  187. <script>
  188. $(function () {
  189. $(".my-date").trigger('click'); //触发laydate绑定
  190. $('.my-select').selectpicker();
  191. });
  192. $("tbody").sortable({
  193. connectWith: ".nowTBody"
  194. }).disableSelection();
  195. $("tbody").sortable({
  196. connectWith: ".nextTBody"
  197. }).disableSelection();
  198. $(".nav-tabs>li").click(function () {
  199. var index = $(this).index();
  200. $(this).addClass("active");
  201. $(this).siblings().removeClass("active");
  202. $(".ul-content>li").eq(index).addClass("active").siblings().removeClass("active")
  203. });
  204. $(function () {
  205. $(".my-date").trigger('click'); //触发laydate绑定
  206. });
  207. var utils = {
  208. editHistory: function (id) {
  209. layer.open({
  210. type: 2,
  211. content: ['/admin/flow-plan-history-update/' + id],
  212. area: ['60%', '60%'],
  213. title: '修改'
  214. });
  215. },
  216. /*var ro = $(_this).parent().parent().find(".remark");
  217. var uo = $(_this).parent().parent().find(".username");
  218. var to = $(_this).parent().parent().find(".title");
  219. var ddo = $(_this).parent().parent().find(".doneDate");
  220. layer.open({
  221. title: "修改",
  222. area: '650px',
  223. type: 1,
  224. content: '<div class="ibox-content">\n' +
  225. ' <form class="form-horizontal">\n' +
  226. '\n' +
  227. ' <div class="form-group">\n' +
  228. ' <label class="col-sm-3 control-label" >完成时间:</label>\n' +
  229. '\n' +
  230. ' <div class="col-sm-8">\n' +
  231. ' <input type="text" class="form-control" value="' + ddo.text() + '" name="edit_done_date" onclick="utils.bindDate(this)">\n' +
  232. ' </div>\n' +
  233. ' </div>\n' +
  234. ' <div class="form-group">\n' +
  235. ' <label class="col-sm-3 control-label">事项:</label>\n' +
  236. '\n' +
  237. ' <div class="col-sm-8">\n' +
  238. ' <input type="text" class="form-control" value="' + to.text() + '" name="edit_title">\n' +
  239. ' </div>\n' +
  240. ' </div>\n' +
  241. ' <div class="form-group">\n' +
  242. ' <label class="col-sm-3 control-label">临时人员:</label>\n' +
  243. '\n' +
  244. ' <div class="col-sm-8">\n' +
  245. ' <input type="text" class="form-control" value="' + uo.text() + '" name="edit_username">\n' +
  246. ' </div>\n' +
  247. ' </div>\n' +
  248. ' <div class="form-group">\n' +
  249. ' <label class="col-sm-3 control-label">编内人员:</label>\n' +
  250. '\n' +
  251. ' <div class="col-sm-8">\n' +
  252. ' <select name="user_ids" class="my-select" multiple data-container="body" data-live-search="true">' +
  253. '
  254. ' </select>' +
  255. ' </div>\n' +
  256. ' </div>\n' +
  257. ' <div class="form-group">\n' +
  258. ' <label class="col-sm-3 control-label">备注:</label>\n' +
  259. '\n' +
  260. ' <div class="col-sm-8">\n' +
  261. ' <input type="text" class="form-control" value="' + ro.text() + '" name="edit_remark">\n' +
  262. ' </div>\n' +
  263. ' </div>\n' +
  264. ' </form>\n' +
  265. ' </div>',
  266. success: function (layero, index) {
  267. layero.find("[name=edit_done_date]").trigger('click');
  268. },
  269. btn: ['确认', '取消'],
  270. yes: function (index, layero) {
  271. var done_date = layero.find("[name=edit_done_date]").val();
  272. var title = layero.find("[name=edit_title]").val();
  273. var username = layero.find("[name=edit_username]").val();
  274. var remark = layero.find("[name=edit_remark]").val();
  275. var ajaxConfig = {
  276. url: '/admin/flow-plan-edit',
  277. type: 'put',
  278. data: {title: title, doneDate: done_date, username: username, remark: remark, planId: id},
  279. success: function () {
  280. ro.text(remark);
  281. uo.text(username);
  282. to.text(title);
  283. ddo.text(done_date);
  284. }
  285. };
  286. tips.ajax(ajaxConfig);
  287. layer.close(index);
  288. }
  289. });
  290. },*/
  291. destroyHistory: function (_this, planId) {
  292. layer.confirm("是否确认删除", {icon: 3, title: '提示'}, function (inx) {
  293. var ajaxConfig = {
  294. url: '/admin/flow-plan-history?planId=' + planId,
  295. type: 'delete',
  296. success: function (result) {
  297. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  298. $(_this).parent().parent().remove();
  299. layer.close(inx)
  300. });
  301. }
  302. };
  303. tips.ajax(ajaxConfig)
  304. })
  305. },
  306. bindDate: function (that) {
  307. var routeTime = {
  308. type: 'date',
  309. elem: that
  310. };
  311. laydate.render(routeTime);
  312. },
  313. addNow: function () {
  314. var str = '<tr>' +
  315. '<td><input type="text" class="form-control my-date" name="done_date" onclick="utils.bindDate(this)"></td>' +
  316. '<td><input type="text" class="form-control" name="title"></td>' +
  317. '<td><input type="text" class="form-control" name="username"></td>' +
  318. '<td>' +
  319. '<select name="user_ids" class="my-select" multiple data-container="body" data-live-search="true">' +
  320. '@foreach($userList as $user)' +
  321. '<option value="{{$user['id']}}">{{$user['nickname']}}' + '【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】' +
  322. '</option>' +
  323. '@endforeach' +
  324. '</select>' +
  325. '</td>' +
  326. '<td><input type="text" class="form-control" name="remark"></td>' +
  327. '<td style="cursor: pointer" onclick="utils.delNow(this)">删除<input type="hidden" name="id" value="0"></td>' +
  328. '</tr>';
  329. $("#nowTBody").append(str);
  330. $(".my-date").trigger('click');
  331. $('.my-select').selectpicker();
  332. },
  333. delNow: function (_this) {
  334. $(_this).parent().remove();
  335. },
  336. saveNow: function () {
  337. var errMsg = '';
  338. var dataList = [];
  339. $("#nowTBody tr").each(function () {
  340. var done_date = $(this).find("[name=done_date]").val();
  341. var title = $(this).find("[name=title]").val();
  342. var username = $(this).find("[name=username]").val();
  343. var remark = $(this).find("[name=remark]").val();
  344. var id = $(this).find("[name=id]").val();
  345. var user_ids = $(this).find("[name=user_ids]").val();
  346. !done_date && (errMsg += '请选择完成时间<br>');
  347. !title && (errMsg += '请填写事项<br>');
  348. //!username && (errMsg += '请填写人员<br>');
  349. dataList.push({
  350. done_date: done_date,
  351. title: title,
  352. username: username,
  353. remark: remark,
  354. id: id,
  355. user_ids: user_ids,
  356. })
  357. });
  358. if (errMsg !== '') {
  359. layer.alert(errMsg, {icon: 5});
  360. return;
  361. }
  362. var ajaxConfig = {
  363. url: '/admin/flow-plan-save/sites/{{$siteId}}',
  364. type: 'post',
  365. data: {dataList: dataList}
  366. };
  367. tips.ajax(ajaxConfig);
  368. //window.location.reload()
  369. },
  370. moveNow: function (_this) {
  371. var id = $(_this).find("[name=id]").val();
  372. var errMsg = '';
  373. if (errMsg !== '') {
  374. layer.alert(errMsg, {icon: 5});
  375. return;
  376. }
  377. var ajaxConfig = {
  378. url: '/admin/flow-plan-save/sites/{{$siteId}}?isMove=' + id,
  379. type: 'post',
  380. // data: {dataList: dataList}
  381. };
  382. tips.ajax(ajaxConfig);
  383. window.location.reload();
  384. },
  385. addNext: function () {
  386. var str =
  387. '<tr>' +
  388. '<td><input type="text" class="form-control my-date" name="done_date" onclick="utils.bindDate(this)"></td>' +
  389. '<td><input type="text" class="form-control" name="title"></td>' +
  390. '<td><input type="text" class="form-control" name="username"></td>' +
  391. '<td>' +
  392. '<select name="user_ids" class="my-select" multiple data-container="body" data-live-search="true">' +
  393. '@foreach($userList as $user)' +
  394. '<option value="{{$user['id']}}">{{$user['nickname']}}' + '【{{\App\Http\Models\FlowInfoTpl::RoleScope[$user['role_id']]??''}}】' +
  395. '</option>' +
  396. '@endforeach' +
  397. '</select>' +
  398. '</td>' +
  399. '<td><input type="text" class="form-control" name="remark"></td>' +
  400. '<td style="cursor: pointer" onclick="utils.delNext(this)">删除<input type="hidden" name="id" value="0"></td>' +
  401. '</tr>';
  402. $("#nextTBody").append(str);
  403. $(".my-date").trigger('click');
  404. $('.my-select').selectpicker();
  405. },
  406. delNext: function (_this) {
  407. $(_this).parent().remove();
  408. },
  409. saveNext: function () {
  410. var errMsg = '';
  411. var dataList = [];
  412. $("#nextTBody tr").each(function () {
  413. var done_date = $(this).find("[name=done_date]").val();
  414. var title = $(this).find("[name=title]").val();
  415. var username = $(this).find("[name=username]").val();
  416. var remark = $(this).find("[name=remark]").val();
  417. var id = $(this).find("[name=id]").val();
  418. var user_ids = $(this).find("[name=user_ids]").val();
  419. !done_date && (errMsg += '请选择预计时间<br>');
  420. !title && (errMsg += '请填写事项<br>');
  421. //!username && (errMsg += '请填写人员<br>');
  422. dataList.push({
  423. done_date: done_date,
  424. title: title,
  425. username: username,
  426. remark: remark,
  427. id: id,
  428. user_ids: user_ids
  429. })
  430. });
  431. if (errMsg !== '') {
  432. layer.alert(errMsg, {icon: 5});
  433. return;
  434. }
  435. var ajaxConfig = {
  436. url: '/admin/flow-plan-save/sites/{{$siteId}}?isNext=1',
  437. type: 'post',
  438. data: {dataList: dataList}
  439. };
  440. tips.ajax(ajaxConfig);
  441. //window.location.reload()
  442. }
  443. };
  444. </script>
  445. @endsection