1 |
- import{_ as h,a as _,b as m,c as u,d as g,e as f}from"./special.8497e60d.js";import{_ as v,a as y,b,c as C}from"./square.0d739171.js";import{H as I}from"./header.e8d4f73a.js";import{n as $,b as w,c as o,d as S,F as E,C as A,e as T,i as k,M as R,f as x,h as r}from"./index.4fdc1c7a.js";const z={name:"base-filter-blow",components:{Header:I},data(){return{containers:[],shapes:[],capacities:[],materials:[],containerIds:[],shapeIds:[],capacityIds:[],materialIds:[],level1Count:0,level2Count:0}},mounted(){const e=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:this.id}}).then(t=>{const{code:s,msg:a=e,data:i=[]}=t.data;if(s==0){const l=i.find(n=>n.id===this.containerId),c=i.find(n=>n.id===this.shapeId),d=i.find(n=>n.id===this.capacityId),p=i.find(n=>n.id===this.materialId);this.getContainers(l),this.getShapes(c),this.getCapacities(d),this.getMaterials(p)}else this.$message.error(a||e)}),this.getFilterTypes()},methods:{toggleContainers(){this.containerAll?this.containerIds=[]:this.containerIds=this.containers.filter(e=>e.type!=="empty").map(e=>e.id)},toggleShapes(){this.shapeAll?this.shapeIds=[]:this.shapeIds=this.shapes.filter(e=>e.type!=="empty").map(e=>e.id)},toggleCapacities(){this.capacityAll?this.capacityIds=[]:this.capacityIds=this.capacities.filter(e=>e.type!=="empty").map(e=>e.id)},toggleMaterials(){this.materialAll?this.materialIds=[]:this.materialIds=this.materials.filter(e=>e.type!=="empty").map(e=>e.id)},getFilterTypes(){const e=this.$t("common.failure");this.$axios.get("/api/filter_type_list").then(t=>{const{code:s,msg:a=e,data:i=[]}=t.data;if(s==0){const[l,c]=w(r.base,x[r.base].blow,i);this.level1Count=l,this.level2Count=c}else this.$message.error(a||e)})},toBase(){sessionStorage.setItem("conf_filters",JSON.stringify([this.containers,this.shapes,this.capacities,this.materials])),this.$router.push({path:"/base",query:{filter:`${this.containerIds},${this.shapeIds},${this.capacityIds},${this.materialIds}`}})},changeContainer({id:e,type:t}){t!=="empty"&&(this.containerIds=[],this.containerIds.push(e))},changeShape({id:e,type:t}){t!=="empty"&&(this.shapeIds=[],this.shapeIds.push(e))},changeCapacity({id:e,type:t}){t!=="empty"&&(this.capacityIds=[],this.capacityIds.push(e))},changeMaterial({id:e,type:t}){t!=="empty"&&(this.materialIds=[],this.materialIds.push(e))},fillEmpty(e){for(let t=5;t>=0;t--)if(!e[t]){e[t]={type:"empty"};continue}return e},rebuildContainers(e){let t=o[this.id];t=t[this.containerId];const s=e.map(a=>{const i=t[a.id];return{...a,type:i,image:new URL(Object.assign({"../../../../assets/images/base/filter/containers/blow/NBR.png":h,"../../../../assets/images/base/filter/containers/blow/cover.png":_,"../../../../assets/images/base/filter/containers/blow/flip.png":m,"../../../../assets/images/base/filter/containers/blow/general.png":u,"../../../../assets/images/base/filter/containers/blow/press.png":g,"../../../../assets/images/base/filter/containers/blow/special.png":f})[`../../../../assets/images/base/filter/containers/blow/${i}.png`],self.location).href}});return this.fillEmpty(s)},rebuildShapes(e){let t=o[parseInt(this.id)];t=t[this.shapeId];const s=e.map(a=>{const i=t[a.id];return{...a,type:i,image:new URL(Object.assign({"../../../../assets/images/base/filter/shapes/blow/oval.png":v,"../../../../assets/images/base/filter/shapes/blow/quadrangle.png":y,"../../../../assets/images/base/filter/shapes/blow/round.png":b,"../../../../assets/images/base/filter/shapes/blow/square.png":C})[`../../../../assets/images/base/filter/shapes/blow/${i}.png`],self.location).href}});return this.fillEmpty(s)},getContainers({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:a,msg:i=t,data:l=[]}=s.data;a==0?this.containers=this.rebuildContainers(l):this.$message.error(i||t)})},getShapes({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:a,msg:i=t,data:l=[]}=s.data;a==0?this.shapes=this.rebuildShapes(l):this.$message.error(i||t)})},getCapacities({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:a,msg:i=t,data:l=[]}=s.data;a==0?this.capacities=l:this.$message.error(i||t)})},getMaterials({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:a,msg:i=t,data:l=[]}=s.data;a==0?this.materials=l:this.$message.error(i||t)})}},computed:{id(){return S[E.mode].blow},containerAll(){return this.containerIds.length===this.containers.filter(e=>e.type!=="empty").length},shapeAll(){return this.shapeIds.length===this.shapes.filter(e=>e.type!=="empty").length},capacityAll(){return this.capacityIds.length===this.capacities.filter(e=>e.type!=="empty").length},materialAll(){return this.materialIds.length===this.materials.filter(e=>e.type!=="empty").length},containerId(){return A[this.id]},shapeId(){return T[this.id]},capacityId(){return k[this.id]},materialId(){return R[this.id]},disabled(){return!(this.containerIds.length&&this.shapeIds.length&&this.capacityIds.length&&this.materialIds.length)},nameKey(){return this.$store.state.nameKey}}};var D=function(){var t=this,s=t._self._c;return s("div",{staticClass:"base-filter-blow"},[s("div",{staticClass:"filter-content"},[s("Header",{attrs:{type:"blow"}}),s("div",{staticClass:"filter-container"},[s("div",{staticClass:"row"},[s("div",{class:["column-item",t.containerAll?"selected":""],on:{click:t.toggleContainers}},[t._m(0),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(a){return s("div",{key:a.id,class:["column-item",a.type,a.type==="other"?"vh-center":"",a.type==="empty"?"filter":"",t.containerIds.includes(a.id)?"selected":""],on:{click:function(i){return t.changeContainer(a)}}},[a.type==="empty"?void 0:[t._m(1,!0),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[a.type==="other"?s("span",[t._v(t._s(a[t.nameKey]))]):s("img",{attrs:{src:a.image,alt:"plastic"}})]),a.type==="other"?s("div",{staticClass:"bottom"}):s("div",{staticClass:"bottom"},[t._v(" "+t._s(a[t.nameKey])+" ")])])]],2)})],2),s("div",{staticClass:"row"},[s("div",{class:["column-item",t.shapeAll?"selected":""],on:{click:t.toggleShapes}},[t._m(2),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.shape"))+" ")])])]),t._l(t.shapes,function(a){return s("div",{key:a.id,class:["column-item",a.type,a.type==="other"?"vh-center":"",a.type==="empty"?"filter":"",t.shapeIds.includes(a.id)?"selected":""],on:{click:function(i){return t.changeShape(a)}}},[a.type==="empty"?void 0:[t._m(3,!0),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[a.type==="other"?s("span",[t._v(t._s(a[t.nameKey]))]):s("img",{attrs:{src:a.image,alt:"plastic"}})]),a.type==="other"?s("div",{staticClass:"bottom"}):s("div",{staticClass:"bottom"},[t._v(" "+t._s(a[t.nameKey])+" ")])])]],2)})],2),s("div",{staticClass:"row horizontal"},[s("div",{class:["column-item",t.capacityAll?"selected":""],on:{click:t.toggleCapacities}},[s("i",{staticClass:"el-icon-success"}),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(a){return s("div",{key:a.id,class:["column-item",t.capacityIds.includes(a.id)?"selected":""],on:{click:function(i){return t.changeCapacity(a)}}},[s("i",{staticClass:"el-icon-success"}),s("div",{staticClass:"horizontal-item"},[t._v(" "+t._s(a[t.nameKey])+" ")])])})],2),s("div",{staticClass:"row horizontal"},[s("div",{class:["column-item",t.materialAll?"selected":""],on:{click:t.toggleMaterials}},[s("i",{staticClass:"el-icon-success"}),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.material"))+" ")])]),t._l(t.materials,function(a){return s("div",{key:a.id,class:["column-item",t.materialIds.includes(a.id)?"selected":""],on:{click:function(i){return t.changeMaterial(a)}}},[s("i",{staticClass:"el-icon-success"}),s("div",{staticClass:"horizontal-item"},[t._v(" "+t._s(a[t.nameKey])+" ")])])})],2)]),s("div",{staticClass:"upload-makeup-footer"},[s("div",{staticClass:"footer-count"},[s("ul",[s("li",[t._v(" "+t._s(t.$t("header.navs.nav1"))+" "+t._s(t.level1Count)+" ")]),t._v(" \xA0\xA0 > \xA0\xA0 "),s("li",[t._v(" "+t._s(t.$t("base.nav.blow"))+" "+t._s(t.level2Count)+" ")])])]),s("el-button",{attrs:{type:"primary",disabled:t.disabled,round:""},on:{click:t.toBase}},[t._v(t._s(t.$t("common.resume")))])],1)],1)])},F=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])}],L=$(z,D,F,!1,null,"3b7cb9ed",null,null);const H=L.exports;export{H as default};
|