index.blade.php 12 KB

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