index.blade.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. @extends('layouts.app')
  2. @section('title')称重管理@endsection
  3. @section('content')
  4. <span id="nav2">
  5. @component('store.menu')@endcomponent
  6. </span>
  7. <div class="d-none" id="fast">
  8. <div class="container-fluid">
  9. <div class="">
  10. <table class="table table-striped table-sm text-nowrap table-hover">
  11. <tr>
  12. <th>
  13. <label for="all">
  14. <input id="all" type="checkbox" @click="checkAll($event)">全选
  15. </label>
  16. </th>
  17. <th>序号</th>
  18. <th>ID</th>
  19. <th>ASN编号</th>
  20. <th>仓库</th>
  21. <th>货主</th>
  22. <th>入库类型</th>
  23. <th>状态</th>
  24. <th>备注</th>
  25. <th>生成时间</th>
  26. </tr>
  27. <tr v-for="(store,i) in stores">
  28. <td>
  29. <input class="checkItem" type="checkbox" :value="store.id" v-model="checkData">
  30. </td>
  31. <td>@{{ i+1 }}</td>
  32. <td>@{{store.id}}</td>
  33. <td class="text-muted">@{{store.asn_code}}</td>
  34. <td>@{{store.warehouse_name}}</td>
  35. <td class="text-muted">@{{store.owner_name}}</td>
  36. <td class="text-muted">@{{store.stored_method}}</td>
  37. <td class="text-muted">@{{store.status}}</td>
  38. <td>@{{store.remark}}</td>
  39. <td class="text-muted">@{{store.created_at}}</td>
  40. </tr>
  41. </table>
  42. <div class="text-info h5 btn btn">{{$stores->count()}}/{{$stores->total()}}</div>
  43. {{$stores->links()}}
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. @endsection
  49. @section('lastScript')
  50. <script>
  51. new Vue({
  52. el:'#fast',
  53. data:{
  54. stores:[
  55. @foreach($stores as $store)
  56. {!! $store !!},
  57. @endforeach
  58. ],
  59. checkData:[]
  60. },
  61. mounted:function(){
  62. /*this.initInputs();
  63. $(".tooltipTarget").tooltip({'trigger':'hover'});*/
  64. $('#fast').removeClass('d-none');
  65. },
  66. watch:{
  67. checkData:{
  68. handler(){
  69. if (this.checkData.length === this.stores.length){
  70. document.querySelector('#all').checked = true;
  71. }else {
  72. document.querySelector('#all').checked = false;
  73. }
  74. },
  75. deep:true
  76. }
  77. },
  78. methods:{
  79. checkAll(e){
  80. if (e.target.checked){
  81. this.stores.forEach((el,i)=>{
  82. if (this.checkData.indexOf(el.id) == '-1'){
  83. this.checkData.push(el.id);
  84. }
  85. });
  86. }else {
  87. this.checkData = [];
  88. }
  89. },
  90. }
  91. });
  92. </script>
  93. @endsection