import{C as g,D as k,v as x,t as R,F as h}from"./element-plus.fa1aa32c.js";import{p as y,a as S,b as A}from"./post.a07c89b8.js";import{P as U}from"./index.082aefea.js";import{f as I}from"./index.0abf9e5c.js";import{d as N,s as c,r as q,e as P,a0 as z,o as M,c as T,V as o,M as a,a as f,u as j}from"./@vue.cab01781.js";const G={class:"edit-popup"},H=f("div",{class:"form-tips"},"\u9ED8\u8BA4\u4E3A0\uFF0C \u6570\u503C\u8D8A\u5927\u8D8A\u6392\u524D",-1),X=N({__name:"edit",emits:["success","close"],setup(J,{expose:F,emit:d}){const p=c(),r=c(),n=q("add"),_=P(()=>n.value=="edit"?"\u7F16\u8F91\u5C97\u4F4D":"\u65B0\u589E\u5C97\u4F4D"),u=z({id:"",name:"",code:"",sort:0,remarks:"",isStop:0}),D={code:[{required:!0,message:"\u8BF7\u8F93\u5165\u5C97\u4F4D\u7F16\u7801",trigger:["blur"]}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5C97\u4F4D\u540D\u79F0",trigger:["blur"]}]},C=async()=>{var l,e;await((l=p.value)==null?void 0:l.validate()),n.value=="edit"?await y(u):await S(u),I.msgSuccess("\u64CD\u4F5C\u6210\u529F"),(e=r.value)==null||e.close(),d("success")},V=(l="add")=>{var e;n.value=l,(e=r.value)==null||e.open()},i=l=>{for(const e in u)l[e]!=null&&l[e]!=null&&(u[e]=l[e])},v=async l=>{const e=await A({id:l.id});i(e)},b=()=>{d("close")};return F({open:V,setFormData:i,getDetail:v}),(l,e)=>{const m=g,s=k,w=x,E=R,B=h;return M(),T("div",G,[o(U,{ref_key:"popupRef",ref:r,title:j(_),async:!0,width:"550px",onConfirm:C,onClose:b},{default:a(()=>[o(B,{ref_key:"formRef",ref:p,model:u,"label-width":"84px",rules:D},{default:a(()=>[o(s,{label:"\u5C97\u4F4D\u540D\u79F0",prop:"name"},{default:a(()=>[o(m,{modelValue:u.name,"onUpdate:modelValue":e[0]||(e[0]=t=>u.name=t),placeholder:"\u8BF7\u8F93\u5165\u5C97\u4F4D\u540D\u79F0",clearable:"",maxlength:100},null,8,["modelValue"])]),_:1}),o(s,{label:"\u5C97\u4F4D\u7F16\u7801",prop:"code"},{default:a(()=>[o(m,{modelValue:u.code,"onUpdate:modelValue":e[1]||(e[1]=t=>u.code=t),placeholder:"\u8BF7\u8F93\u5165\u5C97\u4F4D\u7F16\u7801",clearable:""},null,8,["modelValue"])]),_:1}),o(s,{label:"\u6392\u5E8F",prop:"sort"},{default:a(()=>[f("div",null,[o(w,{modelValue:u.sort,"onUpdate:modelValue":e[2]||(e[2]=t=>u.sort=t),min:0,max:9999},null,8,["modelValue"]),H])]),_:1}),o(s,{label:"\u5907\u6CE8",prop:"remarks"},{default:a(()=>[o(m,{modelValue:u.remarks,"onUpdate:modelValue":e[3]||(e[3]=t=>u.remarks=t),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8",type:"textarea",autosize:{minRows:4,maxRows:6},maxlength:"200","show-word-limit":""},null,8,["modelValue"])]),_:1}),o(s,{label:"\u5C97\u4F4D\u72B6\u6001",prop:"isStop"},{default:a(()=>[o(E,{modelValue:u.isStop,"onUpdate:modelValue":e[4]||(e[4]=t=>u.isStop=t),"active-value":0,"inactive-value":1},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{X as _};
