import{d as e,k as a,H as l,p as r,r as s,K as o,J as u,o as t,j as d,w as m,e as i,a as p,f as n,N as c,s as v,c as g,F as f,q as b,b as w,t as V,O as y}from"./index-018fb6dd.js";import{b as _,c as h,d as x}from"./index-cb41d118.js";import{g as k}from"./index-937329f9.js";/* empty css             *//* empty css                   */const j={class:"flex flex-row justify-between"},q={class:"w-full"},U=i("br",null,null,-1),I={class:"flex justify-end"},P=e({__name:"create",props:{primary:String|Number},emits:["close"],setup(e,{emit:P}){const z=e,F=a(),E=a([]),J=a({status:1,miniProgramIds:[]}),N=l({miniProgramIds:[{required:!0,message:"请选择小程序"}],email:[{required:!0,message:"请输入邮箱",trigger:"blur"},{type:"email",message:"邮箱格式不正确",trigger:"blur"}],remark:[{required:!1,message:"请输入备注",trigger:"blur"}],username:[{required:!0,message:"请输入用户名",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{pattern:/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/,message:"必须包含大小写字母和数字的组合，可以使用特殊字符，长度在6-20之间"}],repassword:[{required:!0,message:"请再次输入密码",trigger:"blur"},{validator:(e,a,l)=>{""===a?l(new Error("请再次输入密码")):a!==J.value.password?(J.value.password,l(new Error("两次密码不匹配"))):l()},trigger:"blur"}]}),$=a(!1);return z.primary&&_({id:z.primary}).then((e=>{J.value=e.data})),a(),r((()=>{k().then((e=>{E.value=e.data}))})),(e,a)=>{const l=s("el-input"),r=s("el-form-item"),_=s("el-option"),k=s("el-select"),A=s("el-switch"),C=s("el-tooltip"),H=s("el-button"),K=s("el-form"),O=o("loading");return u((t(),d(K,{model:J.value,"label-width":"100px",ref_key:"ruleForm",ref:F,rules:n(N),class:"pr-4"},{default:m((()=>[i("div",j,[i("div",q,[p(r,{label:"邮箱",prop:"email"},{default:m((()=>[p(l,{modelValue:J.value.email,"onUpdate:modelValue":a[0]||(a[0]=e=>J.value.email=e),placeholder:"请填写邮箱"},null,8,["modelValue"])])),_:1}),p(r,{label:"用户名",prop:"username"},{default:m((()=>[p(l,{modelValue:J.value.username,"onUpdate:modelValue":a[1]||(a[1]=e=>J.value.username=e),placeholder:"请填写用户名"},null,8,["modelValue"])])),_:1}),z.primary?v("",!0):(t(),d(r,{key:0,label:"密码",prop:"password"},{default:m((()=>[p(l,{modelValue:J.value.password,"onUpdate:modelValue":a[2]||(a[2]=e=>J.value.password=e),clearable:"",type:"password",autocomplete:"new-password",size:"large",placeholder:"密码","show-password":"","prefix-icon":n(c),class:"h-12 text-base"},null,8,["modelValue","prefix-icon"])])),_:1})),z.primary?v("",!0):(t(),d(r,{key:1,label:"确认密码",prop:"repassword"},{default:m((()=>[p(l,{modelValue:J.value.repassword,"onUpdate:modelValue":a[3]||(a[3]=e=>J.value.repassword=e),clearable:"",type:"password",autocomplete:"new-password",size:"large",placeholder:"确认密码","show-password":"","prefix-icon":n(c),class:"h-12 text-base"},null,8,["modelValue","prefix-icon"])])),_:1})),p(r,{label:"绑定小程序",prop:"miniProgramIds"},{default:m((()=>[p(k,{class:"w-full",modelValue:J.value.miniProgramIds,"onUpdate:modelValue":a[4]||(a[4]=e=>J.value.miniProgramIds=e),filterable:"",multiple:"",clearable:"",placeholder:"选择小程序"},{default:m((()=>[(t(!0),g(f,null,b(E.value,(e=>(t(),d(_,{key:e.miniprogram_id,label:e.name,value:e.miniprogram_id},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),p(r,{label:"状态",prop:"status"},{default:m((()=>[p(A,{modelValue:J.value.status,"onUpdate:modelValue":a[5]||(a[5]=e=>J.value.status=e),"active-value":1,"inactive-value":2},null,8,["modelValue"])])),_:1}),p(r,{label:"备注",prop:"remark"},{default:m((()=>[p(C,{placement:"top"},{content:m((()=>[w(" 鼠标移到账号上面显示备注内容"),U])),default:m((()=>[p(l,{modelValue:J.value.remark,"onUpdate:modelValue":a[6]||(a[6]=e=>J.value.remark=e),placeholder:"请填写备注",type:"textarea"},null,8,["modelValue"])])),_:1})])),_:1})])]),i("div",I,[p(H,{type:"primary",onClick:a[7]||(a[7]=e=>{return a=F.value,J.value,void(a&&a.validate((e=>{if(e){let e;e=z.primary?h:x,e({...J.value}).then((e=>{y.success(e.message),P("close")}))}else $.value=!1})).then((()=>{})));var a})},{default:m((()=>[w(V(e.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model","rules"])),[[O,$.value]])}}});export{P as _};
