import{b as R,e as x}from"./category-de1deb16.js";import{f as D}from"./date-20546ee0.js";import{M as b,I,F,R as M,e as O,f as P}from"./ui-ba7aaa7e.js";import{e as q,r as d,P as A,a3 as B,a4 as s,f as o,I as y}from"./vue-bf422dc1.js";const z=[{colKey:"id",title:"ID"},{colKey:"name",title:"名称"},{colKey:"alias",title:"别名"},{colKey:"type",title:"类型",cell(r,n){let u="";switch(n.row.type){case 1:u="前台列表";break;case 2:u="后台列表";break;default:u="单页";break}return r("span",u)}},{colKey:"status",title:"状态"},{colKey:"create_at",title:"添加时间",cell(r,n){return r("span",D(n.row.create_at))}},{colKey:"operate",title:"操作",fixed:"right"}],C=[{label:"正常",value:1},{label:"禁用",value:0}],E=[{label:"前台列表",value:1},{label:"后台列表",value:2},{label:"单页",value:3}],L={name:"EditPopup"},H=q({...L,emits:["success"],setup(r,{expose:n,emit:u}){const c={id:0,name:"",alias:"",remark:"",status:1,top:0,type:1,create_at:Date.now()},a=d({...c}),f=d(),m=d(!1),v=d("");n({init:l=>{v.value=(l==null?void 0:l.id)>0?"编辑分类":"添加分类",a.value=(l==null?void 0:l.id)>0?{...l}:{...c},m.value=!0}});const V={name:[{required:!0,message:"必填",type:"error"}],alias:[{required:!0,message:"必填",type:"error"}]},g=u,k=async()=>{const l=await f.value.validate();if(typeof l!="object"&&l){const e=a.value.id===0?await R(a.value):await x(a.value);e.code===1?(b.success(e.msg),m.value=!1,g("success")):b.error(e.msg)}};return(l,e)=>{const p=I,i=F,_=M,K=O,U=P;return A(),B(U,{visible:m.value,"onUpdate:visible":e[5]||(e[5]=t=>m.value=t),"destroy-on-close":!0,header:v.value,"on-confirm":k},{default:s(()=>[o(K,{ref_key:"formRef",ref:f,"label-align":"left",data:a.value,rules:V,"label-width":60},{default:s(()=>[o(i,{label:"名称",name:"name"},{default:s(()=>[o(p,{modelValue:a.value.name,"onUpdate:modelValue":e[0]||(e[0]=t=>a.value.name=t),clearable:"",placeholder:"请输入分类名"},null,8,["modelValue"])]),_:1}),o(i,{label:"别名",name:"alias",tips:"英文别名，方便前台调用"},{default:s(()=>[o(p,{modelValue:a.value.alias,"onUpdate:modelValue":e[1]||(e[1]=t=>a.value.alias=t),clearable:""},null,8,["modelValue"])]),_:1}),o(i,{label:"状态",name:"status"},{default:s(()=>[o(_,{modelValue:a.value.status,"onUpdate:modelValue":e[2]||(e[2]=t=>a.value.status=t),options:y(C)},null,8,["modelValue","options"])]),_:1}),o(i,{label:"类型",name:"type"},{default:s(()=>[o(_,{modelValue:a.value.type,"onUpdate:modelValue":e[3]||(e[3]=t=>a.value.type=t),options:y(E)},null,8,["modelValue","options"])]),_:1}),o(i,{label:"备注",name:"remark",tips:"简短的文字备注，方便自己记忆"},{default:s(()=>[o(p,{modelValue:a.value.remark,"onUpdate:modelValue":e[4]||(e[4]=t=>a.value.remark=t),clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["data"])]),_:1},8,["visible","header"])}}});export{H as _,z as c};
