| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- @extends('layouts.app')
- @section('title')查询-临时工@endsection
- @section('content')
- <div class="container-fluid card" id="list">
- <div class="card-body">
- @if(Session::has('successTip'))
- <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
- @endif
- <div id="form_div"></div>
- <div class="modal fade" id="workRecord" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content" style="width: 800px">
- <div class="modal-header">
- <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">×</button>
- </div>
- <div class="modal-body m-auto">
- <table class="table-sm table-bordered table-striped text-nowrap">
- <thead class="thead-light">
- <tr>
- <td>二次加工单号</td>
- <td>开始时间</td>
- <td>结束时间</td>
- <td>计件数</td>
- <td>计件单价</td>
- <td>计时数</td>
- <td>计时单价</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(processDailyParticipant,i) in processDailyParticipants" >
- <td v-if="processDailyParticipant.process_daily">@{{ processDailyParticipant.process_daily.process_code }}</td>
- <td>@{{ processDailyParticipant.started_at }}</td>
- <td>@{{ processDailyParticipant.ended_at }}</td>
- <td>@{{ processDailyParticipant.unit_count }}</td>
- <td>@{{ processDailyParticipant.unit_price }}</td>
- <td>@{{ processDailyParticipant.hour_count }}</td>
- <td>@{{ processDailyParticipant.hour_price }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <div class="modal fade" id="clockRecord" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">×</button>
- </div>
- <div class="modal-body m-auto">
- <table class="table-sm table-bordered table-striped text-nowrap">
- <thead class="thead-light">
- <tr>
- <td>打卡时间</td>
- <td>打卡类型</td>
- <td>记录类型</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for="userDutyCheck in userDutyChecks">
- <td>@{{ userDutyCheck.checked_at }}</td>
- <td>@{{ userDutyCheck.type }}</td>
- <td>@{{ userDutyCheck.source }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <table class="table table-striped table-sm" >
- <tr>
- <th>序号</th>
- <th>姓名</th>
- <th>电话</th>
- <th>详情</th>
- <th>操作</th>
- <th>解除绑定设备</th>
- </tr>
- <tr v-for="(userLabor,i) in userLabors" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
- <td>@{{ i+1 }}</td>
- <td class="text-muted"><span v-if="userLabor.user_detail">@{{userLabor.user_detail.full_name}}</span></td>
- <td><span v-if="userLabor.user_detail">@{{userLabor.user_detail.mobile_phone}}</span></td>
- <td><u class="text-info" style="cursor:pointer" @click="show(userLabor.user_id)">查看详情</u></td>
- <td>
- @can('临时工-编辑')
- <button class="btn btn-sm btn-outline-primary" @click="edit(userLabor.user_id)">改</button>
- <button class="btn btn-sm btn-outline-success" @click="conversion(userLabor)">转正</button>
- <span v-if="userLabor.user_detail && userLabor.user_detail.black_status==0">
- <button class="btn btn-sm btn-outline-secondary" @click="black(userLabor.user_id)">拉黑</button>
- </span>
- <span v-if="userLabor.user_detail && userLabor.user_detail.black_status==1">
- <button class="btn btn-sm btn-outline-secondary" @click="cancelBlack(userLabor.user_id)">取消拉黑</button>
- </span>
- @endcan
- @can('临时工-删除')
- <button class="btn btn-sm btn-outline-danger" @click="destroy(userLabor)">删</button> @endcan
- <button class="btn btn-sm btn-outline-dark" @click="workRecord(userLabor.user_id)">劳务记录</button>
- <button class="btn btn-sm btn-outline-dark" @click="clockRecord(userLabor.user_id)">打卡记录</button>
- </td>
- <td>
- @can('临时工')
- <span v-if="userLabor.is_relieve_facility">
- <button class="btn btn-sm btn-outline-secondary" @click="relieve(userLabor.user_id,userLabor.user_detail.full_name)">解</button>
- </span>
- @endcan
- </td>
- </tr>
- </table>
- {{$userLabors->links()}}
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
- <script>
- new Vue({
- el:"#list",
- data:{
- userLabors:[
- @foreach( $userLabors as $userLabor )
- {{-- {!! $userLabor !!},--}}
- {user_id:'{{$userLabor->user_id}}',@if($userLabor->userDetail)user_detail:{!! $userLabor->userDetail !!}, @endif
- is_relieve_facility:'{{$userLabor->is_relieve_facility}}',
- },
- @endforeach
- ],
- processDailyParticipants:[],
- userDutyChecks:[],
- selectTr:0
- },
- mounted(){
- let data=[
- [
- {name: 'name', type: 'input', tip: '可支持多姓名查找,模糊搜索可在左侧增加百分号(%)进行', placeholder: '姓名'},
- ]
- ];
- this.form = new query({
- el: "#form_div",
- condition: data,
- });
- this.form.init();
- },
- methods:{
- show(user_id){
- window.open("{{url('maintenance/userLabor')}}/"+user_id);
- },
- black(user_id){
- let _this=this;
- axios.post("{{url('maintenance/userLabor/black')}}",{user_id:user_id})
- .then(function (response) {
- if (response.data.error){
- tempTip.setDuration(3000);
- tempTip.show(response.data.error);
- return;
- }else {
- _this.userLabors.forEach(function (userLabor){
- if (userLabor.user_id==response.data.data.user_id){
- userLabor.user_detail=response.data.data.user_detail;
- _this.$forceUpdate();
- }
- })
- tempTip.setDuration(3000);
- tempTip.showSuccess('拉黑临时工成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('拉黑临时工失败!网络错误:' + err);
- });
- },
- cancelBlack(user_id){
- let _this=this;
- axios.post("{{url('maintenance/userLabor/cancelBlack')}}",{user_id:user_id})
- .then(function (response) {
- if (response.data.error){
- tempTip.setDuration(3000);
- tempTip.show(response.data.error);
- return;
- }else {
- _this.userLabors.forEach(function (userLabor){
- if (userLabor.user_id==response.data.data.user_id){
- userLabor.user_detail=response.data.data.user_detail;
- _this.$forceUpdate();
- }
- })
- tempTip.setDuration(3000);
- tempTip.showSuccess('取消拉黑临时工成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('取消拉黑临时工失败!网络错误:' + err);
- });
- },
- workRecord(user_id){
- let _this=this;
- axios.post("{{url('maintenance/userLabor/getWorkRecord')}}",{user_id:user_id})
- .then(function (response) {
- if (response.data.error){
- tempTip.setDuration(3000);
- tempTip.show(response.data.error);
- return;
- }
- _this.processDailyParticipants=response.data;
- $("#workRecord").modal('show');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('获取劳务记录失败!网络错误:' + err);
- });
- },
- clockRecord(user_id){
- let _this=this;
- axios.post("{{url('maintenance/userLabor/getClockRecord')}}",{user_id:user_id})
- .then(function (response) {
- if (response.data.error){
- tempTip.setDuration(3000);
- tempTip.show(response.data.error);
- return;
- }
- _this.userDutyChecks=response.data;
- $("#clockRecord").modal('show');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('获取打卡记录失败!网络错误:' + err);
- });
- },
- edit:function(id){
- location.href = "{{url('maintenance/userLabor')}}/"+id+"/edit";
- },
- destroy:function(userLabor){
- if(!confirm('确定要删除临时工“' + userLabor.user_detail.full_name + '”吗?')){return};
- let _this=this;
- let user_id=userLabor.user_id;
- let url = "{{url('maintenance/userLabor')}}/"+user_id;
- axios.delete(url)
- .then(function (response) {
- if(response.data.success){
- _this.userLabors.every(function (userLabor,i) {
- if (userLabor.user_id==user_id){
- _this.userLabors.splice(i,1);
- return false;
- }
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('删除临时工成功!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('删除临时工失败!');
- })
- .catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('删除临时工失败!'+'网络错误:' + err);
- });
- },
- conversion:function(userLabor){
- if(!confirm('确定要将临时工“' + userLabor.user_detail.full_name + '”转正吗?')){return};
- let _this=this;
- let user_id=userLabor.user_id;
- let url = "{{url('maintenance/userLabor/conversion')}}";
- axios.post(url,{user_id:user_id}).then(function (response) {
- if(response.data.success){
- _this.userLabors.every(function (userLabor,i) {
- if (userLabor.user_id==user_id){
- _this.userLabors.splice(i,1);
- return false;
- }
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('转正临时工成功!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('转正临时工失败!');
- })
- .catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('转正临时工失败!'+'网络错误:' + err);
- });
- },
- relieve(user_id,full_name){
- let _this=this;
- axios.post('{{url('maintenance/userLabor/relieve')}}',{user_id:user_id})
- .then((response)=>{
- if (response.data.error){
- tempTip.setDuration(3000);
- tempTip.show(response.data.error);
- return;
- }
- if (response.data.success){
- _this.userLabors.every(function (userLabor) {
- if (userLabor.user_id==response.data.userLabor.user_id){
- userLabor.is_relieve_facility=response.data.userLabor.is_relieve_facility;
- return false;
- }
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('已解除“'+full_name+'”的绑定设备!');
- // return;
- }
- }).catch((err)=>{
- tempTip.setDuration(3000);
- tempTip.show('解绑失败!网络错误:' + err);
- });
- }
- }
- });
- </script>
- @endsection
|