index.blade.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. @extends('layouts.app')
  2. @section('title')查看-临时工申请协调@endsection
  3. @section('content')
  4. <div id="list" class="d-none">
  5. <div class="container-fluid">
  6. <div id="form_div"></div>
  7. <div class="ml-3 form-inline" id="btn">
  8. @can('临时工申请协调-查看-重新生成劳务派遣数据')
  9. <span class="ml-1">
  10. <a title="00:00 - 01:00 禁止生成数据" href="{{ route('laborApply.createDispatch') }}" type="button"
  11. class="btn btn-sm ml-2 btn-outline-danger">重新生成劳务派遣数据</a>
  12. </span>
  13. @endcan
  14. </div>
  15. @include('shared._messages')
  16. <table class="table table-striped table-bordered table-hover card-body td-min-width-80" id="table">
  17. <tr v-for="(labor_apply,i) in labor_applies" @click="selectTr===i+1?selectTr=0:selectTr=i+1"
  18. :class="selectTr===i+1?'focusing' : ''">
  19. <td>
  20. <input class="checkItem" type="checkbox" :value="labor_apply.id">
  21. </td>
  22. <td>@{{ i+1 }}</td>
  23. <td>
  24. <span :class="getStatusClass(labor_apply.status)">@{{ labor_apply.status }}</span>
  25. </td>
  26. <td>@{{ labor_apply.created_at }}</td>
  27. <td>@{{ labor_apply.remark }}</td>
  28. <td>@{{ labor_apply.warehouse && labor_apply.warehouse.name }}</td>
  29. <td>@{{ labor_apply.user_work_group && labor_apply.user_work_group.name }}</td>
  30. <td>@{{ labor_apply.apply_user && labor_apply.apply_user.name }}</td>
  31. <td>@{{ labor_apply.man_num }}</td>
  32. <td>@{{ labor_apply.woman_num }}</td>
  33. <td>@{{ labor_apply.actual_num }}</td>
  34. <td>@{{ labor_apply.arrive_rate }}</td>
  35. <td>
  36. <a v-if="labor_apply.status === '创建'" :href="getEditlUrl(labor_apply)"
  37. class="btn btn-outline-secondary btn-sm" role="button">修改</a>
  38. <form v-if="labor_apply.status === '创建'" :action="getBaseUrl(labor_apply)" method="post"
  39. style="display: inline-block;"
  40. onsubmit="return confirm('您确定要删除吗?');">
  41. {{ csrf_field() }}
  42. {{ method_field('DELETE') }}
  43. <button type="submit" class="btn btn-outline-danger btn-sm">
  44. <i class="far fa-trash-alt"></i> 删除
  45. </button>
  46. </form>
  47. </td>
  48. </tr>
  49. </table>
  50. {{ $labor_applies->links() }}
  51. </div>
  52. </div>
  53. @endsection
  54. @section('lastScript')
  55. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  56. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  57. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  58. <script>
  59. new Vue({
  60. el: "#list",
  61. data: {
  62. labor_applies: [
  63. @foreach( $labor_applies as $labor_apply )
  64. {!! $labor_apply !!},
  65. @endforeach
  66. ],
  67. selectTr: 0,
  68. warehouses: [
  69. @foreach( $warehouses as $item )
  70. {
  71. name: '{{ $item->id }}', value: '{{ $item->name }}'
  72. },
  73. @endforeach
  74. ],
  75. user_work_groups: [
  76. @foreach( $user_work_groups as $item )
  77. {
  78. name: '{{ $item->id }}', value: '{{ $item->name }}'
  79. },
  80. @endforeach
  81. ],
  82. statuses: [
  83. {name: 1, value: '创建'},
  84. {name: 2, value: '指派成功'},
  85. {name: 3, value: '劳务接单'},
  86. {name: 4, value: '任务完结'},
  87. ]
  88. },
  89. created() {
  90. //计算到岗率
  91. this.labor_applies.map(item => {
  92. const created_at = item.created_at;
  93. const user_workgroup_id = item.user_workgroup_id;
  94. const same_items = this.labor_applies.filter(f_item => {
  95. return f_item.created_at.slice(0, 10) === created_at.slice(0, 10) && f_item.user_workgroup_id === user_workgroup_id
  96. });
  97. const total_applied_num = same_items.reduce((sum, current) => {
  98. return sum + (current.man_num + current.woman_num);
  99. }, 0)
  100. const arrive_rate = Math.floor((item.actual_num / total_applied_num) * 100);
  101. item.arrive_rate = arrive_rate + '%';
  102. return item;
  103. });
  104. },
  105. mounted() {
  106. $('#list').removeClass('d-none');
  107. let _this = this;
  108. $(".up").slideUp();
  109. let data = [
  110. [
  111. //申请人
  112. {name: 'apply_user', type: 'input', tip: '搜索申请人', placeholder: '申请人'},
  113. //创建起始时间
  114. {name: 'created_at_start', type: 'dateTime', tip: '选择显示创建时间的起始时间'},
  115. //仓库
  116. {
  117. name: 'warehouse',
  118. type: 'select_multiple_select',
  119. tip: ['输入关键词快速定位下拉列表,回车确定', '仓库'],
  120. placeholder: ['仓库', '定位或多选仓库'],
  121. data: _this.warehouses
  122. },
  123. //状态
  124. {
  125. name: 'status',
  126. type: 'select_multiple_select',
  127. tip: ['输入关键词快速定位下拉列表,回车确定', '状态'],
  128. placeholder: ['状态', '定位或多选状态'],
  129. data: _this.statuses
  130. },
  131. ],
  132. [
  133. //用工要求
  134. {name: 'remark', type: 'input', tip: '搜索用工要求', placeholder: '用工要求'},
  135. //创建截止时间
  136. {name: 'created_at_end', type: 'dateTime', tip: '选择显示创建时间的截止时间'},
  137. //仓库小组
  138. {
  139. name: 'user_work_group',
  140. type: 'select_multiple_select',
  141. tip: ['输入关键词快速定位下拉列表,回车确定', '仓库小组'],
  142. placeholder: ['仓库小组', '定位或多选仓库小组'],
  143. data: _this.user_work_groups
  144. },
  145. ]
  146. ];
  147. _this.form = new query({
  148. el: '#form_div',
  149. condition: data,
  150. appendDom: "btn",
  151. });
  152. _this.form.init();
  153. let column = [
  154. {name: 'index', value: '序号', neglect: true},
  155. {name: 'status', value: '状态'},
  156. {name: 'created_at', value: '申请日期'},
  157. {name: 'remark', value: '用工要求'},
  158. {name: 'warehouse', value: '仓库'},
  159. {name: 'user_workgroup_id', value: '仓库小组'},
  160. {name: 'apply_user', value: '申请人'},
  161. {name: 'man_num', value: '男工人数'},
  162. {name: 'woman_num', value: '女工人数'},
  163. {name: 'actual_num', value: '到岗人数'},
  164. {name: 'arrive_rate', value: '到岗率'},
  165. {name: 'do', value: '操作'},
  166. ];
  167. new Header({
  168. el: "table",
  169. name: "labor_applies",
  170. column: column,
  171. data: this.labor_applies,
  172. restorationColumn: 'addtime',
  173. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  174. }).init();
  175. },
  176. methods: {
  177. getEditlUrl(obj) {
  178. return "{{ url('personnel/laborApply') }}/" + obj.id + '/edit';
  179. },
  180. getBaseUrl(obj) {
  181. return "{{ url('personnel/laborApply') }}/" + obj.id;
  182. },
  183. //获取状态的徽章(badge)组件的外观
  184. getStatusClass(status) {
  185. let result = '';
  186. switch (status) {
  187. case '创建':
  188. result = 'badge badge-light'
  189. break;
  190. case '指派成功':
  191. result = 'badge badge-info'
  192. break;
  193. case '劳务接单':
  194. result = 'badge badge-primary'
  195. break;
  196. case '任务完结':
  197. result = 'badge badge-success'
  198. break;
  199. default:
  200. result = 'badge badge-info'
  201. }
  202. return result;
  203. }
  204. }
  205. });
  206. </script>
  207. @endsection