import{U as x,A as D}from"./api.CnUXTblF.js";import{ai as g}from"./index.CL7yl-Wb.js";import{a as v,r as k,_ as F,q as U,aj as n,c as A,o as j,S as o,K as a,P as c}from"./vue.D1BjjNmv.js";import{_ as N}from"./_plugin-vue_export-helper.DlAUqK2U.js";const q={class:"document-form-container"},B=v({__name:"index",props:{initFormData:{type:Object,default:()=>({})},cacheData:{type:Array,default:()=>[]},treeData:{type:Array,default:()=>[]}},emits:["drawerClose"],setup(f,{emit:_}){const s=f,i=_,m=k(null),t=F({id:"",name:"",parent:"",sort:0,description:""}),b={name:[{required:!0,message:"请输入分类名称",trigger:"blur"}]};U(()=>{s.initFormData&&s.initFormData.id&&Object.assign(t,s.initFormData)});const y=async()=>{m.value&&await m.value.validate(async d=>{if(d)try{let e;t.id?e=await x(t):e=await D(t),e&&e.code===2e3&&(g(e.msg||"操作成功"),i("drawerClose","submit"))}catch(e){console.error("保存文档分类失败:",e)}})},C=()=>{i("drawerClose")};return(d,e)=>{const u=n("el-input"),l=n("el-form-item"),V=n("el-input-number"),p=n("el-button"),w=n("el-form");return j(),A("div",q,[o(w,{ref_key:"formRef",ref:m,model:t,rules:b,"label-width":"100px"},{default:a(()=>[o(l,{label:"分类名称",prop:"name"},{default:a(()=>[o(u,{modelValue:t.name,"onUpdate:modelValue":e[0]||(e[0]=r=>t.name=r),placeholder:"请输入分类名称"},null,8,["modelValue"])]),_:1}),o(l,{label:"排序",prop:"sort"},{default:a(()=>[o(V,{modelValue:t.sort,"onUpdate:modelValue":e[1]||(e[1]=r=>t.sort=r),min:0,max:999},null,8,["modelValue"])]),_:1}),o(l,{label:"描述",prop:"description"},{default:a(()=>[o(u,{modelValue:t.description,"onUpdate:modelValue":e[2]||(e[2]=r=>t.description=r),type:"textarea",rows:"4",placeholder:"请输入分类描述"},null,8,["modelValue"])]),_:1}),o(l,null,{default:a(()=>[o(p,{type:"primary",onClick:y},{default:a(()=>e[3]||(e[3]=[c("保存")])),_:1}),o(p,{onClick:C},{default:a(()=>e[4]||(e[4]=[c("取消")])),_:1})]),_:1})]),_:1},8,["model"])])}}}),I=N(B,[["__scopeId","data-v-b9a8b4ff"]]);export{I as default};
