import{_ as e,q as a,c as t,b as s,d as l,j as d,g as c,w as o,k as i,r as n,m as r,h,E as u,i as p,M as f}from"./index-DuyQv-rd.js";const k=a({setup(){const e=n(-1),a=n(!1),t=r([]),s=r([]),l=r([]),d=r([]),c=r([]),o=r([]),i=a=>{e.value=a.userId,d.forEach((e=>{e.checked=!1}));let t=`/api/Sys_PDAAuth/GetUserTreePDAAuth?userId=${a.userId}`;h.post(t,{},!0).then((e=>{e.status&&e.data.data.forEach((e=>{let a=d.find((a=>a.id==e.id));a&&(a.checked=!0)}))}))},p=()=>{h.post("/api/Sys_PDAAuth/GetCurrentPDAAuth",{},!0).then((e=>{e.status&&(d.splice(0),d.push(...e.data.data),d.forEach(((e,a)=>{e.lv=a,c.push(e)})))}))};return h.post("api/Sys_PDAAuth/GetChildUser",{},!0).then((e=>{e.status&&(s.splice(0),s.push(...e.data.data),s.forEach(((e,a)=>{e.lv=a,e.children=[],t.push(e)})),t.forEach((e=>{o.push(e.userId)})))})),p(),{list:s,nodeClick:(a,t)=>{e.value=a.userId,i(a)},checked:a,tree:t,selectId:e,openKeys:o,getUserRole:i,roles:l,roleList:d,getCurrentTreePermission:p,leftCheckChange:(e,a)=>{e.actions.forEach(((e,t)=>{e.checked=a}))},nodeCheck:(e,a)=>{let t=d.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:c,actionChange:(e,a)=>{a=e.actions.filter((e=>e.checked)).length==e.actions.length,e.leftCk=a},save:()=>{if(e.value<=0)return u({message:"请选择用户",type:"error"});let a=[];d.forEach((e=>{a.push(e)}));let t=`api/Sys_PDAAuth/SavePDAAuth?userId=${e.value}`;h.post(t,a.map((({lv:e,...a})=>a)),!0).then((e=>u({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,n,r,h,u){const k=i("el-tree"),_=i("el-scrollbar"),I=i("el-button"),P=i("el-checkbox");return s(),t("div",v,[l("div",g,[a[0]||(a[0]=l("div",{class:"title"},[l("i",{class:"el-icon-user"}),c("PDA用户列表")],-1)),d(_,{class:"el-role-list"},{default:o((()=>[d(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:o((({data:e})=>[l("div",C,[l("div",y,p(e.userName),1)])])),_:1},8,["data","onNodeClick","default-expanded-keys"])])),_:1})]),l("div",m,[l("div",x,[a[2]||(a[2]=l("div",null,[l("i",{class:"el-icon-folder-opened"}),c("菜单权限")],-1)),d(I,{type:"primary",onClick:e.save},{default:o((()=>a[1]||(a[1]=[c("保存")]))),_:1},8,["onClick"])]),d(_,{class:"el-role-list",style:{height:"100%"}},{default:o((()=>[d(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:o((({data:e})=>[l("div",A,[l("div",{class:"action-text",style:f({width:18*(4-e.lv)+150+"px"})},[d(P,{modelValue:e.checked,"onUpdate:modelValue":a=>e.checked=a},{default:o((()=>[c(p(e.menuName),1)])),_:2},1032,["modelValue","onUpdate:modelValue"])],4)])])),_:1},8,["onCheckChange","onCheck","data"])])),_:1})])])}],["__scopeId","data-v-07dae509"]]);export{_ as default};
