mission.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. @extends('layouts.app')
  2. @section('title')盘收一体-任务@endsection
  3. @section('content')
  4. <div id="container" class="d-none container-fluid">
  5. <span>
  6. @component('store.menu')@endcomponent
  7. @component('store.checkingReceive.menu')@endcomponent
  8. </span>
  9. <div class="modal fade" id="import" tabindex="-1" role="dialog" aria-hidden="true">
  10. <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
  11. <div class="modal-content">
  12. <div class="modal-body" style="text-align:center;height: 150px">
  13. <button type="button" id="popover" class="btn btn-danger"
  14. data-container="body" data-toggle="popover" data-placement="bottom"
  15. :data-content="popoverContent" data-html="true">
  16. 部分数据导入失败
  17. </button>
  18. <div class="mt-5">
  19. <label>
  20. <input name="file" hidden type="file" class="col-5" id="excelFile" @change="getFile($event)"
  21. accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
  22. </label>
  23. <button class="btn btn-dark col-5" @click="$('#excelFile').trigger('click');">选择Excel文件</button><br>
  24. <small class="text-primary">@{{ excel.file ? excel.file.name : '' }}</small>
  25. </div>
  26. </div>
  27. <div class="modal-footer">
  28. <button class="col-12 btn btn-success" @click="importMission()">开始导入</button>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div id="form_div"></div>
  34. <div class="ml-2">
  35. <button class="btn btn-sm btn-outline-info" @click="openImport()">导入</button>
  36. </div>
  37. <label for="all" class="d-none" id="cloneCheckAll">
  38. <input id="all" type="checkbox" @click="checkAll($event)">全选
  39. </label>
  40. <table class="table table-sm text-nowrap table-bordered d-none" id="headerRoll"></table>
  41. <table class="table table-striped table-sm text-nowrap table-hover mt-1" id="headerParent">
  42. <tr id="header"></tr>
  43. <tr v-for="(storeCheckingReceive,i) in storeCheckingReceives">
  44. <td>
  45. <label><input class="checkItem" type="checkbox" :value="storeCheckingReceives.id" v-model="checkData" /></label>
  46. </td>
  47. <td>@{{ i+1 }}</td>
  48. <td>@{{ storeCheckingReceive.id }}</td>
  49. <td>@{{ storeCheckingReceive.owner_name }}</td>
  50. <td>@{{ storeCheckingReceive.status }}</td>
  51. <td>@{{ storeCheckingReceive.is_receive_diff }}</td>
  52. <td>@{{ storeCheckingReceive.asn }}</td>
  53. <td>@{{ storeCheckingReceive.is_asn_diff }}</td>
  54. <td>@{{ storeCheckingReceive.created_at }}</td>
  55. <td>
  56. @can('入库管理-盘收一体-盘收')<a target="_blank" :href="'{{url('store/checkReceive/mission')}}/'+storeCheckingReceive.id">
  57. <button class="btn btn-sm btn-outline-success">盘收</button>
  58. </a>@endcan
  59. </td>
  60. </tr>
  61. </table>
  62. {{$storeCheckingReceives->appends($params)->links()}}
  63. </div>
  64. @stop
  65. @section('lastScript')
  66. <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
  67. <script type="text/javascript" src="{{asset('js/queryForm/queryForm200914.js')}}"></script>
  68. <script>
  69. let vue = new Vue({
  70. el:"#container",
  71. data:{
  72. storeCheckingReceives:[
  73. @foreach($storeCheckingReceives as $storeCheckingReceive)
  74. {id:'{{$storeCheckingReceive->id}}',owner_name:'{{$storeCheckingReceive->owner ? $storeCheckingReceive->owner->name : ''}}',
  75. created_at:'{{$storeCheckingReceive->created_at}}',status:'{{$storeCheckingReceive->status}}',
  76. is_receive_diff:'{{$storeCheckingReceive->is_receive_diff}}',asn:'{{$storeCheckingReceive->asn}}',
  77. is_asn_diff:'{{$storeCheckingReceive->is_asn_diff}}',
  78. },
  79. @endforeach
  80. ],
  81. owners:[
  82. @foreach($owners as $owner)
  83. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  84. @endforeach
  85. ],
  86. checkData:[],
  87. sum:Number('{{$storeCheckingReceives->total()}}'),
  88. excel : {
  89. file : null,
  90. },
  91. popoverContent:'',
  92. },
  93. mounted(){
  94. $('#container').removeClass('d-none');
  95. $(".tooltipTarget").tooltip({'trigger':'hover'});
  96. let _this = this;
  97. let data = [[
  98. {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间'},
  99. {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的结束时间'},
  100. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
  101. placeholder:['货主','定位或多选货主'],data:_this.owners},
  102. {name:'asn',type:'input',tip:'ASN单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'ASN单号'},
  103. ]];
  104. _this.form = new query({
  105. el:'#form_div',
  106. condition:data,
  107. });
  108. _this.form.init();
  109. let column = [
  110. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  111. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  112. {name:'index',value: '序号', neglect: true},
  113. {name:'id',value: 'ID', neglect: true},
  114. {name:'owner_name',value: '货主'},
  115. {name:'status',value: '状态'},
  116. {name:'is_receive_diff',value: '收货差异'},
  117. {name:'asn',value: 'ASN单号'},
  118. {name:'is_asn_diff',value: 'ASN差异'},
  119. {name:'created_at',value: '创建时间'},
  120. {name:'operating',value: '操作', neglect: true},
  121. ];
  122. setTimeout(function () {
  123. let header = new Header({
  124. el: "#header",
  125. column: column,
  126. data: _this.storeCheckingReceives,
  127. restorationColumn: 'id',
  128. vue:vue,
  129. });
  130. header.init();
  131. },0);
  132. },
  133. methods:{
  134. checkAll(event){
  135. if (event.target.checked){
  136. this.packages.forEach((el)=>{
  137. if (this.checkData.indexOf(el.id) === '-1'){
  138. this.checkData.push(el.id);
  139. }
  140. });
  141. }else this.checkData = [];
  142. },
  143. getFile(e){
  144. this.excel.file = e.target.files[0];
  145. },
  146. openImport(){
  147. $("#popover").attr('hidden','hidden');
  148. $('#import').modal('show');
  149. },
  150. importMission(){
  151. if (!this.excel.file){
  152. tempTip.setDuration(3000);
  153. tempTip.setIndex(1099);
  154. tempTip.showSuccess('未选择任何文件!');
  155. return;
  156. }
  157. let formData = new FormData();
  158. formData.append("file",this.excel.file);
  159. axios.post('{{url('store/checkReceive/mission/import')}}',formData,{
  160. 'Content-Type':'multipart/form-data'
  161. })
  162. .then(res=>{
  163. if (res.data.success){
  164. let receive = res.data.data;
  165. let storeCheckingReceive = {
  166. id:receive.id,owner_name:receive.owner_name,created_at:receive.created_at,
  167. status:receive.status,is_receive_diff:receive.is_receive_diff,asn:receive.asn,
  168. is_asn_diff:receive.is_asn_diff
  169. };
  170. this.storeCheckingReceives.unshift(storeCheckingReceive);
  171. console.log(this.storeCheckingReceives);
  172. if (res.data.errors.length < 1) $("#import").modal('hide');
  173. else this.writeErrorText(res.data.errors);
  174. tempTip.setDuration(2000);
  175. tempTip.setIndex(1099);
  176. tempTip.showSuccess("任务导入成功");
  177. return true;
  178. }
  179. if (res.data.errors && res.data.errors.length > 0){
  180. this.writeErrorText(res.data.errors)
  181. return true;
  182. }
  183. tempTip.setDuration(3000);
  184. tempTip.setIndex(1099);
  185. tempTip.show(res.data.data);
  186. }).catch(err=> {
  187. tempTip.setDuration(3000);
  188. tempTip.show("网络错误:"+err);
  189. })
  190. },
  191. writeErrorText(errors){
  192. let content = '';
  193. for (let i in errors){
  194. content += errors[i]+"</br>";
  195. }
  196. this.popoverContent = content;
  197. setTimeout(function () {
  198. $("#popover").removeAttr('hidden').popover('show');
  199. },0);
  200. }
  201. },
  202. });
  203. </script>
  204. @stop