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