index.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=storage'" class="text-decoration-none">@{{ model.counting_type }}-@{{ model.using_type }}</a>
  15. </div>
  16. <hr class="m-1">
  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" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=operation'" class="text-decoration-none">@{{ model.name }}</a>
  20. </div>
  21. <hr class="m-1">
  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" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=expresses'" class="text-decoration-none">@{{ model.name }}</a>
  25. </div>
  26. <hr class="m-1">
  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" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=logistic'" class="text-decoration-none">@{{ model.name }}</a>
  30. </div>
  31. <hr class="m-1">
  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" :href="'{{url('customer/project')}}/'+thisClickIndex+'/edit?type=directLogistic'" 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>
  69. <a :href="'{{url('customer/project')}}/'+owner.id+'/edit'"><button class="btn btn-sm btn0sm btn-outline-info">编辑</button></a>
  70. </td>
  71. <td>@{{ owner.customer_name }}</td>
  72. <td>@{{ owner.tax_rate ? owner.tax_rate+'%' : '' }}</td>
  73. <td>@{{ owner.name }}</td>
  74. <td>@{{ owner.code }}</td>
  75. <td>@{{ owner.created_at }}</td>
  76. <td colspan="2">
  77. <div class="p-0">
  78. <small v-for="contract in owner.contracts">@{{ contract.number }}<label class="ml-2">@{{ contract.salesman }}</label><br></small>
  79. </div>
  80. </td>
  81. <td>@{{ owner.customer_company_name }}</td>
  82. <td>@{{ owner.linkman }}</td>
  83. <td>@{{ owner.phone_number }}</td>
  84. <td>@{{ owner.user_owner_group_name }}</td>
  85. <td>
  86. <button class="btn btn-sm btn-info text-white" @click="showModal(owner)">各项计价</button>
  87. </td>
  88. <td>@{{ owner.owner_storage_price_model_using_type }}</td>
  89. <td>@{{ owner.owner_area_report_accounting_area }}</td>
  90. <td>@{{ owner.waring_line_on }}</td>
  91. <td>@{{ owner.is_activation }}</td>
  92. <td>@{{ owner.description }}</td>
  93. </tr>
  94. </table>
  95. {{$owners->appends($params)->links()}}
  96. </div>
  97. </div>
  98. @endsection
  99. @section('lastScript')
  100. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  101. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  102. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  103. <script>
  104. let vue = new Vue({
  105. el:"#container",
  106. data:{
  107. owners : [
  108. @foreach($owners as $owner)
  109. { id : "{{$owner->id}}",
  110. customer_name:"{{$owner->customer ? $owner->customer->name : ''}}",
  111. tax_rate : "{{$owner->tax_rate}}",
  112. name : "{{$owner->name}}",
  113. code : "{{$owner->code}}",
  114. created_at : "{{$owner->created_at}}",
  115. contracts : [
  116. @foreach($owner->contracts as $contract)
  117. { number:"{{$contract->contract_number}}",salesman:"{{$contract->salesman}}" },
  118. @endforeach
  119. ],
  120. customer_company_name:"{{$owner->customer ? $owner->customer->company_name : ''}}",
  121. linkman:"{{$owner->linkman}}",
  122. phone_number:"{{$owner->phone_number}}",
  123. user_owner_group_name:"{{$owner->userOwnerGroup ? $owner->userOwnerGroup->name : ''}}",
  124. owner_storage_price_model_using_type:"{{ implode(",",array_unique(array_column(($owner->ownerStoragePriceModels)->toArray(),"using_type"))) }}",
  125. owner_area_report_accounting_area : "{{ $owner->ownerAreaReport ? $owner->ownerAreaReport->accounting_area : '' }}",
  126. waring_line_on : "{{$owner->waring_line_on}}",
  127. is_activation : "{{$owner->deleted_at ? '否' : '是'}}",
  128. description : "{{$owner->description}}",
  129. ownerStoragePriceModels : {!! $owner->ownerStoragePriceModels !!},
  130. },
  131. @endforeach
  132. ],
  133. checkData : [],
  134. sum : Number("{{ $owners->total() }}"),
  135. priceModel : {},
  136. thisClickIndex : "",
  137. models:[
  138. @foreach($models as $model)
  139. {name:"{{$model->id}}",value:"{{$model->name}}"},
  140. @endforeach
  141. ],
  142. customers:[
  143. @foreach($customers as $customer)
  144. {name:"{{$customer->id}}",value:"{{$customer->name}}"},
  145. @endforeach
  146. ],
  147. ownerGroups:[
  148. @foreach($ownerGroups as $ownerGroup)
  149. {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
  150. @endforeach
  151. ],
  152. },
  153. mounted(){
  154. $('#container').removeClass('d-none');
  155. let data=[
  156. [
  157. {name:'user_owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
  158. {name:'created_at_start',type:'time',tip:['选择显示创建日期的起始时间','']},
  159. {name:'id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
  160. placeholder:['项目','定位或多选项目'],data:this.models},
  161. {name:'contract_number',type:'input',tip: '合同号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '合同号'},
  162. ],[
  163. {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
  164. {name:'created_at_end',type:'time',tip:['选择显示创建日期的结束时间','']},
  165. {name:'using_type',type:'select',placeholder: '用仓类型',data:[{name:"常温",value:"常温"},{name:"恒温",value:"恒温"}]},
  166. ],
  167. ];
  168. this.form = new query({
  169. el:"#form_div",
  170. condition:data,
  171. });
  172. this.form.init();
  173. let column = [
  174. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  175. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  176. {name:'operating',value: '操作', neglect: true},
  177. {name:'customer',value: '客户'},
  178. {name:'tax_rate',value: '税率%', neglect: true},
  179. {name:'name',value: '项目'},
  180. {name:'code',value: '货主代码'},
  181. {name:'created_at',value: '创建日期'},
  182. {name:'contract_number',value: '合同号', neglect: true},
  183. {name:'salesman',value: '销售名称', neglect: true},
  184. {name:'customer_full_name',value: '公司全称'},
  185. {name:'linkman',value: '联系人'},
  186. {name:'phone_number',value: '联系电话'},
  187. {name:'workgroup',value: '项目小组'},
  188. {name:'relating_price',value: '关联报价', neglect: true},
  189. {name:'type',value: '用仓类型'},
  190. {name:'current_month_counting_area',value: '当月结算面积', neglect: true},
  191. {name:'waring_line_on',value: '月单量预警', neglect: true},
  192. {name:'is_activating',value: '是否激活', neglect: true},
  193. {name:'description',value: '项目描述'},
  194. ];
  195. let _this=this;
  196. setTimeout(function () {
  197. let header = new Header({
  198. el: "#header",
  199. column: column,
  200. data: _this.owners,
  201. restorationColumn: 'id',
  202. fixedTop:($('#form_div').height())+2,
  203. offset:0.5,
  204. vue:vue
  205. });
  206. header.init();
  207. },0);
  208. },
  209. watch:{
  210. checkData:{
  211. handler(){
  212. if (this.checkData.length === this.owners.length){
  213. document.querySelector('#all').checked = true;
  214. document.querySelector('#all_temp').checked = true;
  215. }else {
  216. document.querySelector('#all').checked = false;
  217. document.querySelector('#all_temp').checked = false;
  218. }
  219. },
  220. deep:true
  221. }
  222. },
  223. methods:{
  224. executeExport(isAll){
  225. let url = '{{url('customer/project/index/export')}}';
  226. let token='{{ csrf_token() }}';
  227. //excelExport 定义在 js/queryForm/export.js
  228. excelExport(isAll,this.checkData,url,this.sum,token);
  229. },
  230. //全选事件
  231. checkAll(e){
  232. if (e.target.checked){
  233. this.checkData = [];
  234. this.owners.forEach((el)=>{
  235. this.checkData.push(el.id);
  236. });
  237. }else {
  238. this.checkData = [];
  239. }
  240. },
  241. showModal(owner){
  242. if (this.priceModel[owner.id]){
  243. this.thisClickIndex = owner.id;
  244. $("#modal").modal('show');
  245. return;
  246. }
  247. window.axios.post('{{url('customer/project/getOwnerPriceModel')}}',{id:owner.id})
  248. .then(res=>{
  249. if (res.data.success){
  250. let model = res.data.data;
  251. model["ownerStoragePriceModels"] = owner.ownerStoragePriceModels;
  252. delete owner.ownerStoragePriceModels;
  253. this.priceModel[owner.id] = model;
  254. this.thisClickIndex = owner.id;
  255. $("#modal").modal('show');
  256. return;
  257. }
  258. window.tempTip.setDuration(3000);
  259. window.tempTip.showSuccess(res.data.data);
  260. }).catch(err=>{
  261. window.tempTip.setDuration(3000);
  262. window.tempTip.show("网络错误:"+err);
  263. });
  264. },
  265. },
  266. });
  267. </script>
  268. @endsection