index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. <!-- 分页数量 -->
  8. <div class="form-group m-2">
  9. <select class="form-control selectpicker" title="分页大小" v-model="size">
  10. <option value="50">50</option>
  11. <option value="100">100</option>
  12. <option value="200">200</option>
  13. <option value="500">500</option>
  14. <option value="1000">1000</option>
  15. </select>
  16. </div>
  17. <!--用户-->
  18. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="用户名">
  19. <input v-model="search.username" class="form-control" type="text" placeholder="用户名">
  20. </div>
  21. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="起始日期">
  22. <input v-model="search.startTime" class="form-control" type="datetime-local" step="01">
  23. </div>
  24. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="截止日期">
  25. <input v-model="search.endTime" class="form-control" type="datetime-local" step="01">
  26. </div>
  27. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="单号">
  28. <input v-model="search.content" class="form-control" type="text" placeholder="单号">
  29. </div>
  30. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="桌号">
  31. <input v-model="search.scanLocationCode" class="form-control" type="text" placeholder="桌号">
  32. </div>
  33. <div class="form-group m-2">
  34. <button class="form-control btn btn-sm btn-info" @click="searchData()">查询</button>
  35. </div>
  36. <div class="form-group m-2">
  37. <button class="form-control btn btn-sm btn-success" @click="resetSearch()">重置</button>
  38. </div>
  39. <div class="form-group m-2">
  40. <button class="form-control btn btn-sm btn-success" @click="downExcel()">导出EXCEL</button>
  41. </div>
  42. </div>
  43. <!-- 导出-->
  44. <span class="dropdown"></span>
  45. <!-- 表格-->
  46. <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
  47. style="background: #fff;" id="table">
  48. <tr v-for="(item,i) in details.data" :key="i">
  49. <td class="td-warm text-muted"><span>@{{ i+1 }}</span></td>
  50. <td class="td-warm text-muted"><span>@{{ item.username }}</span></td>
  51. <td class="td-warm text-muted"><span>@{{ item.macAddress }}</span></td>
  52. <td class="td-warm text-muted"><span>@{{ item.scanLocationCode }}</span></td>
  53. <td class="td-warm text-muted"><span>@{{ item.content }}</span></td>
  54. <td class="td-warm text-muted"><span>@{{ item.skuAmount }}</span></td>
  55. <td class="td-warm text-muted"><span>@{{ item.waveDesc }}</span></td>
  56. <td class="td-warm text-muted"><span>@{{ item.createTime }}</span></td>
  57. <td class="td-warm text-muted"><span>@{{ item.recheckTime }}</span></td>
  58. <td class="td-warm text-muted"><span>@{{ item.recheckUsername }}</span></td>
  59. <td class="td-warm text-muted"><span>@{{ item.workstation }}</span></td>
  60. </tr>
  61. </table>
  62. <nav aria-label="...">
  63. <ul class="pagination">
  64. <li class="page-item" :class="current===1?'disabled':''">
  65. <button class="page-link" @click="pagination('pre')">上一页</button>
  66. </li>
  67. <li class="page-item" :class="current===details.pages?'disabled':''">
  68. <button class="page-link" @click="pagination('next')">下一页</button>
  69. </li>
  70. </ul>
  71. </nav>
  72. </div>
  73. @endsection
  74. @section('lastScript')
  75. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  76. <script>
  77. let vue = new Vue({
  78. el: "#list",
  79. data: {
  80. users: [],
  81. selectTr: '',
  82. details: {
  83. data: [],
  84. total: null,
  85. current: null,
  86. pages: null,
  87. size: null
  88. },
  89. size: 50,
  90. current: 1,
  91. search: {
  92. startTime: '',
  93. endTime: '',
  94. userIds: [],
  95. }
  96. },
  97. created() {
  98. Date.prototype.format = function (fmt) {
  99. var o = {
  100. "M+": this.getMonth() + 1, //月份
  101. "d+": this.getDate(), //日
  102. "h+": this.getHours(), //小时
  103. "m+": this.getMinutes(), //分
  104. "s+": this.getSeconds(), //秒
  105. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  106. "S": this.getMilliseconds() //毫秒
  107. };
  108. if (/(y+)/.test(fmt)) {
  109. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  110. }
  111. for (var k in o) {
  112. if (new RegExp("(" + k + ")").test(fmt)) {
  113. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  114. }
  115. }
  116. return fmt;
  117. }
  118. let url = this.getBaseUrl();
  119. url += `/api/report/scanInfo/listPage?size=${this.size}&current=${this.current}`;
  120. axios.post(url, this.search).then(res => {
  121. this.details.data = res.data.data.list;
  122. this.details.total = res.data.data.page.total;
  123. this.details.current = res.data.data.page.pageNum;
  124. this.details.pages = res.data.data.page.pages
  125. this.details.size = res.data.data.page.pageSize;
  126. });
  127. },
  128. mounted: function () {
  129. $('#list').removeClass('d-none');
  130. let column = [
  131. {name: 'username', value: '用户'},
  132. {name: 'macAddress', value: 'MAC地址'},
  133. {name: 'locationCode', value: '桌号'},
  134. {name: 'content', value: '单号'},
  135. {name: 'content', value: '数量'},
  136. {name: 'content', value: '波次类型'},
  137. {name: 'createTime', value: '打包时间'},
  138. {name: 'recheckTime', value: '复核时间'},
  139. {name: 'recheckUsername', value: '复核人'},
  140. {name: 'workstation', value: '工作站'},
  141. ];
  142. new Header({
  143. el: "table",
  144. name: "details",
  145. column: column,
  146. data: this.details.data,
  147. restorationColumn: 'addtime',
  148. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  149. }).init();
  150. },
  151. methods: {
  152. resetSearch() {
  153. this.current = 1;
  154. this.size = 50;
  155. this.search = {
  156. startTime: null,
  157. endTime: null,
  158. customerCodeList: [],
  159. };
  160. },
  161. searchData() {
  162. this.current = 1;
  163. this.pagination();
  164. },
  165. //根据环境获取不同的url
  166. getBaseUrl() {
  167. let url = '';
  168. let env = "{{ config('app.env') }}";
  169. if (env === 'local') {
  170. url = 'http://127.0.0.1:8111'
  171. } else if (env === 'production') {
  172. url = 'https://stat.baoshi56.com'
  173. }
  174. return url;
  175. },
  176. getSearch: function () {
  177. let search = Object.assign({}, this.search)
  178. if (search.startTime != null && search.startTime !== '') {
  179. search.startTime = new Date(Date.parse(search.startTime)).format("yyyy-MM-dd hh:mm:ss");
  180. }
  181. if (search.endTime != null && search.endTime !== '') {
  182. search.endTime = new Date(Date.parse(search.endTime)).format("yyyy-MM-dd hh:mm:ss");
  183. }
  184. return search;
  185. },
  186. pagination(flag) {
  187. if (flag === 'pre' && this.current > 1) {
  188. this.current--;
  189. } else if (flag === 'next' && this.current < this.details.pages) {
  190. this.current++;
  191. }
  192. let url = this.getBaseUrl();
  193. url += `/api/report/scanInfo/listPage?size=${this.size}&current=${this.current}`;
  194. let search = this.getSearch();
  195. axios.post(url, search).then(res => {
  196. if (res.data.data === undefined) {
  197. this.details.data = [];
  198. this.details.total = 0
  199. this.details.current = 1
  200. this.details.pages = 0
  201. this.details.size = 50;
  202. } else {
  203. this.details.data = res.data.data.list;
  204. this.details.total = res.data.data.page.total;
  205. this.details.current = res.data.data.page.pageNum;
  206. this.details.pages = res.data.data.page.pages
  207. this.details.size = res.data.data.page.pageSize;
  208. }
  209. });
  210. },
  211. downExcel() {
  212. let url = this.getBaseUrl();
  213. url += '/api/report/scanInfo/export';
  214. let search = this.getSearch();
  215. axios.post(url, search).then(res => {
  216. if (res.data.code === 200) {
  217. let filename = res.data.data;
  218. let downUrl = this.getBaseUrl() + '/api/report/scanInfo/export/' + filename;
  219. let link = document.createElement('a');
  220. link.style.display = 'none';
  221. link.href = downUrl;
  222. link.download = `${filename}.xlsx`;
  223. document.body.appendChild(link);
  224. link.click();
  225. document.body.removeChild(link);
  226. tempTip.showSuccess('导出成功!');
  227. } else {
  228. tempTip.setDuration(3000);
  229. tempTip.show(res.data.data);
  230. }
  231. })
  232. }
  233. },
  234. });
  235. </script>
  236. @endsection