import{y as v,A as w,t as B,K as y,L as x,B as R}from"./element-plus.33d6376e.js";import{a as g,c as U,b as h}from"./role.4bb0e5e1.js";import{P as I}from"./index.4107e0ad.js";import{f as N}from"./index.80c2a703.js";import{d as S,s as c,r as A,e as L,$ as P,o as T,c as j,U as a,L as t,u as q,S as _}from"./@vue.230e89ba.js";const G={class:"edit-popup"},K=_("\u6B63\u5E38"),M=_("\u505C\u7528"),Y=S({__name:"edit",emits:["success","close"],setup($,{expose:f,emit:m}){const p=c(),r=c(),d=A("add"),F=L(()=>d.value=="edit"?"\u7F16\u8F91\u89D2\u8272":"\u65B0\u589E\u89D2\u8272"),o=P({id:"",name:"",remark:"",sort:0,isDisable:0,menus:[]}),b={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}]},V=async()=>{var e,l;await((e=p.value)==null?void 0:e.validate());const u={...o,menuIds:o.menus.join()};d.value=="edit"?await g(u):await U(u),(l=r.value)==null||l.close(),N.msgSuccess("\u64CD\u4F5C\u6210\u529F"),m("success")},D=()=>{m("close")};return f({open:(u="add")=>{var e;d.value=u,(e=r.value)==null||e.open()},setFormData:async u=>{const e=await h({id:u.id});for(const l in o)e[l]!=null&&e[l]!=null&&(o[l]=e[l])}}),(u,e)=>{const l=v,n=w,E=B,i=y,k=x,C=R;return T(),j("div",G,[a(I,{ref_key:"popupRef",ref:r,title:q(F),async:!0,width:"550px",clickModalClose:!0,onConfirm:V,onClose:D},{default:t(()=>[a(C,{class:"ls-form",ref_key:"formRef",ref:p,rules:b,model:o,"label-width":"60px"},{default:t(()=>[a(n,{label:"\u540D\u79F0",prop:"name"},{default:t(()=>[a(l,{class:"ls-input",modelValue:o.name,"onUpdate:modelValue":e[0]||(e[0]=s=>o.name=s),placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(n,{label:"\u5907\u6CE8",prop:"remark"},{default:t(()=>[a(l,{modelValue:o.remark,"onUpdate:modelValue":e[1]||(e[1]=s=>o.remark=s),type:"textarea",rows:4,placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1}),a(n,{label:"\u6392\u5E8F",prop:"sort"},{default:t(()=>[a(E,{modelValue:o.sort,"onUpdate:modelValue":e[2]||(e[2]=s=>o.sort=s)},null,8,["modelValue"])]),_:1}),a(n,{label:"\u72B6\u6001",prop:"sort"},{default:t(()=>[a(k,{modelValue:o.isDisable,"onUpdate:modelValue":e[3]||(e[3]=s=>o.isDisable=s)},{default:t(()=>[a(i,{label:0},{default:t(()=>[K]),_:1}),a(i,{label:1},{default:t(()=>[M]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{Y as _};
