loustwo 4 лет назад
Родитель
Сommit
6aec7b84bd

+ 6 - 0
app/ReceivingTask.php

@@ -18,6 +18,7 @@ class ReceivingTask extends Model
         'warehouse_id',
         'owner_id',
         'delivery_appointment_car_id',
+        'user_id',
         'driver_name',
         'driver_phone',
         "for_single_member",
@@ -44,6 +45,11 @@ class ReceivingTask extends Model
         return $this->belongsTo(Owner::class);
     }
 
+    public function user(): BelongsTo
+    {
+        return $this->belongsTo(User::class);
+    }
+
     public function deliveryAppointmentCar(): BelongsTo
     {
         return $this->belongsTo(DeliveryAppointmentCar::class);

+ 32 - 0
database/migrations/2021_12_31_092206_receiving_task_add_user_id.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ReceivingTaskAddUserId extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('receiving_tasks', function (Blueprint $table) {
+            $table->integer('user_id')->comment('创建人');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('receiving_tasks', function (Blueprint $table) {
+            $table->dropColumn('user_id');
+        });
+    }
+}

+ 1 - 2
resources/views/store/receivingTasks/create.blade.php

@@ -44,7 +44,6 @@
                                            id="for_single_member" name="for_single_member"
                                            :class="{'is-invalid':errors.for_single_member}"
                                            @change="clearError('for_single_member')"
-
                                            v-model="receiving_task.for_single_member">
                                     <div id="validation-for-single-member" class="invalid-feedback"
                                          v-show="errors.for_single_member">
@@ -382,7 +381,7 @@
                     appointment_number: null,
                     driver_name: null,
                     driver_phone: null,
-                    for_single_member: null,
+                    for_single_member: '{{ Auth::user()->name }}' ,
                     plate_number: null,
                     driving_license_no: null,
                     logistics_single_number: null,

+ 119 - 108
resources/views/store/receivingTasks/index.blade.php

@@ -8,30 +8,32 @@
 
 @section('content')
     <div id="list" class="container-fluid d-none">
-        <div >
+        <div>
             <div id="form_div" style="min-width: 1220px;"></div>
             <div class="ml-3 form-inline" id="btn">
                 @can('入库管理-开单入库-打印任务单')
-                <button type="button"
-                        class="ml-2 btn btn-sm btn-outline-success "
-                        @click="printReceivingTask" >打印任务清单
-                </button>
+                    <button type="button"
+                            class="ml-2 btn btn-sm btn-outline-success "
+                            @click="printReceivingTask">打印任务清单
+                    </button>
                 @endcan
             </div>
             <div>
-                <table class="table table-sm table-striped table-hover table-bordered  " id="table">
-                    <tr v-for="(item,i) in receiving_tasks" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
+                <table class="table table-sm table-striped table-hover table-bordered" id="table">
+                    <tbody>
+                    <tr v-for="(item,i) in receiving_tasks"
+                        @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
                         <td>
-                            <label><input type="checkbox" :value="item.id"></label>
+                            <input type="checkbox" class="checkItem" :value="item.id">
                         </td>
                         <td v-text="i+1"></td>
                         <td v-text="item.number"></td>
                         <td v-text="item.status"></td>
-                        <td >
+                        <td>
                             <template v-for="(asn_no,i) in item.asn_nos">
-                               <div >
-                                   <span v-text="asn_no"></span>
-                               </div>
+                                <div>
+                                    <span v-text="asn_no"></span>
+                                </div>
                             </template>
                         </td>
                         <td v-text="item.created_at"></td>
@@ -40,6 +42,7 @@
                         <td v-text="item.driving_license_no"></td>
                         <td v-text="item.receiving_type"></td>
                     </tr>
+                    </tbody>
                 </table>
                 <div class="text-info h5 btn btn">{{$receivingTasks->count()}}/@{{ total }}</div>
                 {{ $receivingTasks->withQueryString()->links() }}
@@ -50,10 +53,11 @@
 @endsection
 @section('lastScript')
     <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
-    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
-    <script type="text/javascript" src="{{ mix('js/element-ui.js') }}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
+    <script type="text/javascript" src="{{mix('js/element-ui.js') }}"></script>
     <script type="text/javascript" src="{{mix('js/lodop/LodopFuncs.js')}}"></script>
-    <script src='http://localhost:18000/CLodopfuncs.js?name=CLODOPA'></script>
+
+    <script type="text/javascript" src='http://localhost:18000/CLodopfuncs.js?name=CLODOPA'></script>
 
     <script>
         let vue = new Vue({
@@ -61,7 +65,7 @@
             data: {
                 receiving_tasks: [],
                 total: 0,
-                selectTr:0,
+                selectTr: 0,
                 owners: [
                         @foreach($owners as $owner)
                     {
@@ -76,38 +80,39 @@
                     },
                     @endforeach
                 ],
-                receiving_task_print:{
-                    number:null,
-                    warehouse:null,
-                    for_single_member:null,
-                    driver_name:null,
-                    driver_phone:null,
-                    plate_number:null,
-                    driving_license_no:null,
-                    provide_list:null,
-                    receiving_type:null,
-                    owner:null,
-                    appointment_number:null,
+                receiving_task_print: {
+                    number: null,
+                    warehouse: null,
+                    for_single_member: null,
+                    driver_name: null,
+                    driver_phone: null,
+                    plate_number: null,
+                    driving_license_no: null,
+                    provide_list: null,
+                    receiving_type: null,
+                    owner: null,
+                    appointment_number: null,
                 },
-                clodop:null,
+                clodop: null,
                 clodopPrintDialogVisible: false,
                 printerList: [],
                 print_setting: {
                     printer_index: 0,
                 }
             },
+            created() {
+            },
             mounted() {
                 let receiving_tasks = {!! $receivingTasks->toJson() !!}['data'];
+                this.receiving_tasks = this.sortReceivingTasks(receiving_tasks);
                 this.total = {!! $receivingTasks->toJson() !!}['total'];
                 $("#list").removeClass('d-none');
-                this.receiving_tasks = this.sortReceivingTasks(receiving_tasks);
-
                 let data = [[
                     {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
                     {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
                     {name: 'number', type: 'input', tip: '任务号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '任务号'},
                     {name: 'appointment_number', type: 'input', tip: '预约号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '预约号'},
-                ],[
+                ], [
                     {
                         name: 'owner_id',
                         type: 'select_multiple_select',
@@ -130,23 +135,27 @@
                 this.form.init();
 
                 let column = [
-                    {name:'id',value: '序号', neglect: true},
-                    {name:'number',value: '收货任务号'},
-                    {name:'status',value: '状态', neglect: true},
-                    {name:'asn_nos',value: 'ASN单号', neglect: true},
-                    {name:'created_at',value: '投单时间'},
-                    {name:'warehouse',value: '仓库'},
-                    {name:'appointment_number',value: '预约号'},
-                    {name:'driving_license_no',value: '驾驶证号'},
-                    {name:'receiving_type',value: '收货类型'},
+                    {name: 'id', value: '序号', neglect: true},
+                    {name: 'number', value: '收货任务号'},
+                    {name: 'status', value: '状态', neglect: true},
+                    {name: 'asn_nos', value: 'ASN单号', neglect: true},
+                    {name: 'created_at', value: '投单时间'},
+                    {name: 'warehouse', value: '仓库'},
+                    {name: 'appointment_number', value: '预约号'},
+                    {name: 'driving_license_no', value: '驾驶证号'},
+                    {name: 'receiving_type', value: '收货类型'},
                 ];
-                new Header({
+                let init = new Header({
                     el: "table",
                     name: "receiving_tasks",
                     column: column,
                     data: this.receiving_tasks,
+                    restorationColumn: 'id',
                     fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
-                }).init();
+                });
+                setTimeout(()=>{
+                    init.init();
+                },300);
             },
             methods: {
                 waitingTempTip(message) {
@@ -173,6 +182,7 @@
                     let warehouse = this.getWarehouseName(task);
                     let owner = this.getOwnerName(task);
                     return {
+                        id: task.id,
                         number: task.number,
                         status: task.status,
                         asn_nos: asn_nos,
@@ -210,19 +220,19 @@
                     let {owner} = task;
                     return owner ? owner.name : '';
                 },
-                printReceivingTask(){
-                    let message =null;
-                    if (checkData.length > 1){
+                printReceivingTask() {
+                    let message = null;
+                    if (checkData.length > 1) {
                         message = '进行单个任务打印';
-                    }else if (checkData.length < 1){
+                    } else if (checkData.length < 1) {
                         message = '请勾选收货任务';
                     }
-                    if (message){
+                    if (message) {
                         this.errorTempTip(message);
-                        return ;
+                        return;
                     }
                     let id = checkData[0];
-                    this.receiving_task_print = this.receiving_tasks.find(e=>e.id===id);
+                    this.receiving_task_print = this.receiving_tasks.find(e => e.id === id);
                     this.printLodop();
                 },
                 printLodop() {
@@ -268,7 +278,7 @@
                         });
                     }
                 },
-                clodopPrint(){
+                clodopPrint() {
                     let {
                         number,               // 收货任务号
                         warehouse,             // 仓库
@@ -282,63 +292,64 @@
                         owner,                // 货主
                         appointment_number, // 预约号
                     } = this.receiving_task_print;
-                    this.clodop.PRINT_INITA(2,0,0,0,"");
-                    this.clodop.SET_PRINT_PAGESIZE(2,'76mm','130mm');
-                    this.clodop.ADD_PRINT_BARCODE(20,70,350,50,"Code39",number);
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.ADD_PRINT_TEXT(100,15,100,20,"收货任务号");
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(130,15,100,20,"仓库");
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(160,15,100,20,"司机姓名");
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(190,15,100,20,"车牌号");
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(220,15,100,20,"是否提供清单");
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(250,15,100,20,"货主");
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(130,245,100,20,"投单员");
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(160,245,100,20,"司机电话");
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(190,245,100,20,"驾驶证号");
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(220,245,100,20,"收货类型");
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(250,245,100,20,"预约号");
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(100,115,250,20,number); // number
-                    this.clodop.SET_PRINT_STYLEA(0,"FontSize",10);
-                    this.clodop.SET_PRINT_STYLEA(0,"Alignment",2);
-                    this.clodop.SET_PRINT_STYLEA(0,"Bold",1);
-                    this.clodop.ADD_PRINT_TEXT(130,115,130,20,warehouse);  // warehouse
-                    this.clodop.ADD_PRINT_TEXT(160,115,100,20,driver_name); //driver_name
-                    this.clodop.ADD_PRINT_TEXT(190,115,130,20,plate_number);  //plate_number
-                    this.clodop.ADD_PRINT_TEXT(220,115,100,20,provide_list); //provide_list
-                    this.clodop.ADD_PRINT_TEXT(250,115,130,20,owner);  // owner
-                    this.clodop.ADD_PRINT_TEXT(130,345,100,20,for_single_member);  // for_single_member
-                    this.clodop.ADD_PRINT_TEXT(160,345,140,20,driver_phone); // driver_phone
-                    this.clodop.ADD_PRINT_TEXT(190,345,140,20,driving_license_no); // driving_license_no
-                    this.clodop.ADD_PRINT_TEXT(220,345,100,20,receiving_type);  // receiving_type
-                    this.clodop.ADD_PRINT_TEXT(250,345,140,20,appointment_number); //appointment_number
+
+                    this.clodop.PRINT_INITA(2, 0, 0, 0, "");
+                    this.clodop.SET_PRINT_PAGESIZE(2, '76mm', '130mm');
+                    this.clodop.ADD_PRINT_BARCODE(20, 70, 350, 50, "Code39", number);
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.ADD_PRINT_TEXT(100, 15, 100, 20, "收货任务号");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 15, 100, 20, "仓库");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(160, 15, 100, 20, "司机姓名");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(190, 15, 100, 20, "车牌号");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(220, 15, 100, 20, "是否提供清单");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(250, 15, 100, 20, "货主");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 245, 100, 20, "投单员");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(160, 245, 100, 20, "司机电话");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(190, 245, 100, 20, "驾驶证号");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(220, 245, 100, 20, "收货类型");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(250, 245, 100, 20, "预约号");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(100, 115, 250, 20, number); // number
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 115, 130, 20, warehouse);  // warehouse
+                    this.clodop.ADD_PRINT_TEXT(160, 115, 100, 20, driver_name); //driver_name
+                    this.clodop.ADD_PRINT_TEXT(190, 115, 130, 20, plate_number);  //plate_number
+                    this.clodop.ADD_PRINT_TEXT(220, 115, 100, 20, provide_list); //provide_list
+                    this.clodop.ADD_PRINT_TEXT(250, 115, 130, 20, owner);  // owner
+                    this.clodop.ADD_PRINT_TEXT(130, 345, 100, 20, for_single_member);  // for_single_member
+                    this.clodop.ADD_PRINT_TEXT(160, 345, 140, 20, driver_phone); // driver_phone
+                    this.clodop.ADD_PRINT_TEXT(190, 345, 140, 20, driving_license_no); // driving_license_no
+                    this.clodop.ADD_PRINT_TEXT(220, 345, 100, 20, receiving_type);  // receiving_type
+                    this.clodop.ADD_PRINT_TEXT(250, 345, 140, 20, appointment_number); //appointment_number
                     this.clodop.PREVIEW();
                     this.clodopPrintDialogVisible = false;
                 }