changeInventory.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. @extends('layouts.app')
  2. @section('title')库存管理@endsection
  3. @section('content')
  4. @component('inventory.statement.menu')@endcomponent
  5. <div id="list" class="d-none card container-fluid" style="min-width: 1500px">
  6. <form method="GET" action="{{url('inventory/statement/changeInventory')}}" id="form">
  7. <table class="table table-sm table-bordered text-nowrap mb-0">
  8. <tr v-if="isBeingFilterConditions">
  9. <td colspan="10">
  10. <div class="col" style="padding:0">
  11. <a href="{{url('inventory/statement/changeInventory')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
  12. </div></td>
  13. </tr>
  14. <tr>
  15. <td >
  16. <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control form-control-sm" style="vertical-align: middle;max-width: 100px" @change="submit">
  17. <option value="50">50行</option>
  18. <option value="100">100行</option>
  19. <option value="200">200行</option>
  20. <option value="500">500行</option>
  21. <option value="1000">1000行</option>
  22. </select></td>
  23. <td >
  24. <div class="form-inline">
  25. <input type="date" name="date_start" style="max-width: 150px" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的起始时间"
  26. v-model="filterData.date_start" :class="filterData.created_at_start?'bg-warning':''">
  27. <select v-model="filterData.range" name="range" @change="submit" title="查询内容的日期范围" class="form-control form-control-sm tooltipTarget m-2">
  28. <option value="1">近一天</option>
  29. <option value="3">近三天</option>
  30. <option value="7">近七天</option>
  31. <option value="30">近三十天</option>
  32. </select></div>
  33. </td>
  34. <td>
  35. <input name="TOLocation" style="max-width: 200px" v-model="filterData.TOLocation" class="form-control form-control-sm tooltipTarget" placeholder="库位" :class="filterData.TOLocation?'bg-warning':''">
  36. </td>
  37. <td >
  38. <input name="LotAtt05" style="max-width: 200px" v-model="filterData.LotAtt05" class="form-control form-control-sm tooltipTarget" placeholder="属性仓" :class="filterData.LotAtt05?'bg-warning':''">
  39. </td>
  40. <td >
  41. <input style="max-width: 150px" type="date" class="form-control form-control-sm tooltipTarget" name="LotAtt02_start" title="选择显示失效日期的起始时间"
  42. v-model="filterData.LotAtt02_start" :class="filterData.LotAtt02_start?'bg-warning':''" >
  43. </td>
  44. <td colspan="5"></td>
  45. </tr>
  46. <tr>
  47. <td >
  48. <div class="form-inline">
  49. <input type="text" class="form-control form-control-sm tooltipTarget" placeholder="客户"
  50. style="width:70px" @input="owner_seek"
  51. title="输入关键词快速定位下拉列表,回车确定">
  52. <select name="descr_c" v-model="filterData.descr_c" @change="submit" style="max-width: 100px" class="form-control form-control-sm tooltipTarget" title="选择要显示的客户" :class="filterData.descr_c?'bg-warning':''">
  53. <option > </option>
  54. <option v-for="owner in owners" :value="owner.descr_c" >@{{owner.descr_c}}</option>
  55. </select></div>
  56. </td>
  57. <td >
  58. <input style="max-width: 150px" type="date" class="form-control form-control-sm tooltipTarget" name="date_end" title="选择显示指定日期的结束时间"
  59. v-model="filterData.date_end" :class="filterData.created_at_end?'bg-warning':''" >
  60. </td>
  61. <td>
  62. <input style="max-width: 200px" name="SKU" v-model="filterData.SKU" class="form-control form-control-sm tooltipTarget" placeholder="产品编码" :class="filterData.SKU?'bg-warning':''">
  63. </td>
  64. <td >
  65. <input style="max-width: 200px" name="ALTERNATE_SKU1" v-model="filterData.ALTERNATE_SKU1" class="form-control form-control-sm tooltipTarget" placeholder="产品条码" :class="filterData.ALTERNATE_SKU1?'bg-warning':''">
  66. </td>
  67. <td >
  68. <input style="max-width: 150px" type="date" class="form-control form-control-sm tooltipTarget" name="LotAtt02_end" title="选择显示失效日期的结束时间"
  69. v-model="filterData.LotAtt02_end" :class="filterData.LotAtt02_end?'bg-warning':''" >
  70. </td>
  71. <td colspan="5">
  72. <input type="submit" class="btn btn-sm btn-outline-dark pull-left" value="按条件搜索">
  73. </td>
  74. </tr>
  75. <tr>
  76. <td colspan="9">
  77. <span class="dropdown">
  78. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  79. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  80. 导出Excel
  81. </button>
  82. <div class="dropdown-menu">
  83. <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
  84. <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
  85. </div>
  86. </span>
  87. </td>
  88. </tr>
  89. </table>
  90. </form>
  91. <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2">
  92. <tr>
  93. <th>
  94. <label for="all">
  95. <input id="all" type="checkbox" @click="checkAll($event)">全选
  96. </label>
  97. </th>
  98. <th>序号</th>
  99. <th>货主</th>
  100. <th>库位</th>
  101. <th>产品编码</th>
  102. <th>产品条码</th>
  103. <th>商品名称</th>
  104. <th>属性仓</th>
  105. <th>质量状态</th>
  106. <th>失效日期</th>
  107. <th>批号</th>
  108. <th>移出数量</th>
  109. <th>移入数量</th>
  110. <th>在库数量</th>
  111. <th>占用数量</th>
  112. </tr>
  113. <tr v-for="(oracleActTransactingLog,i) in oracleActTransactingLogs">
  114. <td>
  115. <input class="checkItem" type="checkbox" :value="oracleActTransactingLog" v-model="checkData">
  116. </td>
  117. <td>@{{ i+1 }}</td>
  118. <td class="text-primary">@{{ oracleActTransactingLog.货主 }}</td>
  119. <td class="text-muted">@{{ oracleActTransactingLog.库位 }}</td>
  120. <td class="text-muted">@{{ oracleActTransactingLog.产品编码 }}</td>
  121. <td class="text-muted">@{{ oracleActTransactingLog.产品条码 }}</td>
  122. <td :title="oracleActTransactingLog.商品名称" class="tooltipTarget" style="max-width: 200px;overflow:hidden">@{{ oracleActTransactingLog.商品名称 }}</td>
  123. <td class="text-muted">@{{ oracleActTransactingLog.属性仓 }}</td>
  124. <td class="text-muted">@{{ oracleActTransactingLog.质量状态 }}</td>
  125. <td class="text-muted">@{{ oracleActTransactingLog.失效日期 }}</td>
  126. <td class="text-muted">@{{ oracleActTransactingLog.批号 }}</td>
  127. <td>@{{ oracleActTransactingLog.移出数量 }}</td>
  128. <td>@{{ oracleActTransactingLog.移入数量 }}</td>
  129. <td><span v-if="oracleActTransactingLog.在库数量">@{{ oracleActTransactingLog.在库数量 }}</span><span v-else>0</span></td>
  130. <td><span v-if="oracleActTransactingLog.占用数量">@{{ oracleActTransactingLog.占用数量 }}</span><span v-else>0</span></td>
  131. </tr>
  132. </table>
  133. <form method="post" hidden action="{{url('inventory/statement/changeInventory/export')}}" id="checkDataForm">
  134. @csrf
  135. <input name="checkData" :value="checkData | json">
  136. <input name="export" :value="filterData.export">
  137. <input name="date_start" :value="filterData.date_start">
  138. <input name="date_end" :value="filterData.date_end">
  139. <input name="SKU" :value="filterData.SKU">
  140. <input name="TOLocation" :value="filterData.TOLocation">
  141. <input name="LotAtt05" :value="filterData.LotAtt05">
  142. <input name="LotAtt02_start" :value="filterData.LotAtt02_start">
  143. <input name="LotAtt02_end" :value="filterData.LotAtt02_end">
  144. <input name="descr_c" :value="filterData.descr_c">
  145. <input name="ALTERNATE_SKU1" :value="filterData.ALTERNATE_SKU1">
  146. </form>
  147. <div >
  148. <button type="button" @click="pageUp()" :readonly="page>1?false:true" class="btn btn-sm " :class="page>1?'btn-outline-info':''">上一页</button>
  149. <button type="button" @click="pageDown()" :readonly="page<maxPage?false:true" class="btn btn-sm m-3" :class="page<maxPage?'btn-outline-info':''">下一页</button>
  150. <input @keyup.enter="pageSkip($event)" class="form-control-sm ml-3 tooltipTarget" :placeholder="'当前页数:'+page+'/'+maxPage" title="去往指定页">
  151. <span class="text-muted m-1">共 @{{ sum }} 条</span>
  152. </div>
  153. </div>
  154. @endsection
  155. @section('lastScript')
  156. <script>
  157. new Vue({
  158. el:"#list",
  159. data:{
  160. oracleActTransactingLogs:{!! $oracleActTransactingLogs !!},
  161. page:Number('{{$page}}'),
  162. filterData:{date_start:'',date_end:'',SKU:'',paginate:"50",TOLocation:'',range:'',
  163. LotAtt05:'',LotAtt02_start:'',LotAtt02_end:'',descr_c:'',ALTERNATE_SKU1:'',export:''},
  164. owners:[
  165. @foreach($owners as $owner)
  166. {!! $owner !!},
  167. @endforeach
  168. ],
  169. checkData:[],
  170. maxPage:1,
  171. sum:0
  172. },
  173. mounted:function () {
  174. $(".tooltipTarget").tooltip({'trigger':'hover'});
  175. this.initInputs();
  176. $("#list").removeClass('d-none');
  177. if (this.oracleActTransactingLogs.length>0){
  178. this.maxPage=Math.ceil(this.oracleActTransactingLogs[0].sum/50);
  179. this.sum=this.oracleActTransactingLogs[0].sum;
  180. }
  181. },
  182. computed:{
  183. isBeingFilterConditions:function(){
  184. for(let key in this.filterData){
  185. if(this.filterData[key] && key!='paginate'){
  186. return true
  187. }
  188. }
  189. return false;
  190. },
  191. },
  192. watch:{
  193. checkData:{
  194. handler(){
  195. if (this.checkData.length === this.oracleActTransactingLogs.length){
  196. document.querySelector('#all').checked = true;
  197. }else {
  198. document.querySelector('#all').checked = false;
  199. }
  200. },
  201. deep:true
  202. }
  203. },
  204. methods:{
  205. initInputs:function(){
  206. let data=this;
  207. let uriParts =decodeURI(location.href).split("?");
  208. if(uriParts.length>1){
  209. let params = uriParts[1].split('&');
  210. params.forEach(function(paramPair){
  211. let pair=paramPair.split('=');
  212. let key = pair[0], val = pair[1];
  213. $('input[name="'+key+'"]').val(val);
  214. $('select[name="'+key+'"]').val(val);
  215. decodeURI(data.filterData[key]=val);
  216. });
  217. }
  218. },
  219. pageUp(){
  220. if (this.page<=1)return;
  221. this.page=this.page-1;
  222. this.href();
  223. },
  224. pageDown(){
  225. if (this.page>=this.maxPage)return;
  226. this.page=this.page+1;
  227. this.href();
  228. },
  229. pageSkip(e){
  230. if (Number(e.target.value)<=0 || Number(e.target.value)>this.maxPage){
  231. tempTip.setDuration(2000);
  232. tempTip.show('页数不存在! ');
  233. return
  234. }
  235. this.page=e.target.value;
  236. this.href();
  237. },
  238. href(){
  239. let url="{{url('inventory/statement/changeInventory?page=')}}"+this.page;
  240. if (this.filterData.date_start)url+="&&date_start="+this.filterData.date_start;
  241. if (this.filterData.date_end)url+="&&date_end="+this.filterData.date_end;
  242. if (this.filterData.SKU)url+="&&SKU="+this.filterData.SKU;
  243. if (this.filterData.paginate)url+="&&paginate="+this.filterData.paginate;
  244. if (this.filterData.TOLocation)url+="&&TOLocation="+this.filterData.TOLocation;
  245. if (this.filterData.LotAtt05)url+="&&LotAtt05="+this.filterData.LotAtt05;
  246. if (this.filterData.LotAtt02_start)url+="&&LotAtt02_start="+this.filterData.LotAtt02_start;
  247. if (this.filterData.LotAtt02_end)url+="&&LotAtt02_end="+this.filterData.LotAtt02_end;
  248. if (this.filterData.ALTERNATE_SKU1)url+="&&ALTERNATE_SKU1="+this.filterData.ALTERNATE_SKU1;
  249. if (this.filterData.descr_c)url+="&&descr_c="+this.filterData.descr_c;
  250. if (this.filterData.range)url+="&&range="+this.filterData.range;
  251. window.location.href=url;
  252. },
  253. //提交表单
  254. submit:function(){
  255. let form = $("#form");
  256. form.submit();
  257. },
  258. //全选事件
  259. checkAll(e){
  260. if (e.target.checked){
  261. this.oracleActTransactingLogs.forEach((el,i)=>{
  262. if (this.checkData.indexOf(el) == '-1'){
  263. this.checkData.push(el);
  264. }
  265. });
  266. }else {
  267. this.checkData = [];
  268. }
  269. },
  270. //寻找客户
  271. owner_seek:function (e) {
  272. let _this=this;
  273. let $val=e.target.value;
  274. if($val==='')_this.filterData.descr_c='';
  275. else
  276. _this.owners.forEach(function (owner) {
  277. if (owner.descr_c.includes($val)){
  278. _this.filterData.descr_c=owner.descr_c;
  279. }
  280. });
  281. },
  282. processExport:function(value){
  283. if (value==1&&this.checkData.length <= 0) {
  284. tempTip.setDuration(2000);
  285. tempTip.showSuccess('没有勾选任何记录');
  286. return
  287. }
  288. this.filterData.export=value;
  289. setTimeout(function () {
  290. $("#checkDataForm").submit();
  291. },1);
  292. },
  293. },
  294. filters:{
  295. json(value) {
  296. return JSON.stringify(value);
  297. }
  298. },
  299. });
  300. </script>
  301. @endsection