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