classify.b3300f53.js 8.0 KB

1
  1. import{g as V,a as F,b as M}from"./goods.c7e6e6a2.js";import{M as T}from"./index.dfdc0704.js";import{_ as U,E as f,N,c as n,e as g,f as W,h as e,i as l,g as c,k as b,A as y,C as p,m}from"./index.0308b213.js";import"./index.vue_vue_type_style_index_0_scoped_f00ed21d_lang.2c48f49b.js";import"./vuedraggable.umd.405b1bec.js";import"./index.35b8c9ab.js";import"./index.9e8820cd.js";import"./sort_out.2008c10d.js";const j={data(){return{title:"\u7F16\u8F91",type:1,prev:null,curTab:"index",dialogFormVisible:!1,formLabelWidth:"100px",defaultProps:{children:"children",label:"label"},firstLevelList:[],secondLevelList:[],threeLevelList:[],rules:{name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:"blur"},{min:1,max:80,message:"\u957F\u5EA6\u5728 1 \u5230 80 \u4E2A\u5B57\u7B26",trigger:"blur"}]},info:{}}},components:{MaterialSelect:T},created(){this.getGoodsCatList()},methods:{getGoodsCatList(o=0){V({parent_id:o}).then(i=>{if(i){const{list:u}=i;this.firstLevelList=u,this.prev=u[0],u.length>0?this.secondClassify(this.firstLevelList[0]):this.secondLevelList=[]}})},handleSelectionChange(o){this.selectItem=o.map(i=>i.id)},save(){if(!this.info.title.trim())return f({message:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0",type:"error"});if(!this.info.cover)return f({message:"\u8BF7\u4E0A\u4F20\u5206\u7C7B\u56FE\u7247",type:"error"});F(this.info).then(o=>{f({message:o.msg,type:o.code==1?"success":"error"}),this.type==2?this.secondClassify(this.prev):this.goodsCatList(),setTimeout(()=>{this.closeDialog()},200)})},goodsCatDelete(o,i){N.confirm("","\u662F\u5426\u5220\u9664",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning",center:!0}).then(()=>{M({id:i}).then(u=>{f({message:u.msg,type:u.code==1?"success":"error"}),o==0?this.goodsCatList():this.secondClassify(this.prev)})}).catch(()=>{})},edit(o,i){o==2?(this.type=1,this.title="\u7F16\u8F91\u4E00\u7EA7\u5206\u7C7B"):(this.title="\u6DFB\u52A0\u4E8C\u7EA7\u5206\u7C7B",this.type=2),this.info={parent_id:0,title:"",cover:"",cover_url:"",sort:1,id:0},o==2?(this.info=i,this.info.parent_id=0):o==3&&(this.info.parent_id=i.id),this.dialogFormVisible=!0},secondLevelEdit(o){this.title="\u4E8C\u7EA7\u5206\u7C7B\u7F16\u8F91",this.type=2,this.info=o,this.info.parent_id=this.prev.id,this.dialogFormVisible=!0},secondClassify(o){this.prev=o,V({parent_id:o.id}).then(i=>{i&&(this.secondLevelList=i.list)})},addClassify(o){if(o==2&&(this.prev==null||!this.prev||this.prev==null))return f("\u8BF7\u5148\u6DFB\u52A0\u4E00\u7EA7\u5206\u7C7B");this.type=o,this.title=o==2?"\u6DFB\u52A0\u4E8C\u7EA7\u5206\u7C7B":"\u6DFB\u52A0\u4E00\u7EA7\u5206\u7C7B",this.info={parent_id:o==1?0:this.prev.id,title:"",cover:"",cover_url:"",sort:1,id:0},this.dialogFormVisible=!0},closeDialog(){this.dialogFormVisible=!1,this.info={},this.type=1,this.type=null}}},q={class:"w100p h100p"},G={class:"flex justify-around w100p h100p"},R={class:"clearfix flex align-center justify-between"},A=c("div",null,"\u4E00\u7EA7\u5206\u7C7B",-1),I=m("\u6DFB\u52A0\u5206\u7C7B"),P=m("\u6DFB\u52A0"),H=m("\u7F16\u8F91"),J=m("\u5220\u9664"),K={class:"clearfix flex align-center justify-between"},O=c("div",null,"\u4E8C\u7EA7\u5206\u7C7B",-1),Q=m("\u6DFB\u52A0\u5206\u7C7B"),X=m("\u7F16\u8F91"),Y=m("\u5220\u9664"),Z=c("span",null,"\u6392\u5E8F",-1),$=c("span",{class:"el-icon-info hover"},null,-1),ee={class:"flex justify-center"},te=m("\u4FDD\u5B58");function le(o,i,u,ie,s,a){const r=n("el-button"),d=n("el-table-column"),w=n("el-avatar"),C=n("viewer"),x=n("el-table"),L=n("el-card"),k=n("el-tab-pane"),v=n("el-input"),_=n("el-form-item"),S=n("MaterialSelect"),z=n("el-tooltip"),B=n("el-form"),D=n("el-dialog"),E=n("el-tabs");return g(),W("div",q,[e(E,{modelValue:s.curTab,"onUpdate:modelValue":i[7]||(i[7]=t=>s.curTab=t),type:"border-card",class:"w100p h100p"},{default:l(()=>[e(k,{name:"index",label:"\u5546\u54C1\u5206\u7C7B"},{default:l(()=>[c("div",G,[e(L,{class:"box-card",style:{width:"45%",height:"100%"}},{header:l(()=>[c("div",R,[A,e(r,{onClick:i[0]||(i[0]=t=>a.addClassify(1)),style:{float:"right"},type:"text"},{default:l(()=>[I]),_:1})])]),default:l(()=>[e(x,{data:s.firstLevelList,class:"w100p",style:{},"max-height":"550",onSelectionChange:a.handleSelectionChange,onRowClick:a.secondClassify},{default:l(()=>[e(d,{type:"index",label:"\u5E8F\u53F7"}),e(d,{prop:"title",label:"\u540D\u79F0",align:"center"}),e(d,{prop:"cover_url",label:"\u5C01\u9762",width:"90",align:"center"},{default:l(t=>[t.row.cover_url?(g(),b(C,{key:0,images:[t.row.cover_url]},{default:l(()=>[e(w,{shape:"square",size:"medium",fit:"cover",src:t.row.cover_url?t.row.cover_url:"@/assets/empty.png"},null,8,["src"])]),_:2},1032,["images"])):y("",!0)]),_:1}),e(d,{label:"\u64CD\u4F5C",width:"260",align:"center"},{default:l(t=>[e(r,{onClick:p(h=>a.edit(3,t.row),["stop"]),type:"success",size:"mini"},{default:l(()=>[P]),_:2},1032,["onClick"]),e(r,{onClick:p(h=>a.edit(2,t.row),["stop"]),type:"primary",size:"mini"},{default:l(()=>[H]),_:2},1032,["onClick"]),e(r,{onClick:p(h=>a.goodsCatDelete(0,t.row.id),["stop"]),type:"danger",size:"mini"},{default:l(()=>[J]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","onSelectionChange","onRowClick"])]),_:1}),e(L,{class:"box-card",style:{width:"45%",height:"100%"}},{header:l(()=>[c("div",K,[O,e(r,{onClick:i[1]||(i[1]=t=>a.addClassify(2)),style:{float:"right",padding:"3px 0"},type:"text"},{default:l(()=>[Q]),_:1})])]),default:l(()=>[e(x,{data:s.secondLevelList,class:"w100p",style:{},"max-height":"550",onSelectionChange:a.handleSelectionChange},{default:l(()=>[e(d,{type:"index",label:"\u5E8F\u53F7",class:"w20p"}),e(d,{prop:"title",label:"\u540D\u79F0",class:"w20p"}),e(d,{prop:"cover",label:"\u5C01\u9762",class:"w20p"},{default:l(t=>[t.row.cover_url?(g(),b(C,{key:0,images:[t.row.cover_url]},{default:l(()=>[e(w,{shape:"square",size:"medium",fit:"cover",src:t.row.cover_url?t.row.cover_url:"@/assets/empty.png"},null,8,["src"])]),_:2},1032,["images"])):y("",!0)]),_:1}),e(d,{label:"\u64CD\u4F5C",class:"w20p"},{default:l(t=>[e(r,{onClick:p(h=>a.secondLevelEdit(t.row),["stop"]),type:"primary",size:"mini"},{default:l(()=>[X]),_:2},1032,["onClick"]),e(r,{onClick:p(h=>a.goodsCatDelete(1,t.row.id),["stop"]),type:"danger",size:"mini"},{default:l(()=>[Y]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","onSelectionChange"])]),_:1})])]),_:1}),e(D,{title:s.title,"before-close":a.closeDialog,modelValue:s.dialogFormVisible,"onUpdate:modelValue":i[6]||(i[6]=t=>s.dialogFormVisible=t),"close-on-click-modal":!1,width:"500px"},{default:l(()=>[e(B,{rules:s.rules,class:"overflow-auto",model:s.info},{default:l(()=>[s.type==2?(g(),b(_,{key:0,label:"\u4E00\u7EA7\u5206\u7C7B:",prop:"title","label-width":s.formLabelWidth,class:"m-t-10 w-300"},{default:l(()=>[e(v,{disabled:"",modelValue:s.prev.title,"onUpdate:modelValue":i[2]||(i[2]=t=>s.prev.title=t),type:"text",maxlength:"80","show-word-limit":""},null,8,["modelValue"])]),_:1},8,["label-width"])):y("",!0),e(_,{label:s.type==1?"\u4E00\u7EA7\u5206\u7C7B\u540D\u79F0:":"\u4E8C\u7EA7\u5206\u7C7B\u540D\u79F0:",prop:"title","label-width":s.formLabelWidth,class:"m-t-10 w-300"},{default:l(()=>[e(v,{modelValue:s.info.title,"onUpdate:modelValue":i[3]||(i[3]=t=>s.info.title=t),type:"text",maxlength:"80","show-word-limit":""},null,8,["modelValue"])]),_:1},8,["label","label-width"]),e(_,{label:"\u5206\u7C7B\u56FE\u7247","label-width":s.formLabelWidth},{default:l(()=>[e(S,{modelValue:s.info.cover,"onUpdate:modelValue":i[4]||(i[4]=t=>s.info.cover=t)},null,8,["modelValue"])]),_:1},8,["label-width"]),e(_,{prop:"sort",label:"\u6392\u5E8F:","label-width":s.formLabelWidth},{label:l(()=>[Z,e(z,{class:"item",effect:"dark",content:"\u6570\u5B57\u4ECE\u5C0F\u5230\u5927\u6392\u5E8F",placement:"top"},{default:l(()=>[$]),_:1})]),default:l(()=>[e(v,{style:{width:"50%"},class:"w-300",type:"number",modelValue:s.info.sort,"onUpdate:modelValue":i[5]||(i[5]=t=>s.info.sort=t),autocomplete:"off"},null,8,["modelValue"])]),_:1},8,["label-width"])]),_:1},8,["rules","model"]),c("div",ee,[e(r,{onClick:a.save,type:"primary"},{default:l(()=>[te]),_:1},8,["onClick"])])]),_:1},8,["title","before-close","modelValue"])]),_:1},8,["modelValue"])])}const ue=U(j,[["render",le]]);export{ue as default};