23.d10c51a6.js 7.0 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[23],{"1de0":function(e,s,t){"use strict";t.r(s);var o=function(){var e=this,s=e._self._c;return s("div",[s("q-toolbar",{staticClass:"row items-center"},[s("q-btn-group",{staticClass:"btn-group",attrs:{push:""}},[s("q-btn",{attrs:{label:e.$t("stock.shelf.shelf_up"),icon:"upload"},on:{click:function(s){return e.handleShelfUp()}}}),s("div",{staticClass:"self-center text-center q-px-sm"},[e._v("\n "+e._s(e.$t("stock.layertip"))+"\n ")]),s("q-input",{staticStyle:{width:"50px"},attrs:{dense:"",color:"primary"},model:{value:e.shelf.layer_now,callback:function(s){e.$set(e.shelf,"layer_now",s)},expression:"shelf.layer_now"}}),s("q-btn",{attrs:{label:e.$t("stock.shelf.shelf_down"),icon:"download"},on:{click:function(s){return e.handleShelfDown()}}}),s("q-btn",{attrs:{label:e.$t("refresh"),icon:"refresh"},on:{click:function(s){return e.reFresh()}}},[s("q-tooltip",{attrs:{"content-class":"bg-amber text-black shadow-4",offset:[10,10],"content-style":"font-size: 12px"}},[e._v("\n "+e._s(e.$t("refreshtip"))+"\n ")])],1),s("q-separator"),s("q-btn",{attrs:{label:e.$t("stock.edit"),icon:"edit"},on:{click:function(s){return e.handle_edit()}}})],1)],1),s("q-page",{staticClass:"q-pa-md"},[s("div",{staticClass:"grid-system"},[s("div",{staticClass:"axis y-axis"},[s("div",{staticClass:"axis-numbers"},e._l(e.shelf.rows,(function(t){return s("div",{key:"y"+t},[e._v("\n "+e._s(t)+"\n ")])})),0),s("div",{staticClass:"axis-arrow"})]),s("div",{staticClass:"axis x-axis"},[s("div",{staticClass:"axis-arrow"}),s("div",{staticClass:"axis-numbers"},[e._l(e.shelf.cols,(function(t){return s("div",{key:"x"+t,staticClass:"axis-label"},[e._v("\n "+e._s(t)+"\n ")])})),s("div",{staticClass:"axis-label"})],2)]),s("div",{staticClass:"grid-container"},[s("div",{staticClass:"grid-content"},e._l(e.shelf.rows,(function(t,o){return s("div",{key:`row-${o}|${e.shelf.layer_now}`,staticClass:"grid-row"},e._l(e.shelf.cols,(function(t,a){return s("div",{key:`col-${a}|${e.shelf.layer_now}`,staticClass:"grid-item"},[e.shouldShowButton(e.shelf.rows-o,a+1,e.shelf.layer_now)?s("div",{key:`${e.shelf.rows-o}-${a}-${e.shelf.layer_now}`,style:{border:"1px solid #ccc",borderRadius:"5px",width:"var(--cell-d)",height:"var(--cell-d)",backgroundColor:e.getBinColor(e.shelf.rows-o,a+1,e.shelf.layer_now),cursor:"pointer"},on:{click:function(s){return e.handleBinClick(e.shelf.rows-o,a+1,e.shelf.layer_now)}}},[e._v("\n "+e._s(e.goodsMap[`${e.shelf.rows-o}-${a+1}-${e.shelf.layer_now}`].c_number)+"\n ")]):e._e(),e.shouldShowButton(e.shelf.rows-o,a+1,e.shelf.layer_now)?s("q-tooltip",{attrs:{"content-class":"bg-amber text-black shadow-4",offset:[20,20],"content-style":"font-size: 10px"}},[e._v("\n "+e._s(e.$t("stock.rowtip"))+" "+e._s(e.shelf.rows-o)+"\n "+e._s(e.$t("stock.coltip"))+" "+e._s(a+1)+"\n ")]):e._e()],1)})),0)})),0)])])])],1)},a=[],l=(t("caad"),t("18d6")),r=t("3004"),n={data(){return{pathname:"bin/",warehouse_code:"",warehouse_name:"",shelf_name:"A区货架",shelf:{rows:17,cols:29,layers:3,layer_now:1},filter:"",auth_edit:!1,goodsMap:{},goodsMatrix:[],binColors:{T1:"rgba(255, 215, 0, 0.5)",T2:"rgba(255, 165, 0, 0.5)",T4:"rgba(255, 115, 0, 0.5)",T5:"rgba(255, 65, 0, 0.5)",S4:"rgba(255, 115, 0, 0.5)",M1:"rgba(255, 255, 0, 0.5)",E1:"rgba(255, 255, 0, 0.5)",C1:"rgba(255, 255, 0, 0.5)",default:"rgba(255, 0.5)"},showInventoryDetails:!1,select_Inventory:{rowIndex:0,colIndex:0,layerIndex:0,goods_data:{}}}},beforeRouteEnter(e,s,t){t((e=>{e.goodsMatrix=[],e.goodsMap={}}))},beforeDestroy(){this.goodsMap={},this.goodsMatrix=[]},methods:{shouldShowButton(e,s,t){const o=this.goodsMap[`${e}-${s}-${t}`];return["T1","T2","T4","T5","S4","M1","E1","C1"].includes(null===o||void 0===o?void 0:o.location_type)},getList(){var e=this;Object(r["e"])(e.pathname+"?layer="+e.shelf.layer_now+"&warehouse_code="+e.warehouse_code+"&max_page=1000&shelf_name="+e.shelf_name,{}).then((s=>{e.goodsMap={},s.results.forEach((s=>{const t=`${s.row}-${s.col}-${s.layer}`;e.goodsMap[t]=s})),e.$q.notify({message:s.detail,icon:"done",color:"positive"})})).catch((s=>{e.$q.notify({message:s.detail,icon:"close",color:"negative"})}))},handle_setting(){l["a"].has("warehouse_code")&&(this.warehouse_code=l["a"].getItem("warehouse_code")),l["a"].has("warehouse_name")&&(this.warehouse_name=l["a"].getItem("warehouse_name"))},getBinColor(e,s,t){const o=this.goodsMap[`${e}-${s}-${t}`];return o&&this.binColors[o.shelf_type]||this.binColors.default},handleBinClick(e,s,t){this.select_Inventory.rowIndex=e,this.select_Inventory.colIndex=s,this.select_Inventory.layerIndex=t,this.select_Inventory.goods_data=this.goodsMap[`${e}-${s}-${t}`],this.showInventoryDetails=!0,console.log(this.select_Inventory),this.$refs.goodscard.handleclick()},updateCSSVariables(){const e=document.documentElement,s=document.documentElement.clientWidth,t=document.documentElement.clientHeight;console.log(s,t);const o=.6*s,a=.6*t;var l=7*o/8/this.shelf.cols,r=1*l/5,n=r/2,i=a/this.shelf.rows-l;i<2&&(i=2,l=(a-i*this.shelf.rows)/this.shelf.rows,r=3*l/5,n=r/2);var h=i/2,c=r*this.shelf.cols+l*this.shelf.cols;e.style.setProperty("--cell-d",`${l}px`),e.style.setProperty("--cell-d-x",`${l+r}px`),e.style.setProperty("--cell-x-2",`${n}px`),e.style.setProperty("--cell-x",`${r}px`),e.style.setProperty("--cell-y",`${i+l}px`),e.style.setProperty("--cell-y-2",`${h}px`),e.style.setProperty("--axis-x",`${c}px`)},handleResize(){clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout((()=>{this.updateCSSVariables()}),200)},handleShelfDown(){this.shelf.layer_now>this.shelf.layers&&(this.shelf.layer_now=this.shelf.layers),this.shelf.layer_now>1&&(this.shelf.layer_now-=1,this.reFresh())},handleShelfUp(){this.shelf.layer_now<this.shelf.layers?(this.shelf.layer_now+=1,this.reFresh()):this.shelf.layer_now=this.shelf.layers},reFresh(){this.handle_setting(),this.getList()},handle_edit(){this.auth_edit=!this.auth_edit,l["a"].set("auth_edit",this.auth_edit)}},mounted(){this.updateCSSVariables(),window.addEventListener("resize",this.handleResize)},beforeUnmount(){this.goodsMap={},this.goodsMatrix=[],window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimer),this.$refs.goodscard&&this.$refs.goodscard.$destroy()},created(){l["a"].set("auth_edit",this.auth_edit),l["a"].has("warehouse_code")&&(this.warehouse_code=l["a"].getItem("warehouse_code")),l["a"].has("warehouse_name")&&(this.warehouse_name=l["a"].getItem("warehouse_name")),this.getList()}},i=n,h=(t("bbd7"),t("42e1")),c=t("65c6"),d=t("e7a9"),u=t("9c40"),f=t("27f9"),_=t("05c0"),w=t("eb85"),y=t("9989"),p=t("eebe"),g=t.n(p),b=Object(h["a"])(i,o,a,!1,null,"1e3ba243",null);s["default"]=b.exports;g()(b,"components",{QToolbar:c["a"],QBtnGroup:d["a"],QBtn:u["a"],QInput:f["a"],QTooltip:_["a"],QSeparator:w["a"],QPage:y["a"]})},bbd7:function(e,s,t){"use strict";t("fc1a")},fc1a:function(e,s,t){}}]);