import{r as a,b as e,d as r,e as s,f as l,h as o,w as d,g as t,j as i,k as m,i as p,n,E as u,q as c}from"./index.286e9b79.js";import{v as f}from"./loading.c49775a6.js";import{E as w,a as g}from"./form.ad10dcd5.js";import{E as b,a as v}from"./tab-pane.1cc0f769.js";import"./form-item.9355e6dc.js";import{E as _}from"./input.31de1b37.js";import{_ as h}from"./page-header.29890ed0.js";import{g as j,p as x}from"./http.f588794f.js";import"./_initCloneObject.fb8fbaea.js";import"./strings.8c60bfae.js";import"./event.776e7e11.js";import"./index.ed3ed02e.js";import"./divider.948c4b18.js";const V={class:"card goods-wrap"},k={class:"editor-card"},y={class:"editor-card-box"},E={class:"tool"},q={class:"tool-box"},U={__name:"password",setup(U){let C=a(!1),F=a(!1),N=a(0),O=a();const R=(a,e)=>{N.value=a.paneName};let T=e({data:{nickname:"",password:"",confirm_password:""}});C.value=!0,j("system.users/password").then((a=>{C.value=!1,a.code&&(T.data.nickname=a.data)}));const z=e({nickname:[{required:!0,message:"请输入名称",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{validator:(a,e,r)=>{if(""===e)r(new Error("请输入密码"));else{if(""!==T.data.confirm_password){if(!O.value)return;O.value.validateField("confirm_password",(()=>null))}r()}},trigger:"blur"}],confirm_password:[{required:!0,message:"请输入确认密码",trigger:"blur"},{validator:(a,e,r)=>{""===e?r(new Error("请输入确认密码")):e!==T.data.password?r(new Error("您输入的两次密码不相同")):r()},trigger:"blur"}]}),A=async()=>{O.value&&await O.value.validate(((a,e)=>{F.value=!1,a?(F.value=!0,x("system.users/password",T.data).then((a=>{F.value=!1,a.code?(O.value.resetFields(),u.success("修改密码成功")):u.error(a.msg)})).catch((a=>{u.error(a)}))):u.error("请完善内容")}))};return(a,e)=>{const u=h,j=_,x=w,U=b,B=v,D=g,G=c,H=f;return r(),s("div",V,[l(u,{title:"修改密码"}),o("div",k,[d((r(),i(D,{model:t(T).data,rules:t(z),ref_key:"ruleFormRef",ref:O},{default:m((()=>[o("div",y,[l(B,{modelValue:t(N),"onUpdate:modelValue":e[3]||(e[3]=a=>p(N)?N.value=a:N=a),onTabClick:R},{default:m((()=>[l(U,{label:"基本信息",name:0},{default:m((()=>[l(x,{label:"名称",prop:"nickname","label-width":"100px"},{default:m((()=>[l(j,{type:"text",modelValue:t(T).data.nickname,"onUpdate:modelValue":e[0]||(e[0]=a=>t(T).data.nickname=a),"show-word-limit":"",maxlength:"15",placeholder:"请输入名称"},null,8,["modelValue"])])),_:1}),l(x,{label:"密码",prop:"password","label-width":"100px"},{default:m((()=>[l(j,{type:"password",modelValue:t(T).data.password,"onUpdate:modelValue":e[1]||(e[1]=a=>t(T).data.password=a),"show-word-limit":"",maxlength:"15",placeholder:"请输入密码"},null,8,["modelValue"])])),_:1}),l(x,{label:"确认密码",prop:"confirm_password","label-width":"100px"},{default:m((()=>[l(j,{type:"password",modelValue:t(T).data.confirm_password,"onUpdate:modelValue":e[2]||(e[2]=a=>t(T).data.confirm_password=a),"show-word-limit":"",maxlength:"15",placeholder:"请输入确认密码"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])])),_:1},8,["model","rules"])),[[H,t(C)]])]),o("div",E,[o("div",q,[l(G,{type:"primary",loading:t(F),onClick:A},{default:m((()=>[n("保存")])),_:1},8,["loading"])])])])}}};export{U as default};
