index.blade.php 13 KB

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