import{c as a,o as e,q as s,v as o,x as r,e as m,B as l,y as t,ak as i,al as n,ab as d,a9 as p}from"./base-lib.js?v=1761009159";import{setModulePermission as u,getModulePermission as c}from"./database.js?v=1761009159";import{P as b,aK as _,M as f,_ as g}from"./utils-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const v={class:"p-[1.6rem]"},j=g(a({__name:"index",props:{compData:{default:()=>({name:""})}},setup(a,{expose:g}){const j=a,y=e({permission:[]});return s(async()=>{const a=await b({loading:"正在获取权限，请稍后...",request:c({data:JSON.stringify({user_name:j.compData.name})},"mongodb"),data:{status:Boolean,msg:String,data:Object}});y.permission=a.roles,a.status||f.error(a.msg)}),g({onConfirm:async a=>{try{await b({loading:"正在修改权限，请稍后...",request:u({data:JSON.stringify({user_name:j.compData.name,db_permission:y.permission})},"mongodb"),message:!0}),a()}catch(e){_(e,"修改权限-onConfirm")}}}),(a,e)=>{const s=i,u=n,c=d,b=p;return o(),r("div",v,[m(b,{class:"m-[1.6rem]",ref:"permissionForm",model:t(y),"label-width":"5rem"},{default:l(()=>[m(c,{label:"访问权限",prop:"permission"},{default:l(()=>[m(u,{modelValue:t(y).permission,"onUpdate:modelValue":e[0]||(e[0]=a=>t(y).permission=a),class:"!w-[32rem]",multiple:"",placeholder:"请选择"},{default:l(()=>[m(s,{label:"数据库所有者",value:"dbOwner"}),m(s,{label:"读取数据",value:"read"}),m(s,{label:"读取和写入数据",value:"readWrite"}),m(s,{label:"用户管理员",value:"userAdmin"})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])])}}}),[["__scopeId","data-v-bd53bbc1"]]);export{j as default};
