import{A as z}from"./index-164d2618.js";import{A as R}from"./index-0b6f3bad.js";import{a as B}from"./element-plus-91d6d961.js";import{H as F,e as x,_ as E,ah as r,o as H,c as I,V as l,P as t,a as p,T as c,n as h}from"./@vue-6dabbe94.js";const P={style:{display:"flex","flex-direction":"column"}},q=p("div",{class:"sub-title"},"结合网站模板使用",-1),M={class:"dialog-footer"},O=F({name:"articleAddCategory"}),Q=F({...O,emits:["reloadTable"],setup(j,{expose:y,emit:V}){const f=z(),u=x(),_=x(),e=E({isShowDialog:!1,title:"",fit:"fill",ruleForm:{id:"",parentId:"",title:"",path:"",suffix:"",icon:"",sortNum:"",iconUrl:""},rules:{title:{required:!0,message:"请输入分类名称",trigger:"blur"}}}),w=(i,o)=>{i==="edit"?(e.title="修改分类",f.getArticleCategory(o.id).then(s=>{delete s.data.created,delete s.data.updated,e.ruleForm=s.data})):(e.title="新增分类",h(()=>{u.value.resetFields(),e.ruleForm.id="",e.ruleForm.parentId=o==null?0:o.id||0})),e.isShowDialog=!0},g=()=>{e.isShowDialog=!1,d()},D=()=>{g(),d()},v=()=>{_.value.openDialog(1)},C=i=>{e.ruleForm.icon=i[0].filePath,e.ruleForm.iconUrl=i[0].path},k=()=>{u.value.validate(i=>{i&&f.addArticleCategory(e.ruleForm).then(()=>{g(),d(),V("reloadTable")}).catch(o=>{B({showClose:!0,message:o.message?o.message:"系统错误",type:"error"})})})},d=()=>{e.ruleForm.iconUrl="",h(()=>{u.value.resetFields()})};return y({openDialog:w}),(i,o)=>{const s=r("el-input"),n=r("el-form-item"),m=r("el-col"),A=r("el-image"),T=r("el-link"),U=r("el-row"),N=r("el-form"),b=r("el-button"),S=r("el-dialog");return H(),I("div",null,[l(S,{title:"新增分类",modelValue:e.isShowDialog,"onUpdate:modelValue":o[4]||(o[4]=a=>e.isShowDialog=a),width:"769px"},{footer:t(()=>[p("span",M,[l(b,{onClick:D,size:"default"},{default:t(()=>[c("取 消")]),_:1}),l(b,{type:"primary",onClick:k,size:"default"},{default:t(()=>[c("保 存")]),_:1})])]),default:t(()=>[l(N,{model:e.ruleForm,size:"default","label-width":"80px",rules:e.rules,ref_key:"myRefForm",ref:u},{default:t(()=>[l(U,{gutter:35},{default:t(()=>[l(m,{xs:24,sm:12,md:12,lg:12,xl:12,class:"mb20"},{default:t(()=>[l(n,{label:"分类名称",prop:"title"},{default:t(()=>[l(s,{modelValue:e.ruleForm.title,"onUpdate:modelValue":o[0]||(o[0]=a=>e.ruleForm.title=a),placeholder:"请输入分类名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l(m,{xs:24,sm:12,md:12,lg:12,xl:12,class:"mb20"},{default:t(()=>[l(n,{label:"分类图片",prop:"icon"},{default:t(()=>[p("div",P,[l(A,{style:{width:"100px",height:"100px","margin-bottom":"10px"},src:e.ruleForm.iconUrl,fit:e.fit,"preview-src-list":[e.ruleForm.iconUrl]},null,8,["src","fit","preview-src-list"]),l(T,{style:{},type:"primary",size:"small",plain:"",onClick:v},{default:t(()=>[c("选择图片")]),_:1})])]),_:1})]),_:1}),l(m,{xs:24,sm:12,md:12,lg:12,xl:12,class:"mb20"},{default:t(()=>[l(n,{label:"访问路径",prop:"path"},{default:t(()=>[l(s,{modelValue:e.ruleForm.path,"onUpdate:modelValue":o[1]||(o[1]=a=>e.ruleForm.path=a),placeholder:"请输入访问路径",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l(m,{xs:24,sm:12,md:12,lg:12,xl:12,class:"mb20"},{default:t(()=>[l(n,{label:"模板",prop:"suffix"},{default:t(()=>[l(s,{modelValue:e.ruleForm.suffix,"onUpdate:modelValue":o[2]||(o[2]=a=>e.ruleForm.suffix=a),placeholder:"请输入模板后缀名称",clearable:""},null,8,["modelValue"]),q]),_:1})]),_:1}),l(m,{xs:24,sm:12,md:12,lg:12,xl:12,class:"mb20"},{default:t(()=>[l(n,{label:"排序",prop:"sortNum"},{default:t(()=>[l(s,{type:"number",modelValue:e.ruleForm.sortNum,"onUpdate:modelValue":o[3]||(o[3]=a=>e.ruleForm.sortNum=a),placeholder:"排序",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"]),l(R,{ref_key:"thumbnailDialogRef",ref:_,onAttachHandler:C,fileType:e.fileType},null,8,["fileType"])]),_:1},8,["modelValue"])])}}});export{Q as _};
