import{O as e,p as t}from"../element-plus/element-plus.a206f5fe.js";import{d as s,ax as a,B as o,r,j as i,E as l,i as c,o as n,c as u,a as d,P as m,S as p,W as h,V as j}from"../@vue/@vue.2e72eb65.js";import{C as v,E as f,A as b,b as y}from"../../assets/index.9d3f0ed9.js";import{B as w}from"../Controller/Controller.ef4ed6a0.js";import"../lodash-es/lodash-es.72245c2f.js";import"../async-validator/async-validator.21881447.js";import"../@vueuse/@vueuse.decddfd9.js";import"../dayjs/dayjs.c17b983f.js";import"../como-admin-web/como-admin-web.4290f457.js";import"../como-ts-utils/como-ts-utils.52443996.js";import"../szjcomo-utils/szjcomo-utils.8c09309c.js";import"../crypto-js/crypto-js.38083f5b.js";import"../ua-parser-js/ua-parser-js.f2fc0435.js";import"../como-validator/como-validator.c3b2e2bb.js";import"../@element-plus/@element-plus.3703707e.js";import"../@ctrl/@ctrl.9c8f424f.js";import"../@popperjs/@popperjs.f1fb8f77.js";import"../normalize-wheel-es/normalize-wheel-es.94de1731.js";import"../vue-router/vue-router.8caf83cb.js";import"../mitt/mitt.fcf4f812.js";import"../axios/axios.93b23c89.js";import"../pinia/pinia.0960c1bb.js";import"../vue-count-to/vue-count-to.ec270ea8.js";import"../@wangeditor/@wangeditor.bc4d1034.js";import"../xlsx/xlsx.a42c9766.js";import"../docx-preview/docx-preview.ad0b8171.js";import"../jszip/jszip.e379f989.js";import"../vue-como-image/vue-como-image.1f08e6a4.js";import"../echarts/echarts.adb31f9c.js";import"../tslib/tslib.e35f93b8.js";import"../zrender/zrender.a6916eca.js";import"../vue3-count-to/vue3-count-to.20d3c162.js";class g extends w{Select(e,...t){throw new Error("Method not implemented.")}Create(e,...t){throw new Error("Method not implemented.")}Update(e,...t){throw new Error("Method not implemented.")}Delete(e,...t){throw new Error("Method not implemented.")}async GetAuthData(){const e=await this.ProxyRequest(this.Request.Get,v.AccessAPI,{page:1,limit:2e3,access_status:1});return e?e.rows:[]}async GetAuthRoleData(e){const t=await this.ProxyRequest(this.Request.Get,v.RoleAuthAPI,{role_id:e});return t||[]}async SubmitAuthAccess(e,t,s){const a=this;try{const o={role_id:s,access_id:t.concat(e)};await a.ProxyRequest(a.Request.Post,v.RoleAuthAPI,o,!0,"授权中")&&(await a.Dialog()).Message("角色授权成功,请提醒当前已授权角色的管理员账号重新登录后生效",{icon:"SUCCESS"},(()=>{a.dialogIns&&a.dialogIns.Close(),f.emit("loadpageClose",{flush:Math.random()})}))}catch(o){return void a.Exception(null==o?void 0:o.message)}}static get Ins(){return new this}}const x={class:"role-auth"},A={class:"custom-tree-node-container"},_={class:"role-auth-submitbtn"},C=s({__name:"authPage",props:{params:{type:Object,default:()=>({})}},setup(s){a((e=>({e3d2fede:w.value})));const v=o("comoDialog"),f=g.Ins.SetDialogIns(v),w=r(b.Ins.GetThemeColor()),C=s,k=r([]),R=r(),P=i((()=>{let e=[];return f.Utils.ArrayRecursiveBack(I.value,"children").forEach((t=>{(!t.children||0==t.children.length&&k.value&&k.value.includes(t.access_id))&&e.push(t.access_id)})),e})),E=e=>2==e.level&&e.is_nav?"is-penultimate is-nav-node":2==e.level?"is-penultimate":e.is_nav?"is-nav-node":null,I=r([]),z=()=>{var e;return f.SubmitAuthAccess(null==(e=R.value)?void 0:e.getCheckedKeys(),R.value.getHalfCheckedKeys(),C.params.role_id)};return l((async()=>{w.value=await y().GetAppProThemeColor()})),c((()=>{!async function(){const e=await f.GetAuthData();I.value=e,console.log(e,C.params)}(),async function(){const e=await f.GetAuthRoleData(C.params.role_id);e&&e.length>0&&(k.value=e)}()})),(s,a)=>{const o=e,r=t;return n(),u("div",x,[d("div",A,[m(o,{data:I.value,"show-checkbox":"","node-key":"access_id","default-expand-all":"","expand-on-click-node":!1,"default-checked-keys":P.value,ref_key:"roleauthtree",ref:R,props:{class:E,label:"access_name"}},null,8,["data","default-checked-keys","props"])]),d("div",_,[m(r,{type:"danger",style:j({backgroundColor:w.value,border:"none"}),onClick:z},{default:p((()=>[h("确定授权")])),_:1},8,["style"])])])}}});export{C as default};
