import{x as Y,X as k,r as g,c as ee,h as D,k as te,al as _,y as s,H as L,I as u,A as I,Q as c,z as m,P as h,a4 as v,L as oe,O as A,C as ae,M as V}from"./vendor-6ae0c374-1783405707921v=1.0.0.js";import{g as le,d as ne,f as ie,h as se,i as ue,j as re,k as de,l as _e,m as ce}from"./role-ca48e7dd-1783405707921v=1.0.0.js";import{E as me}from"./eleVendor-d42abce8-1783405707921v=1.0.0.js";import{_ as pe}from"./index-71d7b18c-1783405707921v=1.0.0.js";const fe={class:"filter-container"},he=["onClick"],ve={style:{float:"right"}},ge=Y({__name:"AuthInfo",props:{mp_id:{type:String,required:!0},role_id:{type:String,required:!0}},setup(O){const f=O,z=k({}),S=k({}),o=k({mp_id:Number(f.mp_id),root_id:1,role_id:f.role_id}),C=g([]),y=g([]),p=k([{roleList:[]},{roleList:[]},{roleList:[]},{roleList:[]}]),x=g(0),w=g(0),E=g(""),P=ee(()=>[{title:"\u4E00\u7EA7\u83DC\u5355",roleList:p[0].roleList},{title:"\u4E8C\u7EA7\u83DC\u5355",roleList:p[1].roleList},{title:"\u529F\u80FD\u6743\u9650",roleList:p[2].roleList},{title:"\u63A5\u53E3\u6743\u9650",roleList:p[3].roleList}]);D(()=>f.mp_id,t=>{o.mp_id=parseInt(t),R(o.mp_id)}),D(()=>f.role_id,t=>{o.role_id=t}),te(()=>{f.mp_id&&(o.mp_id=parseInt(f.mp_id)),q()});async function q(){const{data:t}=await le({page:1,size:99});C.value=t.list,f.role_id&&R(o.mp_id)}function R(t){y.value=[],o.root_id=1,C.value.forEach(e=>{if(e.menu_tree){const a=JSON.parse(e.menu_tree);e.mp_id===t&&a.length>0&&(y.value=a,o.root_id=a[0].root_id)}}),B()}function U(){B()}function B(){const t={mp_id:o.mp_id,root_id:o.root_id};ne(t).then(e=>{var n,r;p[0].roleList=e.data;const a=(r=(n=e.data)==null?void 0:n[0])==null?void 0:r.auth_id;a&&M(a)})}function M(t){ie({pid:t,mp_id:o.mp_id}).then(e=>{var n,r;p[1].roleList=e.data;const a=(r=(n=e.data)==null?void 0:n[0])==null?void 0:r.auth_id;a&&(E.value=a,b(a))})}function b(t){se({pid:t,mp_id:o.mp_id,role_id:o.role_id}).then(e=>{p[2].roleList=e.data})}function j(t,e){x.value=t,w.value=0,M(e)}function H(t,e){w.value=t,E.value=e,b(e)}function J(t,e){const a={auth_id:t,role_id:o.role_id};(e?_e:ce)(a).then(r=>{r&&(me({message:"\u66F4\u6539\u6210\u529F\uFF01",type:"success",duration:1500}),b(E.value))})}async function Q(t){X(3,0,t.auth_id)}async function X(t,e,a){const n={mp_id:o.mp_id,root_id:o.root_id,role_id:o.role_id,auth_id:a||0},{data:r}=await ue(n);p[3].roleList=r}async function Z(t){var n;const e={role_id:o.role_id,auth_id:0,interface_id:t.interface_id};((n=event==null?void 0:event.target)==null?void 0:n.checked)?await re(e):await de(e)}return(t,e)=>{const a=_("el-option"),n=_("el-select"),r=_("el-form-item"),N=_("el-form"),T=_("el-checkbox"),$=_("el-tag"),G=_("el-card"),K=_("el-col"),W=_("el-row");return s(),L(N,{ref:"formRules",model:z,rules:S,"label-width":"120px",class:"form-section clearfix"},{default:u(()=>[I("div",fe,[c(N,{inline:!0,model:o,class:"demo-form-inline"},{default:u(()=>[c(r,null,{default:u(()=>[c(n,{modelValue:o.mp_id,"onUpdate:modelValue":e[0]||(e[0]=i=>o.mp_id=i),placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528",disabled:""},{default:u(()=>[(s(!0),m(h,null,v(C.value,(i,d)=>(s(),L(a,{key:d,label:i.mp_name,value:i.mp_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),c(r,null,{default:u(()=>[y.value.length>0?(s(),L(n,{key:0,modelValue:o.root_id,"onUpdate:modelValue":e[1]||(e[1]=i=>o.root_id=i),placeholder:"\u8BF7\u9009\u62E9\u6839\u8282\u70B9",onChange:U},{default:u(()=>[(s(!0),m(h,null,v(y.value,(i,d)=>(s(),L(a,{key:d,label:i.root_name,value:i.root_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):oe("v-if",!0)]),_:1})]),_:1},8,["model"])]),c(W,{gutter:20},{default:u(()=>[(s(!0),m(h,null,v(P.value,(i,d)=>(s(),L(K,{lg:6,xs:24,key:d},{default:u(()=>[c(G,{class:"box-card"},{header:u(()=>[I("span",null,A(i.title),1)]),default:u(()=>[d<2?(s(!0),m(h,{key:0},v(i.roleList,(l,F)=>(s(),m("div",{key:l.auth_id,class:ae(["item",(d===0?x.value:w.value)===F?"active":""]),onClick:Le=>d===0?j(F,l.auth_id):H(F,l.auth_id)},A(l.auth_name),11,he))),128)):d===2?(s(!0),m(h,{key:1},v(i.roleList,l=>(s(),m("div",{key:l.auth_id,class:"item"},[c(T,{"model-value":l.is_select,onChange:()=>J(l.auth_id,l.is_select)},{default:u(()=>[V(A(l.auth_name),1)]),_:2},1032,["model-value","onChange"]),I("span",ve,[c($,{type:"success",onClick:()=>Q(l)},{default:u(()=>[...e[2]||(e[2]=[V("\u6388\u6743\u63A5\u53E3",-1)])]),_:2,__:[2]},1032,["onClick"])])]))),128)):(s(!0),m(h,{key:2},v(i.roleList,l=>(s(),m("div",{key:l.interface_id,class:"item"},[c(T,{"model-value":l.is_select,onChange:()=>Z(l)},{default:u(()=>[V(A(l.interface_name),1)]),_:2},1032,["model-value","onChange"])]))),128))]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1},8,["model","rules"])}}});const we=pe(ge,[["__scopeId","data-v-87cddb51"],["__file","D:/desktop/huaZhong/huazhong-common/apps/vue-admin/src/views/roleManage/roleManage/components/AuthInfo.vue"]]);export{we as default};
