import{_ as c,a as l,b as d}from"./press.1dd82abb.js";import{H as p}from"./header.fa4efc57.js";import{n as _,b as m,c as u,F as h,C as f,e as C}from"./index.13f93d3a.js";const v={name:"base-filter-dropper",components:{Header:p},data(){return{containers:[],capacities:[],curContainerId:"",curCapacityId:""}},mounted(){const i=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:this.id}}).then(t=>{const{code:s,msg:e=i,data:a=[]}=t.data;if(s==0){const r=a.find(n=>n.id===this.containerId),o=a.find(n=>n.id===this.capacityId);this.getContainers(r),this.getCapacities(o)}else this.$message.error(e||i)}).catch(()=>{this.$message.error(i)})},methods:{toBase(){sessionStorage.setItem("conf_filters",JSON.stringify([this.containers,this.capacities])),this.$router.push({path:"/base",query:{filter:`${this.curContainerId},${this.curCapacityId}`}})},changeContainer(i){this.curContainerId=i},changeCapacity(i){this.curCapacityId=i},fillEmpty(i){for(let t=5;t>=0;t--)if(!i[t]){i[t]={type:"empty"};continue}return i},rebuildContainers(i){let t=m[this.id];t=t[this.containerId];const s=i.map(e=>{const a=t[e.id];return{...e,type:a,image:new URL(Object.assign({"../../../../assets/images/base/filter/containers/dropper/glass.png":c,"../../../../assets/images/base/filter/containers/dropper/plastic.png":l,"../../../../assets/images/base/filter/containers/dropper/press.png":d})[`../../../../assets/images/base/filter/containers/dropper/${a}.png`],self.location).href}});return this.fillEmpty(s)},rebuildCapacities(i){return this.fillEmpty(i)},getContainers({id:i}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:i}}).then(s=>{const{code:e,msg:a=t,data:r=[]}=s.data;e==0?this.containers=this.rebuildContainers(r):this.$message.error(a||t)}).catch(()=>{this.$message.error(t)})},getCapacities({id:i}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:i}}).then(s=>{const{code:e,msg:a=t,data:r=[]}=s.data;e==0?this.capacities=this.rebuildCapacities(r):this.$message.error(a||t)}).catch(()=>{this.$message.error(t)})}},computed:{id(){return u[h.mode].dropper},containerId(){return f[this.id]},capacityId(){return C[this.id]},disabled(){return!(this.curContainerId&&this.curCapacityId)},nameKey(){return this.$store.state.nameKey}}};var y=function(){var t=this,s=t._self._c;return s("div",{staticClass:"base-filter-dropper"},[s("div",{staticClass:"filter-content"},[s("Header",{attrs:{type:"dropper"}}),s("div",{staticClass:"filter-container"},[s("div",{staticClass:"row"},[s("div",{staticClass:"all column-item"},[s("div",{staticClass:"selection"}),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[s("b",[t._v(t._s(t.$t("common.filter.all")))])]),s("div",{staticClass:"bottom"},[t._v(" "+t._s(t.$t("common.filter.container"))+" ")])])]),t._l(t.containers,function(e){return s("div",{key:e.id,class:["column-item",e.type,e.type==="other"?"vh-center":"",e.type==="empty"?"filter":"",t.curContainerId===e.id?"selected":""],on:{click:function(a){return t.changeContainer(e.id)}}},[e.type==="empty"?void 0:[t._m(0,!0),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[e.type==="other"?s("span",[t._v(t._s(e[t.nameKey]))]):s("img",{attrs:{src:e.image,alt:"plastic"}})]),e.type==="other"?s("div",{staticClass:"bottom"}):s("div",{staticClass:"bottom"},[t._v(" "+t._s(e[t.nameKey])+" ")])])]],2)})],2),s("div",{staticClass:"row horizontal"},[s("div",{staticClass:"column-item"},[s("div",{staticClass:"horizontal-item"}),s("div",{staticClass:"horizontal-item"},[s("b",[t._v(t._s(t.$t("common.filter.all")))])]),s("div",{staticClass:"horizontal-item"},[t._v(" "+t._s(t.$t("common.filter.capacity"))+" ")])]),t._l(t.capacities,function(e){return s("div",{key:e.id,class:["column-item",t.curCapacityId===e.id?"selected":""],on:{click:function(a){return t.changeCapacity(e.id)}}},[t._m(1,!0),s("div",{staticClass:"horizontal-item"},[t._v(" "+t._s(e[t.nameKey])+" ")])])})],2)]),s("div",{staticClass:"upload-makeup-footer"},[s("el-button",{attrs:{type:"primary",disabled:t.disabled,round:""},on:{click:t.toBase}},[t._v(t._s(t.$t("common.resume")))])],1)],1)])},g=[function(){var i=this,t=i._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var i=this,t=i._self._c;return t("div",{staticClass:"horizontal-item"},[t("i",{staticClass:"el-icon-success"})])}],b=_(v,y,g,!1,null,"06818ac2",null,null);const S=b.exports;export{S as default};
