import{C as y,D as R,v as k,t as A,F as g}from"./element-plus.55d71530.js";import{a as I,b as N,c as U}from"./article.b949a73f.js";import{P}from"./index.e651cfa0.js";import{d as S,s as c,r as q,b as M,_ as T,o as j,c as z,V as a,M as s,u,a as _}from"./@vue.96c135a1.js";const G={class:"edit-popup"},H=_("div",{class:"form-tips"},"\u9ED8\u8BA4\u4E3A0\uFF0C \u6570\u503C\u8D8A\u5927\u8D8A\u6392\u524D",-1),W=S({__name:"edit",emits:["success","close"],setup(J,{expose:f,emit:E}){const m=E,d=c(),n=c(),r=q("add"),F=M(()=>r.value=="edit"?"\u7F16\u8F91\u680F\u76EE":"\u65B0\u589E\u680F\u76EE"),o=T({id:"",name:"",sort:0,is_show:1}),v={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u680F\u76EE\u540D\u79F0",trigger:["blur"]}]},w=async()=>{var t,e;await((t=d.value)==null?void 0:t.validate()),r.value=="edit"?await I(o):await N(o),(e=n.value)==null||e.close(),m("success")},D=(t="add")=>{var e;r.value=t,(e=n.value)==null||e.open()},p=t=>{for(const e in o)t[e]!=null&&t[e]!=null&&(o[e]=t[e])},V=async t=>{const e=await U({id:t.id});p(e)},b=()=>{m("close")};return f({open:D,setFormData:p,getDetail:V}),(t,e)=>{const C=y,i=R,h=k,B=A,x=g;return j(),z("div",G,[a(P,{ref_key:"popupRef",ref:n,title:u(F),async:!0,width:"550px",onConfirm:w,onClose:b},{default:s(()=>[a(x,{ref_key:"formRef",ref:d,model:u(o),"label-width":"84px",rules:v},{default:s(()=>[a(i,{label:"\u680F\u76EE\u540D\u79F0",prop:"name"},{default:s(()=>[a(C,{modelValue:u(o).name,"onUpdate:modelValue":e[0]||(e[0]=l=>u(o).name=l),placeholder:"\u8BF7\u8F93\u5165\u680F\u76EE\u540D\u79F0",clearable:""},null,8,["modelValue"])]),_:1}),a(i,{label:"\u6392\u5E8F",prop:"sort"},{default:s(()=>[_("div",null,[a(h,{modelValue:u(o).sort,"onUpdate:modelValue":e[1]||(e[1]=l=>u(o).sort=l),min:0,max:9999},null,8,["modelValue"]),H])]),_:1}),a(i,{label:"\u72B6\u6001",prop:"is_show"},{default:s(()=>[a(B,{modelValue:u(o).is_show,"onUpdate:modelValue":e[2]||(e[2]=l=>u(o).is_show=l),"active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{W as _};
