recycle.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. @extends('layouts.app')
  2. @section('title')回收站-二次加工管理@endsection
  3. @section('content')
  4. <span id="nav2">
  5. @component('process.menu')@endcomponent
  6. </span>
  7. <div id="page" class="d-none container-fluid">
  8. <div class="card">
  9. <div class="card-header form-inline">
  10. <select v-model="paginate" class="form-control form-control-sm" style="max-width: 100px">
  11. <option value="50">显示50条</option>
  12. <option value="100">显示100条</option>
  13. <option value="200">显示200条</option>
  14. <option value="500">显示500条</option>
  15. <option value="1000">显示1000条</option>
  16. </select>
  17. <button class="btn btn-sm btn-outline-danger ml-2" @click="recover()">恢复</button>
  18. </div>
  19. <div class="card-body">
  20. <table class="table table-hover table-striped text-nowrap table-bordered">
  21. <tr>
  22. <th>
  23. <label for="all">
  24. <input id="all" type="checkbox" @click="checkAll($event)">全选
  25. </label>
  26. </th>
  27. <th>序号</th>
  28. <th>任务号</th>
  29. <th>货主</th>
  30. <th>作业类型</th>
  31. <th>单价</th>
  32. <th>数量</th>
  33. <th>备注</th>
  34. <th>状态</th>
  35. <th>创建时间</th>
  36. <th>删除时间</th>
  37. </tr>
  38. <tr v-for="(process,i) in processes">
  39. <td v-if="process.id">
  40. <input class="checkItem" type="checkbox" :value="process.id" v-model="checkData">
  41. </td>
  42. <td>@{{ i+1 }}</td>
  43. <td>@{{ process.code }}</td>
  44. <td>@{{ process.owner_name }}</td>
  45. <td class="text-danger font-weight-bold">@{{ process.process_method_name }}</td>
  46. <td>@{{ process.unit_price }}</td>
  47. <td>@{{ process.completed_amount }}</td>
  48. <td>@{{ process.remark }}</td>
  49. <td class="text-danger">@{{ process.status }}</td>
  50. <td>@{{ process.created_at }}</td>
  51. <td>@{{ process.deleted_at }}</td>
  52. </tr>
  53. </table>
  54. </div>
  55. </div>
  56. </div>
  57. @stop
  58. @section('lastScript')
  59. <script>
  60. new Vue({
  61. el:"#page",
  62. data:{
  63. processes:[
  64. @foreach($processes as $process)
  65. {!! $process !!},
  66. @endforeach
  67. ],
  68. paginate:50,
  69. checkData:[],
  70. },
  71. mounted(){
  72. $("#page").removeClass('d-none');
  73. },
  74. methods:{
  75. //全选事件
  76. checkAll(e){
  77. if (e.target.checked){
  78. this.processes.forEach((el,i)=>{
  79. if (this.checkData.indexOf(el.id) == '-1'){
  80. this.checkData.push(el.id);
  81. }
  82. });
  83. }else {
  84. this.checkData = [];
  85. }
  86. },
  87. recover(){
  88. tempTip.setDuration(3000);
  89. if (this.checkData.length<1){
  90. tempTip.showSuccess('尚未未选择需要恢复单!');
  91. return;
  92. }
  93. let checkData=this.checkData;
  94. let _this=this;
  95. let delArr=[];
  96. if (!confirm('确定要恢复所选内容吗?'))return;
  97. axios.post('{{url('process/recover')}}',{checkData:checkData})
  98. .then(function (response) {
  99. if (response.data.success){
  100. checkData.forEach(function (data) {
  101. _this.processes.every(function (process,i) {
  102. if (data===process.id){
  103. delArr.unshift(i);return false;
  104. }
  105. return true;
  106. });
  107. });
  108. delArr.forEach(function (item) {
  109. _this.$delete(_this.processes,item);
  110. });
  111. tempTip.showSuccess('恢复成功!');
  112. return;
  113. }
  114. tempTip.show('恢复失败,未知错误!');
  115. }).catch(function (err) {
  116. tempTip.show('恢复失败,网络错误:'+err);
  117. });
  118. }
  119. },
  120. });
  121. </script>
  122. @stop