index.blade.php 18 KB

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