createReplenishClock.blade.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. @extends('layouts.app')
  2. @section('title')录入补卡-人事管理@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('personnel.menu')@endcomponent
  6. @component('personnel.checking-in.menuChecking-in')@endcomponent
  7. </div>
  8. <div class="container-fluid" id="list">
  9. <div class="card col-md-10 offset-1">
  10. <div class="card-body">
  11. <div class="form-group row">
  12. <input v-model="full_name" class="col-6 offset-2 form-control" type="text" placeholder="按名称搜索临时工">
  13. <button @click="checkUserLabors()" class="col-2 btn btn-info">搜索</button>
  14. </div>
  15. <table v-if="userLabors.length>0" class="col-10 offset-1 table table-bordered table-hover text-nowrap">
  16. <thead class="thead-light">
  17. <tr>
  18. <th>名称</th>
  19. <th>电话</th>
  20. <th>劳务所</th>
  21. <th>最近打卡时间</th>
  22. <th>输入补卡时间</th>
  23. <th>添加所需备注</th>
  24. <th>补卡类型</th>
  25. <th>工作组</th>
  26. <th>操作</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <tr v-for="userLabor in userLabors">
  31. <td>@{{ userLabor.full_name }}</td>
  32. <td>@{{ userLabor.mobile_phone }}</td>
  33. <td>@{{ userLabor.user_labor_company }}</td>
  34. <td>
  35. <ul class="p-0 m-0 list-unstyled list-inline">
  36. <li v-for="user_duty_check in userLabor.user_duty_checks"><small>@{{ user_duty_check.checked_at }}</small></li>
  37. </ul>
  38. </td>
  39. <td >
  40. <input v-model="userLabor.userDutyCheck_date" type="date" class="form-control-sm" style="width: 150px"><br>
  41. <input v-model="userLabor.userDutyCheck_time" type="time" class="form-control-sm mt-2" style="width: 150px" ><br>
  42. <small v-if="errors.checked_at && errors.checked_at.length>0 " class="text-danger">@{{ errors.checked_at[0] }}</small>
  43. </td>
  44. <td><textarea v-model="userLabor.laborReport_remark" type="text" class="form-control-sm" style="height: 80px;width: 150px"></textarea></td>
  45. <td>
  46. <select :class="{ 'is-invalid' : errors.type && errors.type.length>0 }" v-model="userLabor.userDutyCheck_type" class="form-control">
  47. <option value="">请选择</option>
  48. <option value="登入">登入</option>
  49. <option value="进组">进组</option>
  50. <option value="退组">退组</option>
  51. <option value="登出">登出</option>
  52. </select>
  53. <small v-if="errors.type && errors.type.length>0 " class="text-danger">@{{ errors.type[0] }}</small>
  54. </td>
  55. <td>
  56. <select :class="{ 'is-invalid' : errors.type && errors.type.length>0 }" v-model="userLabor.userWorkGroup" class="form-control">
  57. <option v-for="userWorkGroup in userWorkGroups" :value="userWorkGroup.id">@{{ userWorkGroup.name }}</option>
  58. </select>
  59. <small v-if="errors.type && errors.type.length>0 " class="text-danger">@{{ errors.type[0] }}</small>
  60. </td>
  61. <td><button @click="storeReplenishClock(userLabor)" class="btn btn-info w-100">提交补卡</button></td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. </div>
  66. </div>
  67. </div>
  68. @endsection
  69. @section('lastScript')
  70. <script>
  71. new Vue({
  72. el:"#list",
  73. data:{
  74. full_name:'',
  75. userLabors:[],
  76. errors:{'checked_at':[],'type':[],},
  77. userWorkGroups:[
  78. @foreach($userWorkGroups as $userWorkGroup)
  79. {id:'{{$userWorkGroup->id}}',name:'{{$userWorkGroup->name}}'},
  80. @endforeach
  81. ]
  82. },
  83. methods:{
  84. checkUserLabors(){
  85. let full_name=this.full_name;
  86. let _this=this;
  87. if (!full_name){
  88. tempTip.setDuration(3000);
  89. tempTip.show('请输入临时工全名进行搜索!');
  90. return;
  91. }
  92. axios.post("{{url('personnel/checking-in/checkUserLabors')}}",{full_name:full_name})
  93. .then(function (response) {
  94. if (response.data.success){
  95. if (response.data.data.length<1){
  96. tempTip.setDuration(3000);
  97. tempTip.show('暂无此人打卡信息!');
  98. return;
  99. }
  100. response.data.data.every(function (userLabor) {
  101. userLabor['userDutyCheck_type']='';
  102. userLabor['userDutyCheck_date']='';
  103. userLabor['userDutyCheck_time']='';
  104. return true;
  105. });
  106. _this.userLabors=response.data.data;
  107. }
  108. }).catch(function (err) {
  109. tempTip.setDuration(4000);
  110. tempTip.show('搜索临时工打卡记录失败!网络错误:'+err);
  111. });
  112. },
  113. storeReplenishClock(userLabor){
  114. let checked_at=userLabor.userDutyCheck_date+" "+userLabor.userDutyCheck_time;
  115. if(!confirm('确定要提交'+userLabor.full_name+"在“"+userLabor.userDutyCheck_date+'”的补卡吗?')){return};
  116. let user_id=userLabor.user_id;
  117. let type=userLabor.userDutyCheck_type;
  118. let remark=userLabor.laborReport_remark;
  119. let userWorkGroup=userLabor.userWorkGroup;
  120. if ((type==='进组')&& !userWorkGroup){
  121. tempTip.setDuration(4000);
  122. tempTip.show('工作组不可为空!');
  123. return;
  124. }
  125. let _this=this;
  126. axios.post("{{url('personnel/checking-in/storeReplenishClock')}}",{user_id:user_id,checked_at:checked_at,type:type,remark:remark,userWorkGroup:userWorkGroup})
  127. .then(function (response) {
  128. if (response.data.success){
  129. _this.userLabors.every(function (userLabor) {
  130. if (userLabor.user_id==userLabor.user_id) {
  131. userLabor.user_duty_checks.splice((userLabor.user_duty_checks.length)-1,1);
  132. userLabor.user_duty_checks.unshift(response.data.data);
  133. return false;
  134. }
  135. return true;
  136. });
  137. tempTip.setDuration(3000);
  138. tempTip.showSuccess(userLabor.full_name+'的补卡成功!');
  139. _this.errors={'checked_at':[],'type':[],};
  140. return;
  141. }
  142. if (response.data.result){
  143. tempTip.setDuration(4000);
  144. tempTip.show(response.data.data);
  145. return;
  146. }
  147. _this.errors=response.data.error;
  148. }).catch(function (err) {
  149. tempTip.setDuration(4000);
  150. tempTip.show('录入补卡失败!网络错误:'+err);
  151. });
  152. },
  153. },
  154. });
  155. </script>
  156. @endsection