猎羽广告

menuList.40b2c2e7.js 6.0KB

12
  1. import{E as e,n as t}from"../element-plus/element-plus.983e47a2.js";import{D as a}from"../_dialog/_dialog.b386cdd8.js";import{p as s,T as i}from"../tableInfo/tableInfo.ba8c2df8.js";import{_ as o}from"../_popconfirm/_popconfirm.0c385acd.js";import{I as l}from"../_input/_input.ba197332.js";import{A as n}from"../api/api.7c277a8d.js";import{_ as r,m as p,b as d}from"../../assets/index.594385d1.js";import{d as u,f as c,w as m,o as f,J as b,K as j,T as v,Y as _,h as g,i as h,c as I,a as y,Q as w,u as x,U as M,ae as L,S as k,$ as C,R as O}from"../@vue/@vue.e7eafc10.js";import"../lodash-es/lodash-es.e51fd119.js";import"../async-validator/async-validator.21881447.js";import"../@vueuse/@vueuse.ee9511b3.js";import"../dayjs/dayjs.f67a4005.js";import"../axios/axios.27022086.js";import"../@ctrl/@ctrl.9c8f424f.js";import"../escape-html/escape-html.d572c0fd.js";import"../normalize-wheel-es/normalize-wheel-es.94de1731.js";import"../question-filled/question-filled.e055e5c8.js";import"../vue-router/vue-router.647267ed.js";import"../nprogress/nprogress.b93c8c22.js";import"../pinia/pinia.cb6cf138.js";import"../vue-demi/vue-demi.4f3c4c97.js";import"../pinia-plugin-persist/pinia-plugin-persist.67085de7.js";import"../@element-plus/@element-plus.6e467d43.js";import"../echarts/echarts.5b4b2848.js";import"../tslib/tslib.e35f93b8.js";import"../zrender/zrender.fe59a237.js";var T=r(u({__name:"addEditMenu",props:{propsObj:{default:{}}},emits:["closed","initMenuList"],setup(t,{expose:s,emit:i}){const o=t,{proxy:r}=g(),d=p(),u=c(),h=c(),I=c(),y=e=>{w.value=e};m((()=>o.propsObj.show),(async e=>{await y(e),u.value.value=o.propsObj.editItem?o.propsObj.editItem.title:"",h.value.value=o.propsObj.editItem?o.propsObj.editItem.route:"",I.value.value=o.propsObj.editItem?o.propsObj.editItem.icon:""}));const w=c(!1),x=c(!1),M=()=>{w.value=!1,i("closed")},L=async()=>{x.value=!0;const t=_({title:u.value.value,route:h.value.value,icon:I.value.value,parent_id:o.propsObj.parentId,id:"编辑"==o.propsObj.type?o.propsObj.editItem.id:""});let a=n.menu_add;"编辑"==o.propsObj.type&&(a=n.menu_edit);let s=await r.$http.post(a,t);x.value=!1,s&&"0"==s.errNo?(w.value=!1,await i("initMenuList"),await d.getMenuList((()=>{}))):e.error(s.errMsg)};return s({switchDialogVisable:y}),(e,s)=>(f(),b(a,{width:"600px",dialogVisible:w.value,loading:x.value,onConfirm:L,onClose:M,"dialog-title":t.propsObj.type+"菜单"},{content:j((()=>[v(l,{ref_key:"InputRef_name",ref:u,title:"菜单名称",spanTitleWidth:"100px"},null,512),v(l,{ref_key:"InputRef_webRoute",ref:h,title:"前端页面路由",spanTitleWidth:"100px",class:"tMar20"},null,512),v(l,{ref_key:"InputRef_pageIcon",ref:I,title:"页面图标",spanTitleWidth:"100px",class:"tMar20"},null,512)])),_:1},8,["dialogVisible","loading","dialog-title"]))}}),[["__scopeId","data-v-6721ad26"]]);const A={class:"screenArea flex bMar10"},F=O("添加菜单"),E=O("菜单排序"),R=O("确定排序"),D={key:1,class:"f12 c-theme lMar20"},V={class:"text-center"},$=["onClick"],z={class:"text-center"},N=["onClick"],W={key:0,class:"lMar20"},B=["onClick"],q=["onClick"],J=u({__name:"menuList",props:{parentId:{default:0}},setup(l){const r=l,u=_([{name:"ID",column:"id",minWidth:"50px"},{name:"菜单标题",column:"title"},{name:"路由",column:"route"},{name:"下级模块及个数",column:"child_count",slotFlag:!0},{name:"页面图标",column:"icon"},{name:"操作",column:"operate",slotFlag:!0}]),{tableInfo:O,tableListRef:J}=s(u),{proxy:K}=g(),P=p(),Q=c(!1),S=_({sortFlag:!1,opr:"新增",editId:0,editTitle:"查看下级",showAddEdiTMenu:!1,editItem:{}}),U=async e=>{await(e=>{S.editId=e.id,S.editTitle=e.title})(e),Q.value=!0},Y=()=>{S.showAddEdiTMenu=!1},G=async()=>{J.value.loading=!0;const e=_({parent_id:r.parentId});let t=await K.$http.get(n.menu_list,e);if(t&&"0"==t.errNo){let e=t.rst;O.tableList=e}J.value.loading=!1},H=(e,t)=>{S.showAddEdiTMenu=!0,S.opr=e,S.editItem=t};return m((()=>r.parentId),(()=>{G()})),h((()=>{G()})),(s,p)=>{const u=t,c=L("menu-list",!0);return f(),I(M,null,[y("div",A,[v(u,{type:"primary",onClick:p[0]||(p[0]=e=>H("新增"))},{default:j((()=>[F])),_:1}),v(u,{type:"primary",onClick:p[1]||(p[1]=e=>S.sortFlag=!0)},{default:j((()=>[E])),_:1}),S.sortFlag?(f(),b(u,{key:0,type:"primary",plain:"",onClick:p[2]||(p[2]=t=>(async()=>{J.value.loading=!0;const t=[];O.tableList.forEach((e=>{t.push(e.id)}));const a=_({parent_id:r.parentId,p_id:t});let s=await K.$http.post(n.menu_sort,a);e.info(s.errMsg),s&&"0"==s.errNo&&(S.sortFlag=!1,P.getMenuList((()=>{}))),J.value.loading=!1})())},{default:j((()=>[R])),_:1})):w("",!0),S.sortFlag?(f(),I("span",D,"*排序完成后,请点确定排序,否则排序不生效。")):w("",!0)]),v(i,{ref_key:"tableListRef",ref:J,tableData:x(O).tableList,descol:x(O).descolList,showPagination:!1},{child_count:j((e=>[y("div",V,[y("span",{class:"operate_text",onClick:t=>U(e.row)},"查看下级("+k(e.row.child_count)+")",9,$)])])),operate:j((t=>[y("div",z,[y("span",{class:"operate_text",onClick:e=>H("编辑",t.row)},"编辑",8,N),v(o,{onConfirm:a=>(async(t,a)=>{const s=_({id:t.id});let i=await K.$http.post(n.menu_dele,s);i&&"0"==i.errNo?(G(),P.getMenuList((()=>{}))):e.info(i.errMsg)})(t.row,t.index)},null,8,["onConfirm"]),S.sortFlag?(f(),I("span",W,[y("span",{class:"f12 pointer c-00B38A",style:C(0==t.index?"color:#999;cursor:not-allowed":""),onClick:e=>(e=>{if(0==e)return!1;O.tableList=d(O.tableList,e,e-1)})(t.index)},"上移",12,B),y("span",{class:"f12 pointer c-00B38A lMar8",style:C(t.index==x(O).tableList.length-1?"color:#999;cursor:not-allowed":""),onClick:e=>(e=>{if(e==O.tableList.length-1)return!1;O.tableList=d(O.tableList,e,e+1)})(t.index)},"下移",12,q)])):w("",!0)])])),_:1},8,["tableData","descol"]),v(T,{onClosed:Y,onInitMenuList:G,propsObj:{show:S.showAddEdiTMenu,editItem:S.editItem,type:S.opr,parentId:l.parentId}},null,8,["propsObj"]),v(a,{dialogVisible:Q.value,onConfirm:p[3]||(p[3]=e=>Q.value=!1),onClose:p[4]||(p[4]=e=>Q.value=!1),width:"80%",dialogTitle:S.editTitle,hasBtn:!0},{content:j((()=>[v(c,{parentId:S.editId},null,8,["parentId"])])),_:1},8,["dialogVisible","dialogTitle"])],64)}}});export{J as default};