猎羽广告

index.CXITLafI.js 10KB

12
  1. import{E as e,r as a,k as l,l as t,v as i,B as o,X as s,C as r}from"../element-plus/element-plus.DqqeXZzT.js";import{r as n,d,o as u,J as p,K as c,a as v,T as m,L as f,c as g,Q as y,R as _,ba as h,b8 as k,E as w,u as C,S as b,M as x,U as j,O as M,n as D}from"../@vue/@vue.lccsL1Mu.js";import{t as z}from"../eventModel/eventModel.ekFf8kiN.js";import{h as V,_ as I}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"../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 $=({tableData:a,parent_id:l})=>{const t=n(!1),i=n(!1),o=(e,a,l)=>(e[a]=e.splice(l,1,e[a])[0],e);return{sortFlag:t,sortLoading:i,moveUp:e=>{if(0==e)return!1;a.value=o(a.value,e,e-1)},moveDown:e=>{if(e==a.value?.length-1)return!1;a.value=o(a.value,e,e+1)},onClickSort:()=>{if(a.value&&0!=a.value.length){if(t.value){let t=a.value.map((e=>e.id));i.value=!0,(o={ids:t,parent_id:l},new Promise((async(a,l)=>{const t=await V.post("/api/sys/permissionSort",o);0==t.errNo?a(t.rst):(e.error(t.errMsg),l())}))).then((e=>{i.value=!1})).catch((()=>{i.value=!1}))}var o;t.value=!t.value}}}},R=e=>(h("data-v-af83e66e"),e=e(),k(),e),U={class:"box"},F={class:"itemBox"},A=R((()=>v("div",{class:"name"},[v("em",{class:"c-red"},"*"),_("菜单名称:")],-1))),L={class:"ipt"},S={class:"itemBox"},T={class:"name"},N={key:0,class:"c-red"},P=_("页面路由:"),B={class:"ipt"},O={key:0,class:"itemBox"},E=R((()=>v("div",{class:"name"},"页面图标:",-1))),q={class:"ipt"},J={class:"dialog-footer",style:{"text-align":"right",padding:"10px","padding-top":"0"}},K=_(" 取 消 "),Q=_(" 确 定 "),X=I(d({__name:"addMenu",props:{pageType:{type:String,default:"main"}},emits:["close"],setup(o,{expose:s,emit:r}){const d=o,_=n(!1),h=n(""),k=n(0),w=n(""),C=n(""),b=n(""),x=n(),j=n(!1),M=()=>{_.value=!1},D=async()=>{if(""==w.value||!w.value)return void e.error("请输入菜单名称");if("main"!=d.pageType&&(""==C.value||!C.value))return void e.error("请输入菜单路由");let a=null,l={title:w.value,route:C.value};j.value=!0,a="edit"==h.value?await function(a){return new Promise((async(l,t)=>{const i=await V.post("/api/sys/permissionEdit",a);0==i.errNo?l(i.rst):(e.error(i.errMsg),t())}))}(Object.assign(l,{icon:b.value,id:x.value})):await function(a){return new Promise((async(l,t)=>{const i=await V.post("/api/sys/permissionAdd",a);0==i.errNo?l(i.rst):(e.error(i.errMsg),t())}))}(Object.assign(l,{icon:b.value,parent_id:k.value})),j.value=!1,console.log(a),a&&(_.value=!1,r("close"))};return s({initFun:({show:e,type_c:a,parent_id_c:l,editInfo:t})=>{_.value=e,h.value=a||"",k.value=l||0,t?(w.value=t.title,C.value=t.route,b.value=t.icon,x.value=t.id):(w.value="",C.value="",b.value="")}}),(e,s)=>{const r=a,n=l,d=t,k=i;return u(),p(d,{class:"gdt-dialog","close-on-click-modal":!1,"destroy-on-close":!0,modelValue:_.value,"onUpdate:modelValue":s[3]||(s[3]=e=>_.value=e),title:("edit"==h.value?"编辑":"添加")+"菜单",width:"500px","before-close":M},{footer:c((()=>[v("div",J,[m(n,{size:"default",onClick:M},{default:c((()=>[K])),_:1}),m(n,{size:"default",type:"primary",onClick:D},{default:c((()=>[Q])),_:1})])])),default:c((()=>[f((u(),g("div",U,[v("div",F,[A,v("div",L,[m(r,{size:"large",modelValue:w.value,"onUpdate:modelValue":s[0]||(s[0]=e=>w.value=e),placeholder:"请输入菜单名称"},null,8,["modelValue"])])]),v("div",S,[v("div",T,["main"!=o.pageType?(u(),g("em",N,"*")):y("",!0),P]),v("div",B,[m(r,{size:"large",modelValue:C.value,"onUpdate:modelValue":s[1]||(s[1]=e=>C.value=e),placeholder:"请输入页面路由"},null,8,["modelValue"])])]),"main"==o.pageType?(u(),g("div",O,[E,v("div",q,[m(r,{size:"large",modelValue:b.value,"onUpdate:modelValue":s[2]||(s[2]=e=>b.value=e),placeholder:"请输入页面图标"},null,8,["modelValue"])])])):y("",!0)])),[[k,j.value]])])),_:1},8,["modelValue","title"])}}}),[["__scopeId","data-v-af83e66e"]]),G=({parent_id:a})=>{const l=n([]),t=n(!1),i=n(),o=()=>{var i;t.value=!0,(i={parent_id:a},new Promise((async(a,l)=>{const t=await V.get("/api/sys/permissionList",i);0==t.errNo?a(t.rst):(e.error(t.errMsg),l())}))).then((e=>{t.value=!1,l.value=e})).catch((()=>{t.value=!1}))};return{loading:t,AddMenuDialogRef:i,tableData:l,openDialog:(e,l)=>{"add"==e&&i.value?.initFun({show:!0,type_c:"add",parent_id_c:a}),"edit"==e&&i.value?.initFun({show:!0,type_c:"edit",parent_id_c:a,editInfo:l})},dele_menu:a=>{var l;t.value=!0,(l={id:a.id},new Promise((async(a,t)=>{const i=await V.post("/api/sys/permissionDel",l);0==i.errNo?a(i.rst):(e.error(i.errMsg),t())}))).then((e=>{t.value=!1,o()})).catch((()=>{t.value=!1}))},addMenuCallback:()=>{o()},init:o}},H={class:"box tMar20"},W=_("+添加菜单"),Y={class:"px_hint"},Z={style:{width:"100px",display:"inline-block"}},ee=["onClick"],ae=["onClick"],le=_("修改"),te=_("删除"),ie={class:"dialog-footer",style:{"text-align":"right",padding:"10px","padding-top":"0"}},oe=_(" 关 闭 "),se=I(d({__name:"lowerMenu",props:{superiorInfo:{type:Object,default:()=>{}}},emits:["close"],setup(e,{expose:a,emit:d}){const h=e,k=n(!1);w((()=>{L()}));const D=()=>{k.value=!1},{loading:V,AddMenuDialogRef:I,tableData:R,openDialog:U,dele_menu:F,addMenuCallback:A,init:L}=G({parent_id:h.superiorInfo?.id}),{sortFlag:S,sortLoading:T,moveUp:N,moveDown:P,onClickSort:B}=$({tableData:R,parent_id:h.superiorInfo?.id});return a({initFun:e=>{k.value=e}}),(a,n)=>{const d=l,h=o,w=s,$=r,L=t,O=i;return u(),g(j,null,[m(L,{class:"gdt-dialog","close-on-click-modal":!1,"destroy-on-close":!0,modelValue:k.value,"onUpdate:modelValue":n[1]||(n[1]=e=>k.value=e),title:`二级菜单(${e.superiorInfo?.title})`,width:"800px","before-close":D},{footer:c((()=>[v("div",ie,[m(d,{size:"default",onClick:D},{default:c((()=>[oe])),_:1})])])),default:c((()=>[f((u(),g("div",H,[m(d,{type:"primary",size:"default",onClick:n[0]||(n[0]=e=>C(U)("add"))},{default:c((()=>[W])),_:1}),C(R)&&C(R).length>0?f((u(),p(d,{key:0,type:"primary",size:"default",onClick:C(B)},{default:c((()=>[_(b(C(S)?"确定排序":"菜单排序"),1)])),_:1},8,["onClick"])),[[O,C(T),void 0,{fullscreen:!0,lock:!0}]]):y("",!0),f(v("span",Y,"*排序完成后,请点确定排序,否则排序不生效。",512),[[x,C(S)]]),m($,{data:C(R),ref:"tableRef","row-key":"id","header-cell-style":C(z),border:"",size:"default",class:"tMar15",style:{width:"100%"}},{default:c((()=>[m(h,{label:"ID",prop:"id",align:"center",width:"100"}),m(h,{label:"菜单标题",align:"center"},{default:c((e=>[v("span",Z,b(e.row.title),1),C(S)?(u(),g(j,{key:0},[v("span",{class:M(["lMar8 f12",0==e.$index?"c-999 pointerDrop":"c-theme pointer"]),onClick:a=>0!=e.$index&&C(N)(e.$index)},"上移",10,ee),v("span",{class:M(["lMar8 f12",e.$index==C(R).length-1?"c-999 pointerDrop":"c-theme pointer"]),onClick:a=>e.$index!=C(R).length-1&&C(P)(e.$index)},"下移",10,ae)],64)):y("",!0)])),_:1}),m(h,{label:"路由",prop:"route",align:"center"}),m(h,{label:"操作",prop:"route",align:"center"},{default:c((e=>[m(d,{size:"small",type:"primary",onClick:a=>C(U)("edit",e.row)},{default:c((()=>[le])),_:2},1032,["onClick"]),m(w,{title:"确定要删除该菜单?",onConfirm:a=>C(F)(e.row)},{reference:c((()=>[m(d,{size:"small"},{default:c((()=>[te])),_:1})])),_:2},1032,["onConfirm"])])),_:1})])),_:1},8,["data","header-cell-style"])])),[[O,C(V)]])])),_:1},8,["modelValue","title"]),m(X,{ref_key:"AddMenuDialogRef",ref:I,pageType:"lower",onClose:C(A)},null,8,["onClose"])],64)}}}),[["__scopeId","data-v-7ce9472e"]]),re={class:"container"},ne=_("+添加一级菜单"),de={class:"px_hint"},ue={style:{width:"100px",display:"inline-block"}},pe=["onClick"],ce=["onClick"],ve=["onClick"],me=_("修改"),fe=_("删除"),ge=I(d({__name:"index",setup(e){const a=n(),t=n();w((()=>{U()}));const{loading:d,AddMenuDialogRef:h,tableData:k,openDialog:V,dele_menu:I,addMenuCallback:R,init:U}=G({parent_id:0}),{sortFlag:F,sortLoading:A,moveUp:L,moveDown:S,onClickSort:T}=$({tableData:k,parent_id:0});return(e,n)=>{const w=l,$=o,U=s,N=r,P=i;return u(),g(j,null,[f((u(),g("div",re,[m(w,{type:"primary",size:"default",onClick:n[0]||(n[0]=e=>C(V)("add"))},{default:c((()=>[ne])),_:1}),f((u(),p(w,{type:"primary",size:"default",onClick:C(T)},{default:c((()=>[_(b(C(F)?"确定排序":"一级菜单排序"),1)])),_:1},8,["onClick"])),[[P,C(A),void 0,{fullscreen:!0,lock:!0}]]),f(v("span",de,"*排序完成后,请点确定排序,否则排序不生效。",512),[[x,C(F)]]),m(N,{data:C(k),ref:"tableRef","row-key":"id","header-cell-style":C(z),border:"",size:"default",class:"tMar15",style:{width:"100%"}},{default:c((()=>[m($,{label:"ID",prop:"id",align:"center",width:"100"}),m($,{label:"一级菜单标题",align:"center"},{default:c((e=>[v("span",ue,b(e.row.title),1),C(F)?(u(),g(j,{key:0},[v("span",{class:M(["lMar8 f12",0==e.$index?"c-999 pointerDrop":"c-theme pointer"]),onClick:a=>0!=e.$index&&C(L)(e.$index)},"上移",10,pe),v("span",{class:M(["lMar8 f12",e.$index==C(k).length-1?"c-999 pointerDrop":"c-theme pointer"]),onClick:a=>e.$index!=C(k).length-1&&C(S)(e.$index)},"下移",10,ce)],64)):y("",!0)])),_:1}),m($,{label:"路由",prop:"route",align:"center"}),m($,{label:"下级模块",prop:"route",align:"center"},{default:c((e=>[v("span",{class:"c-theme pointer",onClick:l=>{return i=e.row,t.value=i,void D((()=>{a.value?.initFun(!0)}));var i}},"查看下级",8,ve)])),_:1}),m($,{label:"页面图标",prop:"icon",align:"center"}),m($,{label:"操作",prop:"route",align:"center"},{default:c((e=>[m(w,{size:"small",type:"primary",onClick:a=>C(V)("edit",e.row)},{default:c((()=>[me])),_:2},1032,["onClick"]),7!=e.row.id?(u(),p(U,{key:0,title:"确定要删除该菜单?",onConfirm:a=>C(I)(e.row)},{reference:c((()=>[m(w,{size:"small"},{default:c((()=>[fe])),_:1})])),_:2},1032,["onConfirm"])):y("",!0)])),_:1})])),_:1},8,["data","header-cell-style"])])),[[P,C(d)]]),m(X,{ref_key:"AddMenuDialogRef",ref:h,onClose:C(R)},null,8,["onClose"]),t.value?.id?(u(),p(se,{key:t.value?.id,ref_key:"LoverMenuDialogRef",ref:a,superiorInfo:t.value},null,8,["superiorInfo"])):y("",!0)],64)}}}),[["__scopeId","data-v-711b324e"]]);export{ge as default};