import{g as Z,d as ee,f as te,h as oe,i as ae,j as le,k as ne,l as ie,m as se}from"./role-d87c2313-1782468512657v=1.0.0.js";import{E as ue}from"./eleVendor-12a75a9a-1782468512657v=1.0.0.js";import{x as re,X as y,r as g,c as de,h as D,k as _e,al as _,y as s,H as L,I as u,A as b,Q as c,z as m,P as h,a4 as v,L as ce,O as A,C as me,M as x}from"./vendor-27e23c1b-1782468512657v=1.0.0.js";import{_ as pe}from"./index-c87bcfde-1782468512657v=1.0.0.js";const fe={class:"filter-container"},he=["onClick"],ve={style:{float:"right"}},ge=re({__name:"AuthInfo",props:{mp_id:{},role_id:{}},setup(M){const f=M,z=y({}),P=y({}),o=y({mp_id:Number(f.mp_id),root_id:1,role_id:f.role_id}),C=g([]),k=g([]),p=y([{roleList:[]},{roleList:[]},{roleList:[]},{roleList:[]}]),I=g(0),E=g(0),w=g(""),S=de(()=>[{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}),_e(()=>{f.mp_id&&(o.mp_id=parseInt(f.mp_id)),U()});async function U(){const{data:t}=await Z({page:1,size:99});C.value=t.list,f.role_id&&R(o.mp_id)}function R(t){k.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&&(k.value=a,o.root_id=a[0].root_id)}}),B()}function j(){B()}function B(){const t={mp_id:o.mp_id,root_id:o.root_id};ee(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&&N(a)})}function N(t){te({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&&(w.value=a,F(a))})}function F(t){oe({pid:t,mp_id:o.mp_id,role_id:o.role_id}).then(e=>{p[2].roleList=e.data})}function H(t,e){I.value=t,E.value=0,N(e)}function J(t,e){E.value=t,w.value=e,F(e)}function Q(t,e){const a={auth_id:t,role_id:o.role_id};(e?ie:se)(a).then(r=>{r&&(ue({message:"\u66F4\u6539\u6210\u529F\uFF01",type:"success",duration:1500}),F(w.value))})}async function X(t){$(3,0,t.auth_id)}async function $(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 ae(n);p[3].roleList=r}async function q(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 le(e):await ne(e)}return(t,e)=>{const a=_("el-option"),n=_("el-select"),r=_("el-form-item"),T=_("el-form"),O=_("el-checkbox"),G=_("el-tag"),K=_("el-card"),W=_("el-col"),Y=_("el-row");return s(),L(T,{ref:"formRules",model:z,rules:P,"label-width":"120px",class:"form-section clearfix"},{default:u(()=>[b("div",fe,[c(T,{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(()=>[k.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:j},{default:u(()=>[(s(!0),m(h,null,v(k.value,(i,d)=>(s(),L(a,{key:d,label:i.root_name,value:i.root_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):ce("v-if",!0)]),_:1})]),_:1},8,["model"])]),c(Y,{gutter:20},{default:u(()=>[(s(!0),m(h,null,v(S.value,(i,d)=>(s(),L(W,{lg:6,xs:24,key:d},{default:u(()=>[c(K,{class:"box-card"},{header:u(()=>[b("span",null,A(i.title),1)]),default:u(()=>[d<2?(s(!0),m(h,{key:0},v(i.roleList,(l,V)=>(s(),m("div",{key:l.auth_id,class:me(["item",(d===0?I.value:E.value)===V?"active":""]),onClick:Le=>d===0?H(V,l.auth_id):J(V,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(O,{"model-value":l.is_select,onChange:()=>Q(l.auth_id,l.is_select)},{default:u(()=>[x(A(l.auth_name),1)]),_:2},1032,["model-value","onChange"]),b("span",ve,[c(G,{type:"success",onClick:()=>X(l)},{default:u(()=>e[2]||(e[2]=[x("\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(O,{"model-value":l.is_select,onChange:()=>q(l)},{default:u(()=>[x(A(l.interface_name),1)]),_:2},1032,["model-value","onChange"])]))),128))]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1},8,["model","rules"])}}});const Ee=pe(ge,[["__scopeId","data-v-5cd81d5e"]]);export{Ee as default};
