index.blade.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.ownerName" 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.logisticName" 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. <button class="form-control btn btn-sm btn-info" @click="searchData()">查询</button>
  30. </div>
  31. <div class="form-group m-2">
  32. <button class="form-control btn btn-sm btn-success" @click="downExcel()">导出EXCEL</button>
  33. </div>
  34. </div>
  35. <!-- 导出-->
  36. <span class="dropdown"></span>
  37. <!-- 表格-->
  38. <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
  39. style="background: #fff;" id="table">
  40. <tr v-for="(item,i) in details.data" :key="i">
  41. <td class="td-warm text-muted"><span>@{{ i+1 }}</span></td>
  42. <td class="td-warm text-muted"><span>@{{ item.ownerName }}</span></td>
  43. <td class="td-warm text-muted"><span>@{{ item.logisticName }}</span></td>
  44. <td class="td-warm text-muted"><span>@{{ item.totalAmount }}</span></td>
  45. <td class="td-warm text-muted"><span>@{{ item.overTimeCheckAmount }}</span></td>
  46. <td class="td-warm text-muted"><span>@{{ item.unreceiveAmount }}</span></td>
  47. <td class="td-warm text-muted"><span>@{{ item.avgCheckTime }}</span></td>
  48. </tr>
  49. </table>
  50. <nav aria-label="...">
  51. <ul class="pagination">
  52. <li class="page-item" :class="current===1?'disabled':''">
  53. <button class="page-link" @click="pagination('pre')">上一页</button>
  54. </li>
  55. <li class="page-item" :class="current===details.pages?'disabled':''">
  56. <button class="page-link" @click="pagination('next')">下一页</button>
  57. </li>
  58. </ul>
  59. </nav>
  60. </div>
  61. @endsection
  62. @section('lastScript')
  63. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  64. <script>
  65. let vue = new Vue({
  66. el: "#list",
  67. data: {
  68. selectTr: null,
  69. details: {
  70. data: [],
  71. total: null,
  72. current: 1,
  73. pages: null,
  74. size: 50,
  75. },
  76. search: {
  77. startTime: null,
  78. endTime: null,
  79. ownerName: null,
  80. logisticName: null,
  81. ownerIdList: {!! $ownerIds !!}
  82. },
  83. size: 50,
  84. current: 1,
  85. },
  86. created() {
  87. let url = this.getBaseUrl() + `/api/report/logisticReturnTimeliness/list?size=${this.size}&current=${this.current}`
  88. this.initSearchDate();
  89. this.getPageResult(url);
  90. },
  91. mounted: function () {
  92. $('#list').removeClass('d-none');
  93. let column = [
  94. {name: 'ownerName', value: '货主'},
  95. {name: 'logisticName', value: '承运商'},
  96. {name: 'totalAmount', value: '全部'},
  97. {name: 'overTimeCheckAmount', value: '超时登记数'},
  98. {name: 'unreceiveAmount', value: '未签收登记数'},
  99. {name: 'avgCheckTime', value: '平均登记时间(小时)'},
  100. ];
  101. new Header({
  102. el: "table",
  103. name: "details",
  104. column: column,
  105. data: this.details.data,
  106. restorationColumn: 'addtime',
  107. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  108. }).init();
  109. },
  110. methods: {
  111. getPageResult(url) {
  112. tempTip.showSuccess('开始查询,请稍后!');
  113. axios.post(url, this.getSearch()).then(res => {
  114. tempTip.showSuccess('查询成功!');
  115. if (res.data.data === undefined) {
  116. this.details.data = [];
  117. this.details.total = 0
  118. this.details.current = 1
  119. this.details.pages = 0
  120. this.details.size = 50;
  121. } else {
  122. this.details.data = res.data.data.list;
  123. this.details.total = res.data.data.page.total;
  124. this.details.current = res.data.data.page.pageNum;
  125. this.details.pages = res.data.data.page.pages
  126. this.details.size = res.data.data.page.pageSize;
  127. }
  128. });
  129. },
  130. getSearch() {
  131. let search = Object.assign({}, this.search);
  132. search.startTime += ' 00:00:00';
  133. search.endTime += ' 23:59:59';
  134. return search;
  135. },
  136. //初始化日期为今天和昨天
  137. initSearchDate() {
  138. let day1 = new Date();
  139. day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
  140. let s1 = day1.getFullYear() + "-" + ((day1.getMonth() + 1) >= 10 ? (day1.getMonth() + 1) : ('0' + (day1.getMonth() + 1))) + "-" + (day1.getDate() >= 10 ? day1.getDate() : ('0' + day1.getDate()));
  141. //今天的时间
  142. let day2 = new Date();
  143. day2.setTime(day2.getTime());
  144. let s2 = day2.getFullYear() + "-" + ((day2.getMonth() + 1) >= 10 ? (day2.getMonth() + 1) : ('0' + (day2.getMonth() + 1))) + "-" + (day2.getDate() >= 10 ? day2.getDate() : ('0' + day2.getDate()));
  145. this.search.startTime = s1;
  146. this.search.endTime = s2;
  147. },
  148. searchData() {
  149. this.current = 1;
  150. this.pagination();
  151. },
  152. //根据环境获取不同的url
  153. getBaseUrl() {
  154. let url = null;
  155. let env = "{{ config('app.env') }}";
  156. if (env === 'local') {
  157. url = 'http://127.0.0.1:8111'
  158. } else if (env === 'production') {
  159. url = 'https://stat.baoshi56.com'
  160. }
  161. return url;
  162. },
  163. pagination(flag) {
  164. if (flag === 'pre' && this.current > 1) {
  165. this.current--;
  166. } else if (flag === 'next' && this.current < this.details.pages) {
  167. this.current++;
  168. }
  169. let url = this.getBaseUrl() + `/api/report/logisticReturnTimeliness/list?size=${this.size}&current=${this.current}`
  170. this.getPageResult(url);
  171. },
  172. downExcel() {
  173. let url = this.getBaseUrl();
  174. url += '/api/report/logisticReturnTimeliness/export';
  175. let search = Object.assign({}, this.search);
  176. search.startTime += ' 00:00:00';
  177. search.endTime += ' 23:59:59';
  178. axios.post(url, search).then(res => {
  179. if (res.data.code === 200) {
  180. let filename = res.data.data;
  181. let downUrl = this.getBaseUrl() + '/api/report/logisticReturnTimeliness/export/' + filename;
  182. let link = document.createElement('a');
  183. link.style.display = 'none';
  184. link.href = downUrl;
  185. link.download = `${filename}.xlsx`;
  186. document.body.appendChild(link);
  187. link.click();
  188. document.body.removeChild(link);
  189. tempTip.showSuccess('导出成功!');
  190. } else {
  191. tempTip.setDuration(3000);
  192. tempTip.show(res.data.data);
  193. }
  194. })
  195. }
  196. },
  197. });
  198. </script>
  199. @endsection