report.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. @extends('layouts.app')
  2. @section('title')
  3. 客户管理-项目报表
  4. @endsection
  5. @section('content')
  6. @component('customer.project.menu')@endcomponent
  7. <div class="container-fluid card d-none" id="container">
  8. <div id="form_div"></div>
  9. <div>
  10. <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  11. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  12. 导出Excel
  13. </button>
  14. <div class="dropdown-menu">
  15. <a class="dropdown-item" @click="reportExport(false)" href="javascript:">导出勾选内容</a>
  16. <a class="dropdown-item" @click="reportExport(true)" href="javascript:">导出所有页</a>
  17. </div>
  18. </div>
  19. <div>
  20. <label for="all" id="cloneCheckAll" class="d-none">
  21. <input id="all" type="checkbox" @click="checkAll($event)">全选
  22. </label>
  23. <table class="d-none" id="headerRoll"></table>
  24. <table class="table table-sm table-striped table-hover" id="headerParent">
  25. <tr class="text-center">
  26. <td></td>
  27. <td colspan="7" class="bg-light-khaki">客户信息</td>
  28. <td colspan="4" class="bg-light-info">盘点信息</td>
  29. <td colspan="3" class="bg-light-cyanogen">账单信息</td>
  30. </tr>
  31. <tr class="text-nowrap" id="header"></tr>
  32. <tr v-for="(report,i) in reports">
  33. <td>
  34. <label><input type="checkbox" :value="report.id" v-model="checkData"></label>
  35. </td>
  36. <td>@{{ i+1 }}</td>
  37. <td>@{{ report.ownerGroupName }}</td>
  38. <td>@{{ report.customerName }}</td>
  39. <td>@{{ report.ownerName }}</td>
  40. <td>@{{ report.ownerStatus }}</td>
  41. <td>@{{ report.ownerCreatedAt }}</td>
  42. <td>@{{ report.ownerStorageDuration }} 天</td>
  43. <td>@{{ report.countingMonth }}</td>
  44. <td>@{{ report.dailyAverageOrderAmount }}</td>
  45. <td>@{{ report.lastMonthCountingArea }}</td>
  46. <td>@{{ report.currentMonthCountingArea }}</td>
  47. <td>@{{ report.ownerBillReportInitialFee }}</td>
  48. <td>@{{ report.ownerBillReportConfirmFee }}</td>
  49. <td>@{{ report.ownerBillReportConfirmUpdatedAt }}</td>
  50. </tr>
  51. </table>
  52. {{$reports->appends($params)->links()}}
  53. </div>
  54. </div>
  55. @stop
  56. @section('lastScript')
  57. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  58. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  59. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  60. <script>
  61. let vue = new Vue({
  62. el:"#container",
  63. data:{
  64. reports : [
  65. @foreach($reports as $report)
  66. {
  67. id : "{{$report->id}}",
  68. ownerGroupName : "{{$report->owner ? ($report->owner->userOwnerGroup ? $report->owner->userOwnerGroup->name : '') : ''}}",
  69. customerName : "{{$report->owner ? ($report->owner->customer ? $report->owner->customer->name : '') : ''}}",
  70. ownerName : "{{$report->owner ? $report->owner->name : ''}}",
  71. ownerStatus : "{{$report->owner ? ($report->owner->deleted_at ? "冻结" : "激活") : ''}}",
  72. ownerStorageDuration : "{{$report->owner ? ($report->owner->created_at ? ((new DateTime())->diff(new DateTime($report->owner->created_at))->days) : '') : ''}}",
  73. ownerCreatedAt : "{{$report->owner ? $report->owner->created_at : ''}}",
  74. countingMonth : "{{$report->counting_month}}",
  75. dailyAverageOrderAmount : "{{$report->daily_average_order_amount}}",
  76. lastMonthCountingArea : "{{$report->last_month_counting_area}}",
  77. currentMonthCountingArea : "{{$report->current_month_counting_area}}",
  78. ownerBillReportInitialFee : "{{$report->ownerBillReport ? $report->ownerBillReport->initial_fee : ''}}",
  79. ownerBillReportConfirmFee : "{{$report->ownerBillReport ? $report->ownerBillReport->confirm_fee : ''}}",
  80. ownerBillReportConfirmUpdatedAt : "{{$report->ownerBillReport ? $report->ownerBillReport->updated_at : ''}}",
  81. },
  82. @endforeach
  83. ],
  84. owners : [
  85. @foreach($owners as $owner)
  86. {name:"{{$owner->id}}",value:"{{$owner->name}}"},
  87. @endforeach
  88. ],
  89. workgroup : [
  90. @foreach($ownerGroups as $ownerGroup)
  91. {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
  92. @endforeach
  93. ],
  94. customers : [
  95. @foreach($customers as $customer)
  96. {name:"{{$customer->id}}",value:"{{$customer->name}}"},
  97. @endforeach
  98. ],
  99. status : [
  100. {name:"激活",value:"激活"},
  101. {name:"冻结",value:"冻结"},
  102. ],
  103. checkData : [],
  104. sum : Number("{{ $reports->total() }}"),
  105. },
  106. mounted(){
  107. $('#container').removeClass('d-none');
  108. let data=[
  109. [
  110. {name:'owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.workgroup},
  111. {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
  112. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
  113. placeholder:['项目','定位或多选项目'],data:this.owners},
  114. ],[
  115. {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
  116. {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
  117. {name:'status',type:'select',placeholder:'状态',data:this.status},
  118. ],
  119. ];
  120. this.form = new query({
  121. el:"#form_div",
  122. condition:data,
  123. });
  124. this.form.init();
  125. let column = [
  126. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  127. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  128. {name:'index',value: '序号', neglect: true ,class:"bg-khaki"},
  129. {name:'ownerGroupName',value: '项目小组',class:"bg-khaki"},
  130. {name:'customerName',value: '客户',class:"bg-khaki"},
  131. {name:'ownerName',value: '子项目',class:"bg-khaki"},
  132. {name:'ownerStatus',value: '状态',class:"bg-khaki"},
  133. {name:'ownerCreatedAt',value: '创建日期',class:"bg-khaki"},
  134. {name:'ownerStorageDuration',value: '在库时长',class:"bg-khaki"},
  135. {name:'countingMonth',value: '结算月', class:"bg-info"},
  136. {name:'dailyAverageOrderAmount',value: '日均单量', neglect: true, class:"bg-info"},
  137. {name:'lastMonthCountingArea',value: '结算月上月盘点面积', neglect: true, class:"bg-info"},
  138. {name:'currentMonthCountingArea',value: '结算月盘点面积', neglect: true, class:"bg-info"},
  139. {name:'ownerBillReportInitialFee',value: '初始账单金额', neglect: true, class:"bg-cyanogen"},
  140. {name:'ownerBillReportConfirmFee',value: '确认账单金额', neglect: true, class:"bg-cyanogen"},
  141. {name:'ownerBillReportConfirmUpdatedAt',value: '确认日期', class:"bg-cyanogen"},
  142. ];
  143. let _this=this;
  144. setTimeout(function () {
  145. let header = new Header({
  146. el: "#header",
  147. column: column,
  148. data: _this.reports,
  149. restorationColumn: 'id',
  150. fixedTop:($('#form_div').height())+2,
  151. offset:0.5,
  152. vue:vue
  153. });
  154. header.init();
  155. },0);
  156. },
  157. watch:{
  158. checkData:{
  159. handler(){
  160. if (this.checkData.length === this.reports.length){
  161. document.querySelector('#all').checked = true;
  162. document.querySelector('#all_temp').checked = true;
  163. }else {
  164. document.querySelector('#all').checked = false;
  165. document.querySelector('#all_temp').checked = false;
  166. }
  167. },
  168. deep:true
  169. }
  170. },
  171. methods : {
  172. reportExport(isAll){
  173. let url = '{{url('customer/project/report/export')}}';
  174. let token='{{ csrf_token() }}';
  175. //excelExport 定义在 js/queryForm/export.js
  176. excelExport(isAll,this.checkData,url,this.sum,token);
  177. },
  178. //全选事件
  179. checkAll(e){
  180. if (e.target.checked){
  181. this.checkData = [];
  182. this.reports.forEach((el)=>{
  183. this.checkData.push(el.id);
  184. });
  185. }else {
  186. this.checkData = [];
  187. }
  188. },
  189. }
  190. });
  191. </script>
  192. @stop