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