猎羽广告

index.C6zu1YMt.js 7.2KB

12
  1. import{E as e,u as t,F as a,i,j as s,k as l,v as o}from"../element-plus/element-plus.DqqeXZzT.js";import{_ as r}from"../_popconfirm/_popconfirm.C2WlUwAw.js";import{p as n,T as d}from"../tableInfo/tableInfo.DCb2GEsc.js";import{d as m,r as p,Y as u,L as c,o as h,c as f,T as v,K as _,a as L,u as g,U as k,a9 as y,J as j,R as w,S as b,Q as C,a2 as x,h as I,n as N,ba as S,b8 as M,i as P}from"../@vue/@vue.lccsL1Mu.js";import{_ as z}from"../_drawer/_drawer.C0e253H5.js";import{I as R}from"../_input/_input.DPT4C86A.js";import{A as V}from"../api/api.BtQEnbVN.js";import{_ as A,g as B}from"../../assets/index-DYMYfyXS.js";import"../lodash-es/lodash-es.LxYfApIs.js";import"../async-validator/async-validator.DSgsWN2H.js";import"../@vueuse/@vueuse.D2YafqsA.js";import"../dayjs/dayjs.D4rZQhfm.js";import"../axios/axios.CUN3se9v.js";import"../@ctrl/@ctrl.D2oWfImC.js";import"../@popperjs/@popperjs.D3lHDW-0.js";import"../escape-html/escape-html.J6B7JOz4.js";import"../normalize-wheel-es/normalize-wheel-es.Erkn7R64.js";import"../caret-top/caret-top.BxG-YGIs.js";import"../question-filled/question-filled.CpBGPdbF.js";import"../vue-router/vue-router.D86bYXwF.js";import"../pinia/pinia.DodrAXQg.js";import"../vue-demi/vue-demi.Dq6ymT-8.js";import"../pinia-plugin-persist/pinia-plugin-persist.Cjrd7Wf_.js";import"../@element-plus/@element-plus.BWbqilIf.js";import"../echarts/echarts.C_nC9ACL.js";import"../tslib/tslib.DduEQve-.js";import"../zrender/zrender.XYf_pgl8.js";const F=e=>(S("data-v-91cc8c70"),e=e(),M(),e),E={class:"addPageBox"},T={style:{"background-color":"#fff",height:"100%"}},O={class:"itemBox"},U=F((()=>L("div",{class:"title"},"基础信息",-1))),W={class:"contBox"},$={class:"itemBox"},D=F((()=>L("div",{class:"title"},"权限配置",-1))),J={class:"contBox"},q={key:0},H={class:"itemBox"},K={class:"contBox"},Q=w("  取消  "),Y=w("  确定  "),G=m({__name:"addPage",props:{folderObj:{default:{}}},emits:["init"],setup(r,{expose:m,emit:S}){const{proxy:M}=I(),P=p();M.$NumberHandle;const A=p(!1),F=u([{name:"功能模块",column:"title",minWidth:"40px"},{name:"页面范畴",column:"subPage",slotFlag:!0},{name:"数据权限",column:"limit",slotFlag:!0}]),{tableInfo:G,tableListRef:X,total:Z}=n(F),ee=u({title:"新增权限",menuList:[],editId:-1}),te=p(!1),ae=()=>{te.value=!1},ie=p(),se=p(),le=async()=>{A.value=!0;let t=[],a={};ee.menuList.forEach((e=>{e.pageCheckList&&e.pageCheckList.length>0&&(t=t.concat(e.pageCheckList),t.push(e.id));let i={};i[e.levelName]=e.limitCheckList,a=Object.assign(a,i)})),t.includes(7)||t.push(7),t=Array.from(new Set(t));const i=u({name:ie.value.value,note:se.value.value,permission_ids:t,permission_levels:JSON.stringify(a)});let s=V.limit_add;ee.editId>0&&(s=V.limit_edit,i.id=ee.editId);let l=await M.$http.post(s,i);A.value=!1,e.info(l.errMsg),l&&"0"==l.errNo&&(ae(),S("init"))};return m({switchShow:(e,t)=>{te.value=e,N((async()=>{if(e){try{P.value=JSON.parse(B("userInfo"))}catch(a){}ee.menuList&&0!=ee.menuList.length||await(async()=>{let e=await M.$http.get(V.menu_treeList,{all:1});e&&"0"==e.errNo&&(ee.menuList=e.rst,ee.menuList.forEach((e=>{e.childs&&0!=e.childs.length||(e.childs=[{id:e.id,title:e.title}]),8==e.id?(e.levelName="ad",e.dataPermissionList=[{id:1,name:"个人"},{id:2,name:"部门"},{id:3,name:"公司"},{id:4,name:"项目"}]):1==e.id?(e.levelName="system",e.dataPermissionList=[{id:1,name:"个人"},{id:2,name:"部门"},{id:3,name:"公司"}]):12==e.id&&(e.levelName="material",e.dataPermissionList=[{id:1,name:"个人"},{id:3,name:"公司"}])})))})(),t?.id?(ee.editId=t.id,ie.value.value=t.name,se.value.value=t.note,ee.menuList.forEach((e=>{e.limitCheckList="";for(let a in t.permission_levels)e.levelName==a&&(e.limitCheckList=t.permission_levels[a]);e.pageCheckList=[],t.permission_ids.forEach((t=>{7==e.id&&e.pageCheckList.push(e.id),e.id==t&&e.pageCheckList.push(e.id),e.childs?.forEach((a=>{a.id==t&&e.pageCheckList.push(a.id)})),e.pageCheckList=Array.from(new Set(e.pageCheckList))}))}))):(ee.editId=-1,ie.value.value="",se.value.value="")}}))}}),(e,r)=>{const n=t,m=a,p=i,u=s,I=l,N=o;return c((h(),f("div",E,[v(z,{drawerShow:te.value,onClose:ae,title:ee.title,drawerSize:"70%",closeOnModal:!1},{content:_((()=>[L("div",T,[L("div",O,[U,L("div",W,[v(R,{ref_key:"InputRef_name",ref:ie,spanFS:"14px",title:"权限名称",spanTitleWidth:"100px",inputWidth:"300px",placeholderTxt:"权限名称"},null,512),v(R,{ref_key:"InputRef_note",ref:se,spanFS:"14px",class:"tMar20",spanTitleWidth:"100px",inputWidth:"300px",title:"权限描述",placeholderTxt:"权限描述"},null,512)])]),L("div",$,[D,L("div",J,[v(d,{ref_key:"tableListRef",ref:X,tableData:ee.menuList,descol:g(G).descolList,tableAlign:"left"},{subPage:_((e=>[L("div",null,[v(m,{modelValue:e.row.pageCheckList,"onUpdate:modelValue":t=>e.row.pageCheckList=t},{default:_((()=>[(h(!0),f(k,null,y(e.row.childs,(e=>(h(),f(k,{key:e.id},[1==P.value.userAuth||"menuList"!=e.route&&(P.value.userAuth<=10||"teamManage"!=e.route)?(h(),j(n,{key:0,label:e.id,style:{width:"80px"},disabled:7==e.id},{default:_((()=>[w(b(e.title),1)])),_:2},1032,["label","disabled"])):C("",!0)],64)))),128))])),_:2},1032,["modelValue","onUpdate:modelValue"])])])),limit:_((e=>[7!==e.row.id?(h(),f("div",q,[v(u,{modelValue:e.row.limitCheckList,"onUpdate:modelValue":t=>e.row.limitCheckList=t},{default:_((()=>[(h(!0),f(k,null,y(e.row.dataPermissionList,(t=>(h(),j(p,{label:t.id,onClick:x((a=>((e,t)=>{e==ee.menuList[t].limitCheckList?ee.menuList[t].limitCheckList="":ee.menuList[t].limitCheckList=e})(t.id,e.index)),["prevent"])},{default:_((()=>[w(b(t.name),1)])),_:2},1032,["label","onClick"])))),256))])),_:2},1032,["modelValue","onUpdate:modelValue"])])):C("",!0)])),_:1},8,["tableData","descol"])])]),L("div",H,[L("div",K,[v(I,{type:"primary",plain:"",onClick:ae,size:"large"},{default:_((()=>[Q])),_:1}),v(I,{type:"primary",onClick:le,size:"large"},{default:_((()=>[Y])),_:1})])])])])),_:1},8,["drawerShow","title"])])),[[N,A.value]])}}}),X=A(G,[["__scopeId","data-v-91cc8c70"]]),Z={class:"bMar15"},ee=w("新增权限"),te={key:0,class:"text-center"},ae=["onClick"],ie=A(m({__name:"index",setup(t){const{proxy:a}=I(),i=u([{name:"权限名称",column:"name"},{name:"描述",column:"note",cancleForMat:!0},{name:"更新时间",column:"created_at"},{name:"操作",column:"operate",slotFlag:!0}]),{tableInfo:s,tableListRef:o,total:m}=n(i),c=p(),y=e=>{N((()=>{c.value.switchShow(!0,e||"")}))};p();const j=async()=>{o.value.loading=!0;let t=await a.$http.get(V.limit_list);o.value.loading=!1,t&&"0"==t.errNo?s.tableList=t.rst:e.error(t.errMsg)};return P((async()=>{await j()})),(t,i)=>{const n=l;return h(),f(k,null,[L("div",Z,[v(n,{size:"default",type:"primary",class:"lMarauto",onClick:i[0]||(i[0]=e=>y())},{default:_((()=>[ee])),_:1})]),v(d,{ref_key:"tableListRef",ref:o,tableData:g(s).tableList,descol:g(s).descolList,total:g(m),onInit:j},{operate:_((t=>[t.row.role_type>10?(h(),f("div",te,[L("span",{class:"operate_text lMar8 pointer",onClick:e=>y(t.row)},"编辑",8,ae),v(r,{onConfirm:i=>(async t=>{o.value.loading=!0;const i=u({id:t.id});let s=await a.$http.post(V.limit_dele,i);o.value.loading=!1,e.info(s.errMsg),s&&"0"==s.errNo&&await j()})(t.row)},null,8,["onConfirm"])])):C("",!0)])),_:1},8,["tableData","descol","total"]),v(X,{ref_key:"AddPageRef",ref:c,onInit:j},null,512)],64)}}}),[["__scopeId","data-v-06168390"]]);export{ie as default};