import{F as w}from"./element-plus.4a7d92a3.js";import{P as C}from"./index.64cadcce.js";import{a as x,b as R,c as b}from"./log.78c20f7b.js";import{t as g}from"./index.8127cda8.js";import{d,s as l,r as k,b as B,Z as p,o as L,c as M,U as m,L as P,u as i}from"./@vue.18505fe0.js";const j={class:"edit-popup"},A=d({name:"logEdit"}),Z=d({...A,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(N,{expose:f,emit:_}){const n=_,r=l(),s=l(),c=k("add"),y=B(()=>c.value=="edit"?"\u7F16\u8F91\u7CFB\u7EDF\u65E5\u5FD7\u8868":"\u65B0\u589E\u7CFB\u7EDF\u65E5\u5FD7\u8868"),o=p({id:""}),F=p({}),u=async t=>{for(const e in o)t[e]!=null&&t[e]!=null&&(o[e]=t[e]);o.create_time=g(o.create_time,"yyyy-mm-dd hh:MM:ss")},h=async t=>{const e=await x({id:t.id});u(e)},v=async()=>{var e,a;await((e=r.value)==null?void 0:e.validate());const t={...o};c.value=="edit"?await R(t):await b(t),(a=s.value)==null||a.close(),n("success")},D=(t="add")=>{var e;c.value=t,(e=s.value)==null||e.open()},E=()=>{n("close")};return f({open:D,setFormData:u,getDetail:h}),(t,e)=>{const a=w;return L(),M("div",j,[m(C,{ref_key:"popupRef",ref:s,title:i(y),async:!0,width:"550px",onConfirm:v,onClose:E},{default:P(()=>[m(a,{ref_key:"formRef",ref:r,model:i(o),"label-width":"90px",rules:i(F)},null,8,["model","rules"])]),_:1},8,["title"])])}}});export{Z as _};
