report.blade.php 12 KB

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