"use strict";(self.webpackChunkwu_vue_zone_ecology=self.webpackChunkwu_vue_zone_ecology||[]).push([[935],{60935:function(e,l,a){a.r(l),a.d(l,{default:function(){return r}});var u=a(20641),t=a(50953),o={__name:"UsersEditRoute",props:{showDialog:{type:Boolean,default:!0},title:{type:String,default:"添加"},rowData:{type:Object,default:null}},emits:["closeDialog"],setup(e,{emit:l}){const a={name:[{required:!0,message:"请输入用户名",trigger:"blur"}],userName:[{required:!0,message:"请输入账户",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}],role:[{required:!0,message:"请选择角色",trigger:"change"}]},o=e,r=l,{title:d,rowData:s}=(0,t.QW)(o),n=()=>{r("closeDialog",!1)},i=(0,t.KR)(null),m=(0,t.Kh)({name:"",userName:"",password:"",role:"",status:1}),{userName:b,name:p,password:c,role:v,status:g}=(0,t.QW)(m),f=(0,t.KR)([]);s.value&&(p.value=s.value.name,b.value=s.value.userName,c.value=s.value.password,v.value=s.value.role,g.value=s.value.status);(async()=>{const{code:e,data:l}=await VE_API.system.roleList({page:1,size:10},{Global:!1});if("0"===e){const{list:e}=l;f.value=e}})();return(e,l)=>{const o=(0,u.g2)("el-input"),r=(0,u.g2)("el-form-item"),_=(0,u.g2)("el-option"),k=(0,u.g2)("el-select"),w=(0,u.g2)("el-radio-button"),V=(0,u.g2)("el-radio-group"),F=(0,u.g2)("el-button"),y=(0,u.g2)("el-form");return(0,u.uX)(),(0,u.Wv)(y,{model:m,ref_key:"formRef",ref:i,rules:a,"label-width":"80px",inline:!1},{default:(0,u.k6)((()=>[(0,u.bF)(r,{label:"账号",prop:"name"},{default:(0,u.k6)((()=>[(0,u.bF)(o,{modelValue:(0,t.R1)(p),"onUpdate:modelValue":l[0]||(l[0]=e=>(0,t.i9)(p)?p.value=e:null),placeholder:"",clearable:""},null,8,["modelValue"])])),_:1}),(0,u.bF)(r,{label:"用户名",prop:"userName"},{default:(0,u.k6)((()=>[(0,u.bF)(o,{modelValue:(0,t.R1)(b),"onUpdate:modelValue":l[1]||(l[1]=e=>(0,t.i9)(b)?b.value=e:null),placeholder:"",clearable:""},null,8,["modelValue"])])),_:1}),(0,u.bF)(r,{label:"密码",prop:"password"},{default:(0,u.k6)((()=>[(0,u.bF)(o,{modelValue:(0,t.R1)(c),"onUpdate:modelValue":l[2]||(l[2]=e=>(0,t.i9)(c)?c.value=e:null),"show-password":"",placeholder:"",clearable:""},null,8,["modelValue"])])),_:1}),(0,u.bF)(r,{label:"角色",prop:"role"},{default:(0,u.k6)((()=>[(0,u.bF)(k,{style:{width:"100%"},modelValue:(0,t.R1)(v),"onUpdate:modelValue":l[3]||(l[3]=e=>(0,t.i9)(v)?v.value=e:null),placeholder:"",clearable:""},{default:(0,u.k6)((()=>[((0,u.uX)(!0),(0,u.CE)(u.FK,null,(0,u.pI)(f.value,(e=>((0,u.uX)(),(0,u.Wv)(_,{key:e.id,label:e.name,value:e.id,disabled:0==e.status},null,8,["label","value","disabled"])))),128))])),_:1},8,["modelValue"])])),_:1}),(0,u.bF)(r,{label:"状态"},{default:(0,u.k6)((()=>[(0,u.bF)(V,{modelValue:(0,t.R1)(g),"onUpdate:modelValue":l[4]||(l[4]=e=>(0,t.i9)(g)?g.value=e:null)},{default:(0,u.k6)((()=>[(0,u.bF)(w,{label:1},{default:(0,u.k6)((()=>[(0,u.eW)("启用")])),_:1}),(0,u.bF)(w,{label:0},{default:(0,u.k6)((()=>[(0,u.eW)("停用")])),_:1})])),_:1},8,["modelValue"])])),_:1}),(0,u.bF)(r,null,{default:(0,u.k6)((()=>[(0,u.bF)(F,{onClick:l[5]||(l[5]=e=>n())},{default:(0,u.k6)((()=>[(0,u.eW)("取消")])),_:1}),(0,u.bF)(F,{type:"primary",onClick:l[6]||(l[6]=e=>{i.value.validate((async e=>{if(!e)return console.log("error submit!!"),!1;{let e;e="添加"===d.value?await VE_API.system.userAdd(m):await VE_API.system.userEdit({id:s.value.id,...m});const{code:l}=e;"0"===l&&n()}}))})},{default:(0,u.k6)((()=>[(0,u.eW)("确定")])),_:1})])),_:1})])),_:1},8,["model"])}}};var r=(0,a(64621).A)(o,[["__scopeId","data-v-8c51848e"]])}}]);