| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- @extends('layouts.app')
- @section('title')客户管理-项目查询@endsection
- @section('content')
- @component('customer.project.menu')@endcomponent
- <div class="container-fluid d-none" id="container">
- <div id="form_div"></div>
- <div class="modal fade" tabindex="-1" role="dialog" id="modal">
- <div class="modal-dialog modal-dialog-scrollable modal-dialog-centered">
- <div class="modal-content">
- <div class="modal-body">
- <div class="container-fluid" v-if="priceModel[thisClickIndex]">
- <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerStoragePriceModels']">
- <label class="text-dark font-weight-bold col-3"><span v-if="i==0">仓储:</span></label>
- <a target="_blank" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=storage'" class="text-decoration-none">@{{ model.counting_type }}-@{{ model.using_type }}</a>
- </div>
- <hr class="m-1">
- <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceOperations']">
- <label class="text-dark font-weight-bold col-3"><span v-if="i==0">作业:</span></label>
- <a target="_blank" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=operation'" class="text-decoration-none">@{{ model.name }}</a>
- </div>
- <hr class="m-1">
- <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceExpresses']">
- <label class="text-dark font-weight-bold col-3"><span v-if="i==0">快递:</span></label>
- <a target="_blank" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=expresses'" class="text-decoration-none">@{{ model.name }}</a>
- </div>
- <hr class="m-1">
- <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceLogistics']">
- <label class="text-dark font-weight-bold col-3"><span v-if="i==0">物流:</span></label>
- <a target="_blank" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=logistic'" class="text-decoration-none">@{{ model.name }}</a>
- </div>
- <hr class="m-1">
- <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceDirectLogistics']">
- <label class="text-dark font-weight-bold col-3"><span v-if="i==0">直发车:</span></label>
- <a target="_blank" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=directLogistic'" class="text-decoration-none">@{{ model.name }}</a>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
- </div>
- </div>
- </div>
- </div>
- <div class="mt-1">
- <button type="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="executeExport(false)" href="javascript:">导出勾选内容</a>
- <a class="dropdown-item" @click="executeExport(true)" href="javascript:">导出所有页</a>
- </div>
- </div>
- @if(Session::has('successTip'))
- <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
- @endif
- <div>
- <label for="all" id="cloneCheckAll" class="d-none">
- <input id="all" type="checkbox" @click="checkAll($event)">全选
- </label>
- <table class="d-none" id="headerRoll"></table>
- <table class="table table-sm text-nowrap table-striped table-hover" id="headerParent">
- <tr id="header"></tr>
- <tr v-for="(owner,i) in owners">
- <td>
- <label><input type="checkbox" :value="owner.id" v-model="checkData"></label>
- </td>
- <td>
- <a :href="'{{url('customer/project')}}/'+owner.id+'/edit'"><button class="btn btn-sm btn0sm btn-outline-info">编辑</button></a>
- </td>
- <td>@{{ owner.customer_name }}</td>
- <td>@{{ owner.tax_rate ? owner.tax_rate+'%' : '' }}</td>
- <td>@{{ owner.name }}</td>
- <td>@{{ owner.code }}</td>
- <td>@{{ owner.created_at }}</td>
- <td colspan="2">
- <div class="p-0">
- <small v-for="contract in owner.contracts">@{{ contract.number }}<label class="ml-2">@{{ contract.salesman }}</label><br></small>
- </div>
- </td>
- <td>@{{ owner.customer_company_name }}</td>
- <td>@{{ owner.linkman }}</td>
- <td>@{{ owner.phone_number }}</td>
- <td>@{{ owner.user_owner_group_name }}</td>
- <td>
- <button class="btn btn-sm btn-info text-white" @click="showModal(owner)">各项计价</button>
- </td>
- <td>@{{ owner.owner_storage_price_model_using_type }}</td>
- <td>@{{ owner.owner_area_report_accounting_area }}</td>
- <td>@{{ owner.waring_line_on }}</td>
- <td>@{{ owner.is_activation }}</td>
- <td>@{{ owner.description }}</td>
- </tr>
- </table>
- {{$owners->appends($params)->links()}}
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
- <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
- <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
- <script>
- let vue = new Vue({
- el:"#container",
- data:{
- owners : [
- @foreach($owners as $owner)
- { id : "{{$owner->id}}",
- customer_name:"{{$owner->customer ? $owner->customer->name : ''}}",
- tax_rate : "{{$owner->tax_rate}}",
- name : "{{$owner->name}}",
- code : "{{$owner->code}}",
- created_at : "{{$owner->created_at}}",
- contracts : [
- @foreach($owner->contracts as $contract)
- { number:"{{$contract->contract_number}}",salesman:"{{$contract->salesman}}" },
- @endforeach
- ],
- customer_company_name:"{{$owner->customer ? $owner->customer->company_name : ''}}",
- linkman:"{{$owner->linkman}}",
- phone_number:"{{$owner->phone_number}}",
- user_owner_group_name:"{{$owner->userOwnerGroup ? $owner->userOwnerGroup->name : ''}}",
- owner_storage_price_model_using_type:"{{ implode(",",array_unique(array_column(($owner->ownerStoragePriceModels)->toArray(),"using_type"))) }}",
- owner_area_report_accounting_area : "{{ $owner->ownerAreaReport ? $owner->ownerAreaReport->accounting_area : '' }}",
- waring_line_on : "{{$owner->waring_line_on}}",
- is_activation : "{{$owner->deleted_at ? '否' : '是'}}",
- description : "{{$owner->description}}",
- ownerStoragePriceModels : {!! $owner->ownerStoragePriceModels !!},
- },
- @endforeach
- ],
- checkData : [],
- sum : Number("{{ $owners->total() }}"),
- priceModel : {},
- thisClickIndex : "",
- models:[
- @foreach($models as $model)
- {name:"{{$model->id}}",value:"{{$model->name}}"},
- @endforeach
- ],
- customers:[
- @foreach($customers as $customer)
- {name:"{{$customer->id}}",value:"{{$customer->name}}"},
- @endforeach
- ],
- ownerGroups:[
- @foreach($ownerGroups as $ownerGroup)
- {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
- @endforeach
- ],
- },
- mounted(){
- $('#container').removeClass('d-none');
- let data=[
- [
- {name:'user_owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
- {name:'created_at_start',type:'time',tip:['选择显示创建日期的起始时间','']},
- {name:'id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
- placeholder:['项目','定位或多选项目'],data:this.models},
- {name:'contract_number',type:'input',tip: '合同号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '合同号'},
- ],[
- {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
- {name:'created_at_end',type:'time',tip:['选择显示创建日期的结束时间','']},
- {name:'using_type',type:'select',placeholder: '用仓类型',data:[{name:"常温",value:"常温"},{name:"恒温",value:"恒温"}]},
- ],
- ];
- this.form = new query({
- el:"#form_div",
- condition:data,
- });
- this.form.init();
- let column = [
- {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
- dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
- {name:'operating',value: '操作', neglect: true},
- {name:'customer',value: '客户'},
- {name:'tax_rate',value: '税率%', neglect: true},
- {name:'name',value: '项目'},
- {name:'code',value: '货主代码'},
- {name:'created_at',value: '创建日期'},
- {name:'contract_number',value: '合同号', neglect: true},
- {name:'salesman',value: '销售名称', neglect: true},
- {name:'customer_full_name',value: '公司全称'},
- {name:'linkman',value: '联系人'},
- {name:'phone_number',value: '联系电话'},
- {name:'workgroup',value: '项目小组'},
- {name:'relating_price',value: '关联报价', neglect: true},
- {name:'type',value: '用仓类型'},
- {name:'current_month_counting_area',value: '当月结算面积', neglect: true},
- {name:'waring_line_on',value: '月单量预警', neglect: true},
- {name:'is_activating',value: '是否激活', neglect: true},
- {name:'description',value: '项目描述'},
- ];
- let _this=this;
- setTimeout(function () {
- let header = new Header({
- el: "#header",
- column: column,
- data: _this.owners,
- restorationColumn: 'id',
- fixedTop:($('#form_div').height())+2,
- offset:0.5,
- vue:vue
- });
- header.init();
- },0);
- },
- watch:{
- checkData:{
- handler(){
- if (this.checkData.length === this.owners.length){
- document.querySelector('#all').checked = true;
- document.querySelector('#all_temp').checked = true;
- }else {
- document.querySelector('#all').checked = false;
- document.querySelector('#all_temp').checked = false;
- }
- },
- deep:true
- }
- },
- methods:{
- executeExport(isAll){
- let url = '{{url('customer/project/index/export')}}';
- let token='{{ csrf_token() }}';
- //excelExport 定义在 js/queryForm/export.js
- excelExport(isAll,this.checkData,url,this.sum,token);
- },
- //全选事件
- checkAll(e){
- if (e.target.checked){
- this.checkData = [];
- this.owners.forEach((el)=>{
- this.checkData.push(el.id);
- });
- }else {
- this.checkData = [];
- }
- },
- showModal(owner){
- if (this.priceModel[owner.id]){
- this.thisClickIndex = owner.id;
- $("#modal").modal('show');
- return;
- }
- window.axios.post('{{url('customer/project/getOwnerPriceModel')}}',{id:owner.id})
- .then(res=>{
- if (res.data.success){
- let model = res.data.data;
- model["ownerStoragePriceModels"] = owner.ownerStoragePriceModels;
- delete owner.ownerStoragePriceModels;
- this.priceModel[owner.id] = model;
- this.thisClickIndex = owner.id;
- $("#modal").modal('show');
- return;
- }
- window.tempTip.setDuration(3000);
- window.tempTip.showSuccess(res.data.data);
- }).catch(err=>{
- window.tempTip.setDuration(3000);
- window.tempTip.show("网络错误:"+err);
- });
- },
- },
- });
- </script>
- @endsection
|