index.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. @extends('layouts.app')
  2. @section('title')开单入库-查询@endsection
  3. @section('head')
  4. <link rel="stylesheet" href="{{ asset('css/element/index.css') }}">
  5. @endsection
  6. @section('content')
  7. <div id="list" class="container-fluid d-none">
  8. <div>
  9. <div id="form_div" style="min-width: 1220px;"></div>
  10. <div class="ml-3 form-inline" id="btn">
  11. @can('入库管理-开单入库-打印任务单')
  12. <button type="button"
  13. class="ml-2 btn btn-sm btn-outline-success "
  14. @click="printReceivingTask">打印任务清单
  15. </button>
  16. @endcan
  17. <span class="dropdown">
  18. <button type="button"
  19. class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  20. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出"
  21. :class="[checkData.length>0?'btn-dark text-light':'']">导出Excel
  22. </button>
  23. <div class="dropdown-menu">
  24. <a class="dropdown-item" href="javascript:" @click="excelExport(false)">导出勾选内容</a>
  25. <a class="dropdown-item" href="javascript:" @click="excelExport(true)">导出所有页</a>
  26. </div>
  27. </span>
  28. </div>
  29. <div>
  30. <table class="table table-sm table-striped table-hover table-bordered" id="table">
  31. <tbody>
  32. <tr v-for="(item,i) in receiving_tasks"
  33. @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
  34. <td>
  35. <input type="checkbox" class="checkItem" :value="item.id">
  36. </td>
  37. <td v-text="i+1"></td>
  38. <td v-text="item.number"></td>
  39. <td v-text="item.status"></td>
  40. <td v-text="item.owner"></td>
  41. <td>
  42. <template v-for="(asn_no,i) in item.asn_nos">
  43. <div>
  44. <span v-text="asn_no"></span>
  45. </div>
  46. </template>
  47. </td>
  48. <td v-text="item.created_at"></td>
  49. <td v-text="item.warehouse"></td>
  50. <td v-text="item.appointment_number"></td>
  51. <td v-text="item.driving_license_no"></td>
  52. <td v-text="item.receiving_type"></td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. <div class="text-info h5 btn btn">{{$receivingTasks->count()}}/@{{ total }}</div>
  57. {{ $receivingTasks->withQueryString()->links() }}
  58. </div>
  59. </div>
  60. @include('store.receivingTasks._clodop_print')
  61. </div>
  62. @endsection
  63. @section('lastScript')
  64. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  65. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  66. <script type="text/javascript" src="{{asset('js/element-ui.js') }}"></script>
  67. <script type="text/javascript" src="{{mix('js/lodop/LodopFuncs.js')}}"></script>
  68. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  69. <script type="text/javascript" src='http://localhost:18000/CLodopfuncs.js?name=CLODOPA'></script>
  70. <script>
  71. let vue = new Vue({
  72. el: "#list",
  73. data: {
  74. checkData:[],
  75. receiving_tasks: [],
  76. total: 0,
  77. selectTr: 0,
  78. owners: [
  79. @foreach($owners as $owner)
  80. {
  81. name: '{{$owner->id}}', value: '{{$owner->name}}'
  82. },
  83. @endforeach
  84. ],
  85. warehouses: [
  86. @foreach($warehouses as $warehouse)
  87. {
  88. name: '{{$warehouse->id}}', value: '{{$warehouse->name}}'
  89. },
  90. @endforeach
  91. ],
  92. receiving_task_print: {
  93. number: null,
  94. warehouse: null,
  95. for_single_member: null,
  96. driver_name: null,
  97. driver_phone: null,
  98. plate_number: null,
  99. driving_license_no: null,
  100. provide_list: null,
  101. receiving_type: null,
  102. owner: null,
  103. appointment_number: null,
  104. },
  105. clodop: null,
  106. clodopPrintDialogVisible: false,
  107. printerList: [],
  108. print_setting: {
  109. printer_index: 0,
  110. }
  111. },
  112. created() {
  113. },
  114. mounted() {
  115. let receiving_tasks = {!! $receivingTasks->toJson() !!}['data'];
  116. this.receiving_tasks = this.sortReceivingTasks(receiving_tasks);
  117. this.total = {!! $receivingTasks->toJson() !!}['total'];
  118. $("#list").removeClass('d-none');
  119. let data = [[
  120. {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
  121. {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
  122. {name: 'number', type: 'input', tip: '任务号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '任务号'},
  123. {name: 'appointment_number', type: 'input', tip: '预约号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '预约号'},
  124. ], [
  125. {
  126. name: 'owner_id',
  127. type: 'select_multiple_select',
  128. data: this.owners,
  129. tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的货主'],
  130. placeholder: ['货主', '定位或多选货主']
  131. },
  132. {
  133. name: 'warehouse_id',
  134. type: 'select_multiple_select',
  135. data: this.warehouses,
  136. tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的仓库'],
  137. placeholder: ['仓库', '定位或多选仓库']
  138. },
  139. ]];
  140. this.form = new query({
  141. el: '#form_div',
  142. condition: data,
  143. });
  144. this.form.init();
  145. let column = [
  146. {name: 'id', value: '序号', neglect: true},
  147. {name: 'number', value: '收货任务号'},
  148. {name: 'status', value: '状态', neglect: true},
  149. {name: 'owner', value: '货主', neglect: true},
  150. {name: 'asn_nos', value: 'ASN单号', neglect: true},
  151. {name: 'created_at', value: '投单时间'},
  152. {name: 'warehouse', value: '仓库'},
  153. {name: 'appointment_number', value: '预约号'},
  154. {name: 'driving_license_no', value: '驾驶证号'},
  155. {name: 'receiving_type', value: '收货类型'},
  156. ];
  157. let init = new Header({
  158. el: "table",
  159. name: "receiving_tasks",
  160. column: column,
  161. data: this.receiving_tasks,
  162. restorationColumn: 'id',
  163. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  164. });
  165. setTimeout(()=>{
  166. init.init();
  167. },300);
  168. },
  169. methods: {
  170. waitingTempTip(message) {
  171. window.tempTip.setIndex(2005);
  172. window.tempTip.waitingTip(message);
  173. },
  174. successTempTip(message) {
  175. window.tempTip.setDuration(1500);
  176. window.tempTip.setIndex(2005);
  177. window.tempTip.showSuccess(message);
  178. },
  179. errorTempTip(message) {
  180. window.tempTip.setDuration(2000);
  181. window.tempTip.setIndex(2005);
  182. window.tempTip.show(message);
  183. },
  184. sortReceivingTasks(tasks) {
  185. return tasks.map(e => this.sortReceivingTask(e));
  186. },
  187. sortReceivingTask(task) {
  188. let asn_nos = this.sortAsnNos(task);
  189. let driving_license_no = this.getDrivingLicenseNo(task);
  190. let appointment_number = this.getAppointmentNumber(task);
  191. let warehouse = this.getWarehouseName(task);
  192. let owner = this.getOwnerName(task);
  193. return {
  194. id: task.id,
  195. number: task.number,
  196. status: task.status,
  197. asn_nos: asn_nos,
  198. created_at: task.created_at,
  199. warehouse: warehouse,
  200. for_single_member: task.for_single_member,
  201. driver_name: task.driver_name,
  202. driver_phone: task.driver_phone,
  203. plate_number: task.plate_number,
  204. provide_list: task.provide_list,
  205. owner: owner,
  206. appointment_number: appointment_number,
  207. driving_license_no: driving_license_no,
  208. receiving_type: task.receiving_type,
  209. };
  210. },
  211. sortAsnNos(task) {
  212. let items = task.items;
  213. return items.map(e => e.asn_no);
  214. },
  215. getDrivingLicenseNo(task) {
  216. let {delivery_appointment_car, driving_license_no} = task;
  217. let license_plate_number = delivery_appointment_car ? delivery_appointment_car.license_plate_number : '';
  218. return driving_license_no ? driving_license_no : license_plate_number;
  219. },
  220. getAppointmentNumber(task) {
  221. let {delivery_appointment_car} = task;
  222. return delivery_appointment_car ? delivery_appointment_car.appointment_number : '';
  223. },
  224. getWarehouseName(task) {
  225. let {ware_house} = task;
  226. return ware_house ? ware_house.name : '';
  227. },
  228. getOwnerName(task) {
  229. let {owner} = task;
  230. return owner ? owner.name : '';
  231. },
  232. printReceivingTask() {
  233. let message = null;
  234. if (checkData.length > 1) {
  235. message = '进行单个任务打印';
  236. } else if (checkData.length < 1) {
  237. message = '请勾选收货任务';
  238. }
  239. if (message) {
  240. this.errorTempTip(message);
  241. return;
  242. }
  243. let id = checkData[0];
  244. this.receiving_task_print = this.receiving_tasks.find(e => e.id.toString() === id);
  245. this.printLodop();
  246. },
  247. printLodop() {
  248. this.clodop = null;
  249. try {
  250. this.clodop = getLodop();
  251. if ((this.clodop != null) && (typeof (this.clodop.VERSION) != "undefined")) {
  252. this.showPrintDialog();
  253. } else {
  254. this.downloadClodopConfirm();
  255. }
  256. } catch (err) {
  257. this.errorTempTip('getLodop error');
  258. }
  259. },
  260. downloadClodopConfirm() {
  261. this.$confirm('打印组件不存在,是否下载?', '提示', {
  262. confirmButtonText: '确定',
  263. cancelButtonText: '取消',
  264. type: 'warning'
  265. }).then(() => {
  266. // 下载
  267. this.downloadLodop();
  268. }).catch(() => {
  269. // 取消下载
  270. });
  271. },
  272. downloadLodop() {
  273. let url = "{{mix('/js/lodop/CLodop_Setup_for_Win32NT.exe')}}"
  274. window.open(url, '_target');
  275. },
  276. showPrintDialog() { //
  277. this.getPrinterList();
  278. this.clodopPrintDialogVisible = true;
  279. },
  280. getPrinterList() { // 获取打印机列表
  281. this.printerList = [];
  282. let count = this.clodop.GET_PRINTER_COUNT();
  283. for (let i = 0; i < count; i++) {
  284. this.printerList.push({
  285. name: this.clodop.GET_PRINTER_NAME(i),
  286. value: i,
  287. });
  288. }
  289. },
  290. excelExport(sign){
  291. let url = '{{url('store/receivingTask/exportExcel')}}';
  292. let token = '{{ csrf_token() }}';
  293. if (sign) {
  294. excelExport(true, checkData, url, this.total, token);
  295. } else {
  296. excelExport(false, checkData, url, null, token);
  297. }
  298. },
  299. clodopPrint() {
  300. let {
  301. number, // 收货任务号
  302. warehouse, // 仓库
  303. for_single_member, // 投单员
  304. driver_name, // 司机姓名
  305. driver_phone, // 司机电话
  306. plate_number, // 车号牌
  307. driving_license_no, // 驾驶证号
  308. provide_list, // 是否提供清单
  309. receiving_type, // 收货类型
  310. owner, // 货主
  311. appointment_number, // 预约号
  312. } = this.receiving_task_print;
  313. this.clodop.PRINT_INITA(2, 0, 0, 0, "");
  314. this.clodop.SET_PRINT_PAGESIZE(2, '76mm', '130mm');
  315. this.clodop.ADD_PRINT_BARCODE(5, 50, 480, 80, "Code39", number);
  316. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  317. this.clodop.ADD_PRINT_TEXT(100, 15, 100, 20, "收货任务号");
  318. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  319. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  320. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  321. this.clodop.ADD_PRINT_TEXT(130, 15, 100, 20, "仓库");
  322. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  323. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  324. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  325. this.clodop.ADD_PRINT_TEXT(160, 15, 100, 20, "司机姓名");
  326. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  327. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  328. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  329. this.clodop.ADD_PRINT_TEXT(190, 15, 100, 20, "车牌号");
  330. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  331. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  332. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  333. this.clodop.ADD_PRINT_TEXT(220, 15, 100, 20, "是否提供清单");
  334. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  335. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  336. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  337. this.clodop.ADD_PRINT_TEXT(250, 15, 100, 20, "货主");
  338. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  339. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  340. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  341. this.clodop.ADD_PRINT_TEXT(130, 245, 100, 20, "投单员");
  342. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  343. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  344. this.clodop.ADD_PRINT_TEXT(160, 245, 100, 20, "司机电话");
  345. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  346. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  347. this.clodop.ADD_PRINT_TEXT(190, 245, 100, 20, "驾驶证号");
  348. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  349. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  350. this.clodop.ADD_PRINT_TEXT(220, 245, 100, 20, "收货类型");
  351. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  352. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  353. this.clodop.ADD_PRINT_TEXT(250, 245, 100, 20, "预约号");
  354. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  355. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  356. this.clodop.ADD_PRINT_TEXT(100, 115, 250, 20, number); // number
  357. this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
  358. this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
  359. this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
  360. this.clodop.ADD_PRINT_TEXT(130, 115, 130, 20, warehouse); // warehouse
  361. this.clodop.ADD_PRINT_TEXT(160, 115, 100, 20, driver_name); //driver_name
  362. this.clodop.ADD_PRINT_TEXT(190, 115, 130, 20, plate_number); //plate_number
  363. this.clodop.ADD_PRINT_TEXT(220, 115, 100, 20, provide_list); //provide_list
  364. this.clodop.ADD_PRINT_TEXT(250, 115, 130, 20, owner); // owner
  365. this.clodop.ADD_PRINT_TEXT(130, 345, 100, 20, for_single_member); // for_single_member
  366. this.clodop.ADD_PRINT_TEXT(160, 345, 140, 20, driver_phone); // driver_phone
  367. this.clodop.ADD_PRINT_TEXT(190, 345, 140, 20, driving_license_no); // driving_license_no
  368. this.clodop.ADD_PRINT_TEXT(220, 345, 100, 20, receiving_type); // receiving_type
  369. this.clodop.ADD_PRINT_TEXT(250, 345, 140, 20, appointment_number); //appointment_number
  370. this.clodop.PREVIEW();
  371. this.clodopPrintDialogVisible = false;
  372. }
  373. },
  374. })
  375. </script>
  376. @endsection