|
|
@@ -40,6 +40,12 @@
|
|
|
</button>
|
|
|
@endcan
|
|
|
|
|
|
+ @can('订单管理-工单处理-货主编辑')
|
|
|
+ <button type="button"
|
|
|
+ class="ml-1 btn btn-outline-dark btn-sm"
|
|
|
+ @click="batchEndWorkOrder">批量完结
|
|
|
+ </button>
|
|
|
+ @endcan
|
|
|
</div>
|
|
|
<div>
|
|
|
<table class="table table-sm table-striped table-hover table-bordered td-min-width-80 " id="table">
|
|
|
@@ -2880,7 +2886,42 @@
|
|
|
window.tempTip.cancelWaitingTip();
|
|
|
this.errorTempTip(err)
|
|
|
});
|
|
|
-
|
|
|
+ },
|
|
|
+ batchEndWorkOrder(){
|
|
|
+ if (checkData.length === 0){
|
|
|
+ this.errorTempTip("请勾选需要完结的工单");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ let count = this.workOrders.filter(e=>checkData.includes(`${e.id}`))
|
|
|
+ .filter(e=>e.status !== '待货主完结').length;
|
|
|
+ if (count>0){
|
|
|
+ this.errorTempTip("勾选工单中有不符合完结条件的工单");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ let detail_ids = this.workOrders.filter(e=>{
|
|
|
+ return checkData.includes(`${e.id}`);
|
|
|
+ }).map(e=>{
|
|
|
+ return e.pending_detail ? e.pending_detail.id : null;
|
|
|
+ }).filter(e=>e);
|
|
|
+ let url = "{{route('workOrder.owner.batchEndApi')}}";
|
|
|
+ let data = {detail_ids:detail_ids};
|
|
|
+ this.waitingTempTip('处理中');
|
|
|
+ window.axios.post(url,data).then(res=>{
|
|
|
+ window.tempTip.cancelWaitingTip();
|
|
|
+ if(res.data.success){
|
|
|
+ checkData.forEach(e=>{
|
|
|
+ let index = this.workOrders.findIndex(workOrder=>`${workOrder.id}` === `${e}`);
|
|
|
+ if (index >= 0){
|
|
|
+ this.$delete(this.workOrders,index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.errorTempTip(res.data.message);
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.cancelWaitingTip();
|
|
|
+ this.errorTempTip(err);
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
})
|