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