index.ce4abc5e.js 7.0 KB

1
  1. import{aC as B,a2 as te,_ as ae,d as ie,v as ce,w as k,ad as ne,W as se,x as oe,X as re,r as A,o as s,c as u,b as h,a as S,F as E,D,l as $,C as L,M,G as V,au as P,b2 as O,B as de,L as N,u as Y,J as ue,bk as he,Q as _e,R as ve,y as pe}from"./index.1d5f2f42.js";import{u as fe}from"./useCompany.f3b703c8.js";const{VITE_PROXY_DOMAIN_REAL:Ye,VITE_PROXY_USER_REAL:ge}=te(),F=ge+"/admin/",ke=_=>B.request("post",`${F}role/info`,{data:_}),me=_=>B.request("post",`${F}role/save`,{data:_}),Se=_=>B.request("post",`${F}menu/MenuAction`,{data:_}),Le=_=>B.request("post",`${F}role/query`,{data:_});const we=_=>(_e("data-v-4b412a89"),_=_(),ve(),_),Ce={class:"action"},Ae={key:0},Ee={class:"action_show"},Ve={class:"action_show_box"},ye={class:"role-list"},Re=we(()=>h("p",{class:"role-list__title"},"\u89D2\u8272\u5217\u8868",-1)),De={key:0,style:{"line-height":"60px","text-align":"center",color:"#858599"}},Me=["onClick"],Ne={class:"rule-view"},Ue={class:"rule-list",style:{padding:"0 0 100px 0"}},ze={class:"ftitle"},Oe={class:"fbody"},Be={class:"stitle clear"},Fe={class:"_h2 fl"},qe={key:0,class:"scheck"},Je={class:"checkAll"},Te={class:"checkItem"},$e={class:"rule-bottom"},He={name:"action"},Xe=ie({...He,setup(_){const{logout:U}=ce();fe();const w=k([]),p=k(!0),q=k([]),H=k([]),r=k([]),J=k("add"),C=k([]),z=k([]),X=k([]),m=ne({roleid:"",role_name:"",level:"1",action:[],private_data:[]}),Q=(a,l,i,e)=>{r.value[l].child[e].checkAll=a,r.value[l].child[e].child.forEach(t=>{const c=r.value[l].child[e].checkList.findIndex(v=>String(v)===String(t.id));a&&c==-1?r.value[l].child[e].checkList.push(String(t.id)):!a&&c>-1&&r.value[l].child[e].checkList.splice(c,1)})},W=(a,l,i,e)=>{r.value[l].child[e].checkAll=r.value[l].child[e].child.every(t=>r.value[l].child[e].checkList.findIndex(c=>String(c)===String(t.id))>-1)},j=(a,l,i,e)=>{if(a)r.value[i].child[e].checkList.indexOf(l)==-1&&r.value[i].child[e].checkList.push(String(l));else{const t=r.value[i].child[e].checkList.findIndex(c=>c==l);t>-1&&r.value[i].child[e].checkList.splice(t,1),r.value[i].child[e].checkAll=!1}},x=async a=>{const{id:l}=a;m.roleid=l,await pe(async()=>{await G(l)})},K=async()=>{if(p.value)return;if(C.value=[],z.value=[],X.value=[],r.value.forEach(e=>{e.child.forEach(t=>{z.value.push(...t.fieldList),C.value.push(...t.checkList),String(t.is_private_change)==="1"&&X.value.push(t.id)})}),C.value.length===0){P.error("\u8BF7\u9009\u62E9!");return}const a={status:"1",id:m.roleid,action:C.value,role_name:m.role_name};p.value=!0;const{code:l,message:i}=await me(a);O({code:l,message:i,logout:U,handler:()=>{P.success(i)}}),p.value=!1},Z=async()=>{const{code:a,data:l,message:i}=await Se({});O({code:a,message:i,logout:U,handler:()=>{let e=JSON.parse(JSON.stringify(l!=null?l:[]));e=e.filter(t=>t.child&&t.child.length>0),e=e.map(t=>(t.child.map(c=>(c.checkAll=!1,c.checkList=[],c.fieldAll=!1,c.fieldList=[],c.is_private_change="0",String(c.is_private)==="0"&&(c.private=[]),c)),t)),H.value=e}})},b=async()=>{const{code:a,data:l,message:i}=await Le({});O({code:a,message:i,logout:U,handler:()=>{w.value=l!=null?l:[]}})},G=async a=>{p.value=!0;const{code:l,data:i,message:e}=await ke({id:a});O({code:l,message:e,logout:U,handler:async()=>{const{action:t,id:c,role_name:v,level:f}=i!=null?i:{};m.roleid=c,m.role_name=v!=null?v:"",m.level=f!=null?f:"1",C.value=t?t.map(g=>String(g)):[],await I()}}),p.value=!1},I=async()=>{r.value=JSON.parse(JSON.stringify(H.value)),r.value.forEach((a,l)=>{var i;((i=a==null?void 0:a.child)==null?void 0:i.length)>0&&a.child.forEach((e,t)=>{var c,v;((c=e==null?void 0:e.child)==null?void 0:c.length)>0&&e.child.forEach(f=>{const g=C.value.findIndex(d=>String(d)===String(f.id));g!==-1&&e.checkList.push(C.value[g]),e.child.length===e.checkList.length&&(e.checkAll=!0)}),((v=e==null?void 0:e.child)==null?void 0:v.length)>0&&(e.child.map(f=>{const g=z.value.findIndex(d=>String(d)===String(f.id));g!==-1&&e.fieldList.push(z.value[g])}),e.child.length===e.fieldList.length&&(e.fieldAll=!0))})})};async function ee(){p.value=!0,await b(),await Z(),(w==null?void 0:w.value.length)>0&&await G(w.value[0].id),p.value=!1}let le=se(()=>a=>{const l=a.child.filter(e=>a.checkList.findIndex(t=>String(t)===String(e.id))>-1).length,i=a.child.filter(e=>a.checkList.findIndex(t=>String(t)===String(e.id))==-1).length;return l>0&&i>0});return oe(()=>{q.value=re().getMenuActions("actionSet"),ee()}),(a,l)=>{const i=A("el-button"),e=A("el-radio-button"),t=A("el-radio-group"),c=A("el-checkbox"),v=A("el-checkbox-group"),f=A("el-col"),g=A("el-row");return s(),u("div",Ce,[q.value.includes("3")?(s(),u("div",Ae,[h("div",Ee,[h("div",Ve,[h("ul",ye,[Re,w.value.length==0?(s(),u("p",De," \u6682\u65E0\u6570\u636E ")):S("v-if",!0),(s(!0),u(E,null,D(w.value,(d,y)=>(s(),u("li",{key:"role"+y,class:de(["role-list__item",{active:d.id==m.roleid}]),onClick:n=>!p.value&&x(d)},[M(N(d.role_name)+" ",1),p.value&&d.id==m.roleid?(s(),V(i,{key:0,class:"fr",link:"",size:"mini",icon:Y(ue)("Loading")},null,8,["icon"])):S("v-if",!0)],10,Me))),128))]),h("div",Ne,[h("div",Ue,[(s(!0),u(E,null,D(r.value,(d,y)=>(s(),V(g,{key:"menu"+d.id+y},{default:L(()=>[d.child&&d.child.length>0?(s(),V(f,{key:0,class:"ffff",span:24},{default:L(()=>[h("div",ze,[(s(!0),u(E,null,D(d.menu_name,(n,R)=>(s(),u("div",{key:"title"+R+n},N(n),1))),128))]),h("div",Oe,[(s(!0),u(E,null,D(d.child,(n,R)=>(s(),u("div",{class:"fbody-item",key:"yemian"+n.id+R},[n.action&&n.action.length===0&&n.child&&n.child.length===0?S("v-if",!0):(s(),u(E,{key:0},[h("div",Be,[h("span",Fe,N(n.menu_name),1),n&&n.private&&n.private.length===2?(s(),V(t,{key:0,style:{margin:"0 0 0 20px"},class:"fl",size:"small",modelValue:n.is_private_change,"onUpdate:modelValue":o=>n.is_private_change=o},{default:L(()=>[(s(!0),u(E,null,D(n.private,(o,T)=>(s(),V(e,{size:"small",key:o.label+T,label:o.id},{default:L(()=>[M(N(o.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):S("v-if",!0)]),n.child&&n.child.length>0?(s(),u("div",qe,[h("div",Je,[$(c,{modelValue:n.checkAll,"onUpdate:modelValue":o=>n.checkAll=o,size:"small",disabled:J.value==="view",indeterminate:Y(le)(n),onChange:o=>Q(o,y,d,R)},{default:L(()=>[M("\u529F\u80FD\u5168\u9009")]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","indeterminate","onChange"])]),h("div",Te,[$(v,{size:"small",modelValue:n.checkList,"onUpdate:modelValue":o=>n.checkList=o,disabled:J.value==="view",onChange:o=>W(o,y,d,R)},{default:L(()=>[(s(!0),u(E,null,D(n.child,o=>(s(),V(c,{size:"small",disabled:J.value==="view",key:"checkItem"+o.id,label:String(o.id),onChange:T=>j(T,String(o.id),y,R,d)},{default:L(()=>[M(N(o.action_name),1)]),_:2},1032,["disabled","label","onChange"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","onChange"])])])):S("v-if",!0)],64))]))),128))])]),_:2},1024)):S("v-if",!0)]),_:2},1024))),128))])])]),h("div",$e,[$(i,{size:"small",type:"primary",onClick:K},{default:L(()=>[M("\u63D0 \u4EA4")]),_:1})])])])):S("v-if",!0),q.value.includes("3")?S("v-if",!0):(s(),V(he,{key:1}))])}}});var Qe=ae(Xe,[["__scopeId","data-v-4b412a89"],["__file","D:/work/rep-v3/report-v3/src/views/system/actionSet/index.vue"]]);export{Qe as default};