import{_ as e,m as a,f as t,r as s,h as l,e as d,c,b as o,j as n,g as i,w as r,t as h,P as u,p,E as f}from"./index-vtcwYVzc.js";const k=a({setup(){const e=t(-1),a=t(!1),l=s([]),d=s([]),c=s([]),o=s([]),n=s([]),i=s([]),r=a=>{e.value=a.userId,o.forEach((e=>{e.checked=!1}));let t=`/api/Sys_PDAAuth/GetUserTreePDAAuth?userId=${a.userId}`;p.post(t,{},!0).then((e=>{e.status&&e.data.data.forEach((e=>{let a=o.find((a=>a.id==e.id));a&&(a.checked=!0)}))}))},h=()=>{p.post("/api/Sys_PDAAuth/GetCurrentPDAAuth",{},!0).then((e=>{e.status&&(o.splice(0),o.push(...e.data.data),o.forEach(((e,a)=>{e.lv=a,n.push(e)})))}))};return p.post("api/Sys_PDAAuth/GetChildUser",{},!0).then((e=>{e.status&&(d.splice(0),d.push(...e.data.data),d.forEach(((e,a)=>{e.lv=a,e.children=[],l.push(e)})),l.forEach((e=>{i.push(e.userId)})))})),h(),{list:d,nodeClick:(a,t)=>{e.value=a.userId,r(a)},checked:a,tree:l,selectId:e,openKeys:i,getUserRole:r,roles:c,roleList:o,getCurrentTreePermission:h,leftCheckChange:(e,a)=>{e.actions.forEach(((e,t)=>{e.checked=a}))},nodeCheck:(e,a)=>{let t=o.find((a=>a.id===e.pid));t&&t.actions.length&&(t.actions[0].checked=e.actions.some((e=>e.checked))||a.halfCheckedNodes.some((a=>a.id===e.pid)))},roleTree:n,actionChange:(e,a)=>{a=e.actions.filter((e=>e.checked)).length==e.actions.length,e.leftCk=a},save:()=>{if(e.value<=0)return f({message:"请选择用户",type:"error"});let a=[];o.forEach((e=>{a.push(e)}));let t=`api/Sys_PDAAuth/SavePDAAuth?userId=${e.value}`;p.post(t,a.map((({lv:e,...a})=>a)),!0).then((e=>f({message:"保存成功",type:"success"})))}}}}),v={style:{width:"100%",height:"100%",display:"flex",overflow:"hidden"}},g={class:"role-tree-left flex-col"},C={class:"action-group"},y={class:"action-text"},m={style:{height:"calc(100vh - 6.5rem)",flex:"1",overflow:"hidden","background-color":"white"},class:"role-tree-right flex-col"},x={class:"title"},A={class:"action-group"};const _=e(k,[["render",function(e,a,t,s,p,f){const k=l("el-tree"),_=l("el-scrollbar"),P=l("el-button"),I=l("el-checkbox");return d(),c("div",v,[o("div",g,[a[0]||(a[0]=o("div",{class:"title"},[o("i",{class:"el-icon-user"}),n("PDA用户列表")],-1)),i(_,{class:"el-role-list"},{default:r((()=>[i(k,{data:e.tree,onNodeClick:e.nodeClick,"node-key":"userId","default-expanded-keys":e.openKeys,"expand-on-click-node":!1,style:{padding:"5px 0","margin-right":"2px"}},{default:r((({data:e})=>[o("div",C,[o("div",y,h(e.userName),1)])])),_:1},8,["data","onNodeClick","default-expanded-keys"])])),_:1})]),o("div",m,[o("div",x,[a[2]||(a[2]=o("div",null,[o("i",{class:"el-icon-folder-opened"}),n("菜单权限")],-1)),i(P,{type:"primary",onClick:e.save},{default:r((()=>a[1]||(a[1]=[n("保存")]))),_:1},8,["onClick"])]),i(_,{class:"el-role-list",style:{height:"100%"}},{default:r((()=>[i(k,{onCheckChange:e.leftCheckChange,onCheck:e.nodeCheck,data:e.roleTree,"show-checkbox":!1,style:{padding:"15px"},"node-key":"id","default-expand-all":"","expand-on-click-node":!1},{default:r((({data:e})=>[o("div",A,[o("div",{class:"action-text",style:u({width:18*(4-e.lv)+150+"px"})},[i(I,{modelValue:e.checked,"onUpdate:modelValue":a=>e.checked=a},{default:r((()=>[n(h(e.menuName),1)])),_:2},1032,["modelValue","onUpdate:modelValue"])],4)])])),_:1},8,["onCheckChange","onCheck","data"])])),_:1})])])}],["__scopeId","data-v-07dae509"]]);export{_ as default};
