bindShelf.blade.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @extends('layouts.app')
  2. @section('title')料箱绑定货架-入库管理@endsection
  3. @section('content')
  4. <div class="container-fluid d-none" id="container">
  5. <div class="row h-100">
  6. <div class="col-4 border border-dark bg-white text-center p-0"
  7. v-for="(location,key) in locations" :class="selected===location ? 'box-shadow-dark' : ''"
  8. @click="selectedLocation(key)">
  9. <div class="h-25 small">@{{ location }}</div>
  10. <div class="w-100 h-75 center row align-items-center justify-content-center p-0">
  11. <div contentEditable='true' :id="'box-'+key" class="w-75 h-50 ml-4 text-success" @keydown.enter="submitBind(key)"></div>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. @stop
  17. @section('lastScript')
  18. <script type="text/javascript">
  19. new Vue({
  20. el:"#container",
  21. data:{
  22. element:[
  23. "asn","ide","barCode","amount","submit"
  24. ],
  25. before:{},
  26. isAndroid:false,
  27. locations:[
  28. "HAIB1-03-03","HAIB1-02-03","HAIB1-01-03",
  29. "HAIB1-03-02","HAIB1-02-02","HAIB1-01-02",
  30. "HAIB1-03-01","HAIB1-02-01","HAIB1-01-01",
  31. ],
  32. selected:"",
  33. },
  34. mounted(){
  35. if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
  36. this.createBefore();
  37. this.pageInit();
  38. $("#container").removeClass("d-none");
  39. },
  40. methods:{
  41. //页面初始化
  42. pageInit(){
  43. if (!this.isAndroid)return;
  44. let element = document.getElementById("navbarSupportedContent").parentElement;
  45. element.className = "row";
  46. element.children[0].className += " col-5";
  47. element.children[0].href = "#";
  48. element.innerHTML = element.children[0].outerHTML;
  49. let e1 = document.getElementById("menu");
  50. let e2 = document.getElementById("demand-div");
  51. if (e1)e1.remove();
  52. if (e2)e2.remove();
  53. document.getElementById("container").style.height = (window.innerHeight-100)+"px";
  54. },
  55. createBefore(){
  56. this.before.ide = 'IDE000000';
  57. },
  58. selectedLocation(index){
  59. this.selected = this.locations[index];
  60. let element = document.getElementById("box-"+index);
  61. element.innerText = "";
  62. element.focus();
  63. },
  64. submitBind(index){
  65. event.preventDefault();
  66. let val = event.target.innerText;
  67. if (!val)return;
  68. if (val.length<10){
  69. val = this.before.ide.substr(0,10-val.length)+val;
  70. event.target.innerText = val;
  71. }
  72. window.tempTip.postBasicRequest("{{url('store/inStorage/bindBox')}}",{location:this.locations[index],ide:val},()=>{
  73. if (index!==this.locations.length-1)this.selectedLocation(index+1);
  74. return "绑定成功";
  75. },true)
  76. },
  77. },
  78. });
  79. </script>
  80. @stop