index.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. @extends('layouts.app')
  2. @section('title')订单管理-指定分配@endsection
  3. @section('content')
  4. @component('order.index.menu')@endcomponent
  5. <div class="container-fluid d-none" id="container">
  6. @include("order.index._importModal")
  7. <div class="card">
  8. <div class="card-body">
  9. <button class="btn btn-outline-info mb-1" data-toggle="modal" data-target="#importModal">导入</button>
  10. <table class="table table-striped table-hover" id="headerParent">
  11. <tr id="header"></tr>
  12. <tr v-for="(model,i) in models">
  13. <td>@{{ i+1 }}</td>
  14. <td>@{{ model.orderNumber }}</td>
  15. <td>@{{ model.barcode }}</td>
  16. <td>@{{ model.amount }}</td>
  17. <td>@{{ model.producedAt }}</td>
  18. <td>@{{ model.validAt }}</td>
  19. <td>@{{ model.batchNumber }}</td>
  20. <td>@{{ model.location }}</td>
  21. <td>@{{ model.region }}</td>
  22. <td>@{{ model.createdAt }}</td>
  23. <td>@{{ model.userName }}</td>
  24. </tr>
  25. </table>
  26. </div>
  27. </div>
  28. {{$assigns->links()}}
  29. </div>
  30. @endsection
  31. @section('lastScript')
  32. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  33. <script>
  34. new Vue({
  35. el:"#container",
  36. data:{
  37. models:[
  38. @foreach($assigns as $assign)
  39. {
  40. orderNumber:"{{$assign->order ? $assign->order->code : ''}}",
  41. barcode:"{{$assign->commodity ? $assign->commodity->barcode : ''}}",
  42. amount:"{{$assign->amount}}",
  43. producedAt:"{{$assign->produced_at}}",
  44. validAt:"{{$assign->valid_at}}",
  45. batchNumber:"{{$assign->batch_number}}",
  46. location:"{{$assign->location}}",
  47. region:"{{$assign->region}}",
  48. createdAt:"{{$assign->created_at}}",
  49. userName:"{{$assign->user ? $assign->user->name : 'system'}}",
  50. },
  51. @endforeach
  52. ],
  53. isShowError : false,
  54. errors:[],
  55. },
  56. mounted(){
  57. $("#container").removeClass("d-none");
  58. let column = [
  59. {name:'index',value: '序号', neglect: true},
  60. {name:'orderNumber',value: '订单编号'},
  61. {name:'barcode',value: '商品条码'},
  62. {name:'amount',value: '数量', neglect: true},
  63. {name:'producedAt',value: '生产日期'},
  64. {name:'validAt',value: '失效日期'},
  65. {name:'batchNumber',value: '批次号'},
  66. {name:'location',value: '库位'},
  67. {name:'region',value: '库区'},
  68. {name:'createdAt',value: '导入日期'},
  69. {name:'userName',value: '操作人'},
  70. ];
  71. let header = new Header({
  72. el: "#header",
  73. column: column,
  74. data: this.models,
  75. restorationColumn: 'id',
  76. });
  77. header.init();
  78. },
  79. methods:{
  80. selectFile(){
  81. $("#file").click();
  82. },
  83. importAssign(e){
  84. let file=e.target.files[0];
  85. if (!file){
  86. tempTip.setDuration(3000);
  87. tempTip.setIndex(1099);
  88. tempTip.show("未选择文件");
  89. return;
  90. }
  91. let formData = new FormData();
  92. formData.append("file",file);
  93. window.tempTip.setIndex(1099);
  94. window.tempTip.setDuration(9999);
  95. window.tempTip.waitingTip("执行中,请耐心等候......");
  96. axios.post('{{url('order/index/commodityAssign/import')}}',formData,{
  97. 'Content-Type':'multipart/form-data'
  98. })
  99. .then(res=>{
  100. if (res.data.success) {
  101. if (res.data.data.length>0) {
  102. this.models.unshift.apply(this.models,res.data.data);
  103. if (this.models.length>50) this.models.split(50);
  104. }
  105. this.errors = res.data.errors;
  106. tempTip.cancelWaitingTip();
  107. tempTip.setDuration(2000);
  108. tempTip.showSuccess("导入成功!");
  109. return;
  110. }
  111. tempTip.cancelWaitingTip();
  112. tempTip.setDuration(3000);
  113. tempTip.show(res.data.data);
  114. }).catch(err=> {
  115. tempTip.cancelWaitingTip();
  116. tempTip.setDuration(3000);
  117. tempTip.show("网络错误:"+err);
  118. })
  119. }
  120. },
  121. });
  122. </script>
  123. @endsection