task_self.blade.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. @extends('admin/layout')
  2. @section('header')
  3. <link rel="stylesheet" href="{{asset('js/plugins/bootstrap-select-1.13.9/dist/css/bootstrap-select.min.css')}}">
  4. <style>
  5. .area {
  6. resize: vertical;
  7. width: 280px;
  8. }
  9. .taskStatus {
  10. font-weight: bold;
  11. font-size: 14px;
  12. }
  13. .addBtn {
  14. margin-left: 10px;
  15. width: 50px;
  16. height: 30px;
  17. line-height: 30px;
  18. border: none;
  19. background-color: #ff6700;
  20. color: white;
  21. outline: none;
  22. }
  23. .my-select {
  24. width: 128px !important;
  25. }
  26. .navNav {
  27. padding: 10px 0 10px 10px;
  28. position: fixed;
  29. top: 10px;
  30. left: 10px;
  31. border: 1px solid gray;
  32. }
  33. .nav-ul {
  34. list-style-type: none;
  35. margin: 0;
  36. padding: 0;
  37. float: left;
  38. }
  39. .clearfix::after {
  40. content: '';
  41. display: block;
  42. clear: both;
  43. }
  44. .nav-ul li {
  45. margin-right: 12px;
  46. float: left;
  47. width: 80px;
  48. height: 32px;
  49. line-height: 32px;
  50. background-color: white;
  51. text-align: center;
  52. font-weight: bold;
  53. cursor: pointer;
  54. }
  55. .nav-active {
  56. background-color: #0d8ddb !important;
  57. color: white;
  58. }
  59. .man-section {
  60. display: none;
  61. }
  62. .section-active {
  63. display: block;
  64. }
  65. </style>
  66. @endsection
  67. @section('content')
  68. <body class="gray-bg" style="padding:10px">
  69. {{-- <div class="col-md-12">
  70. <form class="row" id="searchForm" action="/admin/plan/week-task/indexSelf" method="get">
  71. <div class="col-md-12">
  72. <div class="input-group" style="width: 250px;margin: 0 auto;">
  73. <select class="my-select" name="duty_id" id="duty_id">
  74. @foreach($allUserList as $item)
  75. <option value="{{$item->id}}"
  76. @if($item->id==$dutyId) selected @endif>{{$item->nickname}}</option>
  77. @endforeach
  78. </select>
  79. <span class="input-group-btn">
  80. <button type="button" id="submitbut" class="btn btn-md btn-primary"> 搜索</button>
  81. </span>
  82. </div>
  83. </div>
  84. </form>
  85. </div>--}}
  86. <nav class="navNav clearfix">
  87. <ul class="nav-ul">
  88. <li class="nav-li nav-active" data-section="0">前端</li>
  89. <li class="nav-li" data-section="1">设计</li>
  90. </ul>
  91. @if ($type =='next')
  92. <button type="button" class="btn btn-danger" onclick="units.migrate()"
  93. style="float: left;margin-right: 10px">迁移
  94. </button>
  95. @endif
  96. </nav>
  97. <main style="margin-top: 60px;touch-action: none">
  98. @foreach(\App\Http\Models\WeekTaskInfo::TypeList as $typeIndex=>$typeItem)
  99. <section class="man-section @if($typeIndex=='web') section-active @endif">
  100. <div class="ibox-content" style="position: fixed;top: 0;right: 0;z-index: 99;border: 1px solid grey">
  101. @foreach($typeItem as $inx=>$name)
  102. <a href="#{{$typeIndex.$inx}}" style="margin-right:20px;">{{$name}}</a>
  103. @endforeach
  104. </div>
  105. @foreach($typeItem as $inx=>$name)
  106. <div class="ibox float-e-margins" id="{{$typeIndex.$inx}}">
  107. <div class="ibox-title">
  108. {{$name}}
  109. </div>
  110. @if(substr($inx,0,3)=='wfp')
  111. @php $limit=1; @endphp
  112. @else
  113. @php $limit=5; @endphp
  114. @endif
  115. <div class="ibox-content">
  116. <ul style="list-style-type: none">
  117. @for($day=1;$day<=$limit;$day++)
  118. <li>
  119. @php
  120. if (substr($inx,0,3)=='wfp') {
  121. $dayDataList=array_get($taskInfoList,sprintf('%s.%s',$inx,0));
  122. } else {
  123. $dayDataList=array_get($taskInfoList,sprintf('%s.%s',$inx,$day));
  124. }
  125. $dayDataList=collect($dayDataList??[])->sortBy('sort')->toArray();
  126. @endphp
  127. @if(!empty($dayDataList))
  128. @if(substr($inx,0,3)!='wfp') <span
  129. style="font-weight: bold;font-size: 18px">周 {{\App\Http\Models\WeekTaskInfo::DayMap[$day]??'???'}} </span>
  130. @endif
  131. @php $isAllowAdd=true; @endphp
  132. @if( ($day==date('w') &&$type=='now'&&date('H')>=10&&substr($inx,0,3)!='wfp'))
  133. @php $isAllowAdd=false; @endphp
  134. @endif
  135. <table class="table">
  136. <thead>
  137. <tr>
  138. <th>状态</th>
  139. <th>类型</th>
  140. <th>任务描述</th>
  141. <th>负责人</th>
  142. <th>设计</th>
  143. <th>前端</th>
  144. @php $authUser=auth()->user(); @endphp
  145. @if($authUser->role_id!=14)
  146. <th>检查反馈</th>
  147. @endif
  148. <th>deadline</th>
  149. <th>备注</th>
  150. <th>
  151. 操作&nbsp;
  152. @if( $isAllowAdd)
  153. <button type="button" class="addBtn"
  154. onclick="units.add(this)">新增
  155. </button>
  156. @endif
  157. </th>
  158. </tr>
  159. </thead>
  160. <tbody
  161. @if($isAllowAdd) class="connectedSortable"
  162. @endif data-day="{{$day}}" data-user-type="{{$inx}}">
  163. <tr>
  164. <td colspan="8"></td>
  165. </tr>
  166. @foreach($dayDataList as $dayData)
  167. <tr class="sortableList">
  168. <td>
  169. <span class="taskStatus">
  170. {{\App\Http\Models\WeekTaskInfo::StatusMap[$dayData['status']]??''}}
  171. </span>
  172. <input type="hidden" name="status"
  173. value="{{$dayData['status']}}">
  174. </td>
  175. <td>
  176. <select name="cond_id" class="form-control"
  177. onchange="units.condChange(this)">
  178. <option value="">请选择</option>
  179. @foreach($condList[$typeIndex] as $cond)
  180. <option value="{{$cond->id}}"
  181. @if($cond->id==$dayData['cond_id']) selected @endif>{{$cond->name}}</option>
  182. @endforeach
  183. </select>
  184. </td>
  185. <td>
  186. <textarea class="form-control" name="describe" rows="2"
  187. style="resize: vertical">{{$dayData['describe']}}</textarea>
  188. </td>
  189. <td>
  190. <select class="my-select" name="duty_id">
  191. <option value="">请选择</option>
  192. @foreach($allUserList as $item)
  193. <option value="{{$item->id}}"
  194. @if($item->id==$dayData['duty_id']) selected @endif>{{$item->nickname}}</option>
  195. @endforeach
  196. </select>
  197. </td>
  198. <td>
  199. <select class="my-select" name="design_id">
  200. <option value="">请选择</option>
  201. @foreach($designerList as $item)
  202. <option value="{{$item->id}}"
  203. @if($item->id==$dayData['design_id']) selected @endif>{{$item->nickname}}</option>
  204. @endforeach
  205. </select>
  206. </td>
  207. <td>
  208. <select class="my-select" name="web_id">
  209. <option value="">请选择</option>
  210. @foreach($webList as $item)
  211. <option value="{{$item->id}}"
  212. @if($item->id==$dayData['web_id']) selected @endif>{{$item->nickname}}</option>
  213. @endforeach
  214. </select>
  215. </td>
  216. @php $authUser=auth()->user(); @endphp
  217. @if($authUser->role_id!=14)
  218. <td>
  219. {{-- <input type="text" class="form-control" name="feedback"
  220. value="{{$dayData['feedback']}}">--}}
  221. @php $selectItems=$condItems[$dayData['cond_id']]??[]; @endphp
  222. <select name="cond_item_id" class="form-control">
  223. <option value="">请先选择类型</option>
  224. @foreach($selectItems as $item)
  225. <option value="{{$item->id}}"
  226. @if($item->id==$dayData['cond_item_id']) selected @endif>{{$item->name}}</option>
  227. @endforeach
  228. </select>
  229. </td>
  230. @endif
  231. <td><input type="text" class="form-control" name="deadline"
  232. value="{{$dayData['deadline']}}"
  233. @if($dayData['deadline']) readonly="readonly" @endif>
  234. </td>
  235. {{--<td><input type="text" class="form-control" name="remark"
  236. value="{{$dayData['remark']}}"></td>--}}
  237. <td>
  238. <textarea type="text" class="form-control" name="remark"
  239. style="overflow: hidden"
  240. {{--value="{{$dayData['remark']}}"--}}>{{$dayData['remark']}}
  241. </textarea>
  242. </td>
  243. <td style="position:relative">
  244. <div>
  245. <input type="hidden" name="taskId"
  246. value="{{$dayData['id']}}">
  247. <button type="button" class="btn btn-default btn-sm"
  248. onclick="units.changeStatus(this,'reset')">重置
  249. </button>
  250. <button type="button" class="btn btn-info btn-sm"
  251. onclick="units.changeStatus(this,'ok')">完成
  252. </button>
  253. <button type="button" class="btn btn-success btn-sm"
  254. onclick="units.changeStatus(this,'pause')">暂停
  255. </button>
  256. </div>
  257. <div>
  258. <button type="button" class="btn btn-warning btn-sm"
  259. onclick="units.del(this)">删除
  260. </button>
  261. <button type="button" class="btn btn-primary btn-sm"
  262. onclick="units.singleSave(this)">保存
  263. </button>
  264. </div>
  265. </td>
  266. </tr>
  267. @endforeach
  268. </tbody>
  269. </table>
  270. @endif
  271. </li>
  272. @endfor
  273. </ul>
  274. </div>
  275. </div>
  276. @endforeach
  277. </section>
  278. @endforeach
  279. </main>
  280. </body>
  281. @endsection
  282. @section('footer')
  283. <script src="{{asset('js/plugins/bootstrap-select-1.13.9/dist/js/bootstrap-select.min.js')}}"></script>
  284. <script src="{{asset('js/jquery-ui-1.10.4.min.js')}}"></script>
  285. <script>
  286. $("#submitbut").click(function () {
  287. $("#searchForm").submit();
  288. });
  289. $(function () {
  290. $('.my-select').selectpicker({
  291. liveSearch: true
  292. });
  293. $("tbody").sortable({
  294. connectWith: ".connectedSortable"
  295. }).disableSelection();
  296. $(document).on('click', '.nav-li', function () {
  297. var sectionInx = $(this).data('section');
  298. $(".nav-li").each(function (inx) {
  299. if (inx === sectionInx) {
  300. $(this).addClass("nav-active");
  301. } else {
  302. $(this).removeClass("nav-active");
  303. }
  304. });
  305. $(".man-section").each(function (inx) {
  306. if (inx === sectionInx) {
  307. $(this).show();
  308. } else {
  309. $(this).hide();
  310. }
  311. })
  312. });
  313. });
  314. var units = {
  315. condChange: function (_this) {
  316. var condId = $(_this).find(":selected").val();
  317. var optionStr = '<option value="">请选择</option>';
  318. if (condId) {
  319. var ajaxConfig = {
  320. url: '/admin/plan/week-task/cond-items?condId=' + condId,
  321. type: 'get',
  322. success: function (result) {
  323. $.each(result.data, function (inx, item) {
  324. optionStr += '<option value="' + item.id + '">' + item.name + '</option>';
  325. });
  326. $(_this).parent().parent().find("[name=cond_item_id]").html(optionStr);
  327. }
  328. };
  329. tips.ajax(ajaxConfig);
  330. } else {
  331. $(_this).parent().parent().find("[name=cond_item_id]").html(optionStr);
  332. }
  333. },
  334. add: function (_this) {
  335. var section = $(".nav-active").data('section');
  336. var tpl = '<tr class="sortableList">' +
  337. '<td><span class="taskStatus"></span><input type="hidden" name="status" value=""></td>' +
  338. '<td>' +
  339. '<select name="cond_id" class="form-control" onchange="units.condChange(this)"><option value="">请选择</option>';
  340. var webStr, designStr;
  341. webStr = '' +
  342. @foreach($condList['web'] as $cond)
  343. '<option value="{{$cond->id}}">{{$cond->name}}</option>' +
  344. @endforeach
  345. +'';
  346. designStr = '' +
  347. @foreach($condList['design'] as $cond)
  348. '<option value="{{$cond->id}}">{{$cond->name}}</option>' +
  349. @endforeach
  350. +'';
  351. var foot = '</select>' +
  352. '</td>' +
  353. '<td><textarea class="form-control" name="describe" rows="2" style="resize: vertical"></textarea></td>\n' +
  354. ' <td><select class="my-select" name="duty_id">\n' +
  355. '<option value="">请选择</option>' +
  356. @foreach($allUserList as $item)
  357. ' <option value="{{$item->id}}">{{$item->nickname}}</option>\n' +
  358. @endforeach
  359. ' </select></td>\n' +
  360. ' <td><select class="my-select" name="design_id">\n' +
  361. ' <option value="">请选择</option>' +
  362. @foreach($designerList as $item)
  363. ' <option value="{{$item->id}}">{{$item->nickname}}</option>\n' +
  364. @endforeach
  365. ' </select></td>\n' +
  366. ' <td><select class="my-select" name="web_id">\n' +
  367. ' <option value="">请选择</option>' +
  368. @foreach($webList as $item)
  369. ' <option value="{{$item->id}}">{{$item->nickname}}</option>\n' +
  370. @endforeach
  371. ' </select></td>\n' +
  372. ' <td><select name="cond_item_id" class="form-control">\n' +
  373. ' <option value="">请选择</option>' +
  374. ' </select></td>\n' +
  375. ' <td><input type="text" class="form-control" name="deadline"></td>\n' +
  376. ' <td><input type="text" class="form-control" name="remark"></td>\n' +
  377. ' <td style="position:relative">\n' +
  378. ' <div> <input type="hidden" name="taskId" value="0">' +
  379. ' <button type="button" class="btn btn-default btn-sm" onclick="units.changeStatus(this,\'reset\')">重置\n' + '</button>' +
  380. ' <button type="button" class="btn btn-info btn-sm" onclick="units.changeStatus(this,\'ok\')">完成</button>\n' +
  381. ' <button type="button" class="btn btn-success btn-sm" onclick="units.changeStatus(this,\'pause\')">暂停</button></div>' +
  382. ' <div><button type="button" class="btn btn-warning btn-sm" onclick="units.del(this)">删除</button>\n' +
  383. ' <button type="button" class="btn btn-primary btn-sm"\n' +
  384. ' onclick="units.singleSave(this)">保存\n' +
  385. ' </button></div>' +
  386. ' </td>\n' +
  387. ' </tr>';
  388. var result;
  389. if (section == 0) {
  390. result = tpl + webStr + foot;
  391. } else if (section == 1) {
  392. result = tpl + designStr + foot;
  393. }
  394. var tBody = $(_this).parent().parent().parent().next();
  395. tBody.append(result);
  396. $('.my-select').selectpicker({
  397. liveSearch: true
  398. });
  399. },
  400. del: function (_this) {
  401. var inx = layer.confirm('确认删除', {icon: 3, title: '删除'}, function () {
  402. var taskId = $(_this).parent().parent().find("[name=taskId]").val();
  403. if (taskId > 0) {
  404. var ajaxConfig = {
  405. url: '/admin/plan/week-task/del',
  406. type: 'post',
  407. data: {taskId: taskId},
  408. success: function (result) {
  409. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  410. });
  411. }
  412. };
  413. tips.ajax(ajaxConfig);
  414. }
  415. $(_this).parent().parent().parent().remove();
  416. layer.close(inx);
  417. });
  418. },
  419. singleSave: function (_this) {
  420. var tBody = $(_this).parent().parent().parent().parent();
  421. var tr = $(_this).parent().parent().parent();
  422. var taskId = tr.find("[name=taskId]").val();
  423. var data = {
  424. user_type: tBody.data('user-type'),
  425. day: tBody.data('day'),
  426. describe: tr.find("[name=describe]").val(),
  427. duty_id: tr.find("[name=duty_id]").val(),
  428. design_id: tr.find("[name=design_id]").val(),
  429. web_id: tr.find("[name=web_id]").val(),
  430. feedback: tr.find("[name=feedback]").val(),
  431. remark: tr.find("[name=remark]").val(),
  432. deadline: tr.find("[name=deadline]").val(),
  433. status: tr.find("[name=status]").val(),
  434. cond_id: tr.find("[name=cond_id] :selected").val(),
  435. cond_item_id: tr.find("[name=cond_item_id] :selected").val()
  436. };
  437. var sortIds = [];
  438. tBody.find("tr.sortableList").each(function () {
  439. sortIds.push($(this).find("[name=taskId]").val());
  440. });
  441. var ajaxConfig = {
  442. url: '/admin/plan/week-task/single-save',
  443. type: 'post',
  444. data: {data: data, taskId: taskId, sortIds: sortIds, type: "{{$type}}"},
  445. success: function (result) {
  446. var iconNum = 6;
  447. if (result['addId'] > 0) {
  448. tr.find("[name=taskId]").val(result['addId']);
  449. }
  450. if (result['code'] && result['code'] == '201') {
  451. iconNum = 3;
  452. }
  453. layer.msg(result.message, {icon: iconNum, time: 1000}, function () {
  454. });
  455. }
  456. };
  457. tips.ajax(ajaxConfig);
  458. },
  459. migrate: function () {
  460. layer.confirm('确认迁移', {icon: 3, title: '迁移'}, function () {
  461. var ajaxConfig = {
  462. url: '/admin/plan/week-task/migrate',
  463. type: 'post',
  464. success: function (result) {
  465. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  466. window.location.reload();
  467. });
  468. }
  469. };
  470. tips.ajax(ajaxConfig);
  471. });
  472. },
  473. changeStatus: function (_this, statusType) {
  474. var mapData = {ok: "完成", pause: "暂停", reset: ""};
  475. $(_this).parent().parent().parent().find(".taskStatus").text(mapData[statusType]);
  476. $(_this).parent().parent().parent().find("[name=status]").val(statusType);
  477. }
  478. };
  479. </script>
  480. @endsection