recycle.blade.php 4.9 KB

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