statistic.blade.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. @extends('layouts.app')
  2. @section('title')二次加工单统计@endsection
  3. @section('content')
  4. <span id="nav2">
  5. @component('process.menu')@endcomponent
  6. </span>
  7. <div class="d-none container-fluid" id="statistics" style="width: 2070px">
  8. <div id="form_div"></div>
  9. <span class="dropdown">
  10. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  11. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  12. 导出Excel
  13. </button>
  14. <div class="dropdown-menu">
  15. <a class="dropdown-item" @click="processStatisticExport(false)" href="javascript:">导出勾选内容</a>
  16. <a class="dropdown-item" @click="processStatisticExport(true)" href="javascript:">导出所有页</a>
  17. </div>
  18. </span>
  19. <table class="table table-striped text-nowrap table-hover" style="background: #fff;">
  20. <tr>
  21. <th>
  22. <label for="all">
  23. <input id="all" type="checkbox" @click="checkAll($event)">全选
  24. </label>
  25. </th>
  26. <th>序号</th>
  27. <th>任务号</th>
  28. <th>货主</th>
  29. <th>开始日期</th>
  30. <th>完成日期</th>
  31. <th>创建日期</th>
  32. <th>单价</th>
  33. <th>预期数量</th>
  34. <th>完成数量</th>
  35. <th>收入合计</th>
  36. <th>完成时间(天)</th>
  37. <th>总工时</th>
  38. <th>加工类型</th>
  39. <th>最高日产能</th>
  40. <th>最低日产能</th>
  41. <th>日均产能</th>
  42. <th>合计成本</th>
  43. <th>毛利润</th>
  44. <th>毛利率</th>
  45. <th>状态</th>
  46. <th>加工备注</th>
  47. <th>结算备注</th>
  48. </tr>
  49. <tr v-for="(processStatistic,i) in processStatistics" :class="processStatistic.gross_profit_rate?'text-success':''">
  50. <td><input class="checkItem" type="checkbox" :value="processStatistic.process_id" v-model="checkData"></td>
  51. <td>@{{ i+1 }}</td>
  52. <td><span v-if="processStatistic.process">@{{ processStatistic.process.code }}</span></td>
  53. <td><span v-if="processStatistic.process">@{{ processStatistic.process.owner_name }}</span></td>
  54. <td>@{{ processStatistic.started_at }}</td>
  55. <td>@{{ processStatistic.ended_at }}</td>
  56. <td><span v-if="processStatistic.process">@{{ processStatistic.process.created_at }}</span></td>
  57. <td><span v-if="processStatistic.process">@{{ processStatistic.process.unit_price }}</span></td>
  58. <td><span v-if="processStatistic.process">@{{ processStatistic.process.amount }}</span></td>
  59. <td><span v-if="processStatistic.process">@{{ processStatistic.process.completed_amount }}</span></td>
  60. <td>@{{ processStatistic.revenue }}</td>
  61. <td>@{{ processStatistic.duration_days }}</td>
  62. <td><span v-if="processStatistic.process">@{{ processStatistic.duration_man_hours }}</span></td>
  63. <td><span v-if="processStatistic.process">@{{ processStatistic.process.process_method_name }}</span></td>
  64. <td>@{{ processStatistic.top_capacity }}</td>
  65. <td>@{{ processStatistic.bottom_capacity }}</td>
  66. <td>@{{ processStatistic.average_capacity }}</td>
  67. <td>@{{ processStatistic.total_cost }}</td>
  68. <td>@{{ processStatistic.gross_profit }}</td>
  69. <td><b v-if="processStatistic.gross_profit_rate">@{{ (processStatistic.gross_profit_rate)*100 | money}}%</b></td>
  70. <td><span v-if="processStatistic.process">@{{ processStatistic.process.status }}</span></td>
  71. <td><span v-if="processStatistic.process">@{{ processStatistic.process.remark }}</span></td>
  72. <td><span v-if="processStatistic.process">@{{ processStatistic.process.balance_remark }}</span></td>
  73. </tr>
  74. </table>
  75. {{$processStatistics->appends($params)->links()}}
  76. </div>
  77. @endsection
  78. @section('lastScript')
  79. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  80. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  81. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  82. <script>
  83. new Vue({
  84. el:"#statistics",
  85. data:{
  86. processStatistics:[
  87. @foreach($processStatistics as $processStatistic)
  88. {!! $processStatistic !!},
  89. @endforeach
  90. ],
  91. owners:[
  92. @foreach($owners as $owner)
  93. {name:'{{ $owner->id }}',value:'{{ $owner->name }}'},
  94. @endforeach
  95. ],
  96. processMethods:[
  97. @foreach($processMethods as $processMethod)
  98. {name:'{{ $processMethod->id }}',value:'{{ $processMethod->name }}'},
  99. @endforeach
  100. ],
  101. checkData:[],
  102. sum:{!! $processStatistics->total() !!},
  103. filterData:{paginate:'50',started_at:'',ended_at:'',owner_id:'',code:'',status:''},
  104. status:[
  105. {name:'待审核',value:'待审核'},{name:'待接单',value:'待接单'},{name:'待加工',value:'待加工'},
  106. {name:'已驳回',value:'已驳回'},{name:'加工中',value:'加工中'},{name:'待验收',value:'待验收'},
  107. {name:'交接完成',value:'交接完成'},
  108. ],
  109. },
  110. watch:{
  111. checkData:{
  112. handler(){
  113. if (this.checkData.length === this.processStatistics.length){
  114. document.querySelector('#all').checked = true;
  115. }else {
  116. document.querySelector('#all').checked = false;
  117. }
  118. },
  119. deep:true
  120. }
  121. },
  122. mounted:function(){
  123. $(".tooltipTarget").tooltip({'trigger':'hover'});
  124. $('#statistics').removeClass('d-none');
  125. let data=[
  126. [
  127. {name: 'started_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
  128. {
  129. name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
  130. placeholder: ['货主', '定位或多选货主'], data: this.owners
  131. },
  132. {name: 'process_method_id', type: 'select', placeholder: '加工类型', data: this.processMethods},
  133. ],
  134. [
  135. {name: 'started_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
  136. {name: 'code', type: 'input', tip: '任务号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '任务号'},
  137. {name: 'status', type: 'select', placeholder: '状态', data: this.status},
  138. ],
  139. ];
  140. this.form = new query({
  141. el: "#form_div",
  142. condition: data,
  143. });
  144. this.form.init();
  145. },
  146. methods: {
  147. checkAll(e){
  148. if (e.target.checked){
  149. this.processStatistics.forEach(el=>{
  150. if (this.checkData.indexOf(el.process_id) == '-1'){
  151. this.checkData.push(el.process_id);
  152. }
  153. });
  154. }else {
  155. this.checkData = [];
  156. }
  157. },
  158. //导出excel
  159. processStatisticExport(checkAllSign){
  160. let url = '{{url('process/statistic/export')}}';
  161. let token='{{ csrf_token() }}';
  162. //excelExport 定义在 js/queryForm/export.js
  163. excelExport(checkAllSign,this.checkData,url,this.sum,token);
  164. },
  165. },
  166. filters:{
  167. money:function(value){
  168. return _.round(value,2);
  169. }
  170. }
  171. });
  172. </script>
  173. @endsection