index.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 td-min-width-80" id="table">
  11. <tr v-for="(model,i) in models" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
  12. <td><span>@{{ i+1 }}</span></td>
  13. <td><span>@{{ model.orderNumber }}</span></td>
  14. <td><span>@{{ model.barcode }}</span></td>
  15. <td><span>@{{ model.amount }}</span></td>
  16. <td><span>@{{ model.producedAt }}</span></td>
  17. <td><span>@{{ model.validAt }}</span></td>
  18. <td><span>@{{ model.batchNumber }}</span></td>
  19. <td><span>@{{ model.location }}</span></td>
  20. <td><span>@{{ model.region }}</span></td>
  21. <td><span>@{{ model.createdAt }}</span></td>
  22. <td><span>@{{ model.userName }}</span></td>
  23. </tr>
  24. </table>
  25. </div>
  26. </div>
  27. {{$assigns->links()}}
  28. </div>
  29. @endsection
  30. @section('lastScript')
  31. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  32. <script>
  33. new Vue({
  34. el:"#container",
  35. data:{
  36. models:[
  37. @foreach($assigns as $assign)
  38. {
  39. orderNumber:"{{$assign->order ? $assign->order->code : ''}}",
  40. barcode:"{{$assign->commodity ? $assign->commodity->barcode : ''}}",
  41. amount:"{{$assign->amount}}",
  42. producedAt:"{{$assign->produced_at}}",
  43. validAt:"{{$assign->valid_at}}",
  44. batchNumber:"{{$assign->batch_number}}",
  45. location:"{{$assign->location}}",
  46. region:"{{$assign->region}}",
  47. createdAt:"{{$assign->created_at}}",
  48. userName:"{{$assign->user ? $assign->user->name : 'system'}}",
  49. },
  50. @endforeach
  51. ],
  52. isShowError : false,
  53. errors:[],
  54. selectTr:''
  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. new Header({
  72. el: "table",
  73. name: "orderIndex",
  74. column: column,
  75. data: this.models,
  76. }).init();
  77. },
  78. methods:{
  79. selectFile(){
  80. $("#file").click();
  81. },
  82. importAssign(e){
  83. let file=e.target.files[0];
  84. if (!file){
  85. window.tempTip.setDuration(3000);
  86. window.tempTip.setIndex(1099);
  87. window.tempTip.show("未选择文件");
  88. return;
  89. }
  90. let formData = new FormData();
  91. formData.append("file",file);
  92. window.tempTip.setIndex(1099);
  93. window.tempTip.setDuration(9999);
  94. window.tempTip.waitingTip("执行中,请耐心等候......");
  95. window.axios.post('{{url('order/index/commodityAssign/import')}}',formData,{
  96. 'Content-Type':'multipart/form-data'
  97. })
  98. .then(res=>{
  99. if (res.data.success) {
  100. this.errors = res.data.errors;
  101. this.isShowError = true;
  102. window.tempTip.cancelWaitingTip();
  103. window.tempTip.setDuration(2000);
  104. if (res.data.data.length>0) {
  105. this.models.unshift.apply(this.models,res.data.data);
  106. if (this.models.length>50) this.models = this.models.split(50);
  107. window.tempTip.showSuccess("导入成功!");
  108. }else {
  109. window.tempTip.setDuration(3000);
  110. window.tempTip.show("导入失败!");
  111. }
  112. return;
  113. }
  114. window.tempTip.cancelWaitingTip();
  115. window.tempTip.setDuration(3000);
  116. window.tempTip.show(res.data.data);
  117. }).catch(err=> {
  118. window.tempTip.cancelWaitingTip();
  119. window.tempTip.setDuration(3000);
  120. window.tempTip.show("网络错误:"+err);
  121. })
  122. }
  123. },
  124. });
  125. </script>
  126. @endsection