Pārlūkot izejas kodu

Merge branch 'master' into LD

LD 4 gadi atpakaļ
vecāks
revīzija
1ea7f33ad2

+ 2 - 2
app/Http/Controllers/StorageController.php

@@ -21,7 +21,7 @@ class StorageController extends Controller
         $amount = (int)\request("amount");
         //check info
         if (!$asn || !$ide || !$barCode || !$amount)$this->error("信息不完整");
-        $fromLocation = 'HAIB1-03-03';//app("MaterialBoxService")->getBoxLocation($ide);
+        $fromLocation = app("MaterialBoxService")->getBoxLocation($ide);
         if (!$fromLocation)$this->error("海柔无此库位信息");
         $box = MaterialBox::query()->select("id")->where("code",$ide)->first();
         if (!$box)$this->error("WAS无此料箱");
@@ -55,7 +55,7 @@ sql;
         //亮灯
         app("CacheShelfService")->_stationCacheLightOn($fromLocation,$ide);
         //建立入库任务
-        app("ForeignHaiRoboticsService")->putWareHousing($fromLocation,'',$box->id);
+        if (!app("ForeignHaiRoboticsService")->putWareHousing($fromLocation,'',$box->id))$this->error("错误库位或库位已被下达任务");
         $this->success();
     }
 

+ 4 - 0
app/Http/Controllers/TestController.php

@@ -123,9 +123,13 @@ class TestController extends Controller
     }
     public function test()
     {
+        StationTask::destroy([1278,1279,1280,1282,1283]);
+        StationTaskMaterialBox::destroy([18405,18406,18407,18409,18410]);
+        dd("OK");
         $s = Station::query()->select("id")->where("parent_id",6)->whereNotIn("code",[
             "HAIB1-01-01","HAIB1-03-01","HAIB1-03-03"
         ]);
+        dd($s->get());
         $t = StationTask::query()->select("id")->where("status",'待处理')
             ->whereIn("station_id",$s);
         StationTask::query()->where("status",'待处理')

+ 50 - 56
app/Http/Controllers/WaybillController.php

@@ -7,7 +7,6 @@ use App\CarType;
 use App\Components\AsyncResponse;
 use App\Region;
 use App\Services\CarTypeService;
-use App\Services\common\ExportService;
 use App\Services\LogisticService;
 use App\Services\OwnerService;
 use App\Services\UnitService;
@@ -24,7 +23,6 @@ use App\WaybillPayoff;
 use App\WaybillFinancialExcepted;
 use App\WaybillFinancialSnapshot;
 use Carbon\Carbon;
-use Exception;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
@@ -32,7 +30,6 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
-use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Facades\Validator;
 use Intervention\Image\Facades\Image;
@@ -493,51 +490,47 @@ class WaybillController extends Controller
     }
 
     public function upload(Request $request){
-        if(!Gate::allows('运输管理-运单-图片上传')){ return '没有权限';  }
-        $file=$request->file('file');
-        $waybill_number=$request->input('waybill_number');
-        $waybill=Waybill::query()->where('waybill_number',$waybill_number)->first();
-        if (!$waybill){
-            return ['success'=>false,'error'=>"未找到该运单!"];
-        }
-        if ($waybill->upload_file_url){
-            return ['success'=>false,'error'=>"该运单已存在照片!"];
-        }
-        if (!$file){
-            return ['success'=>false,'error'=>"照片不得为空!"];
-        }
-        if (!$file->isValid()){
-            return ['success'=>false,'error'=>"找不到照片!"];
-        }
-        $tmpFile = $file->getRealPath();
-        if (! is_uploaded_file($tmpFile)) {
-            return ['success'=>false,'error'=>"文件错误!"];
-        }
-        $fileExtension=$file->getClientOriginalExtension();
-        // 5.存储, 生成一个随机文件名
-        $fileName = date('ymd').'-'.Uuid::uuid1();//thumbnail common bulky
-        $thumbnailName=storage_path('app/public/files/'.$fileName.'-thumbnail.'.$fileExtension);
-        $commonName=storage_path('app/public/files/'.$fileName.'-common.'.$fileExtension);
-        $bulkyName=storage_path('app/public/files/'.$fileName.'-bulky.'.$fileExtension);
-        $result=move_uploaded_file ($tmpFile ,$bulkyName);
-        if ($result){
-            $img=Image::make($bulkyName);
-            if ($img->height() > $img->width())
-                $img->heighten(250)->save($commonName);
-            else $img->widen(250)->save($commonName);
-            $img->heighten(28)->save($thumbnailName);
-            $uploadFile=new UploadFile([
-                "table_name"=>"waybills",
-                "table_id"=>$waybill->id,
-                "url"=>'/files/'.$fileName,
-                "type"=>$fileExtension,
-            ]);
-            if ($uploadFile->save())
-                app('LogService')->log(__METHOD__,'图片上传',json_encode($request),Auth::user()['id']);
-            $uploadFile->url=asset('/storage'.$uploadFile->url);
-            return ['success'=>true,'data'=>$uploadFile];
+        $this->gate("运输管理-运单-图片上传");
+        $files=$request->file("files");
+        if (!$files)$this->error("未传递照片");
+        $id=$request->input('id');
+        $waybill=Waybill::query()->find($id);
+        if (!$waybill)$this->error("未找到该运单!");
+        $res = [];
+        foreach ($files as $file){
+            if (!$file->isValid()){
+                return ['success'=>false,'error'=>"找不到照片!"];
+            }
+            $tmpFile = $file->getRealPath();
+            if (! is_uploaded_file($tmpFile)) {
+                return ['success'=>false,'error'=>"文件错误!"];
+            }
+            $fileExtension=$file->getClientOriginalExtension();
+            // 5.存储, 生成一个随机文件名
+            $fileName = date('ymd').'-'.Uuid::uuid1();//thumbnail common bulky
+            $thumbnailName=storage_path('app/public/files/'.$fileName.'-thumbnail.'.$fileExtension);
+            $commonName=storage_path('app/public/files/'.$fileName.'-common.'.$fileExtension);
+            $bulkyName=storage_path('app/public/files/'.$fileName.'-bulky.'.$fileExtension);
+            $result=move_uploaded_file ($tmpFile ,$bulkyName);
+            if ($result){
+                $img=Image::make($bulkyName);
+                if ($img->height() > $img->width())
+                    $img->heighten(250)->save($commonName);
+                else $img->widen(250)->save($commonName);
+                $img->heighten(28)->save($thumbnailName);
+                /** @var UploadFile|\stdClass $uploadFile */
+                $uploadFile=new UploadFile([
+                    "table_name"=>"waybills",
+                    "table_id"=>$waybill->id,
+                    "url"=>'/files/'.$fileName,
+                    "type"=>$fileExtension,
+                ]);
+                if ($uploadFile->save())
+                    app('LogService')->log(__CLASS__,'运输图片上传',json_encode($request),Auth::user()['id']);
+                $res[] = $uploadFile;
+            }else $this->error("图片存储失败,检查服务器状态");
         }
-        return ['success'=>false,'error'=>"图片保存失败!"];
+        $this->success($res);
     }
 
     //批量上传图片
@@ -566,9 +559,9 @@ class WaybillController extends Controller
             $number[] = $num;
             $mapping[$num] = $index;
         }
-        $waybills = Waybill::query()->select("id","source_bill")->doesntHave("uploadFile")->whereIn('source_bill',$number)->get();
+        $waybills = Waybill::query()->select("id","source_bill")->whereIn('source_bill',$number)->get();
         foreach (array_diff($number,array_column($waybills->toArray(),"source_bill")) as $diff){
-            $errors[] = "“".$diff."”不存在运单或已存在照片";
+            $errors[] = "“".$diff."”不存在运单";
             unset($images[$mapping[$diff]]);
         }
         $insert = [];
@@ -598,16 +591,17 @@ class WaybillController extends Controller
             ];
         }
         if ($insert)UploadFile::query()->insert($insert);
-        $waybills->load("uploadFile");
+        $waybills->load("uploadFiles");
         $this->success(["errors"=>$errors,"data"=>$waybills]);
     }
 
     //删除照片
     public function deleteImg(Request $request){
-        if(!Gate::allows('运输管理-运单-图片删除')){ return '没有权限';  }
-        $ids=$request->input('ids');
-        $uploadFiles=UploadFile::where('table_name','waybills')->whereIn('table_id',$ids)->get();
-        foreach ($uploadFiles as $uploadFile){
+        $this->gate("运输管理-运单-图片删除");
+        $query=UploadFile::query()->where('table_name','waybills');
+        if ($request->input("url"))$query = $query->where('table_id',$request->input("id"))->where("url",$request->input("url"));
+        else $query = $query->whereIn('table_id',$request->input("id"));
+        foreach ($query->get() as $uploadFile){
             $bulky=storage_path('app/public/'.$uploadFile->url.'-bulky.'.$uploadFile->type);
             $common=storage_path('app/public/'.$uploadFile->url.'-common.'.$uploadFile->type);
             $thumbnail=storage_path('app/public/'.$uploadFile->url.'-thumbnail.'.$uploadFile->type);
@@ -615,9 +609,9 @@ class WaybillController extends Controller
                 unlink($bulky);unlink($common);unlink($thumbnail);
             }
         }
-        UploadFile::where('table_name','waybills')->whereIn('table_id',$ids)->delete();
+        $query->delete();
         app('LogService')->log(__METHOD__,'图片删除',json_encode($request),Auth::user()['id']);
-        return ['success'=>true];
+        $this->success();
     }
 
     public function export(){

+ 3 - 6
app/Http/Controllers/WeighController.php

@@ -10,7 +10,6 @@ use App\Services\OwnerService;
 use App\Services\PackageService;
 use App\Services\PackageStatisticsService;
 use Carbon\Carbon;
-use Exception;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
@@ -146,12 +145,10 @@ class WeighController extends Controller
 
     public function statistics(Request $request){
         $packages = app('PackageStatisticsService')->get($request->input());
-        $owners=app('OwnerService')->getIntersectPermitting();
+        $owners=app('OwnerService')->get([],null,false);
         $logistics=app('LogisticService')->getSelection();
         $ownerTemp = [];
-        foreach ($owners as $owner){
-            $ownerTemp[$owner->id] = $owner->name;
-        }
+        foreach ($owners as $owner)$ownerTemp[$owner->id] = $owner->name;
         $ps = [];
         $logisticsTemp = [];
         foreach ($packages as $package){
@@ -164,7 +161,7 @@ class WeighController extends Controller
                     $package->logistic_id => $package->count,
                     "sum" => (int)$package->count,
                     "owner_id" => $package->owner_id,
-                    "owner_name" => $ownerTemp[$package->owner_id]
+                    "owner_name" => $ownerTemp[$package->owner_id] ?? '未知',
                 ];
             }
         }

+ 2 - 0
app/Providers/AppServiceProvider.php

@@ -126,6 +126,7 @@ use App\Services\OrderPackageCommoditySerialNumberService;
 use App\Services\OrderPackageExceptionTypeCountingRecordService;
 use App\Services\LogisticYDService;
 use App\Services\ForeignZhenCangService;
+use App\Services\StorageService;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -289,6 +290,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('StationTaskTypeService', StationTaskTypeService::class);
         app()->singleton('StationTypeBinMonitorService', StationTypeBinMonitorService::class);
         app()->singleton('StationTypeService', StationTypeService::class);
+        app()->singleton('StorageService',StorageService::class);
         app()->singleton('StoreCheckingReceiveItemService', StoreCheckingReceiveItemService::class);
         app()->singleton('StoreCheckingReceiveService', StoreCheckingReceiveService::class);
         app()->singleton('StoreItemService', StoreItemService::class);

+ 0 - 3
app/Providers/AuthServiceProvider.php

@@ -38,9 +38,6 @@ class AuthServiceProvider extends ServiceProvider
     public function boot()
     {
         $this->registerPolicies();
-        Gate::before(function ($user){
-            if (config("app.env") == 'local')return true;
-        });
         $isSuperAdmin = null;
         if(!Schema::hasTable('users')){return;}
         /** @var CacheService $cacheService */

+ 1 - 0
app/Services/ForeignHaiRoboticsService.php

@@ -512,6 +512,7 @@ class ForeignHaiRoboticsService
     {
         $station = Station::query()->select("id")->where("code",$fromLocation)->first();
         if (!$station)return false;
+        if (StationTask::query()->select("id")->where("status","!=",'完成')->where("station_id",$station->id)->first())return false;
         /** @var \stdClass $task */
         $task = StationTask::query()->create([
             'status' => "待处理",

+ 1 - 2
app/Services/MaterialBoxService.php

@@ -43,8 +43,7 @@ class MaterialBoxService
                 ->where("status",1)->whereIn("ks_bin_code",array_column($boxes->toArray(),"code"))->get();
             if ($haiBoxes->count()==0)continue;
             $haiBoxes->each(function ($haiBox)use(&$codes){$codes[$haiBox->ks_bin_code] = true;});
-            foreach ($boxes as $index=>$box)if (!isset($codes[$box->code]))unset($boxes[$index]);
-            $boxes = array_values($boxes);
+            foreach ($boxes as $index=>$box)if (!isset($codes[$box->code]))$boxes->splice($index,1);
             $ides = [];
             $str = "(";
             for ($i=0;$i<count($boxes)-1;$i++){

+ 2 - 4
app/Services/OwnerService.php

@@ -185,14 +185,12 @@ class OwnerService
 
     public function get(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false, $user = null)
     {
+        /** @var User $user */
+        if ($user==null)$user = Auth::user();
         return Cache::remember(
             'owner_'.md5(json_encode($params).json_encode($withs).$authority.$notShowSoftDelete.json_encode($user))
             ,config('cache.expirations.rarelyChange')
             ,function()use($params,$withs,$authority,$notShowSoftDelete,$user){
-            /** @var User $user */
-            if ($user==null) {
-                $user = Auth::user();
-            }
             $query = Owner::query();
             if ($withs)$query->with($withs);
             if ($authority&&$user){

+ 23 - 0
app/Services/StorageService.php

@@ -0,0 +1,23 @@
+<?php 
+
+namespace App\Services;
+
+use App\Traits\ServiceAppAop;
+use App\Storage;
+
+class StorageService
+{
+    use ServiceAppAop;
+    protected $modelClass=Storage::class;
+
+    /**
+     * 标记指定库位为占用
+     *
+     * @param string $location
+     */
+    public function markOccupy($location)
+    {
+
+    }
+
+}

+ 4 - 4
app/Services/WaybillService.php

@@ -28,8 +28,8 @@ class WaybillService
      */
     private function conditionQuery(array $param){
         $waybills = Waybill::filterAuthorities()->with(['owner','logistic','originationCity','destinationCity.parent',
-            'uploadFile','amountUnit','warehouseWeightUnit','carrierWeightUnit','district','order',
-            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFile','waybillAuditLogs.user'])
+            'uploadFiles','amountUnit','warehouseWeightUnit','carrierWeightUnit','district','order',
+            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFiles','waybillAuditLogs.user'])
             ->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
             ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
             ->whereNull('waybill_on_tops.deleted_at')
@@ -163,8 +163,8 @@ class WaybillService
     }
     public function dailyBilling(array $param){
         $waybills = Waybill::query()->with(['owner','logistic','originationCity','destinationCity.parent',
-            'uploadFile','amountUnit','warehouseWeightUnit','carrierWeightUnit','district','order',
-            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFile','waybillAuditLogs.user'])
+            'uploadFiles','amountUnit','warehouseWeightUnit','carrierWeightUnit','district','order',
+            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFiles','waybillAuditLogs.user'])
             ->selectRaw('waybills.* ,waybill_on_tops.id top_id,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
             ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
             ->whereNull('waybill_on_tops.deleted_at')

+ 8 - 1
app/Storage.php

@@ -11,9 +11,16 @@ class Storage extends Model
     use ModelLogChanging;
 
     protected $fillable = [
+        "station_id",
         "material_box_id",
         "commodity_id",
-        "amount"
+        "amount",
+        "status"
+    ];
+
+    const STATUS=[
+        0 => "正常",
+        1 => "占用",
     ];
 
     public function materialBox()

+ 2 - 2
app/Waybill.php

@@ -107,8 +107,8 @@ class Waybill extends Model
     public function waybillAuditLogs(){
         return $this->hasMany('App\WaybillAuditLog','waybill_id','id')->orderByDesc("created_at");
     }
-    public function uploadFile(){
-        return $this->hasOne('App\UploadFile','table_id','id')->where('table_name','waybills');
+    public function uploadFiles(){
+        return $this->hasMany(UploadFile::class,'table_id','id')->where('table_name','waybills');
     }
     public function order()
     {   //订单

+ 44 - 0
database/migrations/2021_06_02_114506_change_storages_table.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeStoragesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::dropIfExists('storages');
+        Schema::create('storages', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("station_id")->index()->comment("外键库位");
+            $table->bigInteger("material_box_id")->nullable()->index()->comment("外键料箱");
+            $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品");
+            $table->integer("amount")->default(0)->comment("数量");
+            $table->tinyInteger("status")->default(0)->comment("状态");
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('storages');
+        Schema::create('storages', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("material_box_id")->index()->comment("外键料箱");
+            $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品");
+            $table->integer("amount")->default(0)->comment("数量");
+            $table->timestamps();
+        });
+    }
+}

+ 23 - 0
package-lock.json

@@ -2931,6 +2931,21 @@
         "timsort": "^0.3.0"
       }
     },
+    "css-line-break": {
+      "version": "1.1.1",
+      "resolved": "https://registry.nlark.com/css-line-break/download/css-line-break-1.1.1.tgz",
+      "integrity": "sha1-1em90peEAJnrBQPHMQ/TSSegJu8=",
+      "requires": {
+        "base64-arraybuffer": "^0.2.0"
+      },
+      "dependencies": {
+        "base64-arraybuffer": {
+          "version": "0.2.0",
+          "resolved": "https://registry.npm.taobao.org/base64-arraybuffer/download/base64-arraybuffer-0.2.0.tgz",
+          "integrity": "sha1-S5RPrAGRqlkHr+LYyZnMxXzoD0U="
+        }
+      }
+    },
     "css-loader": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-1.0.1.tgz",
@@ -4739,6 +4754,14 @@
         "uglify-js": "3.4.x"
       }
     },
+    "html2canvas": {
+      "version": "1.0.0-rc.7",
+      "resolved": "https://registry.npm.taobao.org/html2canvas/download/html2canvas-1.0.0-rc.7.tgz",
+      "integrity": "sha1-cMFZzg5jlUqRFpUxiU0IrVYnrJg=",
+      "requires": {
+        "css-line-break": "1.1.1"
+      }
+    },
     "http-deceiver": {
       "version": "1.2.7",
       "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz",

+ 1 - 1
resources/js/utilities/html2canvas.js

@@ -8,4 +8,4 @@ window.canvasImg = function(dom,imageDiv,scale=1,func){
     }).then(canvas=>{
         func(canvas);
     });
-}
+};

+ 4 - 2
resources/js/utilities/tempTip.js

@@ -117,9 +117,11 @@ const tempTip={
         $('body').append(tiper);
         $input.focus()
     },
-    postBasicRequest(url, params, successExe, isPriority = false) {
+    postBasicRequest(url, params, successExe, isPriority = false, isMultipart = false) {
         if (isPriority)this.setIndex(1099);
-        window.axios.post(url,params).then(res=> {
+        let header = {};
+        if (isMultipart)header = {'Content-Type': 'multipart/form-data'};
+        window.axios.post(url,params,header).then(res=> {
             if (res.data.success){
                 let successMsg = successExe(res.data.data);
                 if (successMsg){

+ 59 - 79
resources/views/transport/waybill/index.blade.php

@@ -42,6 +42,7 @@
                 </div>
             </span>
             @can('运输管理-运单-图片上传')<button class="btn btn-sm btn-outline-info" data-target="#batchUploadImg" data-toggle="modal">批量上传图片</button>@endcan
+            @can('运输管理-运单-图片删除')<button class="btn btn-sm btn-outline-danger" @click="deleteImg()">批量删除图片</button>@endcan
             @if($uriType=='' || $uriType=='专线')
                 @can('运输管理-运单-按日计算专线费')
                     <button class="btn btn-sm btn-outline-success tooltipTarget" data-target="#dailyBilling" data-toggle="modal"
@@ -140,14 +141,15 @@
                     <td class="td-warm"><span>@{{waybill.other_charge}}</span></td>
                     <td class="td-warm"><span>@{{waybill.other_charge_remark}}</span></td>
                     <td class="td-warm">
-                        <div align="center" @mouseleave="removeCommonImg('common_img_'+waybill.id)" @mouseenter="commonImg('img_'+waybill.id,waybill.url,waybill.suffix)">
-                            <img v-if="waybill.url" :id="'img_'+waybill.id"  :src="waybill.url+'-thumbnail.'+waybill.suffix"
-                                {{--:data-src="waybill.url+'-thumbnail.'+waybill.suffix" src="{{url('icon/img404-thumbnail.jpg')}}"--}}>
-                            @can('运输管理-运单-图片上传')<div v-if="!waybill.url">
-                                <input class="btn  btn-sm btn-outline-secondary" type="button" @click="certiimg(waybill.waybill_number)" value="上传照片 "/>
-                                <input type="file" @change="submitFile($event,waybill.waybill_number)" :id="waybill.waybill_number"
-                                       style="display: none" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"/>
+                        <div align="center" @mouseleave="removeCommonImg('common_img_'+waybill.id)" @mouseenter="commonImg('img_'+waybill.id,waybill.uploadFiles)">
+                            @can('运输管理-运单-图片上传')<div>
+                            <input class="btn  btn-sm btn-outline-secondary" type="button" @click="certiimg(waybill.waybill_number)" value="上传照片 "/>
+                            <input multiple type="file" @change="submitFile($event,i)" :id="waybill.waybill_number"
+                                   style="display: none" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"/>
                             </div>@endcan
+                            <div :id="'img_'+waybill.id">
+                                <img v-for="uploadFile in waybill.uploadFiles"  :src="imgPrefix+uploadFile.url+'-thumbnail.'+uploadFile.type">
+                            </div>
                         </div>
                     </td>
                     <td class="td-cool"><span>@{{waybill.ordering_remark}}</span></td>
@@ -296,14 +298,14 @@
         let vue = new Vue({
             el:'#list',
             data:{
+                imgPrefix:"{{asset("/storage")}}",
                 waybills:[
                         @foreach($waybills as $waybill)
                     {
                         id:'{{$waybill->id}}',
                         created_at:'{{$waybill->created_at}}',
                         updated_at:'{{$waybill->updated_at}}',
-                        url:'{{$waybill->uploadFile ? asset('/storage'.$waybill->uploadFile->url) : ''}}',
-                        suffix:'{{$waybill->uploadFile ? $waybill->uploadFile->type : ''}}',
+                        uploadFiles:{!! $waybill->uploadFiles !!},
                         status:'{{$waybill->status}}',
                         type:'{{$waybill->type}}',
                         end_date:'{{($waybill->order&&$waybill->order->wms_status=='订单完成') ? $waybill->order->wms_edittime:'-'}}',
@@ -695,50 +697,35 @@
                 certiimg(waybill_number){
                     $('#'+waybill_number).click();
                 },
-                submitFile(e,waybill_number){
-                    let file=e.target.files[0];
-                    if (file.size >=5242880){
-                        tempTip.setDuration(3000);
-                        tempTip.show("图片大小不能超过5MB!");
-                        return;
-                    }
-                    let _this=this;
+                submitFile(e,index){
+                    let files=e.target.files;
+                    window.tempTip.setDuration(3000);
+                    if (files.length===0){window.tempTip.show("未选定图片!");return;}
                     let formData=new FormData();
-                    formData.append("file",file);
-                    formData.append("waybill_number",waybill_number);
-                    axios.post('{{url('transport/waybill/upload')}}',formData)
-                        .then(function (response) {
-                            if (!response.data.success){
-                                tempTip.setDuration(4000);
-                                tempTip.show(response.data.error);
-                                return;
-                            }
-                            _this.waybills.some(function (waybill) {
-                                if (waybill.waybill_number===waybill_number){
-                                    waybill.url=response.data.data.url;
-                                    waybill.suffix=response.data.data.type;
-                                    tempTip.setDuration(3000);
-                                    tempTip.showSuccess("上传成功!");
-                                    return true;
-                                }
-                            });
-                        }).catch(function (err) {
-                        tempTip.setDuration(4000);
-                        tempTip.show("网络错误:"+err);
-                    })
+                    for (let i=0;i<files.length;i++){
+                        if (files[i].size >=5242880){window.tempTip.show("图片大小不能超过5MB!");return;}
+                        formData.append("files[]",files[i]);
+                    }
+                    formData.append("id",this.waybills[index].id);
+                    window.tempTip.postBasicRequest('{{url('transport/waybill/upload')}}',formData,res=>{
+                        if (this.waybills[index].uploadFiles.length===0) this.$set(this.waybills[index],'uploadFiles',res);
+                        else this.$set(this.waybills[index],'uploadFiles',this.waybills[index].uploadFiles.concat(res));
+                        return "上传成功";
+                    },false,true);
                 },
-                commonImg(id,url,suffix){
+                commonImg(id,uploadFiles){
+                    let div = "";
+                    let isBtn = 0+@can('运输管理-运单-图片删除1')1 @endcan > 0;
+                    for(let i=0;i<uploadFiles.length;i++){
+                        let btn = isBtn ? "<button type='button' class='btn btn-sm btn-danger' onclick='vue.btnDeleteImg(this)' data-url='"+uploadFiles[i].url+"' value='"+id+"' style='position: relative;float: right;margin-top: -30px;' >删除</button>" : "";
+                        let href = this.imgPrefix+uploadFiles[i].url+'-bulky.'+uploadFiles[i].type;
+                        let src = this.imgPrefix+uploadFiles[i].url+'-common.'+uploadFiles[i].type;
+                        div += "<div><a target='_blank' href='"+href+"'><img alt='#' src='"+src+"' style='position: relative;' ></a>"+btn+"</div>"
+                    }
                     $('#'+id).after(
-                        "<div id=\"common_"+id+"\" style='position: absolute;padding-top: 2px;z-index: 99'>" +
-                        "<div style='position:absolute'>"+
-                        "<div >"+
-                        "<a target='_blank' href='"+url+'-bulky.'+suffix+"'>" +
-                        "<img src=\""+url+'-common.'+suffix+"\" style='position: relative;left:-50px;' >" +
-                        "</a>" +
-                        "</div>"+
-                        @can('运输管理-运单-图片删除')"<button type='button' class='btn btn-sm btn-danger' onclick='vue.btnDeleteImg(this)' value='"+id+"' style='position: relative;float: right;margin-right: 51px;margin-top: -30px;' >删除</button>" +@endcan
-                            "</div>"+
-                        "</div>");
+                        "<div id=\"common_"+id+"\" style='position: absolute;padding-bottom: 2px;z-index: 99'>" +
+                        "<div style='position:absolute;left: -50px' class='overflow-y-scrollbar-200'>"+div+
+                        "</div></div>");
                 },
                 removeCommonImg(id){
                     $('#'+id).remove();
@@ -746,41 +733,36 @@
                 btnDeleteImg(e){
                     let idstr = $(e).val();
                     let id =  idstr.substr( idstr.indexOf('_')+1);
+                    let url = e.getAttribute("data-url");
                     if (!confirm('确定要删除所选图片吗?'))return;
-                    this.destroyImg([id]);
+                    this.destroyImg(id,url);
                 },
                 deleteImg(){
                     if (checkData.length <= 0) {
-                        tempTip.setDuration(2000);
-                        tempTip.showSuccess('没有勾选任何记录');
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.showSuccess('没有勾选任何记录');
                         return;
                     }
                     if (!confirm('确定要删除所选图片吗?'))return;
                     this.destroyImg(checkData);
                 },
-                destroyImg(id){
-                    let _this = this;
-                    axios.post('{{url('transport/waybill/deleteImg')}}',{'ids':id})
-                        .then(function (response) {
-                            if (!response.data.success){
-                                tempTip.setDuration(4000);
-                                tempTip.show("删除失败");
-                                return;
-                            }
-                            id.forEach(function (id) {
-                                _this.waybills.some(function (waybill) {
-                                    if (waybill.id===id){
-                                        waybill.url='';
-                                        return true;
-                                    }
-                                });
+                destroyImg(id,url = null){
+                    window.tempTip.postBasicRequest('{{url('transport/waybill/deleteImg')}}',{id:id,url:url},()=>{
+                        if (url){
+                            this.waybills.some((waybill,i)=>{
+                                if (waybill.id===id){
+                                    waybill.uploadFiles.some((file,j)=>{
+                                        if (file.url === url){this.$delete(this.waybills[i].uploadFiles,j);return true;}
+                                    });
+                                    return true;
+                                }
                             });
-
-                            tempTip.setDuration(3000);
-                            tempTip.showSuccess("删除成功!");
-                        }).catch(function (err) {
-                        tempTip.setDuration(4000);
-                        tempTip.show("网络错误:"+err);
+                        }else{
+                            this.waybills.forEach((waybill,i)=>{
+                                if (id.includes(waybill.id))this.$set(this.waybills[i],'uploadFiles',[]);
+                            });
+                        }
+                        return "删除成功";
                     });
                 },
                 // 运输收费修改
@@ -1086,16 +1068,14 @@
                         let errors = res.errors;
                         if (errors.length>0)this.batchUploadError =  errors;
                         result.forEach(r=>{
-                            this.waybills.some(waybill=> {
+                            this.waybills.some((waybill,i)=> {
                                 if (waybill.id==r.id){
-                                    waybill.url="/storage"+r.upload_file.url;
-                                    waybill.suffix=r.upload_file.type;
+                                    this.$set(this.waybills[i],'uploadFiles',r.upload_files);
                                     return true;
                                 }
                             });
                             this.size = 0;
                         });
-                        this.$forceUpdate();
                         return "上传成功";
                     },true);
                 },