Ver Fonte

采购管理

haozi há 5 anos atrás
pai
commit
ab9b1e7316
36 ficheiros alterados com 2418 adições e 5 exclusões
  1. 143 0
      app/Filters/ProcurementFilters.php
  2. 5 5
      app/Http/Controllers/OwnerMaterialController.php
  3. 85 0
      app/Http/Controllers/ProcurementCheckSheetController.php
  4. 150 0
      app/Http/Controllers/ProcurementController.php
  5. 85 0
      app/Http/Controllers/ProcurementDeliverieController.php
  6. 85 0
      app/Http/Controllers/ProcurementQuotationController.php
  7. 85 0
      app/Http/Controllers/ProcurementTotalBillController.php
  8. 4 0
      app/Owner.php
  9. 36 0
      app/Procurement.php
  10. 21 0
      app/ProcurementCheckSheet.php
  11. 27 0
      app/ProcurementDeliverie.php
  12. 18 0
      app/ProcurementQuotation.php
  13. 21 0
      app/ProcurementTotalBill.php
  14. 4 0
      app/Providers/AppServiceProvider.php
  15. 20 0
      app/Services/OwnerMaterialService.php
  16. 37 0
      app/Services/ProcurementService.php
  17. 42 0
      database/migrations/2021_02_03_145200_create_procurements_table.php
  18. 37 0
      database/migrations/2021_02_03_151138_create_procurement_quotations_table.php
  19. 37 0
      database/migrations/2021_02_03_151704_create_procurement_deliveries_table.php
  20. 36 0
      database/migrations/2021_02_03_152845_create_procurement_check_sheets_table.php
  21. 35 0
      database/migrations/2021_02_03_153406_create_procurement_total_bills_table.php
  22. 36 0
      database/migrations/2021_02_03_161934_add_authorrities_to_procurement.php
  23. 5 0
      resources/views/layouts/menu.blade.php
  24. 181 0
      resources/views/procurement/finance/checkBill.blade.php
  25. 23 0
      resources/views/procurement/finance/menu.blade.php
  26. 137 0
      resources/views/procurement/finance/monthlyBillReport.blade.php
  27. 194 0
      resources/views/procurement/finance/procurementBill.blade.php
  28. 21 0
      resources/views/procurement/menu.blade.php
  29. 32 0
      resources/views/procurement/menuProcurement.blade.php
  30. 62 0
      resources/views/procurement/procurement/_addEnquiry.blade.php
  31. 111 0
      resources/views/procurement/procurement/_addProcurement.blade.php
  32. 62 0
      resources/views/procurement/procurement/_addProof.blade.php
  33. 191 0
      resources/views/procurement/procurement/create.blade.php
  34. 313 0
      resources/views/procurement/procurement/index.blade.php
  35. 19 0
      resources/views/procurement/procurement/menu.blade.php
  36. 18 0
      routes/web.php

+ 143 - 0
app/Filters/ProcurementFilters.php

@@ -0,0 +1,143 @@
+<?php
+
+
+namespace App\Filters;
+
+
+use App\Customer;
+use App\Material;
+use App\Owner;
+use App\OwnerMaterial;
+use App\Supplier;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Http\Request;
+
+class ProcurementFilters
+{
+    protected $request;
+    protected $queryBuilder;
+    protected $ownerMaterialQuery;
+    protected $materialQuery;
+    protected $ownerQuery;
+    protected $supplierQuery;
+    protected $customerQuery;
+    protected $array_filter;
+    protected $filters = [
+        'owner_id','material_id','company_name','created_at_start','created_at_end','supplier_id'
+    ];
+    protected $params = [];
+
+    public function __construct(Request $request)
+    {
+        $this->request = $request;
+        $this->params = $request->all();
+    }
+
+    public function apply($builder)
+    {
+        $this->queryBuilder = $builder;
+        $filters = array_filter($this->request->only($this->filters));
+        foreach ($filters as $filter => $value) {
+            if (method_exists($this, $filter)) {
+                $this->$filter($value, $this->queryBuilder);
+            }
+        }
+        $this->afterApply();
+        return $this->queryBuilder;
+    }
+
+    private function isSearchLike($str):bool
+    {
+        if (substr($str, 0, 1) == "%" || substr($str, strlen($str) - 1, 1) == "%") {
+            return true;
+        }
+        return false;
+    }
+
+    private function searchWay($query, $param, $column)
+    {
+        if ($this->isSearchLike($param)) {
+            $query->where($column, 'like', $param);
+        } else {
+            $query->whereIn($column, array_filter(preg_split('/[,, ]+/is', $param)));
+        }
+        return $query;
+    }
+
+    private function getMaterialQuery():Builder
+    {
+        if(!$this->materialQuery)
+            $this->materialQuery = Material::query()->selectRaw('id');
+        return $this->materialQuery;
+    }
+    private function getOwnerMaterialQuery():Builder
+    {
+        if(!$this->ownerMaterialQuery)
+            $this->ownerMaterialQuery = OwnerMaterial::query()->selectRaw('id');
+        return $this->ownerMaterialQuery;
+    }
+    private function getOwnerQuery():Builder
+    {
+        if(!$this->ownerQuery)
+            $this->ownerQuery = Owner::query()->selectRaw('id');
+        return $this->ownerQuery;
+    }
+    private function getSupplierQuery():Builder
+    {
+        if(!$this->supplierQuery)
+            $this->supplierQuery = Supplier::query()->selectRaw('id');
+        return $this->supplierQuery;
+    }
+    private function getCustomerQuery():Builder
+    {
+        if(!$this->customerQuery)
+            $this->customerQuery = Customer::query()->selectRaw('id');
+        return $this->customerQuery;
+    }
+
+    public function created_at_start($created_at)
+    {
+        $this->queryBuilder->where('created_at','>=',"{$created_at} 00:00:00");
+    }
+
+    public function created_at_end($created_at)
+    {
+        $this->queryBuilder->where('created_at','<=',"{$created_at} 23:59:59");
+    }
+
+    public function company_name($company_name)
+    {
+        $this->getCustomerQuery()->where('company_name','like',$company_name);
+    }
+
+    public function owner_id($owner_id)
+    {
+        $this->searchWay($this->getOwnerQuery(),$owner_id,'owner_id');
+    }
+    public function supplier_id($supplier_id)
+    {
+        $this->searchWay($this->getSupplierQuery(),$supplier_id,'supplier_id');
+    }
+
+    public function material_id($material_id)
+    {
+        $this->searchWay($this->getMaterialQuery(),$material_id,'id');
+    }
+
+
+    public function afterApply()
+    {
+        if($this->customerQuery)
+            $this->getOwnerQuery()->whereIn('customer_id',$this->customerQuery);
+
+        if($this->ownerQuery)
+            $this->getOwnerMaterialQuery()->whereIn('owner_id',$this->ownerQuery);
+
+        if($this->materialQuery)
+            $this->getOwnerMaterialQuery()->whereIn('material_id',$this->materialQuery);
+
+        if($this->ownerMaterialQuery)
+            $this->queryBuilder->whereIn('owner_material_id',$this->ownerMaterialQuery);
+
+    }
+}

+ 5 - 5
app/Http/Controllers/OwnerMaterialController.php

@@ -8,7 +8,7 @@ use App\Filters\OwnerMaterialFilters;
 use App\Material;
 use App\OwnerMaterial;
 use App\Services\OwnerService;
-use App\UploadFile;
+use App\file;
 use Faker\Provider\Uuid;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
@@ -32,7 +32,7 @@ class OwnerMaterialController extends Controller
         $params['initiator'] = Auth::user()['id'];
         try {
             $material = OwnerMaterial::query()->create($params);
-            if ($material) return ['success' => true,'data' => $material->loadMissing(['owner','material','initiator','uploadFile'])];
+            if ($material) return ['success' => true,'data' => $material->loadMissing(['owner','material','initiator','file'])];
             else return ['success' => false, 'message' => '添加失败'];
         } catch (\Exception $e) {
             return ['success' => false,'message' => $e->getMessage()];
@@ -46,7 +46,7 @@ class OwnerMaterialController extends Controller
         if(!$material)$this->error("对应的项目耗材没有找到");
         $bool = $material->update($request->all(['owner_id', 'material_id', 'material_code', 'size', 'special', 'specification']));
         if($bool==0)$this->error("更新异常");
-        $this->success($material->loadMissing(['owner','material','initiator','uploadFile']));
+        $this->success($material->loadMissing(['owner','material','initiator','file']));
     }
 
     public function destroyApi($id)
@@ -58,7 +58,7 @@ class OwnerMaterialController extends Controller
         $this->success();
     }
 
-    public function uploadFileApi(Request $request)
+    public function fileApi(Request $request)
     {
         $this->gate('项目耗材-文件上传');
         $ownerMaterial = OwnerMaterial::query()->find($request['id']);
@@ -68,7 +68,7 @@ class OwnerMaterialController extends Controller
             $fileType = $file->getMimeType();// 文件类型
             $fileName = strtolower($file->getClientOriginalExtension());// 文件名
             $path = $file->storeAs("ownerMaterial", Uuid::uuid() . "." . $fileName);
-            $file = UploadFile::query()->create([
+            $file = file::query()->create([
                 'table_name' => 'owner_material',
                 'table_id' => $ownerMaterial['id'],
                 'url' => $path,

+ 85 - 0
app/Http/Controllers/ProcurementCheckSheetController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\ProcurementCheckSheet;
+use Illuminate\Http\Request;
+
+class ProcurementCheckSheetController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\ProcurementCheckSheet  $procurementCheckSheet
+     * @return \Illuminate\Http\Response
+     */
+    public function show(ProcurementCheckSheet $procurementCheckSheet)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\ProcurementCheckSheet  $procurementCheckSheet
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(ProcurementCheckSheet $procurementCheckSheet)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\ProcurementCheckSheet  $procurementCheckSheet
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, ProcurementCheckSheet $procurementCheckSheet)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\ProcurementCheckSheet  $procurementCheckSheet
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(ProcurementCheckSheet $procurementCheckSheet)
+    {
+        //
+    }
+}

+ 150 - 0
app/Http/Controllers/ProcurementController.php

@@ -0,0 +1,150 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use App\Filters\ProcurementFilters;
+use App\Material;
+use App\Procurement;
+use App\ProcurementCheckSheet;
+use App\ProcurementTotalBill;
+use App\Services\OwnerMaterialService;
+use App\Supplier;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class ProcurementController extends Controller
+{
+    use AsyncResponse;
+
+    public function index(Request $request,ProcurementFilters $filters)
+    {
+        $this->gate('采购管理-采购-查询');
+        $paginateParams=$request->input();
+        $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
+        $procurements = Procurement::query()
+            ->filter($filters)
+            ->with(['initiator','ownerMaterial.material','ownerMaterial.owner'=>function($query)use($owner_ids){
+                $query->with('customer')->whereIn('id',$owner_ids);
+            }])->paginate($param['paginate'] ?? 50);
+        /** @var OwnerMaterialService $ownerMaterialService*/
+        $ownerMaterialService=app(OwnerMaterialService::class);
+        $owners=$ownerMaterialService->getOwnerPermittingWithMaterial();
+        $materials=Material::query()->select('id','name')->get();
+        return view('procurement/procurement/index',compact('procurements','owners','materials','paginateParams'));
+    }
+
+
+    public function create()
+    {
+        $this->gate('采购管理-采购-新建');
+        /** @var OwnerMaterialService $ownerMaterialService*/
+        $ownerMaterialService=app(OwnerMaterialService::class);
+        $owners=$ownerMaterialService->getOwnerPermittingWithMaterial();
+        return view('procurement/procurement/create',compact('owners'));
+    }
+
+    public function store(Request $request)
+    {
+        $this->gate('采购管理-采购-新建');
+        $param=$request->all(['owner_material_id','quantity','amount','unit_price']);
+        $procurement=new Procurement([
+            'owner_material_id'=>$param['owner_material_id'],
+            'quantity'=>$param['quantity'],
+            'amount'=>$param['amount'],
+            'unit_price'=>$param['unit_price'],
+            'initiator'=>Auth::user()['id'],
+        ]);
+        $procurement->save();
+        $number_id=$procurement['id'];
+        $procurement_code='BSHC';
+        $procurement_code .= date ("ymd").str_pad($number_id>99999?$number_id%99999:$number_id,4,"0",STR_PAD_LEFT);
+        $procurement->update(['code'=>$procurement_code]);
+        return redirect('procurement/procurement/index')->with('successTip','新采购单“'.$procurement_code.'”添加成功');
+    }
+    public function createProcurement(Request $request)
+    {
+        $this->gate('采购管理-采购-新建');
+        $param=$request->all(['owner_material_id','quantity','amount','unit_price']);
+        try {
+            $procurement=new Procurement([
+                'owner_material_id'=>$param['owner_material_id'],
+                'quantity'=>$param['quantity'],
+                'amount'=>$param['amount'],
+                'unit_price'=>$param['unit_price'],
+                'initiator'=>Auth::user()['id'],
+            ]);
+            $procurement->save();
+            $number_id=$procurement['id'];
+            $procurement_code='BSHC';
+            $procurement_code .= date ("ymd").str_pad($number_id>99999?$number_id%99999:$number_id,4,"0",STR_PAD_LEFT);
+            $procurement->update(['code'=>$procurement_code]);
+            $procurement = $procurement->loadMissing(['initiator','ownerMaterial.material','ownerMaterial.owner.customer']);
+            if ($procurement) return ['success' => true,'data' => $procurement];
+            else return ['success' => false, 'message' => '添加失败'];
+        } catch (\Exception $e) {
+            return ['success' => false,'message' => $e->getMessage()];
+        }
+    }
+
+
+    public function show(Procurement $procurement)
+    {
+        //
+    }
+
+
+    public function edit(Procurement $procurement)
+    {
+        //
+    }
+
+
+    public function update(Request $request, Procurement $procurement)
+    {
+        //
+    }
+
+
+    public function destroy(Procurement $procurement)
+    {
+        //
+    }
+
+    public function checkBill(Request $request)
+    {
+        $this->gate('采购管理-财务-对账单');
+        $paginateParams=$request->input();
+        $procurementCheckSheets=ProcurementCheckSheet::query()
+            ->with(['procurementDelivery.procurement.supplier','procurementDelivery.procurement.ownerMaterial.material','procurementDelivery.receiver',])
+            ->paginate($param['paginate'] ?? 50);
+        $suppliers=Supplier::query()->select('id','name')->get();
+        $materials=Material::query()->select('id','name')->get();
+        return view('procurement/finance/checkBill',compact('procurementCheckSheets','suppliers','paginateParams','materials'));
+    }
+
+    public function procurementBill(Request $request,ProcurementFilters $filters)
+    {
+        $this->gate('采购管理-财务-采购账单');
+        $paginateParams=$request->input();
+        $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
+        $owners=app("OwnerService")->getIntersectPermitting();
+        $materials=Material::query()->select('id','name')->get();
+        $suppliers=Supplier::query()->select('id','name')->get();
+        $procurements = Procurement::query()
+            ->filter($filters)
+            ->with(['initiator','supplier','ownerMaterial.material','ownerMaterial.owner'=>function($query)use($owner_ids){
+                $query->with('customer')->whereIn('id',$owner_ids);
+            }])->paginate($param['paginate'] ?? 50);
+        return view('procurement/finance/procurementBill',compact('suppliers','materials','owners','paginateParams','procurements'));
+    }
+
+    public function monthlyBillReport(Request $request)
+    {
+        $this->gate('采购管理-财务-月账单报表');
+        $paginateParams=$request->input();
+        $procurementTotalBills=ProcurementTotalBill::query()->with('supplier')->paginate($param['paginate'] ?? 50);
+        $suppliers=Supplier::query()->select('id','name')->get();
+        return view('procurement/finance/monthlyBillReport',compact('suppliers','procurementTotalBills','paginateParams'));
+    }
+}

+ 85 - 0
app/Http/Controllers/ProcurementDeliverieController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\ProcurementDeliverie;
+use Illuminate\Http\Request;
+
+class ProcurementDeliverieController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\ProcurementDeliverie  $procurementDeliverie
+     * @return \Illuminate\Http\Response
+     */
+    public function show(ProcurementDeliverie $procurementDeliverie)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\ProcurementDeliverie  $procurementDeliverie
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(ProcurementDeliverie $procurementDeliverie)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\ProcurementDeliverie  $procurementDeliverie
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, ProcurementDeliverie $procurementDeliverie)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\ProcurementDeliverie  $procurementDeliverie
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(ProcurementDeliverie $procurementDeliverie)
+    {
+        //
+    }
+}

+ 85 - 0
app/Http/Controllers/ProcurementQuotationController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\ProcurementQuotation;
+use Illuminate\Http\Request;
+
+class ProcurementQuotationController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\ProcurementQuotation  $procurementQuotation
+     * @return \Illuminate\Http\Response
+     */
+    public function show(ProcurementQuotation $procurementQuotation)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\ProcurementQuotation  $procurementQuotation
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(ProcurementQuotation $procurementQuotation)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\ProcurementQuotation  $procurementQuotation
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, ProcurementQuotation $procurementQuotation)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\ProcurementQuotation  $procurementQuotation
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(ProcurementQuotation $procurementQuotation)
+    {
+        //
+    }
+}

+ 85 - 0
app/Http/Controllers/ProcurementTotalBillController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\ProcurementTotalBill;
+use Illuminate\Http\Request;
+
+class ProcurementTotalBillController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\ProcurementTotalBill  $procurementTotalBill
+     * @return \Illuminate\Http\Response
+     */
+    public function show(ProcurementTotalBill $procurementTotalBill)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\ProcurementTotalBill  $procurementTotalBill
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(ProcurementTotalBill $procurementTotalBill)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\ProcurementTotalBill  $procurementTotalBill
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, ProcurementTotalBill $procurementTotalBill)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\ProcurementTotalBill  $procurementTotalBill
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(ProcurementTotalBill $procurementTotalBill)
+    {
+        //
+    }
+}

+ 4 - 0
app/Owner.php

@@ -107,4 +107,8 @@ class Owner extends Model
     {   //仓库
         return $this->belongsTo(Warehouse::class,"warehouse_id","id");
     }
+    public function ownerMaterials()
+    {   //耗材
+        return $this->hasMany(OwnerMaterial::class,"owner_id","id");
+    }
 }

+ 36 - 0
app/Procurement.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class Procurement extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+
+    protected $fillable=[
+        'code','owner_material_id', 'supplier_id', 'quantity','amount','unit_price','cost_price','status','initiator'
+    ];
+
+    public  function ownerMaterial(){
+        return $this->hasOne('App\OwnerMaterial','id','owner_material_id');
+    }
+
+    public  function supplier(){
+        return $this->hasOne('App\Supplier','id','supplier_id');
+    }
+
+    public function initiator()
+    {
+        return $this->belongsTo(User::class,'initiator','id');
+    }
+
+    public function scopeFilter($query, $filters)
+    {
+        return $filters->apply($query);
+    }
+}

+ 21 - 0
app/ProcurementCheckSheet.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class ProcurementCheckSheet extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+
+    protected $fillable=[
+        'procurement_delivery_id','invoice_number', 'account_payable', 'auditor','status','created_at'
+    ];
+    public function procurementDelivery(){
+        return $this->belongsTo('App\ProcurementDeliverie','procurement_delivery_id','id');
+    }
+}

+ 27 - 0
app/ProcurementDeliverie.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+use Illuminate\Support\Facades\App;
+
+class ProcurementDeliverie extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+
+    protected $fillable=[
+        'procurement_id','amount', 'initiator','status','signer','signed_at',
+    ];
+
+    public function procurement(){
+        return $this->belongsTo('App\Procurement','procurement_id','id');
+    }
+
+    public function receiver(){
+        return $this->belongsTo('App\User','signer','id');
+    }
+}

+ 18 - 0
app/ProcurementQuotation.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class ProcurementQuotation extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+
+    protected $fillable=[
+        'procurement_id','offer', 'operator', 'quoted_at','status','created_at'
+    ];
+}

+ 21 - 0
app/ProcurementTotalBill.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class ProcurementTotalBill extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+
+    protected $fillable=[
+        'counting_month','supplier_id','status'
+    ];
+    public function supplier(){
+        return $this->belongsTo('App\Supplier','supplier_id','id');
+    }
+}

+ 4 - 0
app/Providers/AppServiceProvider.php

@@ -45,6 +45,7 @@ use App\Services\OrderTrackingService;
 use App\Services\OwnerAreaReportService;
 use App\Services\OwnerBillReportService;
 use App\Services\OwnerFeeDetailService;
+use App\Services\OwnerMaterialService;
 use App\Services\OwnerPriceDirectLogisticService;
 use App\Services\OwnerPriceExpressService;
 use App\Services\OwnerPriceLogisticService;
@@ -59,6 +60,7 @@ use App\Services\ProcessesContentService;
 use App\Services\ProcessMethodService;
 use App\Services\ProcessService;
 use App\Services\ProcessStatisticService;
+use App\Services\ProcurementService;
 use App\Services\ProvinceService;
 use App\Services\RealtimePendingOrdersService;
 use App\Services\RejectedBillItemService;
@@ -193,6 +195,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('OwnerReportService',OwnerReportService::class);
         app()->singleton('OwnerService',OwnerService::class);
         app()->singleton('OwnerStoragePriceModelService',OwnerStoragePriceModelService::class);
+        app()->singleton('OwnerMaterialService',OwnerMaterialService::class);
         app()->singleton('PackageService',PackageService::class);
         app()->singleton('PackageStatisticsService',PackageStatisticsService::class);
         app()->singleton('ProcessMethodService',ProcessMethodService::class);
@@ -200,6 +203,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('ProcessStatisticService',ProcessStatisticService::class);
         app()->singleton('ProcessesContentService',ProcessesContentService::class);
         app()->singleton('ProvinceService',ProvinceService::class);
+        app()->singleton('ProcurementService',ProcurementService::class);
         app()->singleton('RealtimePendingOrdersService',RealtimePendingOrdersService::class);
         app()->singleton('RegionService',RegionService::class);
         app()->singleton('RejectedBillItemService',RejectedBillItemService::class);

+ 20 - 0
app/Services/OwnerMaterialService.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Services;
+
+use App\Owner;
+use App\OwnerMaterial;
+use Illuminate\Support\Facades\Auth;
+use App\Traits\ServiceAppAop;
+
+
+class OwnerMaterialService
+{
+    use ServiceAppAop;
+    protected $modelClass=OwnerMaterial::class;
+    public function getOwnerPermittingWithMaterial()
+    {
+        $ownerIds=app('UserService')->getPermittingOwnerIds(Auth::user());
+        return Owner::query()->with('ownerMaterials.material')->select('id','name')->whereIn('id', $ownerIds)->get();
+    }
+}

+ 37 - 0
app/Services/ProcurementService.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Services;
+
+use App\Owner;
+use App\Procurement;
+use App\Services\common\QueryService;
+use Illuminate\Support\Facades\Auth;
+use App\Traits\ServiceAppAop;
+
+
+class ProcurementService
+{
+    use ServiceAppAop;
+
+    private function conditionQuery(array $param){
+        $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
+        $procurements = Procurement::with(['initiator','ownerMaterial.material','ownerMaterial.owner'=>function($query)use($owner_ids){
+            $query->with('customer')->whereIn('id',$owner_ids);
+        }]);
+        $columnQueryRules=[
+            'owner_id' => ['multi' => ','],
+            'material_id' => ['multi' => ','],
+            'supplier_id' => ['multi' => ','],
+            'company_name' => ['like' => ','],
+            'created_at_start' => ['alias' => 'created_at' , 'startDate' => ':00'],
+            'created_at_end' => ['alias' => 'created_at' , 'endDate' => ':59'],
+        ];
+        $procurements = app(QueryService::class)->query($param,$procurements,$columnQueryRules,"procurements");
+        return $procurements;
+    }
+
+    public function paginate(array $param){
+        $procurements = $this->conditionQuery($param);
+        return $procurements->paginate($param['paginate'] ?? 50);
+    }
+}

+ 42 - 0
database/migrations/2021_02_03_145200_create_procurements_table.php

@@ -0,0 +1,42 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProcurementsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('procurements', function (Blueprint $table) {
+            $table->id();
+            $table->string('code')->index()->comment('采购编号');
+            $table->tinyInteger('type')->index()->default(0)->comment('采购类型');
+            $table->bigInteger('owner_material_id')->index()->comment('外键项目耗材');
+            $table->bigInteger('supplier_id')->index()->nullable()->comment('外键供应商');
+            $table->decimal('quantity')->comment('采购数量');
+            $table->decimal('amount')->comment('销售数量');
+            $table->decimal('unit_price')->nullable()->comment('销售单价');
+            $table->decimal('cost_price')->nullable()->comment('成本单价(采购)');
+            $table->tinyInteger('status')->default(0)->comment('状态');//待报价 已报价 待接单 生产中 送货中 已完成 已取消
+            $table->enum('is_enquiry',['是','否'])->default('否')->comment('是否询价');
+            $table->bigInteger('initiator')->index()->comment('外键用户(发起者)');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('procurements');
+    }
+}

+ 37 - 0
database/migrations/2021_02_03_151138_create_procurement_quotations_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProcurementQuotationsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('procurement_quotations', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('procurement_id')->index()->comment('外键采购单');
+            $table->bigInteger('supplier_id')->index()->comment('外键供应商');
+            $table->decimal('offer')->nullable()->comment('报价');
+            $table->bigInteger('operator')->index()->comment('操作者');
+            $table->timestamp('quoted_at')->nullable()->comment('报价时间');
+            $table->tinyInteger('status')->default(0)->comment('状态');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('procurement_quotations');
+    }
+}

+ 37 - 0
database/migrations/2021_02_03_151704_create_procurement_deliveries_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProcurementDeliveriesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('procurement_deliveries', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('procurement_id')->index()->comment('外键采购单');
+            $table->decimal('amount')->comment('送货数量');
+            $table->bigInteger('initiator')->index()->comment('发起人');
+            $table->bigInteger('signer')->index()->comment('签收人');
+            $table->tinyInteger('status')->default(0)->comment('状态');
+            $table->date('signed_at')->comment('签收时间');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('procurement_deliveries');
+    }
+}

+ 36 - 0
database/migrations/2021_02_03_152845_create_procurement_check_sheets_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProcurementCheckSheetsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('procurement_check_sheets', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('procurement_delivery_id')->index()->comment('外键采购送货单');
+            $table->integer('invoice_number')->nullable()->comment('发票号');
+            $table->decimal('account_payable',10,4)->comment('应付款');
+            $table->tinyInteger('status')->default(0)->comment('状态');
+            $table->bigInteger('auditor')->index()->comment('出纳审核人');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('procurement_check_sheets');
+    }
+}

+ 35 - 0
database/migrations/2021_02_03_153406_create_procurement_total_bills_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProcurementTotalBillsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('procurement_total_bills', function (Blueprint $table) {
+            $table->id();
+            $table->date('counting_month')->index()->comment('结算月');
+            $table->bigInteger('supplier_id')->index()->comment('外键供应商');
+            $table->tinyInteger('status')->default(0)->comment('状态');
+            $table->decimal('total_payable',10,4)->comment('总金额');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('procurement_total_bills');
+    }
+}

+ 36 - 0
database/migrations/2021_02_03_161934_add_authorrities_to_procurement.php

@@ -0,0 +1,36 @@
+<?php
+
+use App\Authority;
+use Illuminate\Database\Migrations\Migration;
+
+class AddAuthorritiesToProcurement extends Migration
+{
+    private $names = [
+        '采购管理',
+        '采购管理-采购','采购管理-财务','采购管理-相关设置',
+        '采购管理-采购-查询','采购管理-采购-新建','采购管理-采购-编辑',
+        '采购管理-财务-对账单','采购管理-财务-采购账单','采购管理-财务-月账单报表',
+    ];
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->names as $name) {
+            if(!Authority::query()->where('name',$name)->exists())
+                Authority::query()->create(['name'=>$name,'alias_name'=>$name]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::query()->whereIn('name',$this->names)->delete();
+    }
+}

+ 5 - 0
resources/views/layouts/menu.blade.php

@@ -52,6 +52,11 @@
                                     :class="{active:isActive('station',1)}">
                     <span class="fa fa-share-alt-square" style="color: #72441b"></span>
                     站管理</a></li> @endcan
+        @can('采购管理')
+                <li class="nav-item"><a href="{{url("procurement/procurement/index")}}" class="nav-link"
+                                        :class="{active:isActive('station',1)}">
+                        <span class="fa fa-cart-plus" style="color: #1b4b72"></span>
+                        采购管理</a></li>@endcan
         @can('基础设置')
             <li class="nav-item"><a href="{{url("maintenance")}}" class="nav-link" target="maintenance"
                                     :class="{active:isActive('maintenance',1)}">

+ 181 - 0
resources/views/procurement/finance/checkBill.blade.php

@@ -0,0 +1,181 @@
+@extends('layouts.app')
+@section('title')采购管理-财务-对账单@endsection
+
+@section('content')
+    @component('procurement.finance.menu')@endcomponent
+    <div class="container-fluid" id="list">
+        <div id="form_div" class="mt-1"></div>
+        <div class="row mt-2">
+        <span class="dropdown ml-3">
+        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                :class="[checkData.length>0?'btn-dark text-light':'']"
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
+            导出Excel
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" @click="procurementExport(false)" href="javascript:">导出勾选内容</a>
+            <a class="dropdown-item" @click="procurementExport(true)" href="javascript:">导出所有页</a>
+        </div>
+        </span>
+        </div>
+        <label for="all" id="cloneCheckAll" class="d-none">
+            <input id="all" type="checkbox" @click="checkAll($event)">全选
+        </label>
+        <table class="table table-sm table-bordered text-nowrap d-none" id="headerRoll"></table>
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2"
+               id="headerParent">
+            <tr id="header"></tr>
+            <tr v-for="(procurementCheckSheet,i) in procurementCheckSheets">
+                <td>
+                    <input class="checkItem" type="checkbox" :value="procurementCheckSheet" v-model="checkData">
+                </td>
+                <td class="">@{{ procurementCheckSheet.procurement_code }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.procurement_at }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.procurement_delivery_at }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.supplier_name }}</td>
+                <td class="tooltipTarget" style="max-width: 200px;overflow:hidden">@{{ procurementCheckSheet.material_code }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.material_name }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.procurement_quantity }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.amount }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.signer_name }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.signed_at }}</td>
+                <td class="text-muted">@{{ procurementCheckSheet.account_payable }}</td>
+                <td><span>@{{ procurementCheckSheet.invoice_number }}</span></td>
+                <td><span>@{{ procurementCheckSheet.status }}</span></td>
+                <td><a class="text-primary">填写发票号</a></td>
+            </tr>
+        </table>
+        <div class="text-info h5 btn btn">{{$procurementCheckSheets->count()}}/@{{ sum }}</div>
+        <div>{{$procurementCheckSheets->appends($paginateParams)->links()}}</div>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el: '#list',
+            data: {
+                procurementCheckSheets: [
+                    @foreach($procurementCheckSheets as $procurementCheckSheet)
+                    {
+                        id:'{{$procurementCheckSheet->id}}',invoice_number:'{{$procurementCheckSheet->invoice_number}}',account_payable:'{{$procurementCheckSheet->account_payable}}',
+                        created_at:'{{$procurementCheckSheet->created_at}}',auditor:'{{$procurementCheckSheet->auditor}}',status:'{{$procurementCheckSheet->status}}',
+
+                        @if($procurementCheckSheet->procurementDelivery)
+                        amount:'{{$procurementCheckSheet->procurementDelivery->amount}}',initiator:'{{$procurementCheckSheet->procurementDelivery->initiator}}',
+                        signer:'{{$procurementCheckSheet->procurementDelivery->signer}}',signed_at:'{{$procurementCheckSheet->procurementDelivery->signed_at}}',
+                        procurement_delivery_at:'{{$procurementCheckSheet->procurementDelivery->created_at}}',@endif
+
+                        @if($procurementCheckSheet->procurementDelivery->procurement)
+                        procurement_quantity:'{{$procurementCheckSheet->procurementDelivery->procurement->quantity}}',
+                        procurement_code:'{{$procurementCheckSheet->procurementDelivery->procurement->code}}',
+                        procurement_at:'{{$procurementCheckSheet->procurementDelivery->procurement->created_at}}',@endif
+
+                        @if($procurementCheckSheet->procurementDelivery->receiver)
+                        signer_name:'{{$procurementCheckSheet->procurementDelivery->receiver->name}}',@endif
+
+                        @if($procurementCheckSheet->procurementDelivery->procurement->supplier)
+                        supplier_id:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->id}}',supplier_name:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->name}}',@endif
+
+                        @if($procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material)
+                        material_id:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->id}}',
+                        material_name:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->name}}',
+                        material_code:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->code}}',@endif
+
+                    }
+                    @endforeach
+                ],
+                suppliers:[
+                        @foreach($suppliers as $supplier)
+                    {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
+                    @endforeach
+                ],
+                materials: [
+                        @foreach($materials as $material)
+                    {name:'{{$material->id}}',value:'{{$material->name}}'},
+                    @endforeach
+                ],
+                checkData: [],
+                sum:{!! $procurementCheckSheets->total() !!},
+
+            },
+            mounted: function () {
+                $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                $('#list').removeClass('d-none');
+                let data = [
+                    [
+                        {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
+                        {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {
+                            name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
+                            placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
+                        },
+                        {
+                            name: 'material_id',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
+                            placeholder: ['耗材', '定位或多选耗材'],
+                            data: this.materials
+                        },
+                    ],
+                ];
+                this.form = new query({
+                    el: "#form_div",
+                    condition: data,
+                });
+                this.form.init();
+                let column = [
+                    {
+                        name: 'cloneCheckAll', customization: true, type: 'checkAll',
+                        dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
+                    },
+                    {name: 'code', value: '采购编号', neglect: true},
+                    {name: 'procurement_at', value: '采购日期', class: ''},
+                    {name: '', value: '送货日期', class: 'text-muted'},
+                    {name: 'company_name', value: '供应商名称', class: 'text-muted'},
+                    {name: 'material_code', value: '耗材编号', class: 'text-muted'},
+                    {name: 'material_name', value: '耗材'},
+                    {name: 'quantity', value: '采购数量', class: 'text-muted'},
+                    {name: 'amount', value: '送货数量', class: 'text-muted'},
+                    {name: 'signer', value: '签收人', class: 'text-muted'},
+                    {name: 'signed_at', value: '签收日期', class: 'text-muted'},
+                    {name: '', value: '应付金额', neglect: true},
+                    {name: '', value: '发票号', neglect: true},
+                    {name: '', value: '状态', neglect: true},
+                    {name: '', value: '填写发票号', neglect: true},
+                ];
+
+                let _this = this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.procurementCheckSheets,
+                        restorationColumn: 'id',
+                        fixedTop: ($('#form_div').height()) + 2,
+                        offset: 0.5,
+                        vue: vue
+                    });
+                    header.init();
+                }, 0);
+            },
+            methods: {
+                //全选事件
+                checkAll(e) {
+                    if (e.target.checked) {
+                        this.procurementCheckSheets.forEach((el, i) => {
+                            if (this.checkData.indexOf(el) == '-1') {
+                                this.checkData.push(el);
+                            }
+                        });
+                    } else {
+                        this.checkData = [];
+                    }
+                },
+
+            }
+        });
+    </script>
+@endsection

+ 23 - 0
resources/views/procurement/finance/menu.blade.php

@@ -0,0 +1,23 @@
+<div id="nav2">
+    @component('procurement.menu')
+    @endcomponent
+    <div class="container-fluid nav3">
+        <div class="card menu-third" >
+            <ul class="nav nav-pills">
+                @can('采购管理-财务-对账单')
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{url('procurement/finance/checkBill')}}" :class="{active:isActive('checkBill',3)}">对账单</a>
+                    </li> @endcan
+                @can('采购管理-财务-采购账单')
+                    <li class="nav-item">
+                        <a  class="nav-link" href="{{url('procurement/finance/procurementBill')}}" :class="{active:isActive('procurementBill',3)}">采购账单</a>
+                    </li> @endcan
+                    @can('采购管理-财务-月账单报表')
+                    <li class="nav-item">
+                        <a  class="nav-link" href="{{url('procurement/finance/monthlyBillReport')}}" :class="{active:isActive('monthlyBillReport',3)}">月账单报表</a>
+                    </li> @endcan
+            </ul>
+        </div>
+    </div>
+</div>
+

+ 137 - 0
resources/views/procurement/finance/monthlyBillReport.blade.php

@@ -0,0 +1,137 @@
+@extends('layouts.app')
+@section('title')采购管理-财务-月账单报表@endsection
+
+@section('content')
+    @component('procurement.finance.menu')@endcomponent
+    <div class="container-fluid" id="list">
+        <div id="form_div" class="mt-1"></div>
+        <div class="row mt-2">
+        <span class="dropdown ml-3">
+        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                :class="[checkData.length>0?'btn-dark text-light':'']"
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
+            导出Excel
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" @click="procurementTotalBillExport(false)" href="javascript:">导出勾选内容</a>
+            <a class="dropdown-item" @click="procurementTotalBillExport(true)" href="javascript:">导出所有页</a>
+        </div>
+        </span>
+        </div>
+        <label for="all" id="cloneCheckAll" class="d-none">
+            <input id="all" type="checkbox" @click="checkAll($event)">全选
+        </label>
+        <table class="table table-sm table-bordered text-nowrap d-none" id="headerRoll"></table>
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2"
+               id="headerParent">
+            <tr id="header"></tr>
+            <tr v-for="(procurementTotalBill,i) in procurementTotalBills">
+                <td>
+                    <input class="checkItem" type="checkbox" :value="procurementTotalBill" v-model="checkData">
+                </td>
+                <td class="text-primary">@{{ procurementTotalBill.id }}</td>
+                <td class="text-muted">@{{ procurementTotalBill.counting_month }}</td>
+                <td class="text-muted">@{{ procurementTotalBill.created_at }}</td>
+                <td class="text-muted">@{{ procurementTotalBill.supplier_name }}</td>
+                <td>@{{ procurementTotalBill.total_payable }}</td>
+                <td><span>@{{ procurementTotalBill.status }}</span></td>
+                <td>
+                    <span class="btn btn-sm btn-outline-success">查看对账单</span>
+                </td>
+            </tr>
+        </table>
+        <div class="text-info h5 btn btn">{{$procurementTotalBills->count()}}/@{{ sum }}</div>
+        <div>{{$procurementTotalBills->appends($paginateParams)->links()}}</div>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el: '#list',
+            data: {
+                procurementTotalBills: [
+                    @foreach($procurementTotalBills as $procurementTotalBill)
+                    {
+                        id:'{{$procurementTotalBill->id}}',counting_month:'{{$procurementTotalBill->counting_month}}',
+                        created_at:'{{$procurementTotalBill->created_at}}',status:'{{$procurementTotalBill->status}}',total_payable:'{{$procurementTotalBill->total_payable}}',
+                            @if($procurementTotalBill->supplier)
+                            supplier_id:'{{$procurementTotalBill->supplier->id}}',supplier_name:'{{$procurementTotalBill->supplier->name}}',@endif
+                    }
+                    @endforeach
+                ],
+                suppliers:[
+                        @foreach($suppliers as $supplier)
+                    {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
+                    @endforeach
+                ],
+                checkData: [],
+                sum:{!! $procurementTotalBills->total() !!},
+
+            },
+            mounted: function () {
+                $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                $('#list').removeClass('d-none');
+                let data = [
+                    [
+                        {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
+                        {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {
+                            name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
+                            placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
+                        },
+                    ],
+                ];
+                this.form = new query({
+                    el: "#form_div",
+                    condition: data,
+                });
+                this.form.init();
+                let column = [
+                    {
+                        name: 'cloneCheckAll', customization: true, type: 'checkAll',
+                        dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
+                    },
+                    {name: 'id', value: '对账编号', neglect: true},
+                    {name: 'counting_month', value: '账单日期', },
+                    {name: 'created_at', value: '提交日期',},
+                    {name: 'supplier', value: '供应商',},
+                    {name: 'total_payable', value: '总金额',},
+                    {name: 'status', value: '状态'},
+                    {name: '', value: '操作', neglect: true},
+                ];
+
+                let _this = this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.procurementTotalBills,
+                        restorationColumn: 'id',
+                        fixedTop: ($('#form_div').height()) + 2,
+                        offset: 0.5,
+                        vue: vue
+                    });
+                    header.init();
+                }, 0);
+            },
+            methods: {
+                //全选事件
+                checkAll(e) {
+                    if (e.target.checked) {
+                        this.procurementTotalBills.forEach((el, i) => {
+                            if (this.checkData.indexOf(el) == '-1') {
+                                this.checkData.push(el);
+                            }
+                        });
+                    } else {
+                        this.checkData = [];
+                    }
+                },
+
+            }
+        });
+    </script>
+@endsection

+ 194 - 0
resources/views/procurement/finance/procurementBill.blade.php

@@ -0,0 +1,194 @@
+@extends('layouts.app')
+@section('title')采购管理-财务-采购账单@endsection
+
+@section('content')
+    @component('procurement.finance.menu')@endcomponent
+    <div class="container-fluid" id="list">
+        <div id="form_div" class="mt-1"></div>
+        <div class="row mt-2">
+        <span class="dropdown ml-3">
+        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                :class="[checkData.length>0?'btn-dark text-light':'']"
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
+            导出Excel
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" @click="{{--procurementExport(false)--}}" href="javascript:">导出勾选内容</a>
+            <a class="dropdown-item" @click="{{--procurementExport(true)--}}" href="javascript:">导出所有页</a>
+        </div>
+        </span>
+        </div>
+        <label for="all" id="cloneCheckAll" class="d-none">
+            <input id="all" type="checkbox" @click="checkAll($event)">全选
+        </label>
+        <table class="table table-sm table-bordered text-nowrap d-none" id="headerRoll"></table>
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2"
+               id="headerParent">
+            <tr id="header"></tr>
+            <tr v-for="(procurement,i) in procurements">
+                <td>
+                    <input class="checkItem" type="checkbox" :value="procurement" v-model="checkData">
+                </td>
+                <td class="">@{{ procurement.code }}</td>
+                <td class="">@{{ procurement.created_at }}</td>
+                <td class=""></td>
+                <td class=""></td>
+                <td class="">@{{ procurement.owner_name }}</td>
+                <td class="">@{{ procurement.company_name }}</td>
+                <td class="">@{{ procurement.supplier_name }}</td>
+                <td class="tooltipTarget" style="max-width: 200px;overflow:hidden">@{{ procurement.material_code }}</td>
+                <td class="text-muted">@{{ procurement.material_name }}</td>
+                <td class="text-muted">@{{ procurement.size }}</td>
+                <td class="text-muted">@{{ procurement.special }}</td>
+                <td class="text-muted">@{{ procurement.specification }}</td>
+                <td>@{{ procurement.quantity }}</td>
+                <td>@{{ procurement.amount }}</td>
+                <td></td>
+                <td>@{{ procurement.cost_price }}</td>
+                <td>@{{ procurement.unit_price }}</td>
+                <td></td>
+                <td></td>
+                <td><span>@{{ procurement.status }}</span></td>
+                <td>
+                    <span class="btn btn-sm btn-outline-danger">锁定</span>
+                    <span class="btn btn-sm btn-outline-success">修改采购单价</span>
+                </td>
+            </tr>
+        </table>
+        <div class="text-info h5 btn btn">{{$procurements->count()}}/@{{ sum }}</div>
+        <div>{{$procurements->appends($paginateParams)->links()}}</div>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el: '#list',
+            data: {
+                procurements: [
+                        @foreach($procurements as $procurement)
+                    {
+                        id:'{{$procurement->id}}',code:'{{$procurement->code}}',type:'{{$procurement->type}}',created_at:'{{$procurement->created_at}}',
+                        quantity:'{{$procurement->quantity}}',unit_price:'{{$procurement->unit_price}}',status:'{{$procurement->status}}',cost_price:'{{$procurement->cost_price}}',
+                        @if($procurement->ownerMaterial)
+                        owner_id:'{{$procurement->ownerMaterial->owner_id}}',size:'{{$procurement->ownerMaterial->size}}',
+                        special:'{{$procurement->ownerMaterial->special}}',specification:'{{$procurement->ownerMaterial->specification}}',@endif
+                            @if($procurement->ownerMaterial->material)
+                        material_id:'{{$procurement->ownerMaterial->material->id}}',material_code:'{{$procurement->ownerMaterial->material->code}}',
+                        material_name:'{{$procurement->ownerMaterial->material->name}}',@endif
+                            @if($procurement->ownerMaterial->owner)owner_name:'{{$procurement->ownerMaterial->owner->name}}',@endif
+                            @if($procurement->supplier)supplier_name:'{{$procurement->supplier->name}}',@endif
+                            @if($procurement->ownerMaterial->owner->customer)
+                        company_name:'{{$procurement->ownerMaterial->owner->customer->company_name}}',customer_id:'{{$procurement->ownerMaterial->owner->customer->id}}',
+                        phone:'{{$procurement->ownerMaterial->owner->customer->phone}}',@endif
+                    },
+                    @endforeach
+                ],
+                owners:[
+                        @foreach($owners as $owner)
+                    {name:'{{$owner->id}}',value:'{{$owner->name}}'},
+                    @endforeach
+                ],
+                materials: [
+                        @foreach($materials as $material)
+                    {name:'{{$material->id}}',value:'{{$material->name}}'},
+                    @endforeach
+                ],
+                suppliers:[
+                        @foreach($suppliers as $supplier)
+                    {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
+                    @endforeach
+                ],
+                checkData: [],
+                sum:{!! $procurements->total() !!},
+
+            },
+            mounted: function () {
+                $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                $('#list').removeClass('d-none');
+                let data = [
+                    [
+                        {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
+                        {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {
+                            name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的项目'],
+                            placeholder: ['项目', '定位或多选项目'], data: this.owners
+                        },
+                        {
+                            name: 'material_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
+                            placeholder: ['耗材', '定位或多选耗材'], data: this.materials
+                        },
+                        {
+                            name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
+                            placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
+                        },
+                        {name: 'company_name', type: 'input', tip: '采购公司:可在两侧增加百分号(%)进行模糊搜索', placeholder: '采购公司'},
+                    ],
+                ];
+                this.form = new query({
+                    el: "#form_div",
+                    condition: data,
+                });
+                this.form.init();
+                let column = [
+                    {
+                        name: 'cloneCheckAll', customization: true, type: 'checkAll',
+                        dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
+                    },
+                    {name: 'code', value: '采购编号', neglect: true},
+                    {name: 'code', value: '采购日期', neglect: true},
+                    {name: 'code', value: '接单日期', neglect: true},
+                    {name: 'code', value: '签收日期', neglect: true},
+                    {name: 'owner_id', value: '项目名称', class: ''},
+                    {name: 'company_name', value: '采购公司', class: ''},
+                    {name: 'supplier_name', value: '供应商',},
+                    {name: 'material_code', value: '耗材编号', class: 'text-muted'},
+                    {name: 'material_name', value: '耗材'},
+                    {name: 'size', value: '尺寸大小', class: 'text-muted'},
+                    {name: 'special', value: '特殊要求', class: 'text-muted'},
+                    {name: 'specification', value: '材质规格', class: 'text-muted'},
+                    {name: 'quantity', value: '采购数量', neglect: true},
+                    {name: '', value: '销售数量', neglect: true},
+                    {name: '', value: '收货数量', neglect: true},
+                    {name: '', value: '采购单价(元)', neglect: true},
+                    {name: 'unit_price', value: '销售单价(元)', neglect: true},
+                    {name: '', value: '应收金额(元)', neglect: true},
+                    {name: '', value: '应付金额(元)', neglect: true},
+                    {name: '', value: '状态', neglect: true},
+                    {name: '', value: '操作', neglect: true},
+                ];
+
+                let _this = this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.procurements,
+                        restorationColumn: 'id',
+                        fixedTop: ($('#form_div').height()) + 2,
+                        offset: 0.5,
+                        vue: vue
+                    });
+                    header.init();
+                }, 0);
+            },
+            methods: {
+                //全选事件
+                checkAll(e) {
+                    if (e.target.checked) {
+                        this.procurements.forEach((el, i) => {
+                            if (this.checkData.indexOf(el) == '-1') {
+                                this.checkData.push(el);
+                            }
+                        });
+                    } else {
+                        this.checkData = [];
+                    }
+                },
+
+            }
+        });
+    </script>
+@endsection

+ 21 - 0
resources/views/procurement/menu.blade.php

@@ -0,0 +1,21 @@
+<div class="container-fluid nav2" id="nav2">
+    <div class="card">
+        <ul class="nav nav-pills">
+            @can('采购管理-采购')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('procurement/procurement/index')}}"
+                       :class="{active:isActive('procurement',2)}">采购</a>
+                </li> @endcan
+            @can('采购管理-财务')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('procurement/finance/checkBill')}}"
+                       :class="{active:isActive('finance',2)}">财务</a>
+                </li> @endcan
+            @can('采购管理-相关设置')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('procurement/relating')}}"
+                       :class="{active:isActive('relating',2)}">相关设置</a>
+                </li> @endcan
+        </ul>
+    </div>
+</div>

+ 32 - 0
resources/views/procurement/menuProcurement.blade.php

@@ -0,0 +1,32 @@
+@extends('layouts.app')
+@section('title')相关设置@endsection
+
+@section('content')
+    <div id="nav2">
+        @component('procurement.menu')
+        @endcomponent
+            <div class="container-fluid nav3">
+                <div class="card menu-third" >
+                    <ul class="nav nav-pills">
+                    @can('耗材类型')
+                        <li class="nav-item">
+                            <a target="maintenance/userWorkgroup" class="nav-link text-dark" href="{{url('maintenance/material')}}" :class="{active:isActive('material',2)}">耗材</a>
+                        </li> @endcan
+                    @can('项目耗材')
+                        <li class="nav-item">
+                            <a target="maintenance/userLabor" class="nav-link text-dark" href="{{url('maintenance/ownerMaterial')}}" :class="{active:isActive('ownerMaterial',2)}">项目耗材</a>
+                        </li> @endcan
+                    @can('供应商')
+                        <li class="nav-item">
+                            <a target="maintenance/laborCompany" class="nav-link text-dark" href="{{url('maintenance/supplier')}}" :class="{active:isActive('supplier',2)}">供应商</a>
+                        </li> @endcan
+                        @can('系统配置')
+                        <li class="nav-item">
+                            <a target="maintenance/laborCompany" class="nav-link text-dark" href="{{url('maintenance/configuration')}}" :class="{active:isActive('configuration',2)}">系统配置</a>
+                        </li> @endcan
+                </ul>
+            </div>
+        </div>
+    </div>
+@endsection
+

+ 62 - 0
resources/views/procurement/procurement/_addEnquiry.blade.php

@@ -0,0 +1,62 @@
+<div class="modal " id="add-ownerMaterial" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">项目耗材添加</h5>
+                <button type="button" class="close" data-dismiss="modal">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="add-owner-id" class="col-sm-2 col-form-label text-right">货主</label>
+                        <div class="col-sm-10 form-inline">
+                            <select name="owner_id" id="add-owner-id" class="form-control col-sm-5 required" v-model="addOwnerMaterial.owner_id">
+                                <option v-for="(owner,i) in filterOwners"  :value="owner.id">@{{ owner.name }}</option>
+                            </select>
+                            <input type="text" placeholder="输入货主进行筛选" class="form-control col-sm-4 offset-1" @change="filterOwner($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-material-code" class="col-sm-2 col-form-label text-right">耗材编码</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" name="material-code" id="add-material-code" class="form-control col-sm-10" placeholder="耗材编码" v-model="addOwnerMaterial.material_code">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add_material_id" class="col-sm-2 col-form-label text-right">耗材</label>
+                        <div class="col-sm-10 form-inline">
+                            <select name="material_id" id="add_material_id" class="form-control col-sm-5" required v-model="addOwnerMaterial.material_id">
+                                <option v-for="(materials,i) in filterMaterials"  :value="materials.id">@{{ materials.code }}</option>
+                            </select>
+                            <input type="text" placeholder="输入耗材进行筛选" class="form-control col-m-4 offset-1" @change="filterMaterial($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-size" class="col-sm-2 col-form-label text-right">尺寸</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" id="add-size" class="form-control col-10" name="size" placeholder="项目耗材尺寸" v-model="addOwnerMaterial.size">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-special" class="col-sm-2 col-form-label text-right">特殊要求</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="special" id="add-special" cols="30" rows="3" class="form-control form-text col-10" v-model="addOwnerMaterial.special"></textarea>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-specification" class="col-sm-2 col-form-label text-right">材质规格</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="specification" id="add-specification" cols="30" rows="5" class="form-control form-text col-10" v-model="addOwnerMaterial.specification"></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="addOwnerMaterial={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="create">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 111 - 0
resources/views/procurement/procurement/_addProcurement.blade.php

@@ -0,0 +1,111 @@
+<div class="modal " id="add-procurement" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">新增采购单</h5>
+                <button type="button" class="close" data-dismiss="modal">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">项目名称{{old('owner_id')}} *</label>
+                        <div class="col-8 form-inline">
+                            <select id="owner_id" name="owner_id" class="form-control @error('owner_id') is-invalid @enderror col-4" v-model="owner_id" @change="selectOwner" required>
+                                <option v-for="owner in owners" :value="owner.name">@{{owner.value}}</option>
+                            </select>
+                            <input type="text" class="form-control-sm ml-2" placeholder="输入关键字定位项目" @input="owner_seek">
+                        </div>
+                        <div class="col-sm-5">
+                            <p class="form-control-static text-danger small font-weight-bold" >{{ $errors->first('owner_id') }}</p>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="owner_material_id" class="col-2 col-form-label text-right text-primary">项目耗材编号{{old('owner_material_id')}} *</label>
+                        <div class="col-8">
+                            <select id="owner_material_id" name="owner_material_id" class="form-control @error('owner_material_id') is-invalid @enderror col-4" v-model="owner_material_id" @change="ownerMaterial" required>
+                                <option v-for="ownerMaterial in ownerMaterials" :value="ownerMaterial.id">@{{ownerMaterial.material_code}}</option>
+                            </select>
+                            @error('owner_material_id')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">耗材名称</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control " name="material_name" autocomplete="off" value="{{ old('material_name') }}" v-model="material_name" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">尺寸大小</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control " name="size" autocomplete="off" value="{{ old('size') }}" v-model="size" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">特殊要求</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control " name="special" autocomplete="off" value="{{ old('special') }}" v-model="special" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">材质规格</label>
+                        <div class="col-8">
+                            <textarea type="text" class="form-control" name="specification" autocomplete="off" value="{{ old('specification') }}" readonly>@{{ specification }}</textarea>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="quantity" class="col-2 col-form-label text-right">采购数量</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('quantity') is-invalid @enderror"
+                                   v-model="quantity"  name="quantity" autocomplete="off" value="{{ old('quantity') }}" required>
+                            @error('quantity')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="amount" class="col-2 col-form-label text-right">销售数量</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('amount') is-invalid @enderror"
+                                   name="amount" autocomplete="off" value="{{ old('amount') }}" @input="countTotalPrice" v-model="amount" required>
+                            @error('amount')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_price" class="col-2 col-form-label text-right">销售单价</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('unit_price') is-invalid @enderror"
+                                   name="unit_price" autocomplete="off" value="{{ old('unit_price') }}" @input="countTotalPrice" v-model="unit_price" required>
+                            @error('unit_price')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="total_price" class="col-2 col-form-label text-right">销售总价</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control" name="total_price" autocomplete="off" value="{{ old('total_price') }}" v-model="total_price" readonly>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" >关闭</button>
+                <button type="button" class="btn btn-primary" @click="createProcurement">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 62 - 0
resources/views/procurement/procurement/_addProof.blade.php

@@ -0,0 +1,62 @@
+<div class="modal " id="add-ownerMaterial" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">项目耗材添加</h5>
+                <button type="button" class="close" data-dismiss="modal">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="add-owner-id" class="col-sm-2 col-form-label text-right">货主</label>
+                        <div class="col-sm-10 form-inline">
+                            <select name="owner_id" id="add-owner-id" class="form-control col-sm-5 required" v-model="addOwnerMaterial.owner_id">
+                                <option v-for="(owner,i) in filterOwners"  :value="owner.id">@{{ owner.name }}</option>
+                            </select>
+                            <input type="text" placeholder="输入货主进行筛选" class="form-control col-sm-4 offset-1" @change="filterOwner($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-material-code" class="col-sm-2 col-form-label text-right">耗材编码</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" name="material-code" id="add-material-code" class="form-control col-sm-10" placeholder="耗材编码" v-model="addOwnerMaterial.material_code">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add_material_id" class="col-sm-2 col-form-label text-right">耗材</label>
+                        <div class="col-sm-10 form-inline">
+                            <select name="material_id" id="add_material_id" class="form-control col-sm-5" required v-model="addOwnerMaterial.material_id">
+                                <option v-for="(materials,i) in filterMaterials"  :value="materials.id">@{{ materials.code }}</option>
+                            </select>
+                            <input type="text" placeholder="输入耗材进行筛选" class="form-control col-m-4 offset-1" @change="filterMaterial($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-size" class="col-sm-2 col-form-label text-right">尺寸</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" id="add-size" class="form-control col-10" name="size" placeholder="项目耗材尺寸" v-model="addOwnerMaterial.size">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-special" class="col-sm-2 col-form-label text-right">特殊要求</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="special" id="add-special" cols="30" rows="3" class="form-control form-text col-10" v-model="addOwnerMaterial.special"></textarea>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-specification" class="col-sm-2 col-form-label text-right">材质规格</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="specification" id="add-specification" cols="30" rows="5" class="form-control form-text col-10" v-model="addOwnerMaterial.specification"></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="addOwnerMaterial={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="create">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 191 - 0
resources/views/procurement/procurement/create.blade.php

@@ -0,0 +1,191 @@
+@extends('layouts.app')
+@section('title')采购管理-采购-新建@endsection
+
+@section('content')
+    @component('procurement.procurement.menu')@endcomponent
+    <div class="container-fluid" id="list">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                @endif
+                <form method="POST" action="{{ url('procurement/procurement/store') }}">
+                    @csrf
+                    <div class="form-group row">
+                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">项目名称{{old('owner_id')}} *</label>
+                        <div class="col-8 form-inline">
+                            <select id="owner_id" name="owner_id" class="form-control @error('owner_id') is-invalid @enderror col-4" v-model="owner_id" @change="selectOwner" required>
+                                <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
+                            </select>
+                            <input type="text" class="form-control-sm ml-2" placeholder="输入关键字定位项目" @input="owner_seek">
+                        </div>
+                        <div class="col-sm-5">
+                            <p class="form-control-static text-danger small font-weight-bold" >{{ $errors->first('owner_id') }}</p>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="owner_material_id" class="col-2 col-form-label text-right text-primary">项目耗材编号{{old('owner_material_id')}} *</label>
+                        <div class="col-8">
+                            <select id="owner_material_id" name="owner_material_id" class="form-control @error('owner_material_id') is-invalid @enderror col-4" v-model="owner_material_id" @change="ownerMaterial" required>
+                                <option v-for="ownerMaterial in ownerMaterials" :value="ownerMaterial.id">@{{ownerMaterial.material_code}}</option>
+                            </select>
+                            @error('owner_material_id')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">耗材名称</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control " name="material_name" autocomplete="off" value="{{ old('material_name') }}" v-model="material_name" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">尺寸大小</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control " name="size" autocomplete="off" value="{{ old('size') }}" v-model="size" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">特殊要求</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control " name="special" autocomplete="off" value="{{ old('special') }}" v-model="special" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">材质规格</label>
+                        <div class="col-8">
+                            <textarea type="text" class="form-control" name="specification" autocomplete="off" value="{{ old('specification') }}" readonly>@{{ specification }}</textarea>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="quantity" class="col-2 col-form-label text-right">采购数量</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('quantity') is-invalid @enderror"
+                                   name="quantity" autocomplete="off" value="{{ old('quantity') }}" v-model="quantity" required>
+                            @error('quantity')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="amount" class="col-2 col-form-label text-right">销售数量</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('amount') is-invalid @enderror"
+                                   name="amount" autocomplete="off" value="{{ old('amount') }}" @input="countTotalPrice" v-model="amount" required>
+                            @error('amount')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_price" class="col-2 col-form-label text-right">销售单价</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('unit_price') is-invalid @enderror"
+                                   name="unit_price" autocomplete="off" value="{{ old('unit_price') }}" @input="countTotalPrice" v-model="unit_price" required>
+                            @error('unit_price')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="total_price" class="col-2 col-form-label text-right">销售总价</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control" name="total_price" autocomplete="off" value="{{ old('total_price') }}" v-model="total_price" readonly>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        let vueList=new Vue({
+            el:'#list',
+            data:{
+                owners:[
+                        @foreach($owners as $owner)
+                    {
+                        id:'{{$owner->id}}',name:'{{$owner->name}}',
+                        ownerMaterials:[
+                                @foreach($owner->ownerMaterials ? $owner->ownerMaterials :[] as $ownerMaterial)
+                            {
+                                id:'{{$ownerMaterial->id}}',material_code:'{{$ownerMaterial->material_code}}',material_name:'{{$ownerMaterial->material->name}}',
+                                size:'{{$ownerMaterial->size}}',special:'{{$ownerMaterial->special}}',specification:'{{$ownerMaterial->specification}}',
+                            },
+                            @endforeach
+                        ],
+                    },
+                    @endforeach
+                ],
+                owner_id:'{{old('owner_id')}}',
+                owner_material_id:'{{old('owner_material_id')}}',
+                material_name:'{{old('material_name')}}',
+                size:'{{old('size')}}',
+                special:'{{old('special')}}',
+                specification:'{{old('specification')}}',
+                quantity:'{{old('quantity')}}',
+                amount:'{{old('amount')}}',
+                unit_price:'{{old('unit_price')}}',
+                total_price:'{{old('total_price')}}',
+                ownerMaterials:[],
+            },
+            methods:{
+                owner_seek:function (e) {
+                    let _this=this;
+                    let $val=e.target.value;
+                    if($val===''){
+                        _this.owner_id='';
+                    }else{
+                        _this.owners.forEach(function (owner) {
+                            if (owner.name.includes($val)){
+                                _this.owner_id=owner.id;
+                                _this.ownerMaterials=owner.ownerMaterials;
+                            }
+                        });
+                    }
+                },
+                ownerMaterial:function () {
+                    let _this=this;
+                    _this.ownerMaterials.forEach(function (ownerMaterial) {
+                        if (_this.owner_material_id===ownerMaterial.id){
+                            _this.material_name=ownerMaterial.material_name;
+                            _this.size=ownerMaterial.size;
+                            _this.special=ownerMaterial.special;
+                            _this.specification=ownerMaterial.specification;
+                        }
+                    })
+                },
+                selectOwner:function () {
+                    let _this=this;
+                    _this.owners.forEach(function (owner) {
+                        if (_this.owner_id===owner.id){
+                            _this.ownerMaterials=owner.ownerMaterials;
+                        }
+                    })
+                },
+                countTotalPrice:function () {
+                    let _this=this;
+                    if (_this.unit_price===''|| _this.amount==='')_this.total_price=null;
+                    _this.total_price=_this.unit_price*_this.amount;
+                }
+            },
+
+        });
+    </script>
+@endsection

+ 313 - 0
resources/views/procurement/procurement/index.blade.php

@@ -0,0 +1,313 @@
+@extends('layouts.app')
+@section('title')采购管理-采购-查询@endsection
+
+@section('content')
+    @component('procurement.procurement.menu')@endcomponent
+    <div class="container-fluid" id="list">
+        <div class="card container-fluid">
+            @if(Session::has('successTip'))
+                <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+            @endif
+            <div class="row">
+                <div class="col-4">
+                    <div class="card">
+                        <div class="card-body row">
+                            <span class="fa fa-shopping-cart fa-4x offset-md-3" style="color: #4c2584"></span>
+                            <span class="ml-3 mt-2">
+                                <h5 class="font-weight-bold">数量</h5>
+                                <p class="text-muted">今日收货次数</p>
+                            </span>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-4">
+                    <div class="card">
+                        <div class="card-body row">
+                            <span class="fa fa-file-o fa-4x offset-md-3" style="color: #9fcdff"></span>
+                            <span class="ml-3 mt-2">
+                                <h5 class="font-weight-bold">数量</h5>
+                                <p class="text-muted">今日发起采购次数</p>
+                            </span>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-4">
+                    <div class="card">
+                        <div class="card-body row">
+                            <span class="fa fa-calendar-o fa-4x offset-md-3" style="color: #2ca02c"></span>
+                            <span class="ml-3 mt-2">
+                        <h5 class="font-weight-bold">数量</h5>
+                        <p class="text-muted">今日对账金额</p>
+                        </span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div id="form_div" class="mt-1"></div>
+        <div class="row mt-2">
+        <span class="dropdown ml-3">
+        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                :class="[checkData.length>0?'btn-dark text-light':'']"
+                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
+            导出Excel
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" @click="{{--procurementExport(false)--}}" href="javascript:">导出勾选内容</a>
+            <a class="dropdown-item" @click="{{--procurementExport(true)--}}" href="javascript:">导出所有页</a>
+        </div>
+        </span>
+            <span class="btn btn-sm btn-outline-info ml-2" @click="addProcurement">新增采购</span>
+            @can('采购管理-采购-新建')
+                @include('procurement.procurement._addProcurement')
+            @endcan
+            <span class="btn btn-sm btn-outline-success ml-2">新增询价</span>
+            <span class="btn btn-sm btn-outline-danger ml-2">新增打样</span>
+            <span class="btn btn-sm btn-outline-primary ml-2">重新发起</span>
+        </div>
+        <label for="all" id="cloneCheckAll" class="d-none">
+            <input id="all" type="checkbox" @click="checkAll($event)">全选
+        </label>
+        <table class="table table-sm table-bordered text-nowrap d-none" id="headerRoll"></table>
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2"
+               id="headerParent">
+            <tr id="header"></tr>
+            <tr v-for="(procurement,i) in procurements">
+                <td>
+                    <input class="checkItem" type="checkbox" :value="procurement" v-model="checkData">
+                </td>
+{{--                <td class="">@{{ procurement.code }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.owner_name }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.type }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.company_name }}</td>--}}
+{{--                <td class="tooltipTarget" style="max-width: 200px;overflow:hidden">@{{ procurement.material_code }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.material_name }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.size }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.special }}</td>--}}
+{{--                <td class="text-muted">@{{ procurement.specification }}</td>--}}
+{{--                <td></td>--}}
+{{--                <td>@{{ procurement.quantity }}</td>--}}
+{{--                <td><span>@{{ procurement.unit_price }}</span></td>--}}
+{{--                <td><span></span></td>--}}
+{{--                <td><span></span></td>--}}
+{{--                <td><span>@{{ procurement.status }}</span></td>--}}
+{{--                <td><span>@{{ procurement.phone }}</span></td>--}}
+                <td class="">@{{ procurement.code }}</td>
+                <td v-if="procurement.owner_material.owner">@{{ procurement.owner_material.owner.name }}</td>
+                <td class="text-muted">@{{ procurement.type }}</td>
+                <td v-if="procurement.owner_material.owner.customer">@{{ procurement.owner_material.owner.customer.company_name }}</td>
+                <td class="tooltipTarget" style="max-width: 200px;overflow:hidden" v-if="procurement.owner_material.material">@{{ procurement.owner_material.material.code }}</td>
+                <td class="text-muted" v-if="procurement.owner_material.material">@{{ procurement.owner_material.material.name }}</td>
+                <td class="text-muted" v-if="procurement.owner_material">@{{ procurement.owner_material.size }}</td>
+                <td class="text-muted" v-if="procurement.owner_material">@{{ procurement.owner_material.special }}</td>
+                <td class="text-muted" v-if="procurement.owner_material">@{{ procurement.owner_material.specification }}</td>
+                <td></td>
+                <td>@{{ procurement.quantity }}</td>
+                <td><span>@{{ procurement.unit_price }}</span></td>
+                <td><span></span></td>
+                <td><span></span></td>
+                <td><span>@{{ procurement.status }}</span></td>
+                <td v-if="procurement.owner_material.owner.customer">@{{ procurement.owner_material.owner.customer.phone }}</td>
+                <td>
+                    <span class="btn btn-sm btn-outline-danger">取消</span>
+                    <span class="btn btn-sm btn-outline-success">发起采购</span>
+                </td>
+            </tr>
+        </table>
+        <div class="text-info h5 btn btn">{{$procurements->count()}}/@{{ sum }}</div>
+        <div>{{$procurements->appends($paginateParams)->links()}}</div>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el: '#list',
+            data: {
+                procurements:{!! $procurements->toJson() !!}['data'],
+                {{--procurements: [--}}
+                {{--    @foreach($procurements as $procurement)--}}
+                {{--    {--}}
+                {{--        id:'{{$procurement->id}}',code:'{{$procurement->code}}',type:'{{$procurement->type}}',created_at:'{{$procurement->created_at}}',--}}
+                {{--        quantity:'{{$procurement->quantity}}',unit_price:'{{$procurement->unit_price}}',status:'{{$procurement->status}}',--}}
+                {{--        @if($procurement->ownerMaterial)--}}
+                {{--        owner_id:'{{$procurement->ownerMaterial->owner_id}}',size:'{{$procurement->ownerMaterial->size}}',--}}
+                {{--        special:'{{$procurement->ownerMaterial->special}}',specification:'{{$procurement->ownerMaterial->specification}}',@endif--}}
+                {{--            @if($procurement->ownerMaterial->material)--}}
+                {{--        material_id:'{{$procurement->ownerMaterial->material->id}}',material_code:'{{$procurement->ownerMaterial->material->code}}',--}}
+                {{--        material_name:'{{$procurement->ownerMaterial->material->name}}',@endif--}}
+                {{--            @if($procurement->ownerMaterial->owner)owner_name:'{{$procurement->ownerMaterial->owner->name}}',@endif--}}
+                {{--            @if($procurement->ownerMaterial->owner->customer)--}}
+                {{--        company_name:'{{$procurement->ownerMaterial->owner->customer->company_name}}',customer_id:'{{$procurement->ownerMaterial->owner->customer->id}}',--}}
+                {{--        phone:'{{$procurement->ownerMaterial->owner->customer->phone}}',@endif--}}
+                {{--    },--}}
+                {{--    @endforeach--}}
+                {{--],--}}
+                owners:[
+                        @foreach($owners as $owner)
+                    {
+                        name:'{{$owner->id}}',value:'{{$owner->name}}',
+                        ownerMaterials:[
+                                @foreach($owner->ownerMaterials ? $owner->ownerMaterials :[] as $ownerMaterial)
+                            {
+                                id:'{{$ownerMaterial->id}}',material_code:'{{$ownerMaterial->material_code}}',material_name:'{{$ownerMaterial->material->name}}',
+                                size:'{{$ownerMaterial->size}}',special:'{{$ownerMaterial->special}}',specification:'{{$ownerMaterial->specification}}',
+                            },
+                            @endforeach
+                        ],
+                    },
+                    @endforeach
+                ],
+                materials: [
+                        @foreach($materials as $material)
+                    {name:'{{$material->id}}',value:'{{$material->name}}'},
+                    @endforeach
+                ],
+                checkData: [],
+                sum:{!! $procurements->total() !!},
+                owner_id:'{{old('owner_id')}}',
+                owner_material_id:'{{old('owner_material_id')}}',
+                material_name:'{{old('material_name')}}',
+                size:'{{old('size')}}',
+                special:'{{old('special')}}',
+                specification:'{{old('specification')}}',
+                quantity:'{{old('quantity')}}',
+                amount:'{{old('amount')}}',
+                unit_price:'{{old('unit_price')}}',
+                total_price:'{{old('total_price')}}',
+                ownerMaterials:[],
+
+            },
+            mounted: function () {
+                $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                $('#list').removeClass('d-none');
+                let data = [
+                    [
+                        {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
+                        {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {
+                            name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的项目'],
+                            placeholder: ['项目', '定位或多选项目'], data: this.owners
+                        },
+                        {
+                            name: 'material_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
+                            placeholder: ['耗材', '定位或多选耗材'], data: this.materials
+                        },
+                        {name: 'company_name', type: 'input', tip: '采购公司:可在两侧增加百分号(%)进行模糊搜索', placeholder: '采购公司'},
+                    ],
+                ];
+                this.form = new query({
+                    el: "#form_div",
+                    condition: data,
+                });
+                this.form.init();
+                let column = [
+                    {
+                        name: 'cloneCheckAll', customization: true, type: 'checkAll',
+                        dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
+                    },
+                    {name: 'code', value: '采购编号', neglect: true},
+                    {name: 'owner_id', value: '项目', class: ''},
+                    {name: 'type', value: '单据类型', class: 'text-muted'},
+                    {name: 'company_name', value: '采购公司', class: 'text-muted'},
+                    {name: 'material_code', value: '耗材编号', class: 'text-muted'},
+                    {name: 'material_name', value: '耗材'},
+                    {name: 'size', value: '尺寸大小', class: 'text-muted'},
+                    {name: 'special', value: '特殊要求', class: 'text-muted'},
+                    {name: 'specification', value: '材质规格', class: 'text-muted'},
+                    {name: '附件', value: '附件', class: 'text-muted'},
+                    {name: 'quantity', value: '采购数量', neglect: true},
+                    {name: 'unit_price', value: '销售单价(元)', neglect: true},
+                    {name: '', value: '送货数量', neglect: true},
+                    {name: '', value: '销售总价(元)', neglect: true},
+                    {name: '', value: '采购单状态', neglect: true},
+                    {name: '', value: '联系方式', neglect: true},
+                    {name: '', value: '操作', neglect: true},
+                ];
+
+                let _this = this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.procurements,
+                        restorationColumn: 'id',
+                        fixedTop: ($('#form_div').height()) + 2,
+                        offset: 0.5,
+                        vue: vue
+                    });
+                    header.init();
+                }, 0);
+            },
+            methods: {
+                //全选事件
+                checkAll(e) {
+                    if (e.target.checked) {
+                        this.procurements.forEach((el, i) => {
+                            if (this.checkData.indexOf(el) == '-1') {
+                                this.checkData.push(el);
+                            }
+                        });
+                    } else {
+                        this.checkData = [];
+                    }
+                },
+                addProcurement(){
+                    $('#add-procurement').modal('show');
+                },
+                owner_seek:function (e) {
+                    let _this=this;
+                    let $val=e.target.value;
+                    if($val===''){
+                        _this.owner_id='';
+                    }else{
+                        _this.owners.forEach(function (owner) {
+                            if (owner.value.includes($val)){
+                                _this.owner_id=owner.name;
+                                _this.ownerMaterials=owner.ownerMaterials;
+                            }
+                        });
+                    }
+                },
+                ownerMaterial:function () {
+                    let _this=this;
+                    _this.ownerMaterials.forEach(function (ownerMaterial) {
+                        if (_this.owner_material_id===ownerMaterial.id){
+                            _this.material_name=ownerMaterial.material_name;
+                            _this.size=ownerMaterial.size;
+                            _this.special=ownerMaterial.special;
+                            _this.specification=ownerMaterial.specification;
+                        }
+                    })
+                },
+                selectOwner:function () {
+                    let _this=this;
+                    _this.owners.forEach(function (owner) {
+                        if (_this.owner_id===owner.name){
+                            _this.ownerMaterials=owner.ownerMaterials;
+                        }
+                    })
+                },
+                countTotalPrice:function () {
+                    let _this=this;
+                    if (_this.unit_price===''|| _this.amount==='')_this.total_price=null;
+                    _this.total_price=_this.unit_price*_this.amount;
+                },
+                createProcurement(){
+                    let _this=this;
+                    let url = '{{url('procurement/procurement/createProcurement')}}';
+                    let params = {owner_material_id:_this.owner_material_id,quantity:_this.quantity,amount:_this.amount,unit_price:_this.unit_price};
+                    window.tempTip.postBasicRequest(url,params,res=>{
+                        this.procurements.push(res);
+                        this.$forceUpdate();
+                        $("#add-procurement").modal('hide');
+                        return "OK";
+                    },true);
+                },
+
+            }
+        });
+    </script>
+@endsection

+ 19 - 0
resources/views/procurement/procurement/menu.blade.php

@@ -0,0 +1,19 @@
+<div id="nav2">
+    @component('procurement.menu')
+    @endcomponent
+    <div class="container-fluid nav3">
+        <div class="card menu-third" >
+            <ul class="nav nav-pills">
+                @can('采购管理-采购-查询')
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{url('procurement/procurement/index')}}" :class="{active:isActive('index',3)}">查询</a>
+                    </li> @endcan
+                @can('采购管理-采购-新建')
+                    <li class="nav-item">
+                        <a  class="nav-link" href="{{url('procurement/procurement/create')}}" :class="{active:isActive('create',3)}">新建</a>
+                    </li> @endcan
+            </ul>
+        </div>
+    </div>
+</div>
+

+ 18 - 0
routes/web.php

@@ -718,4 +718,22 @@ Route::group(['prefix'=>'station'],function(){
 Route::group(['prefix'=>'control'],function () {
    Route::get('panel/menu','ControlPanelController@index') ;
 });
+/** 采购管理 */
+Route::group(['prefix'=>'procurement'],function () {
+    /** 采购 */
+    Route::group(['prefix'=>'procurement'],function(){
+        Route::get('index','ProcurementController@index');
+        Route::get('create','ProcurementController@create');
+        Route::post('store','ProcurementController@store');
+        Route::post('getOwnerMaterial','ProcurementController@getOwnerMaterial');
+        Route::post('createProcurement','ProcurementController@createProcurement');
+    });
+    /** 财务 */
+    Route::group(['prefix'=>'finance'],function(){
+        Route::get('checkBill','ProcurementController@checkBill');
+        Route::get('procurementBill','ProcurementController@procurementBill');
+        Route::get('monthlyBillReport','ProcurementController@monthlyBillReport');
+    });
+    Route::get('relating',function (){return view('procurement.menuProcurement');});
+});