index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. @extends('layouts.app')
  2. @section('title')承运商时效表@endsection
  3. @section('content')
  4. <div class="d-none" id="list">
  5. <!--查询 -->
  6. <div class="row m-3" style="background-color: #fff;">
  7. <div class="form-group m-2">
  8. <select class="form-control selectpicker" title="分页大小" v-model="size">
  9. <option value="50">50</option>
  10. <option value="100">100</option>
  11. <option value="200">200</option>
  12. <option value="500">500</option>
  13. <option value="1000">1000</option>
  14. </select>
  15. </div>
  16. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="承运商">
  17. <input v-model="search.logisticName" class="form-control" type="text" step="01" placeholder="承运商">
  18. </div>
  19. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="货主">
  20. <input v-model="search.customerName" class="form-control" type="text" step="01" placeholder="货主">
  21. </div>
  22. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="起始日期">
  23. <input v-model="search.startTime" class="form-control" type="date" step="01">
  24. </div>
  25. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="截止日期">
  26. <input v-model="search.endTime" class="form-control" type="date" step="01">
  27. </div>
  28. <div class="form-group m-2">
  29. <select class="form-control selectpicker" title="是否收货" v-model="search.receiveStatus">
  30. <option value="1">全部</option>
  31. <option value="2">是</option>
  32. </select>
  33. </div>
  34. <div class="form-group m-2">
  35. <button class="form-control btn btn-sm btn-info" @click="searchData()">查询</button>
  36. </div>
  37. <div class="form-group m-2">
  38. <button class="form-control btn btn-sm btn-success" @click="downExcel()">导出EXCEL</button>
  39. </div>
  40. </div>
  41. <!-- 导出-->
  42. <span class="dropdown"></span>
  43. <!-- 表格-->
  44. <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
  45. style="background: #fff;" id="table">
  46. <tr v-for="(item,i) in details.data" :key="i">
  47. <td class="td-warm text-muted"><span>@{{ i+1 }}</span></td>
  48. <td class="td-warm text-muted"><span>@{{ item.customerName }}</span></td>
  49. <td class="td-warm text-muted"><span>@{{ item.logisticName }}</span></td>
  50. <td class="td-warm text-muted"><span>@{{ item.province }}</span></td>
  51. <td class="td-warm text-muted"><span>@{{ item.t0 }}</span></td>
  52. <td class="td-warm text-muted"><span>@{{ item.t1 }}</span></td>
  53. <td class="td-warm text-muted"><span>@{{ item.t2 }}</span></td>
  54. <td class="td-warm text-muted"><span>@{{ item.t3 }}</span></td>
  55. <td class="td-warm text-muted"><span>@{{ item.t4 }}</span></td>
  56. <td class="td-warm text-muted"><span>@{{ item.t5 }}</span></td>
  57. <td class="td-warm text-muted"><span>@{{ item.orderTotalAmount }}</span></td>
  58. <td class="td-warm text-muted"><span>@{{ item.orderHaveRouteAmount }}</span></td>
  59. </tr>
  60. </table>
  61. <nav aria-label="...">
  62. <ul class="pagination">
  63. <li class="page-item" :class="current===1?'disabled':''">
  64. <button class="page-link" @click="pagination('pre')">上一页</button>
  65. </li>
  66. <li class="page-item" :class="current===details.pages?'disabled':''">
  67. <button class="page-link" @click="pagination('next')">下一页</button>
  68. </li>
  69. </ul>
  70. </nav>
  71. </div>
  72. @endsection
  73. @section('lastScript')
  74. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  75. <script>
  76. let vue = new Vue({
  77. el: "#list",
  78. data: {
  79. selectTr: null,
  80. details: {
  81. data: [],
  82. total: null,
  83. current: 1,
  84. pages: null,
  85. size: 50,
  86. },
  87. search: {
  88. startTime: null,
  89. endTime: null,
  90. logisticName: null,
  91. customerName: null,
  92. ownerIdList: {!! $ownerIds !!}
  93. },
  94. size: 50,
  95. current: 1,
  96. },
  97. created() {
  98. let url = this.getBaseUrl() + `/api/report/logisticsPunctuality/list?size=${this.size}&current=${this.current}`;
  99. this.initSearchDate();
  100. this.getPageResult(url);
  101. },
  102. mounted: function () {
  103. $('#list').removeClass('d-none');
  104. let column = [
  105. {name: 'customerName', value: '货主'},
  106. {name: 'logisticName', value: '承运商'},
  107. {name: 'province', value: '省份'},
  108. {name: 't0', value: '付款-推单-小时'},
  109. {name: 't1', value: '推单-出库(库内)-小时'},
  110. {name: 't2', value: '出库-揽收(月台)-小时'},
  111. {name: 't3', value: '揽收-中转(站点)-小时'},
  112. {name: 't4', value: '中转-签收(途中)-日'},
  113. {name: 't5', value: ' 推单-签收(全部)-日'},
  114. {name: 'case6Amount', value: '总单量'},
  115. {name: 'case7Amount', value: '总有路由信息单量'},
  116. ];
  117. new Header({
  118. el: "table",
  119. name: "details",
  120. column: column,
  121. data: this.details.data,
  122. restorationColumn: 'addtime',
  123. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  124. }).init();
  125. },
  126. methods: {
  127. getPageResult(url) {
  128. tempTip.showSuccess('开始查询,请稍后!');
  129. axios.post(url, this.getSearch()).then(res => {
  130. tempTip.showSuccess('查询成功!');
  131. if (res.data.data === undefined) {
  132. this.details.data = [];
  133. this.details.total = 0
  134. this.details.current = 1
  135. this.details.pages = 0
  136. this.details.size = 50;
  137. } else {
  138. this.details.data = res.data.data.list;
  139. this.details.total = res.data.data.page.total;
  140. this.details.current = res.data.data.page.pageNum;
  141. this.details.pages = res.data.data.page.pages
  142. this.details.size = res.data.data.page.pageSize;
  143. }
  144. });
  145. },
  146. getSearch() {
  147. let search = Object.assign({}, this.search);
  148. search.startTime += ' 00:00:00';
  149. search.endTime += ' 23:59:59';
  150. return search;
  151. },
  152. //初始化日期为今天和昨天
  153. initSearchDate() {
  154. let day1 = new Date();
  155. day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
  156. let s1 = day1.getFullYear() + "-" + ((day1.getMonth() + 1) >= 10 ? (day1.getMonth() + 1) : ('0' + (day1.getMonth() + 1))) + "-" + (day1.getDate() >= 10 ? day1.getDate() : ('0' + day1.getDate()));
  157. //今天的时间
  158. let day2 = new Date();
  159. day2.setTime(day2.getTime());
  160. let s2 = day2.getFullYear() + "-" + ((day2.getMonth() + 1) >= 10 ? (day2.getMonth() + 1) : ('0' + (day2.getMonth() + 1))) + "-" + (day2.getDate() >= 10 ? day2.getDate() : ('0' + day2.getDate()));
  161. this.search.startTime = s1;
  162. this.search.endTime = s2;
  163. },
  164. searchData() {
  165. this.current = 1;
  166. this.pagination();
  167. },
  168. //根据环境获取不同的url
  169. getBaseUrl() {
  170. let url = null;
  171. let env = "{{ config('app.env') }}";
  172. if (env === 'local') {
  173. url = 'http://127.0.0.1:8111'
  174. } else if (env === 'production') {
  175. url = 'https://stat.baoshi56.com'
  176. }
  177. return url;
  178. },
  179. pagination(flag) {
  180. if (flag === 'pre' && this.current > 1) {
  181. this.current--;
  182. } else if (flag === 'next' && this.current < this.details.pages) {
  183. this.current++;
  184. }
  185. let url = this.getBaseUrl() + `/api/report/logisticsPunctuality/list?size=${this.size}&current=${this.current}`;
  186. this.getPageResult(url);
  187. },
  188. downExcel() {
  189. let url = this.getBaseUrl();
  190. url += '/api/report/logisticsPunctuality/export';
  191. let search = Object.assign({}, this.search);
  192. search.startTime += ' 00:00:00';
  193. search.endTime += ' 23:59:59';
  194. axios.post(url, search).then(res => {
  195. if (res.data.code === 200) {
  196. let filename = res.data.data;
  197. let downUrl = this.getBaseUrl() + '/api/report/logisticsPunctuality/export/' + filename;
  198. let link = document.createElement('a');
  199. link.style.display = 'none';
  200. link.href = downUrl;
  201. link.download = `${filename}.xlsx`;
  202. document.body.appendChild(link);
  203. link.click();
  204. document.body.removeChild(link);
  205. tempTip.showSuccess('导出成功!');
  206. } else {
  207. tempTip.setDuration(3000);
  208. tempTip.show(res.data.data);
  209. }
  210. })
  211. }
  212. },
  213. });
  214. </script>
  215. @endsection