index.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. <link href="{{asset('js/plugins/jquery-pretty-radio-checkbox/css/jquery-labelauty.css')}}" rel="stylesheet">
  6. <style>
  7. .ul-content {
  8. margin: 0;
  9. padding: 0;
  10. list-style-type: none;
  11. }
  12. .ul-content li {
  13. padding: 20px 10px 10px;
  14. display: none;
  15. }
  16. .ul-content .active {
  17. display: block;
  18. }
  19. .my-table {
  20. margin-top: 10px;
  21. width: 100%;
  22. }
  23. .my-table tr {
  24. border: 1px solid #f1f1f1;
  25. }
  26. .my-table td {
  27. padding: 8px;
  28. }
  29. .operateAdd, .operateDel {
  30. font-weight: 600;
  31. cursor: pointer;
  32. text-align: center;
  33. }
  34. .mainStep {
  35. /*border: 1px solid #999;*/
  36. padding: 12px;
  37. margin-top: 20px;
  38. }
  39. .mainStepText {
  40. display: inline-block;
  41. width: 180px;
  42. }
  43. .my-select {
  44. /*width: 60% !important;*/
  45. }
  46. .radio-label,
  47. .radio-check {
  48. display: inline-block;
  49. position: relative;
  50. }
  51. .radio-label input[type="checkbox"] {
  52. appearance: none; /*清楚默认样式*/
  53. -webkit-appearance: none;
  54. /* opacity: 0; */
  55. outline: none;
  56. position: absolute;
  57. z-index: 2;
  58. width: 6px;
  59. height: 6px;
  60. top: 10px;
  61. left: 10px;
  62. border-radius: 50%;
  63. background: #b4b4b4;
  64. }
  65. .radio-label label {
  66. display: inline-block;
  67. min-width: 50px;
  68. height: 24px;
  69. line-height: 24px;
  70. text-align: center;
  71. padding-right: 10px;
  72. border-radius: 5px;
  73. padding-left: 25px;
  74. color: #fff;
  75. background-color: #c9c9c9;
  76. }
  77. .radio-label input[type="checkbox"]:checked {
  78. opacity: 0;
  79. }
  80. .radio-label input[type="checkbox"]:checked + label {
  81. color: #fff;
  82. background-color: #3597db;
  83. }
  84. .radio-label input[type="checkbox"]:checked + label::after {
  85. content: "";
  86. position: absolute;
  87. left: 12px;
  88. top: 5px;
  89. width: 5px;
  90. height: 12px;
  91. border-right: 1px solid #fff;
  92. border-bottom: 1px solid #fff;
  93. transform: rotate(45deg);
  94. }
  95. </style>
  96. @endsection
  97. @section('right')
  98. <ul class="ul-content">
  99. <li class="active">
  100. <form id="form">
  101. <main id="main">
  102. <button type="button" class="btn btn-success" onclick="utils.saveFlow()"
  103. style="position: fixed;right: 50px;top:50px">保存
  104. </button>
  105. <div class="mainStep">
  106. <div>
  107. <table class="my-table">
  108. <colgroup>
  109. <col style="width: 5%">
  110. <col style="width: 15%">
  111. <col style="width: 25%">
  112. <col style="width: 10%">
  113. <col style="width: 15%">
  114. <col style="width: 15%">
  115. <col style="width: 15%">
  116. </colgroup>
  117. <thead>
  118. <tr>
  119. <td class="operateAdd">
  120. <a href="javascript:;" onclick="utils.add(this)"> <i class="fa fa-plus"
  121. aria-hidden="true"
  122. style="font-size: 18px"></i></a>
  123. </td>
  124. <td>标题</td>
  125. <td>内容</td>
  126. <td>是否完成</td>
  127. <td>安排时间</td>
  128. <td>完成时间</td>
  129. <td>人员</td>
  130. </tr>
  131. </thead>
  132. <tbody>
  133. @foreach($tasksList as $item)
  134. <tr>
  135. <td class="operateDel" onclick="utils.del(this)"><i class="fa fa-times"
  136. aria-hidden="true"
  137. style="font-size: 18px"></i>
  138. </td>
  139. <td>
  140. <input type="text" class="form-control" name="title"
  141. value="{{$item['title']??''}}">
  142. </td>
  143. <td>
  144. <input type="text" class="form-control" name="data"
  145. value="{{$item['data']??''}}">
  146. </td>
  147. <td>
  148. <select class="form-control" id="fulfil" name="fulfil">
  149. <option value="1" @if ($item['fulfil']==1) selected @endif>未完成
  150. </option>
  151. <option value="2" @if ($item['fulfil']==2) selected @endif>完成
  152. </option>
  153. </select>
  154. </td>
  155. <td>
  156. <input type="text" class="form-control my-date"
  157. onclick="utils.bindDate(this)" autocomplete="off"
  158. name="initial_date" value="{{$item['initial_date']??''}}">
  159. </td>
  160. <td>
  161. <input type="text" class="form-control my-date"
  162. onclick="utils.bindDate(this)" autocomplete="off"
  163. name="flow_except_date" value="{{$item['flow_except_date']?? $date}}">
  164. </td>
  165. <td>
  166. <select name="personnel" id="personnel" class="my-select"
  167. data-container="body" data-live-search="true">
  168. <option value="0" selected>请选择人员</option>
  169. @foreach($optimizationPersonnel as $role)
  170. <option value="{{$role->id}}"
  171. @if (!empty($item['personnel']) && $role->id==$item['personnel']) selected @endif>{{$role->nickname}}
  172. </option>
  173. @endforeach
  174. </select>
  175. </td>
  176. </tr>
  177. @endforeach
  178. </tbody>
  179. </table>
  180. </div>
  181. </div>
  182. </main>
  183. </form>
  184. </li>
  185. </ul>
  186. @endsection
  187. @section('footer_extend')
  188. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  189. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  190. <script>
  191. $(function () {
  192. $(".my-date").trigger('click'); //触发laydate绑定
  193. $('.my-select').selectpicker();
  194. });
  195. var utils = {
  196. add: function (_this) {
  197. var rowspan = $(_this).parent().next().attr('rowspan');
  198. $(_this).parent().next().attr('rowspan', rowspan + 1);
  199. var str =
  200. '<tr>' +
  201. '<td class="operateDel" onclick="utils.del(this)"><i class="fa fa-times" aria-hidden="true" style="font-size:18px"></i></td>' +
  202. '<td>' +
  203. '<input type="text" class="form-control" name="title">' +
  204. '</td>' +
  205. '<td>' +
  206. '<input type="text" class="form-control" name="data">' +
  207. '</td>' +
  208. '<td>' +
  209. '<select class="form-control" id="fulfil" name="fulfil">' +
  210. '<option value="1" >未完成</option>' +
  211. '<option value="2" >完成</option>' +
  212. '</select>' +
  213. '</td>' +
  214. '<td>' +
  215. '<input type="text" class="form-control my-date" name="initial_date" onclick="utils.bindDate(this)" autocomplete="off" value="{{$date}}">' +
  216. '</td>' +
  217. '<td>' +
  218. '<input type="text" class="form-control my-date" name="flow_except_date" onclick="utils.bindDate(this)" autocomplete="off">' +
  219. '</td>' +
  220. '<td>' +
  221. '<select name="personnel" id="personnel" class="my-select" data-container="body" data-live-search="true">' +
  222. ' <option value="0" selected>请选择人员</option>' +
  223. ' @foreach($optimizationPersonnel as $role)' +
  224. ' <option value="{{$role->id}}">{{$role->nickname}}</option>' +
  225. ' @endforeach' +
  226. '</select>' +
  227. '</td>' +
  228. '</tr>';
  229. $(_this).parent().parent().parent().next().prepend(str);
  230. $(".my-date").trigger('click');
  231. $('.my-select').selectpicker();
  232. },
  233. del: function (_this) {
  234. $(_this).parent().remove();
  235. },
  236. saveFlow: function () {
  237. var flowData = [];
  238. var infoList = [];
  239. $('input[name="info"]:checked').each(function () {
  240. infoList.push($(this).val());
  241. });
  242. var list = infoList.toString();
  243. $(".my-table").each(function () {
  244. $(this).find("tbody tr").each(function () {
  245. var title = $(this).find("[name=title]").val();
  246. var data = $(this).find("[name=data]").val();
  247. var flow_except_date = $(this).find("[name=flow_except_date]").val();
  248. var initial_date = $(this).find("[name=initial_date]").val();
  249. var fulfil = $(this).find("[name=fulfil]").val();
  250. var personnel = $(this).find("[name=personnel]").val();
  251. var temp = {
  252. title: title,
  253. data: data,
  254. fulfil: fulfil,
  255. flow_except_date: flow_except_date,
  256. initial_date: initial_date,
  257. personnel: personnel
  258. }
  259. ;
  260. flowData.push(temp);
  261. });
  262. });
  263. var ajaxConfig = {
  264. url: '/admin/work-task/save/siteId/{{$siteId}}/status/{{$siteStatus}}',
  265. type: 'post',
  266. data: {
  267. infoList: list,
  268. dataList: flowData
  269. },
  270. success: function () {
  271. layer.msg('操作成功', {
  272. icon: 1,
  273. time: 1500 //2秒关闭(如果不配置,默认是3秒)
  274. }, function () {
  275. window.location.reload()
  276. });
  277. }
  278. };
  279. tips.ajax(ajaxConfig);
  280. },
  281. bindDate: function (that) {
  282. var routeTime = {
  283. type: 'date',
  284. elem: that
  285. };
  286. laydate.render(routeTime);
  287. }
  288. };
  289. </script>
  290. @endsection