import{B as b}from"./page-content.e0c7af12.js";import{u as h}from"./useNav.5e73c372.js";import{r as k}from"./responseHandle.fe68d5aa.js";import{a as D,I as g,r as u,b as C,c as F,j as N,h as i,f as m,aq as P,u as c,m as j,x as _,an as p}from"./index.4d061c66.js";const I={modalConfig:{type:Object,required:!0}},R={class:"flex justify-end"},H=D({__name:"ResetPwd",props:I,setup(B,{expose:y}){const s=B,{logout:E}=h(),w=g(()=>s.modalConfig.title),d=g(()=>s.modalConfig.formItems),a=u({}),v=u(null),l=u(!1),t=u(!1);function x(){v.value.validate(async n=>{if(n){if(t.value)return;if(a.value[d.value[1].field]!==a.value[d.value[2].field]){p.warning("\u65B0\u5BC6\u7801\u4E0E\u786E\u8BA4\u5BC6\u7801\u4E0D\u4E00\u81F4");return}t.value=!0;const{modalConfig:e}=s,{httpChangePwd:r}=e,{code:f,message:o}=await r(c(a));k({code:f,message:o,logout:E,hasError:!0,handler:()=>{l.value=!1,t.value=!1,p.success(o)},error:()=>{p.error(o),t.value=!1}})}})}async function V(n){d.value.forEach(e=>{e.field==="id"?a.value[e.field]=n:a.value[e.field]=""}),l.value=!0}return y({show:V}),(n,e)=>{const r=C("el-button"),f=C("el-dialog");return F(),N(f,{title:c(w),modelValue:l.value,"onUpdate:modelValue":e[2]||(e[2]=o=>l.value=o),"close-on-press-escape":!1,center:"","append-to-body":"","destroy-on-close":"",width:"500px"},{default:i(()=>[m(c(b),P({ref_key:"formRef",ref:v},s.modalConfig,{"form-data":a.value,"onUpdate:form-data":e[0]||(e[0]=o=>a.value=o)}),null,16,["form-data"]),j("div",R,[m(r,{type:"primary",loading:t.value,onClick:x},{default:i(()=>[_("\u4FDD\u5B58")]),_:1},8,["loading"]),m(r,{onClick:e[1]||(e[1]=o=>l.value=!1)},{default:i(()=>[_("\u5173\u95ED")]),_:1})])]),_:1},8,["title","modelValue"])}}});export{H as _};
