import{d as ne,r as i,ao as I,ax as z,y as se,w as M,a0 as de,eQ as ie,G as ue,bw as re,a as v,c as h,b as l,q as C,f as N,e as t,h as r,H as u,Y as $,b3 as ce,ab as fe,dp as pe,b4 as _e,aj as ve,an as me,ac as be,aQ as ye,at as he,_ as ke}from"./index-e450010e.js";const ge=["innerHTML"],we={key:0},Ce=["id"],Ve={class:"dialog-footer"},Te={class:"dialog-footer"},Ee={class:"dialog-footer"},xe=ne({__name:"aceDrawer",props:{data:{},modelValue:{type:Boolean},title:{},direction:{default:"ltr"},content:{default:""},id:{default:"editJson"},codeType:{}},emits:["beforeClose","confirm","confirmTree","update:modelValue"],setup(Q,{emit:J}){const d=Q,k=J,m=i({}),g=i(!1),V=i(I),T=i(I);let f=0;const E=i(!1),c=i({}),b=i(!1),n=z({value:"1",label:""}),y=i(!1),B=z({label:[{required:!0,message:"请输入名称",trigger:"blur"}]}),p=se({get(){return d.data.content?d.data.content:[]},set(e){return e}}),S=e=>{if(!Array.isArray(e))return f=0;e.forEach(a=>{f++,console.log("递归查数",f),a.children&&a.children.length>0&&S(a.children)})};M(()=>g,e=>{var a;S((a=d.data)==null?void 0:a.content)},{deep:!0}),M(()=>d.modelValue,e=>{g.value=e,e&&O()});const O=()=>{de(()=>{m.value=ie(d.content,d.id,d.codeType)})},Y=()=>{const e=m.value.getValue();k("confirm",e)},F=()=>{k("update:modelValue",!1),k("beforeClose"),p.value=[]};ue(()=>{console.log("预览视图--------------------------------》",d.data)}),re(()=>{Object.keys(m.value).length!==0&&(m.value.destroy(),m.value.container.remove())});const K=e=>{c.value=e,E.value=!1,b.value=!0},x=()=>{c.value={},n.label="",b.value=!1,y.value=!1,V.value.resetFields()},P=()=>{E.value=!0,b.value=!0},W=()=>{y.value=!0,V.value.validate(e=>{e?(f++,E.value?p.value.push({value:f,label:n.label,children:[]}):c.value.children?c.value.children.push({value:f,label:n.label,children:[]}):c.value.children=[{value:f,label:n.label,children:[]}],x()):y.value=!1})},X=()=>{console.log("回填主表值",p.value),k("confirmTree",p.value,d.data.type),F()},Z=e=>{console.log("要删除得节点-->",e.value),U(p.value,e),console.log("删除指定节点数据---结果-->",p)},U=(e,a)=>{console.log("要删除得节点-11->",e,a.value);for(let _=0;_{c.value=e,n.label=e.label,w.value=!0},D=()=>{c.value={},n.label="",w.value=!1,A.value=!1,T.value.resetFields()},le=()=>{A.value=!0,T.value.validate(e=>{e?(c.value.label=n.label,D()):y.value=!1})};return(e,a)=>{const _=ce,o=fe,ae=pe,te=_e,L=ve,R=me,j=I,G=be,oe=ye,H=he;return v(),h(oe,{modelValue:g.value,"onUpdate:modelValue":a[4]||(a[4]=s=>g.value=s),size:"60%",title:e.title,direction:e.direction,class:"ace-dialog","append-to-body":!0,"before-close":F},{header:l(()=>[C("div",{innerHTML:e.title},null,8,ge)]),default:l(()=>[["cascader","treeSelect"].includes(d.data.type)?(v(),N("div",we,[t(te,{data:r(p),"row-key":"value","default-expand-all":""},{default:l(()=>[t(_,{prop:"label",label:"名称"}),t(_,{label:"操作",width:"200",align:"center"},{header:l(()=>[t(o,{type:"success",onClick:P},{default:l(()=>[u("添加顶级分类")]),_:1})]),default:l(s=>[t(ae,null,{default:l(()=>[t(o,{text:"",type:"success",onClick:q=>K(s.row)},{default:l(()=>[u("添加")]),_:2},1032,["onClick"]),t(o,{text:"",type:"warning",onClick:q=>ee(s.row)},{default:l(()=>[u("修改")]),_:2},1032,["onClick"]),t(o,{text:"",type:"danger",onClick:q=>Z(s.row)},{default:l(()=>[u("删除")]),_:2},1032,["onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])])):(v(),N("div",{key:1,id:e.id},null,8,Ce)),C("div",Ve,[["cascader","treeSelect"].includes(d.data.type)?(v(),h(o,{key:0,type:"primary",size:"small",onClick:X},{default:l(()=>[u(" 确定 ")]),_:1})):(v(),h(o,{key:1,type:"primary",size:"small",onClick:Y},{default:l(()=>[u(" 确定 ")]),_:1}))]),t(G,{modelValue:b.value,"onUpdate:modelValue":a[1]||(a[1]=s=>b.value=s),title:"编辑",width:"500","before-close":x},{footer:l(()=>[C("div",Te,[t(o,{onClick:x},{default:l(()=>[u("取消")]),_:1}),$((v(),h(o,{type:"primary",onClick:W},{default:l(()=>[u("确定")]),_:1})),[[H,y.value]])])]),default:l(()=>[t(j,{ref_key:"editTitleFormRef",ref:V,rules:r(B),model:r(n),"label-width":"auto",style:{"max-width":"600px"}},{default:l(()=>[t(R,{label:"名称:",prop:"label"},{default:l(()=>[t(L,{modelValue:r(n).label,"onUpdate:modelValue":a[0]||(a[0]=s=>r(n).label=s)},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"]),t(G,{modelValue:w.value,"onUpdate:modelValue":a[3]||(a[3]=s=>w.value=s),title:"编辑",width:"500","before-close":D},{footer:l(()=>[C("div",Ee,[t(o,{onClick:D},{default:l(()=>[u("取消")]),_:1}),$((v(),h(o,{type:"primary",onClick:le},{default:l(()=>[u("确定")]),_:1})),[[H,A.value]])])]),default:l(()=>[t(j,{ref_key:"editTitleInfoRef",ref:T,rules:r(B),model:r(n),"label-width":"auto",style:{"max-width":"600px"}},{default:l(()=>[t(R,{label:"名称:",prop:"label"},{default:l(()=>[t(L,{modelValue:r(n).label,"onUpdate:modelValue":a[2]||(a[2]=s=>r(n).label=s)},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"])]),_:1},8,["modelValue","title","direction"])}}});const De=ke(xe,[["__scopeId","data-v-fed82c5a"]]);export{De as A};