import{j as e,r as a,o as r,s,a7 as l,c as o,n as u,v as t,x as d,e as p,B as i,z as n,y as v,T as f,ab as m,an as c,a9 as _}from"./base-lib.js?v=1761009159";import{ja as w,jb as b,b as y,ax as V}from"./utils-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const x=e("MAIL_BCC_ADD",()=>{const e=(e,a,r)=>{if(!a)return r(new Error("邮箱不能为空"));if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(a))return r(new Error("请输入正确的邮箱格式"));r()};return{formRef:a(),form:r({user:"",forward_user:"",type:"sender",active:1}),propsData:a({}),typeOptions:[{label:"发送时抄送",value:"sender"},{label:"接收时抄送",value:"recipient"}],rules:{user:[{required:!0,validator:e,trigger:"blur"}],forward_user:[{required:!0,validator:e,trigger:"blur"}],type:[{required:!0,message:"请选择抄送类型",trigger:"change"}]}}}),{form:g,formRef:j,propsData:D}=s(x()),h=y(),A=async e=>{var a;let r;await(null==(a=j.value)?void 0:a.validate());const{isEdit:s,row:o,onRefresh:u}=D.value;r=s&&o?await w({user:o.user,type:o.type,forward_user:o.forward_user,type_new:g.value.type,forward_user_new:g.value.forward_user,active_new:g.value.active}):await b(l(g.value));const{data:t}=r;h.request(t),t.status&&(e(),u&&u())},E=e=>{const{row:a,isEdit:r}=e;D.value=e,g.value.user="",g.value.forward_user="",g.value.type="sender",g.value.active=1,r&&a&&(g.value.user=a.user,g.value.forward_user=a.forward_user,g.value.type=a.type,g.value.active=a.active)},R={class:"p-20px"},q={class:"w-300px"},z={class:"w-300px"},U={class:"w-300px"},C=o({__name:"index",props:{compData:{}},setup(e,{expose:a}){const{form:r,propsData:l,formRef:o}=s(x()),{rules:w,typeOptions:b}=x(),y=e;return u(()=>{E(y.compData)}),a({onConfirm:A}),(e,a)=>{const s=f,u=m,y=V,x=c,g=_;return t(),d("div",R,[p(g,{ref_key:"formRef",ref:o,model:v(r),rules:v(w)},{default:i(()=>[p(u,{label:"被抄送者",prop:"user"},{default:i(()=>[n("div",q,[p(s,{modelValue:v(r).user,"onUpdate:modelValue":a[0]||(a[0]=e=>v(r).user=e),disabled:v(l).isEdit,placeholder:"输入需要密抄用户的邮箱"},null,8,["modelValue","disabled"])])]),_:1}),p(u,{label:"抄送到",prop:"forward_user"},{default:i(()=>[n("div",z,[p(s,{modelValue:v(r).forward_user,"onUpdate:modelValue":a[1]||(a[1]=e=>v(r).forward_user=e),placeholder:"输入您需要收到密抄的邮箱"},null,8,["modelValue"])])]),_:1}),p(u,{label:"抄送类型",prop:"type"},{default:i(()=>[n("div",U,[p(y,{modelValue:v(r).type,"onUpdate:modelValue":a[2]||(a[2]=e=>v(r).type=e),options:v(b)},null,8,["modelValue","options"])])]),_:1}),p(u,{label:"开启","show-feedback":!1},{default:i(()=>[p(x,{modelValue:v(r).active,"onUpdate:modelValue":a[3]||(a[3]=e=>v(r).active=e),"active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])])}}});export{C as default};
