/* empty css             *//* empty css                   *//* empty css                     *//* empty css                  */import"./el-tooltip-4ed993c7.js";/* empty css                  *//* empty css                  *//* empty css                 *//* empty css               *//* empty css                  *//* empty css                     */import{d as e,m as a,U as l,x as r,W as s,o,l as t,w as u,e as m,a as i,f as d,a1 as p,z as n,c,F as g,y as v,b,t as f,a4 as w,a2 as y,a3 as V,A as j,B as _,ar as h,aj as x,S as k,Y as U,$ as q}from"./index-2b50ecca.js";import{b as I,c as P,d as z}from"./index-e9611eca.js";import{g as $}from"./index-39cf29f1.js";/* empty css                 *//* empty css                   */const A={class:"flex flex-row justify-between"},E={class:"w-full"},F=m("br",null,null,-1),S={class:"flex justify-end"},Y=e({__name:"create",props:{primary:String|Number},emits:["close"],setup(e,{emit:Y}){const Z=e,B=a(),C=a([]),N=a({status:1,miniProgramIds:[]}),O=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!==N.value.password?(N.value.password,l(new Error("两次密码不匹配"))):l()},trigger:"blur"}]}),W=a(!1);return Z.primary&&I({id:Z.primary}).then((e=>{N.value=e.data})),a(),r((()=>{$().then((e=>{C.value=e.data}))})),(e,a)=>{const l=y,r=V,I=j,$=_,X=h,D=x,G=k,H=U,J=q;return s((o(),t(H,{model:N.value,"label-width":"100px",ref_key:"ruleForm",ref:B,rules:d(O),class:"pr-4"},{default:u((()=>[m("div",A,[m("div",E,[i(r,{label:"邮箱",prop:"email"},{default:u((()=>[i(l,{modelValue:N.value.email,"onUpdate:modelValue":a[0]||(a[0]=e=>N.value.email=e),placeholder:"请填写邮箱"},null,8,["modelValue"])])),_:1}),i(r,{label:"用户名",prop:"username"},{default:u((()=>[i(l,{modelValue:N.value.username,"onUpdate:modelValue":a[1]||(a[1]=e=>N.value.username=e),placeholder:"请填写用户名"},null,8,["modelValue"])])),_:1}),Z.primary?n("",!0):(o(),t(r,{key:0,label:"密码",prop:"password"},{default:u((()=>[i(l,{modelValue:N.value.password,"onUpdate:modelValue":a[2]||(a[2]=e=>N.value.password=e),clearable:"",type:"password",autocomplete:"new-password",size:"large",placeholder:"密码","show-password":"","prefix-icon":d(p),class:"h-12 text-base"},null,8,["modelValue","prefix-icon"])])),_:1})),Z.primary?n("",!0):(o(),t(r,{key:1,label:"确认密码",prop:"repassword"},{default:u((()=>[i(l,{modelValue:N.value.repassword,"onUpdate:modelValue":a[3]||(a[3]=e=>N.value.repassword=e),clearable:"",type:"password",autocomplete:"new-password",size:"large",placeholder:"确认密码","show-password":"","prefix-icon":d(p),class:"h-12 text-base"},null,8,["modelValue","prefix-icon"])])),_:1})),i(r,{label:"绑定小程序",prop:"miniProgramIds"},{default:u((()=>[i($,{class:"w-full",modelValue:N.value.miniProgramIds,"onUpdate:modelValue":a[4]||(a[4]=e=>N.value.miniProgramIds=e),filterable:"",multiple:"",clearable:"",placeholder:"选择小程序"},{default:u((()=>[(o(!0),c(g,null,v(C.value,(e=>(o(),t(I,{key:e.miniprogram_id,label:e.name,value:e.miniprogram_id},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),i(r,{label:"状态",prop:"status"},{default:u((()=>[i(X,{modelValue:N.value.status,"onUpdate:modelValue":a[5]||(a[5]=e=>N.value.status=e),"active-value":1,"inactive-value":2},null,8,["modelValue"])])),_:1}),i(r,{label:"备注",prop:"remark"},{default:u((()=>[i(D,{placement:"top"},{content:u((()=>[b(" 鼠标移到账号上面显示备注内容"),F])),default:u((()=>[i(l,{modelValue:N.value.remark,"onUpdate:modelValue":a[6]||(a[6]=e=>N.value.remark=e),placeholder:"请填写备注",type:"textarea"},null,8,["modelValue"])])),_:1})])),_:1})])]),m("div",S,[i(G,{type:"primary",onClick:a[7]||(a[7]=e=>{return a=B.value,N.value,void(a&&a.validate((e=>{if(e){let e;e=Z.primary?P:z,e({...N.value}).then((e=>{w.success(e.message),Y("close")}))}else W.value=!1})).then((()=>{})));var a})},{default:u((()=>[b(f(e.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model","rules"])),[[J,W.value]])}}});export{Y as _};
