index.db7b4f65.js 9.7 KB

1
  1. import{aN as P,aO as he,_ as _e,d as ve,D as fe,a5 as ge,E as w,a7 as pe,af as b,F as me,ag as ke,H as Se,x as E,o as d,c as h,O as Y,P as K,u as O,b as _,a as g,L as V,M as B,y as D,K as p,R as x,W as F,aS as W,bi as G,J as Le,T as M,N as U,$ as Ce,a0 as we,G as Ae}from"./index.743f0c80.js";const{VITE_PROXY_DOMAIN_REAL:nl,VITE_PROXY_USER_REAL:Ee}=he(),X=Ee+"/admin/",Ve=f=>P.request("post",`${X}roleinfo`,{data:f}),Fe=f=>P.request("post",`${X}rolesave`,{data:f}),Ne=f=>P.request("post",`${X}menuactionlist`,{data:f}),ye=f=>P.request("post",`${X}roleall`,{data:f});const Be=f=>(Ce("data-v-235465d4"),f=f(),we(),f),De={class:"action"},Ue={class:"action_show"},ze={class:"action_show_box"},Re={class:"role-list"},Oe=Be(()=>_("p",{class:"role-list__title"},"\u89D2\u8272\u5217\u8868",-1)),Me={key:0,style:{"line-height":"60px","text-align":"center",color:"#858599"}},Te=["onClick"],$e={class:"rule-view"},Je={class:"rule-list",style:{padding:"0 0 100px 0"}},qe={class:"ftitle"},He={class:"fbody"},Ge={class:"stitle clear"},Pe={class:"_h2 fl"},Xe={key:0,class:"scheck"},Ye={class:"checkAll"},Ke=F("\u529F\u80FD\u5168\u9009"),We={class:"checkItem"},je={key:1,class:"sfield"},Qe={class:"checkAll"},Ze=F("\u5B57\u6BB5\u5168\u9009"),be={class:"checkItem"},xe={key:0,class:"rule-bottom"},Ie=F("\u63D0 \u4EA4"),el={class:"warning-message"},ll=F(" \u8BF7\u5728\u53F3\u4E0A\u89D2\u9009\u62E9\u4E00\u5BB6\u4E1A\u52A1\u516C\u53F8 "),al={name:"action"},tl=ve({...al,setup(f){const{logout:H}=fe(),{currentCompany:T}=ge(),N=w([]),m=w(!0),$=w([]),j=w([]),s=w([]),z=w("add"),y=w([]),J=w([]),R=w([]),k=pe({roleid:"",role_name:"",level:"1",action:[],private_data:[]}),I=(a,l,i,e)=>{s.value[l].child[e].checkAll=a,s.value[l].child[e].action.forEach(n=>{const t=s.value[l].child[e].checkList.findIndex(r=>String(r)===String(n.id));a&&t==-1?s.value[l].child[e].checkList.push(String(n.id)):!a&&t>-1&&s.value[l].child[e].checkList.splice(t,1)})},ee=(a,l,i,e)=>{s.value[l].child[e].fieldAll=a,s.value[l].child[e].action_data.forEach(n=>{const t=s.value[l].child[e].fieldList.findIndex(r=>String(r)===String(n.id));a&&t==-1?s.value[l].child[e].fieldList.push(String(n.id)):!a&&t>-1&&s.value[l].child[e].fieldList.splice(t,1)})},le=(a,l,i,e)=>{s.value[l].child[e].checkAll=s.value[l].child[e].action.every(n=>s.value[l].child[e].checkList.findIndex(t=>String(t)===String(n.id))>-1)},ae=(a,l,i,e)=>{s.value[l].child[e].fieldAll=s.value[l].child[e].action_data.every(n=>s.value[l].child[e].fieldList.findIndex(t=>String(t)===String(n.id))>-1)},te=(a,l,i,e,n)=>{if(a)s.value[i].child[e].checkList.indexOf(l)==-1&&s.value[i].child[e].checkList.push(String(l));else{const t=s.value[i].child[e].checkList.findIndex(r=>r==l);t>-1&&s.value[i].child[e].checkList.splice(t,1),s.value[i].child[e].checkAll=!1}},ie=(a,l,i,e,n)=>{if(a)s.value[i].child[e].fieldList.indexOf(l)==-1&&s.value[i].child[e].fieldList.push(String(l));else{const t=s.value[i].child[e].fieldList.findIndex(r=>r==l);t>-1&&s.value[i].child[e].fieldList.splice(t,1),s.value[i].child[e].fieldAll=!1}},ne=async a=>{const{id:l}=a;k.roleid=l,await Ae(async()=>{await Q(l)})},oe=async()=>{if(m.value)return;if(y.value=[],J.value=[],R.value=[],s.value.forEach(e=>{e.child.forEach(n=>{J.value.push(...n.fieldList),y.value.push(...n.checkList),String(n.is_private_change)==="1"&&R.value.push(n.id)})}),y.value.length===0){W.error("\u8BF7\u9009\u62E9\u529F\u80FD!");return}const a={roleid:k.roleid,role_name:k.role_name,level:k.level,action:y.value,private_data:R.value};m.value=!0;const{code:l,message:i}=await Fe(a);G({code:l,message:i,logout:H,handler:()=>{W.success(i)}}),m.value=!1},ce=async()=>{const{code:a,data:l,message:i}=await Ne({level:"2"});G({code:a,message:i,logout:H,handler:()=>{let e=JSON.parse(JSON.stringify(l!=null?l:[]));e=e.filter(n=>n.child&&n.child.length>0),e=e.map(n=>(n.child.map(t=>(t.checkAll=!1,t.checkList=[],t.fieldAll=!1,t.fieldList=[],t.is_private_change="0",String(t.is_private)==="0"?t.private=[]:t.private=[{id:"0",label:"\u516C\u6709\u6570\u636E"},{id:"1",label:"\u79C1\u6709\u6570\u636E"}],t)),n)),j.value=e}})},se=async()=>{const{code:a,data:l,message:i}=await ye({companyNo:T.value.companyNo});G({code:a,message:i,logout:H,handler:()=>{N.value=l!=null?l:[]}})},Q=async a=>{m.value=!0;const{code:l,data:i,message:e}=await Ve({roleid:a});G({code:l,message:e,logout:H,handler:async()=>{const{action:n,action_data:t,private_data:r,id:A,role_name:v,level:S}=i!=null?i:{};k.roleid=A,k.role_name=v!=null?v:"",k.level=S!=null?S:"1",y.value=n!=null?n:[],J.value=t!=null?t:[],R.value=r!=null?r:[],await de()}}),m.value=!1},de=async()=>{s.value=JSON.parse(JSON.stringify(j.value)),s.value.forEach((a,l)=>{var i;((i=a==null?void 0:a.child)==null?void 0:i.length)>0&&a.child.forEach((e,n)=>{var t,r;((t=e==null?void 0:e.action)==null?void 0:t.length)>0&&e.action.forEach(A=>{const v=y.value.findIndex(S=>String(S)===String(A.id));v!==-1&&e.checkList.push(y.value[v]),e.action.length===e.checkList.length&&(e.checkAll=!0)}),((r=e==null?void 0:e.action_data)==null?void 0:r.length)>0&&(e.action_data.map(A=>{const v=J.value.findIndex(S=>String(S)===String(A.id));v!==-1&&e.fieldList.push(J.value[v])}),e.action_data.length===e.fieldList.length&&(e.fieldAll=!0)),e.private&&e.private.length===2&&(R.value.length>0?R.value.findIndex(v=>String(v)===String(e.id)):-1)!==-1?e.is_private_change="1":e.is_private_change="0"})})};async function Z(){if(!T.value.companyNo){W.warning("\u8BF7\u9009\u62E9\u4E00\u4E2A\u516C\u53F8");return}m.value=!0,await se(),await ce(),(N==null?void 0:N.value.length)>0&&await Q(N.value[0].id),m.value=!1}let ue=b(()=>a=>{const l=a.action.filter(e=>a.checkList.findIndex(n=>String(n)===String(e.id))>-1).length,i=a.action.filter(e=>a.checkList.findIndex(n=>String(n)===String(e.id))==-1).length;return l>0&&i>0}),re=b(()=>a=>{const l=a.action_data.filter(e=>a.fieldList.findIndex(n=>String(n)===String(e.id))>-1).length,i=a.action_data.filter(e=>a.fieldList.findIndex(n=>String(n)===String(e.id))==-1).length;return l>0&&i>0});return me(()=>{$.value=ke().getMenuActions("action"),$.value.some(a=>a=="001")&&Z()}),Se(()=>T.value,()=>Z()),(a,l)=>{const i=E("el-button"),e=E("el-radio-button"),n=E("el-radio-group"),t=E("el-checkbox"),r=E("el-checkbox-group"),A=E("el-col"),v=E("el-row"),S=E("NoAuth");return d(),h("div",De,[Y(_("div",null,[_("div",Ue,[_("div",ze,[_("ul",Re,[Oe,g(" "),g(" "),g(' v-if="isBtnDisabled && item.id == roleActive.id" '),N.value.length==0?(d(),h("p",Me," \u6682\u65E0\u6570\u636E ")):g("v-if",!0),(d(!0),h(V,null,B(N.value,(u,L)=>(d(),h("li",{key:"role"+L,class:Le(["role-list__item",{active:u.id==k.roleid}]),onClick:o=>!m.value&&ne(u)},[F(M(u.role_name)+" ",1),m.value&&u.id==k.roleid?(d(),U(i,{key:0,class:"fr",link:"",size:"mini",icon:O(x)("Loading")},null,8,["icon"])):g("v-if",!0)],10,Te))),128))]),_("div",$e,[_("div",Je,[(d(!0),h(V,null,B(s.value,(u,L)=>(d(),U(v,{key:"menu"+u.id+L},{default:p(()=>[u.child&&u.child.length>0?(d(),U(A,{key:0,class:"ffff",span:24},{default:p(()=>[_("div",qe,[(d(!0),h(V,null,B(u.menu_name,(o,C)=>(d(),h("div",{key:"title"+C+o},M(o),1))),128))]),_("div",He,[(d(!0),h(V,null,B(u.child,(o,C)=>(d(),h("div",{class:"fbody-item",key:"yemian"+o.id+C},[o.action&&o.action.length===0&&o.action_data&&o.action_data.length===0?g("v-if",!0):(d(),h(V,{key:0},[_("div",Ge,[_("span",Pe,M(o.menu_name),1),o&&o.private&&o.private.length===2?(d(),U(n,{key:0,style:{margin:"0 0 0 20px"},class:"fl",size:"small",modelValue:o.is_private_change,"onUpdate:modelValue":c=>o.is_private_change=c},{default:p(()=>[(d(!0),h(V,null,B(o.private,(c,q)=>(d(),U(e,{size:"small",key:c.label+q,label:c.id},{default:p(()=>[F(M(c.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):g("v-if",!0)]),o.action&&o.action.length>0?(d(),h("div",Xe,[_("div",Ye,[D(t,{modelValue:o.checkAll,"onUpdate:modelValue":c=>o.checkAll=c,size:"small",disabled:z.value==="view",indeterminate:O(ue)(o),onChange:c=>I(c,L,u,C)},{default:p(()=>[Ke]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","indeterminate","onChange"])]),_("div",We,[D(r,{size:"small",modelValue:o.checkList,"onUpdate:modelValue":c=>o.checkList=c,disabled:z.value==="view",onChange:c=>le(c,L,u,C)},{default:p(()=>[(d(!0),h(V,null,B(o.action,c=>(d(),U(t,{size:"small",disabled:z.value==="view",key:"checkItem"+c.id,label:String(c.id),onChange:q=>te(q,String(c.id),L,C)},{default:p(()=>[F(M(c.action_name),1)]),_:2},1032,["disabled","label","onChange"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","onChange"])])])):g("v-if",!0),o.action_data&&o.action_data.length>0?(d(),h("div",je,[_("div",Qe,[D(t,{size:"small",modelValue:o.fieldAll,"onUpdate:modelValue":c=>o.fieldAll=c,disabled:z.value==="view",indeterminate:O(re)(o),onChange:c=>ee(c,L,u,C)},{default:p(()=>[Ze]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","indeterminate","onChange"])]),_("div",be,[D(r,{modelValue:o.fieldList,"onUpdate:modelValue":c=>o.fieldList=c,size:"small",disabled:z.value==="view",onChange:c=>ae(c,L,u,C)},{default:p(()=>[(d(!0),h(V,null,B(o.action_data,c=>(d(),U(t,{key:"FieldItem"+c.id,label:c.id,size:"small",disabled:z.value==="view",onChange:q=>ie(q,c.id,L,C)},{default:p(()=>[F(M(c.field_name),1)]),_:2},1032,["label","disabled","onChange"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","onChange"])])])):g("v-if",!0)],64))]))),128))])]),_:2},1024)):g("v-if",!0)]),_:2},1024))),128))])])]),$.value.some(u=>u=="008")?(d(),h("div",xe,[D(i,{size:"small",type:"primary",onClick:oe},{default:p(()=>[Ie]),_:1})])):g("v-if",!0)])],512),[[K,$.value.some(u=>u=="001")&&O(T).companyNo]]),Y(D(S,null,null,512),[[K,!$.value.some(u=>u=="001")]]),Y(_("h1",el,[D(i,{text:"",size:"large",icon:O(x)("warning-filled"),disabled:""},null,8,["icon"]),ll],512),[[K,!O(T).companyNo]])])}}});var ol=_e(tl,[["__scopeId","data-v-235465d4"],["__file","D:/work/accout-vue3-ui/src/views/interest/action/index.vue"]]);export{ol as default};