mission.blade.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. @extends('layouts.app')
  2. @section('title')盘点-任务@endsection
  3. @section('content')
  4. @component('inventory.stockInventory.menu')@endcomponent
  5. <div id="list" class="container-fluid" style="min-width: 1500px">
  6. <div id="form_div"></div>
  7. <span class="dropdown">
  8. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  9. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  10. 导出Excel
  11. </button>
  12. <div class="dropdown-menu">
  13. <a class="dropdown-item" @click="inventoryExport(false)" href="javascript:">导出勾选内容</a>
  14. <a class="dropdown-item" @click="inventoryExport(true)" href="javascript:">导出所有页</a>
  15. </div>
  16. </span>
  17. @can('库存管理-盘点')
  18. <span v-if="formData.date_start&&formData.date_end" class="btn btn-sm btn-outline-secondary tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成动盘任务</span>
  19. <span v-else class="btn btn-sm btn-outline-secondary tooltipTarget" @click="createInventoryMission" title="选择单一指定货主生成盘点任务">生成全盘任务</span>
  20. @endcan
  21. <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
  22. <tr>
  23. <th>
  24. <label for="all">
  25. <input id="all" type="checkbox" @click="checkAll($event)">全选
  26. </label>
  27. </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. <th>已盘点数</th>
  38. <th>剩余数</th>
  39. <th>复盘差异</th>
  40. <th>复盘归位</th>
  41. <th>操作</th>
  42. </tr>
  43. <tr v-for="(inventory,i) in inventories" @click="selectedColor(inventory.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
  44. <td>
  45. <input class="checkItem" type="checkbox" :value="inventory.id" v-model="checkData">
  46. </td>
  47. <td>
  48. <span class="btn btn-sm btn-outline-info" @click="enterStockInventory(inventory.id)">进入</span>
  49. </td>
  50. <td >@{{ i+1 }}</td>
  51. <td >@{{ inventory.id }}</td>
  52. <td >@{{ inventory.created_at }}</td>
  53. <td ><span v-if="inventory.owner">@{{ inventory.owner.name }}</span></td>
  54. <td >@{{ inventory.type }}</td>
  55. <td >@{{ inventory.start_at }}</td>
  56. <td class="text-muted">@{{ inventory.end_at }}</td>
  57. <td >@{{ inventory.total }}</td>
  58. <td >@{{ inventory.processed }}</td>
  59. <td >@{{ inventory.surplus }}</td>
  60. <td>@{{ inventory.difference }}</td>
  61. <td>@{{ inventory.returned }}</td>
  62. <td>
  63. <span class="btn btn-sm btn-outline-danger" @click="deleteStockInventoryMission(inventory.id)">删除</span>
  64. </td>
  65. </tr>
  66. </table>
  67. <div class="text-info h5 btn btn">{{$inventories->count()}}/@{{ sum }}</div>
  68. <div>{{$inventories->appends($paginateParams)->links()}}</div>
  69. </div>
  70. @endsection
  71. @section('lastScript')
  72. <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
  73. <script type="text/javascript" src="{{asset('js/queryForm/queryForm200805b.js')}}"></script>
  74. <script>
  75. new Vue({
  76. el: "#list",
  77. data: {
  78. inventories:{!! $inventories->toJson()!!}['data'],
  79. owners: [
  80. @foreach($owners as $owner)
  81. {
  82. name: '{{$owner->id}}', value: '{{$owner->name}}'
  83. },
  84. @endforeach
  85. ],
  86. checkData: [],
  87. selectedStyle:'',
  88. sum:{!! $inventories->total() !!},
  89. formData:{},
  90. },
  91. mounted: function () {
  92. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  93. $("#list").removeClass('d-none');
  94. let data=[
  95. [
  96. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
  97. placeholder:['货主','定位或多选货主'],data:this.owners},
  98. {name:'date_start',type:'dateTime',tip:'选择创建日期的开始时间',},
  99. {name:'date_end',type:'dateTime',tip:'选择创建日期的结束时间',},
  100. ],
  101. ];
  102. this.form = new query({
  103. el:'#form_div',
  104. condition:data,
  105. });
  106. this.form.init();
  107. let obj=this.form.getSearchData();
  108. this.formData=obj;
  109. },
  110. methods:{
  111. selectedColor(id){
  112. if (id==this.selectedStyle){
  113. this.selectedStyle='';
  114. return;
  115. }
  116. this.selectedStyle=id;
  117. },
  118. checkAll(e){
  119. if (e.target.checked){
  120. this.inventories.forEach((el,i)=>{
  121. if (this.checkData.indexOf(el.id) == '-1'){
  122. this.checkData.push(el.id);
  123. }
  124. });
  125. }else {
  126. this.checkData = [];
  127. }
  128. },
  129. inventoryExport(checkAllSign){
  130. let url = '{{url('inventory/stockInventoryExport')}}';
  131. let token='{{ csrf_token() }}';
  132. excelExport(checkAllSign,this.checkData,url,this.sum,token);
  133. },
  134. //生成盘点任务
  135. createInventoryMission(){
  136. let _this=this;
  137. if (_this.formData.owner_id.length<=0){
  138. tempTip.setDuration(1000);
  139. tempTip.show('生成盘点任务失败'+' '+'请先选择货主!');
  140. return;
  141. }
  142. let url='{{url('inventory/stockInventory/createStockInventoryMission')}}';
  143. axios.post(url,{formData:_this.formData}).then(function (response) {
  144. if(!response.data.success){
  145. tempTip.setDuration(1000);
  146. tempTip.show('生成盘点任务失败'+' '+response.data.data);
  147. return;
  148. }else{
  149. let inventory=response.data.data;
  150. _this.inventories.push(inventory);
  151. tempTip.setDuration(2000);
  152. tempTip.showSuccess('生成盘点任务成功!');
  153. }
  154. })
  155. .catch(function (err) {
  156. tempTip.setDuration(3000);
  157. tempTip.show('生成盘点任务失败!'+'网络错误:' + err);
  158. });
  159. },
  160. //进入盘点中页面 或者复盘页面
  161. enterStockInventory(id){
  162. location.href='{{url('inventory/stockInventory/enterStockInventory')}}/'+id;
  163. },
  164. //删除盘点任务
  165. deleteStockInventoryMission(id){
  166. if(!confirm('确定要删除盘点单号为:“'+id+'”的运单吗?')){return};
  167. let url = '{{url('inventory/deleteStockInventoryMission')}}/'+id;
  168. axios.delete(url).then(
  169. function (response) {
  170. if(!response.data.success){
  171. tempTip.setDuration(3000);
  172. tempTip.show('盘点单号:'+id+'删除失败!');
  173. }else {
  174. tempTip.setDuration(3000);
  175. tempTip.showSuccess('盘点单号:'+id+'删除成功!');
  176. setInterval(function () {
  177. window.location.reload();
  178. },1000)
  179. }
  180. }
  181. ).catch(function (err) {
  182. tempTip.setDuration(3000);
  183. tempTip.show('删除失败,网络链接错误!'+err);
  184. });
  185. },
  186. }
  187. });
  188. </script>
  189. @endsection