index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. @extends('layouts.app')
  2. @section('title')临时工@endsection
  3. @section('content')
  4. <span id="nav2">
  5. @component('maintenance.menu')@endcomponent
  6. </span>
  7. <div class="container-fluid card" id="list">
  8. <div class="card-body">
  9. @if(Session::has('successTip'))
  10. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  11. @endif
  12. <div class="modal fade" id="workRecord" tabindex="-1" role="dialog" aria-hidden="true">
  13. <div class="modal-dialog">
  14. <div class="modal-content" style="width: 800px">
  15. <div class="modal-header">
  16. <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
  17. </div>
  18. <div class="modal-body m-auto">
  19. <table class="table-sm table-bordered table-striped text-nowrap">
  20. <thead class="thead-light">
  21. <tr>
  22. <td>二次加工单号</td>
  23. <td>开始时间</td>
  24. <td>结束时间</td>
  25. <td>计件数</td>
  26. <td>计件工资</td>
  27. <td>计时数</td>
  28. <td>计时工资</td>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <tr v-for="processDailyParticipant in processDailyParticipants">
  33. <td v-if="processDailyParticipant.process_daily">@{{ processDailyParticipant.process_daily.process_code }}</td>
  34. <td>@{{ processDailyParticipant.started_at }}</td>
  35. <td>@{{ processDailyParticipant.ended_at }}</td>
  36. <td>@{{ processDailyParticipant.unit_count }}</td>
  37. <td>@{{ processDailyParticipant.unit_price }}</td>
  38. <td>@{{ processDailyParticipant.hour_count }}</td>
  39. <td>@{{ processDailyParticipant.hour_price }}</td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. <div class="modal-footer">
  45. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  46. </div>
  47. </div><!-- /.modal-content -->
  48. </div><!-- /.modal -->
  49. </div>
  50. <div class="modal fade" id="clockRecord" tabindex="-1" role="dialog" aria-hidden="true">
  51. <div class="modal-dialog">
  52. <div class="modal-content">
  53. <div class="modal-header">
  54. <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
  55. </div>
  56. <div class="modal-body m-auto">
  57. <table class="table-sm table-bordered table-striped text-nowrap">
  58. <thead class="thead-light">
  59. <tr>
  60. <td>打卡时间</td>
  61. <td>打卡类型</td>
  62. <td>记录类型</td>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <tr v-for="userDutyCheck in userDutyChecks">
  67. <td>@{{ userDutyCheck.checked_at }}</td>
  68. <td>@{{ userDutyCheck.type }}</td>
  69. <td>@{{ userDutyCheck.source }}</td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. </div>
  74. <div class="modal-footer">
  75. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  76. </div>
  77. </div><!-- /.modal-content -->
  78. </div><!-- /.modal -->
  79. </div>
  80. <table class="table table-striped table-sm" >
  81. <tr>
  82. <th>序号</th>
  83. <th>姓名</th>
  84. <th>电话</th>
  85. <th>详情</th>
  86. <th>操作</th>
  87. <th>解除绑定设备</th>
  88. </tr>
  89. <tr v-for="(userLabor,i) in userLabors">
  90. <td>@{{ i+1 }}</td>
  91. <td class="text-muted" v-if="userLabor.user_detail">@{{userLabor.user_detail.full_name}}</td>
  92. <td v-if="userLabor.user_detail">@{{userLabor.user_detail.mobile_phone}}</td>
  93. <td><u class="text-info" style="cursor:pointer" @click="show(userLabor.user_id)">查看详情</u></td>
  94. <td>
  95. @can('临时工-编辑')
  96. <button class="btn btn-sm btn-outline-primary" @click="edit(userLabor.user_id)">改</button>@endcan
  97. @can('临时工-删除')
  98. <button class="btn btn-sm btn-outline-danger" @click="destroy(userLabor)">删</button> @endcan
  99. <button class="btn btn-sm btn-outline-dark" @click="workRecord(userLabor.user_id)">劳务记录</button>
  100. <button class="btn btn-sm btn-outline-dark" @click="clockRecord(userLabor.user_id)">打卡记录</button>
  101. </td>
  102. <td>
  103. @can('临时工')
  104. <button class="btn btn-sm btn-outline-warning" @click="relieve(userLabor.user_id,userLabor.user_detail.full_name)">解</button>
  105. @endcan
  106. </td>
  107. </tr>
  108. </table>
  109. {{$userLabors->links()}}
  110. </div>
  111. </div>
  112. @endsection
  113. @section('lastScript')
  114. <script>
  115. new Vue({
  116. el:"#list",
  117. data:{
  118. userLabors:[
  119. @foreach( $userLabors as $userLabor )
  120. {!! $userLabor !!},
  121. @endforeach
  122. ],
  123. processDailyParticipants:[],
  124. userDutyChecks:[],
  125. },
  126. methods:{
  127. show(user_id){
  128. window.open("{{url('maintenance/userLabor')}}/"+user_id);
  129. },
  130. workRecord(user_id){
  131. let _this=this;
  132. axios.post("{{url('maintenance/userLabor/getWorkRecord')}}",{user_id:user_id})
  133. .then(function (response) {
  134. if (response.data.error){
  135. tempTip.setDuration(3000);
  136. tempTip.show(response.data.error);
  137. return;
  138. }
  139. _this.processDailyParticipants=response.data;
  140. $("#workRecord").modal('show');
  141. }).catch(function (err) {
  142. tempTip.setDuration(3000);
  143. tempTip.show('获取劳务记录失败!网络错误:' + err);
  144. });
  145. },
  146. clockRecord(user_id){
  147. let _this=this;
  148. axios.post("{{url('maintenance/userLabor/getClockRecord')}}",{user_id:user_id})
  149. .then(function (response) {
  150. if (response.data.error){
  151. tempTip.setDuration(3000);
  152. tempTip.show(response.data.error);
  153. return;
  154. }
  155. _this.userDutyChecks=response.data;
  156. $("#clockRecord").modal('show');
  157. }).catch(function (err) {
  158. tempTip.setDuration(3000);
  159. tempTip.show('获取打卡记录失败!网络错误:' + err);
  160. });
  161. },
  162. edit:function(id){
  163. location.href = "{{url('maintenance/userLabor')}}/"+id+"/edit";
  164. },
  165. destroy:function(userLabor){
  166. if(!confirm('确定要删除临时工“' + userLabor.user_detail.full_name + '”吗?')){return};
  167. let _this=this;
  168. let user_id=userLabor.user_id;
  169. let url = "{{url('maintenance/userLabor')}}/"+user_id;
  170. axios.delete(url)
  171. .then(function (response) {
  172. if(response.data.success){
  173. _this.userLabors.every(function (userLabor,i) {
  174. if (userLabor.user_id==user_id){
  175. _this.userLabors.splice(i,1);
  176. return false;
  177. }
  178. return true;
  179. });
  180. tempTip.setDuration(3000);
  181. tempTip.showSuccess('删除临时工成功!');
  182. return;
  183. }
  184. tempTip.setDuration(3000);
  185. tempTip.show('删除临时工失败!');
  186. })
  187. .catch(function (err) {
  188. tempTip.setDuration(3000);
  189. tempTip.show('删除临时工失败!'+'网络错误:' + err);
  190. });
  191. },
  192. relieve(user_id,full_name){
  193. axios.post('{{url('maintenance/userLabor/relieve')}}',{user_id:user_id})
  194. .then((response)=>{
  195. if (response.data.error){
  196. tempTip.setDuration(3000);
  197. tempTip.show(response.data.error);
  198. return;
  199. }
  200. if (response.data.success){
  201. tempTip.setDuration(3000);
  202. tempTip.showSuccess('已解除“'+full_name+'”的绑定设备!');
  203. return;
  204. }
  205. }).catch((err)=>{
  206. tempTip.setDuration(3000);
  207. tempTip.show('解绑失败!网络错误:' + err);
  208. });
  209. }
  210. }
  211. });
  212. </script>
  213. @endsection