Просмотр исходного кода

Merge branch 'zengjun'

# Conflicts:
#	resources/views/waybill/recycle.blade.php
LD 5 лет назад
Родитель
Сommit
1a526abc08

+ 1 - 1
database/migrations/2020_06_17_162321_change_onwer_add_deleted_at.php

@@ -26,7 +26,7 @@ class ChangeOnwerAddDeletedAt extends Migration
     public function down()
     {
         Schema::table('owners',function (Blueprint $table){
-            $table->timestamp('deleted_at')->delete();
+            $table->dropColumn('deleted_at');
         });
     }
 }

+ 30 - 0
database/migrations/2020_06_24_145928_add_storage_public_link.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddStoragePublicLink extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        exec('php artisan storage:link');
+        $path_str = substr(app_path(),0,strripos(app_path(), DIRECTORY_SEPARATOR));
+        exec('mkdir '.$path_str.DIRECTORY_SEPARATOR.'storage\app\public\files');
+        exec('mkdir ./storage/app/public/files');
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+    }
+}

+ 1 - 6
public/t.php

@@ -1,8 +1,3 @@
 <?php
-$str = ',1, 2, 3,     4               5';
-//$str=preg_replace('/([\s]*)|(,)/i',',',trim($str));
-//$str=preg_replace('/[,]{2,}/i',',',$str);
-//$str = trim($str,',');
-$str=preg_split('/[,, ]+/is', $str);
-var_dump($str);
+phpinfo();
 

+ 42 - 16
resources/views/waybill/index.blade.php

@@ -124,7 +124,6 @@
                                     <a class="dropdown-item" @click="waybillExport(2)" href="javascript:">导出所有页</a>
                                 </div>
                             </span>
-                            @can('运输管理-图片删除')<button type="button" @click="deleteImg()" class="btn btn-sm btn-outline-danger ml-2">删除所选图片</button>@endcan
                         </td>
                     </tr>
                 </table>
@@ -238,13 +237,13 @@
                     @endcan
                     <td :class="[waybill.status=='已审核'?'text-success':'']">@{{waybill.status}}</td>
                     <td class="td-bill text-muted toptd" >
-                        <div v-if="waybill.remark" class="bg-light-yellow  text-danger top"  data-toggle="tooltip" style="opacity: 0.1;position: absolute"
+                        <div v-if="waybill.remark" class="bg-light-yellow  text-danger top"  data-toggle="tooltip" style="opacity: 0.1;position: absolute;z-index: 1"
                         >置顶备注:@{{  waybill.remark }}</div>
                         @{{waybill.id}}</td>
                     <td class="td-bill text-muted">@{{waybill.created_at}}</td>
                     <td class="td-bill">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="waybill.collect_fee">到付</span></td>
                     <td class="td-bill">@{{waybill.owner}}</td>
-                    <td class="td-bill toptd" :title="'置顶备注:'+waybill.remark">@{{waybill.source_bill}}</td>
+                    <td class="td-bill toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
                     <td class="td-bill" >@{{waybill.wms_bill_number}}</td>
                     <td class="td-bill">@{{waybill.waybill_number}}</td>
                     <td class="td-bill">
@@ -397,9 +396,6 @@
         </div>
     </div>
 
-
-
-
 @endsection
 
 
@@ -448,6 +444,9 @@
             -webkit-animation-direction: alternate;
             -webkit-animation-play-state: running;
         }
+        .imgBtn{
+        }
+
     </style>
     <script>
         let vueList=new Vue({
@@ -866,14 +865,29 @@
                     })
                 },
                 commonImg(id,url,suffix){
-                    $('#'+id).after("<div id=\"common_"+id+"\" style=\"position: relative;margin-top: 2px\">" +
-                        "                        <a target='_blank' href='"+url+'-bulky.'+suffix+"'><img src=\""+url+'-common.'+suffix+"\" style=\"position: absolute;left:-50px; \" ></a>" +
-                        "                        <p class='title text-center'><button class='btn btn-outline-light btn-sm'>删除</button></p>" +
-                        "                        </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='vueList.btnDeleteImg(this)' value='"+id+"' style='position: relative;float: right;margin-right: 51px;margin-top: -30px;' >删除</button>" +@endcan
+                        "</div>"+
+                        "</div>");
                 },
                 removeCommonImg(id){
                     $('#'+id).remove();
                 },
+                btnDeleteImg(e){
+                    let idstr = $(e).val();
+                    let id =  idstr.substr( idstr.indexOf('_')+1);
+                    if (!confirm('确定要删除所选图片吗?'))return;
+                    this.destroyImg([id]);
+                    this.$forceUpdate();
+
+                },
                 deleteImg(){
                     if (this.checkData.length <= 0) {
                         tempTip.setDuration(2000);
@@ -881,15 +895,26 @@
                         return;
                     }
                     if (!confirm('确定要删除所选图片吗?'))return;
-                    let _this=this;
-                    axios.post('{{url('waybill/deleteImg')}}',{ids:_this.checkData})
+                    this.destroyImg(this.checkData);
+                },
+                destroyImg(id){
+                    let _this = this;
+                    axios.post('{{url('waybill/deleteImg')}}',{'ids':id})
                         .then(function (response) {
                             if (!response.data.success){
                                 tempTip.setDuration(4000);
                                 tempTip.show("删除失败");
                                 return;
                             }
-                            _this.checkData.forEach(function (id) {
+                            // _this.checkData.forEach(function (id) {
+                            //     _this.waybills.some(function (waybill) {
+                            //         if (waybill.id===id){
+                            //             waybill.url='';
+                            //             return true;
+                            //         }
+                            //     });
+                            // });
+                            id.forEach(function (id) {
                                 _this.waybills.some(function (waybill) {
                                     if (waybill.id===id){
                                         waybill.url='';
@@ -897,12 +922,13 @@
                                     }
                                 });
                             });
+
                             tempTip.setDuration(3000);
                             tempTip.showSuccess("删除成功!");
                         }).catch(function (err) {
-                            tempTip.setDuration(4000);
-                            tempTip.show("网络错误:"+err);
-                        });
+                        tempTip.setDuration(4000);
+                        tempTip.show("网络错误:"+err);
+                    });
                 },
                 // 运费修改
                 waybillFeeCheck:function (e) {

+ 1 - 1
resources/views/waybill/recycle.blade.php

@@ -102,7 +102,7 @@
                         <td ><span v-if="waybill.warehouse_weight_other">@{{waybill.warehouse_weight_other}}  @{{waybill.warehouse_weight_unit_other}}</span></td>
                         <td ><span v-if="waybill.carrier_weight_other">@{{waybill.carrier_weight_other}}  @{{waybill.carrier_weight_unit_other}}</span></td>
                         <td ><span v-if="waybill.amount">@{{waybill.amount}} @{{waybill.amount_unit_name }}</span></td>
-                        <td >@{{waybill.mileage}}|km</td>
+                        <td >@{{waybill.mileage|km}}</td>
                         @can('运输管理-可见费用项')
                             <td ><span v-if="waybill.type=='专线'"></span><span v-else>@{{waybill.fee}}</span></td>
                             <td >@{{waybill.pick_up_fee}}</td>