index.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. @extends('layouts.app')
  2. @section('title')项目列表-客户管理@endsection
  3. @section('content')
  4. @component('customer.project.menu')@endcomponent
  5. <div class="container-fluid d-none" id="container">
  6. <div id="form_div"></div>
  7. <div class="modal fade" tabindex="-1" role="dialog" id="modal">
  8. <div class="modal-dialog modal-dialog-scrollable modal-dialog-centered">
  9. <div class="modal-content">
  10. <div class="modal-body">
  11. <div class="container-fluid" v-if="priceModel[thisClickIndex]">
  12. <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerStoragePriceModels']">
  13. <label class="text-dark font-weight-bold col-3"><span v-if="i==0">仓储:</span></label>
  14. <a target="_blank" @can("计费模型-仓储-录入"):href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=storage'" @endcan class="text-decoration-none">@{{ model.counting_type }}-@{{ model.using_type }}</a>
  15. </div>
  16. <hr class="m-1" v-if="priceModel[thisClickIndex]['ownerPriceOperations'].length>0">
  17. <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceOperations']">
  18. <label class="text-dark font-weight-bold col-3"><span v-if="i==0">作业:</span></label>
  19. <a target="_blank" @can("计费模型-作业-录入"):href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=operation'" @endcan class="text-decoration-none">@{{ model.name }}</a>
  20. </div>
  21. <hr class="m-1" v-if="priceModel[thisClickIndex]['ownerPriceExpresses'].length>0">
  22. <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceExpresses']">
  23. <label class="text-dark font-weight-bold col-3"><span v-if="i==0">快递:</span></label>
  24. <a target="_blank" @can("计费模型-快递-录入"):href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=express'" @endcan class="text-decoration-none">@{{ model.name }}</a>
  25. </div>
  26. <hr class="m-1" v-if="priceModel[thisClickIndex]['ownerPriceLogistics'].length>0">
  27. <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceLogistics']">
  28. <label class="text-dark font-weight-bold col-3"><span v-if="i==0">物流:</span></label>
  29. <a target="_blank" @can("计费模型-物流-录入"):href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=logistic'" @endcan class="text-decoration-none">@{{ model.name }}</a>
  30. </div>
  31. <hr class="m-1" v-if="priceModel[thisClickIndex]['ownerPriceDirectLogistics'].length>0">
  32. <div class="row" v-for="(model,i) in priceModel[thisClickIndex]['ownerPriceDirectLogistics']">
  33. <label class="text-dark font-weight-bold col-3"><span v-if="i==0">直发车:</span></label>
  34. <a target="_blank" @can("计费模型-直发-录入"):href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=directLogistic'" @endcan class="text-decoration-none">@{{ model.name }}</a>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="modal-footer">
  39. <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="mt-1">
  45. <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  46. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  47. 导出Excel
  48. </button>
  49. <div class="dropdown-menu">
  50. <a class="dropdown-item" @click="executeExport(false)" href="javascript:">导出勾选内容</a>
  51. <a class="dropdown-item" @click="executeExport(true)" href="javascript:">导出所有页</a>
  52. </div>
  53. </div>
  54. @if(Session::has('successTip'))
  55. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  56. @endif
  57. <div>
  58. <label for="all" id="cloneCheckAll" class="d-none">
  59. <input id="all" type="checkbox" @click="checkAll($event)">全选
  60. </label>
  61. <table class="d-none" id="headerRoll"></table>
  62. <table class="table table-sm text-nowrap table-striped table-hover" id="headerParent">
  63. <tr id="header"></tr>
  64. <tr v-for="(owner,i) in owners">
  65. <td>
  66. <label><input type="checkbox" :value="owner.id" v-model="checkData"></label>
  67. </td>
  68. <td>@{{ owner.name }}</td>
  69. <td>@{{ owner.customer_name }}</td>
  70. <td>@{{ owner.user_owner_group_name }}</td>
  71. <td>@{{ owner.user_work_group_name }}</td>
  72. <td>@{{ owner.created_at }}</td>
  73. <td>@{{ owner.customer_company_name }}</td>
  74. <td>@{{ owner.is_activation }}</td>
  75. <td>
  76. <a :href="'{{url('customer/project')}}/'+owner.id+'/edit'"><button class="btn btn-sm btn0sm btn-outline-info">编辑</button></a>
  77. </td>
  78. <td>
  79. <button class="btn btn-sm btn-info text-white" @click="showModal(owner)">各项计价</button>
  80. </td>
  81. </tr>
  82. </table>
  83. {{$owners->appends($params)->links()}}
  84. </div>
  85. </div>
  86. @endsection
  87. @section('lastScript')
  88. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  89. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  90. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  91. <script>
  92. let vue = new Vue({
  93. el:"#container",
  94. data:{
  95. owners : [
  96. @foreach($owners as $owner)
  97. { id : "{{$owner->id}}",
  98. customer_name:"{{$owner->customer ? $owner->customer->name : ''}}",
  99. //tax_rate : "{{--{{$owner->tax_rate}}--}}",
  100. name : "{{$owner->name}}",
  101. //code : "{{--{{$owner->code}}--}}",
  102. created_at : "{{$owner->created_at}}",
  103. /*contracts : [
  104. {{--@foreach($owner->contracts as $contract)
  105. { number:"{{$contract->contract_number}}",salesman:"{{$contract->salesman}}" },
  106. @endforeach--}}
  107. ],*/
  108. customer_company_name:"{{$owner->customer ? $owner->customer->company_name : ''}}",
  109. //linkman:"{{--{{$owner->linkman}}--}}",
  110. //phone_number:"{{--{{$owner->phone_number}}--}}",
  111. user_owner_group_name:"{{$owner->userOwnerGroup ? $owner->userOwnerGroup->name : ''}}",
  112. user_work_group_name:"{{$owner->userWorkGroup ? $owner->userWorkGroup->name : ''}}",
  113. //owner_storage_price_model_using_type:"{{--{{ implode(",",array_unique(array_column(($owner->ownerStoragePriceModels)->toArray(),"using_type"))) }}--}}",
  114. //owner_area_report_accounting_area : "{{--{{ $owner->ownerAreaReport ? $owner->ownerAreaReport->accounting_area : '' }}--}}",
  115. //waring_line_on : "{{--{{$owner->waring_line_on}}--}}",
  116. is_activation : "{{$owner->deleted_at ? '否' : '是'}}",
  117. //description : "{{--{{$owner->description}}--}}",
  118. ownerStoragePriceModels : {!! $owner->ownerStoragePriceModels !!},
  119. },
  120. @endforeach
  121. ],
  122. checkData : [],
  123. sum : Number("{{ $owners->total() }}"),
  124. priceModel : {},
  125. thisClickIndex : "",
  126. models:[
  127. @foreach($models as $model)
  128. {name:"{{$model->id}}",value:"{{$model->name}}"},
  129. @endforeach
  130. ],
  131. customers:[
  132. @foreach($customers as $customer)
  133. {name:"{{$customer->id}}",value:"{{$customer->name}}"},
  134. @endforeach
  135. ],
  136. ownerGroups:[
  137. @foreach($ownerGroups as $ownerGroup)
  138. {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
  139. @endforeach
  140. ],
  141. },
  142. mounted(){
  143. $('#container').removeClass('d-none');
  144. let data=[
  145. [
  146. {name:'user_owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
  147. {name:'created_at_start',type:'time',tip:['选择显示创建日期的起始时间','']},
  148. {name:'id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
  149. placeholder:['项目','定位或多选项目'],data:this.models},
  150. {name:'contract_number',type:'input',tip: '合同号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '合同号'},
  151. ],[
  152. {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
  153. {name:'created_at_end',type:'time',tip:['选择显示创建日期的结束时间','']},
  154. {name:'using_type',type:'select',placeholder: '用仓类型',data:[{name:"常温",value:"常温"},{name:"恒温",value:"恒温"}]},
  155. ],
  156. ];
  157. this.form = new query({
  158. el:"#form_div",
  159. condition:data,
  160. });
  161. this.form.init();
  162. let column = [
  163. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  164. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  165. {name:'name',value: '项目'},
  166. {name:'customer',value: '客户'},
  167. {name:'user_owner_group_name',value: '项目小组'},
  168. {name:'user_work_group_name',value: '仓库小组'},
  169. {name:'created_at',value: '创建日期'},
  170. {name:'customer_full_name',value: '公司全称'},
  171. {name:'is_activating',value: '是否激活', neglect: true},
  172. {name:'operating',value: '操作', neglect: true},
  173. {name:'relating_price',value: '关联报价', neglect: true},
  174. ];
  175. let _this=this;
  176. setTimeout(function () {
  177. let header = new Header({
  178. el: "#header",
  179. column: column,
  180. data: _this.owners,
  181. restorationColumn: 'id',
  182. fixedTop:($('#form_div').height())+2,
  183. offset:0.5,
  184. vue:vue
  185. });
  186. header.init();
  187. },0);
  188. },
  189. watch:{
  190. checkData:{
  191. handler(){
  192. if (this.checkData.length === this.owners.length){
  193. document.querySelector('#all').checked = true;
  194. document.querySelector('#all_temp').checked = true;
  195. }else {
  196. document.querySelector('#all').checked = false;
  197. document.querySelector('#all_temp').checked = false;
  198. }
  199. },
  200. deep:true
  201. }
  202. },
  203. methods:{
  204. executeExport(isAll){
  205. let url = '{{url('customer/project/index/export')}}';
  206. let token='{{ csrf_token() }}';
  207. //excelExport 定义在 js/queryForm/export.js
  208. excelExport(isAll,this.checkData,url,this.sum,token);
  209. },
  210. //全选事件
  211. checkAll(e){
  212. if (e.target.checked){
  213. this.checkData = [];
  214. this.owners.forEach((el)=>{
  215. this.checkData.push(el.id);
  216. });
  217. }else {
  218. this.checkData = [];
  219. }
  220. },
  221. showModal(owner){
  222. if (this.priceModel[owner.id]){
  223. this.thisClickIndex = owner.id;
  224. $("#modal").modal('show');
  225. return;
  226. }
  227. window.axios.post('{{url('customer/project/getOwnerPriceModel')}}',{id:owner.id})
  228. .then(res=>{
  229. if (res.data.success){
  230. let model = res.data.data;
  231. model["ownerStoragePriceModels"] = owner.ownerStoragePriceModels;
  232. delete owner.ownerStoragePriceModels;
  233. this.priceModel[owner.id] = model;
  234. this.thisClickIndex = owner.id;
  235. $("#modal").modal('show');
  236. return;
  237. }
  238. window.tempTip.setDuration(3000);
  239. window.tempTip.showSuccess(res.data.data);
  240. }).catch(err=>{
  241. window.tempTip.setDuration(3000);
  242. window.tempTip.show("网络错误:"+err);
  243. });
  244. },
  245. },
  246. });
  247. </script>
  248. @endsection