import{_ as H,d as O,l as Y,m as p,a8 as $,r as d,ag as z,o as f,c as h,B as G,A as F,x as t,h as a,u as D,ct as J,F as K,y as Q,d8 as W,a as e,H as g,b as X,cR as Z}from"./index.56449854.js";import{c as ee,d as ue}from"./index.77a8b055.js";import{m as le}from"./status.3ccd5ebb.js";const ae={class:"flex justify-end"},te=O({__name:"edit-dialog",emits:["reload"],setup(oe,{expose:y,emit:x}){const{logout:A}=Y(),v=p(!1),k=p(""),i=p("create"),C=p(null),U=p(null),c=p(!1),_=p(""),E={menu_name:"",is_menu:"1",menu_ico:"",menu_route:"",menu_url:"",weight:"1",pid:"0",id:""},u=p({...E}),B=$({menu_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",trigger:"blur"}],is_menu:[{required:!0,message:"\u8BF7\u9009\u62E9\u83DC\u5355\u7C7B\u578B",trigger:"change"}],menu_ico:[{required:!0,message:"\u8BF7\u9009\u62E9\u83DC\u5355\u56FE\u6807",trigger:"change"}],menu_route:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u8DEF\u7531",trigger:"blur"},{min:1,max:50,message:"\u957F\u5EA6\u5728 1 \u5230 50 \u4E2A\u5B57\u7B26",trigger:"blur"}],menu_url:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740",trigger:"blur"},{min:1,max:100,message:"\u957F\u5EA6\u5728 1 \u5230 100 \u4E2A\u5B57\u7B26",trigger:"blur"}],weight:[{required:!0,message:"\u8BF7\u8F93\u5165\u6392\u5E8F\u6743\u91CD",trigger:"blur"}]});function q(r,l,s){switch(U.value=r,Object.keys(u.value).forEach(n=>{n=="private"?u.value[n]=s==="create"?"1":String(r.is_private):u.value[n]=s==="create"?E[n]:String(r[n])}),l!==""&&s==="create"&&(u.value.pid=l),i.value=s,i.value){case"create":_.value="\u65B0\u5EFA\u83DC\u5355";break;case"edit":_.value="\u7F16\u8F91\u83DC\u5355";break;case"view":_.value="\u83DC\u5355\u8BE6\u60C5";break;default:_.value="\u65B0\u5EFA\u83DC\u5355"}w(),v.value=!0}function N(){return{data:{...u.value},api:ee}}function S(){return{data:{...u.value},api:ue}}function T(){C.value.validate(async r=>{if(r){if(c.value)return;const l=i.value==="create"?S:N;c.value=!0;const{api:s,data:n}=l(),{message:m,code:b}=await s({...n,pid:u.value.pid});Z({code:b,message:m,logout:A,handler:()=>{v.value=!1,c.value=!1,x("reload",{type:i.value,data:n})}})}})}function w(){const{is_menu:r}=u.value;B.menu_url[0].required=String(r)==="1"}return y({show:q,changeCurrentMenuId:r=>k.value=r}),(r,l)=>{const s=d("el-input"),n=d("el-form-item"),m=d("el-col"),b=d("el-option"),M=d("el-select"),j=d("el-input-number"),I=d("el-row"),V=d("el-button"),L=d("el-dialog"),P=z("loading");return f(),h("div",null,[G((f(),F(L,{modelValue:v.value,"onUpdate:modelValue":l[7]||(l[7]=o=>v.value=o),"close-on-click-modal":!1,"close-on-press-escape":!1,center:"","append-to-body":"","destroy-on-close":"",width:"700px",title:_.value},{default:t(()=>[a(D(J),{ref_key:"formRef",ref:C,model:u.value,rules:B,"label-width":"90px",class:"demo-ruleForm","status-icon":""},{default:t(()=>[a(I,null,{default:t(()=>[a(m,{span:24},{default:t(()=>[a(n,{label:"\u83DC\u5355\u540D\u79F0",prop:"menu_name"},{default:t(()=>[a(s,{modelValue:u.value.menu_name,"onUpdate:modelValue":l[0]||(l[0]=o=>u.value.menu_name=o),disabled:i.value==="view",placeholder:"\u83DC\u5355\u540D\u79F0"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),a(m,{span:12},{default:t(()=>[a(n,{label:"\u83DC\u5355\u7C7B\u578B",prop:"is_menu"},{default:t(()=>[a(M,{modelValue:u.value.is_menu,"onUpdate:modelValue":l[1]||(l[1]=o=>u.value.is_menu=o),style:{width:"100%"},onChange:w,disabled:i.value==="view",placeholder:"\u83DC\u5355\u7C7B\u578B"},{default:t(()=>[(f(!0),h(K,null,Q(D(le),(o,R)=>(f(),F(b,{key:"type"+o.value+R,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),a(m,{span:12},{default:t(()=>[a(n,{label:"\u83DC\u5355\u56FE\u6807",prop:"menu_ico"},{default:t(()=>[a(D(W),{modelValue:u.value.menu_ico,"onUpdate:modelValue":l[2]||(l[2]=o=>u.value.menu_ico=o)},null,8,["modelValue"])]),_:1})]),_:1}),a(m,{span:12},{default:t(()=>[a(n,{label:"\u83DC\u5355\u8DEF\u7531",prop:"menu_route"},{default:t(()=>[a(s,{modelValue:u.value.menu_route,"onUpdate:modelValue":l[3]||(l[3]=o=>u.value.menu_route=o),disabled:i.value==="view",placeholder:"\u83DC\u5355\u8DEF\u7531"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),a(m,{span:12},{default:t(()=>[a(n,{label:"\u6392\u5E8F\u6743\u91CD",prop:"weight"},{default:t(()=>[a(j,{modelValue:u.value.weight,"onUpdate:modelValue":l[4]||(l[4]=o=>u.value.weight=o),precision:0,style:{width:"100%"},min:1,max:999,disabled:i.value==="view"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),e(' '),e(' '),e(" "),e(" {{ si.label }}"),e(" "),e(" "),u.value.is_menu==="0"?(f(),F(m,{key:0,span:24},{default:t(()=>[a(n,{label:"\u9875\u9762\u5730\u5740",prop:"menu_url"},{default:t(()=>[a(s,{modelValue:u.value.menu_url,"onUpdate:modelValue":l[5]||(l[5]=o=>u.value.menu_url=o),placeholder:"\u9875\u9762\u5730\u5740",disabled:i.value==="view"},{prepend:t(()=>[g("views/")]),append:t(()=>[g(".vue")]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1})):e("v-if",!0),e(' '),e(' '),e(' '),e(' '),e(' '),e(' '),e(' '),e(" "),e(" "),e(" ")]),_:1}),X("div",ae,[a(V,{loading:c.value,type:"primary",onClick:T},{default:t(()=>[g("\u4FDD\u5B58")]),_:1},8,["loading"]),a(V,{onClick:l[6]||(l[6]=o=>v.value=!1)},{default:t(()=>[g("\u53D6\u6D88")]),_:1})])]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])),[[P,c.value]])])}}});var ie=H(te,[["__file","C:/Users/89793/Desktop/projects/report-v3/src/views/system/menuOperator/components/edit-dialog.vue"]]);export{ie as default};