import{d as M,K as B,s as N,l as O,k as g,v as U,r as c,o as C,c as v,a as o,z as K,b as a,u as n,M as j,t as u,B as A,A as Y}from"./vue.1703796278973.js";import{M as q,K as z,Y as J,a0 as L,ax as V}from"./index.17037962789732.js";import"./index.1703796278973300.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import"./index.170379627897336.js";import{_ as x}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import{c as w,G as F,O as G}from"./system.1703796278973.js";import{a as H}from"./dayjs.min.1703796278973.js";import{U as Q,M as W}from"./consts.1703796278973.js";import{_ as X}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./permission.1703796278973.js";import"./comm.1703796278973.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./404.1703796278973.js";const Z={class:"menu-container"},ee=M({name:"Menu"}),te=M({...ee,setup(se){const _="system/Menu",f=B(),S=w(),{userInfos:$}=N(S),b=O(()=>{var e;return((e=$.value)==null?void 0:e.username)==="admin"}),I=[{title:"编码",dataIndex:"code",key:"code",ellipsis:!0,fixed:"left",search:{type:"string"},width:300},{title:"名称",dataIndex:"name",key:"name",ellipsis:!0,search:{type:"string"}},{title:"页面地址",dataIndex:"url",key:"url",ellipsis:!0,search:{type:"string"}},{title:"排序",dataIndex:"sortIndex",key:"sortIndex",ellipsis:!0,search:{type:"number"},width:80},{title:"说明",dataIndex:"describe",key:"describe",ellipsis:!0},{title:"创建时间",dataIndex:"createTime",key:"createTime",ellipsis:!0,search:{type:"date"},width:180,scopedSlots:!0},{title:"操作",dataIndex:"action",key:"action",fixed:"right",scopedSlots:!0,width:200}],k=g({terms:[]}),p=g([]),T=e=>{k.value=e,e.terms.length||(p.value=[])},y=g({}),l=U({total:0,getList:async e=>{var m;const t={terms:[{terms:[{column:"owner",termType:"eq",value:"iot"},{column:"owner",termType:"isnull",value:"1",type:"or"}]}]},i={...e,terms:e.terms&&e.length!==0?[...e.terms,t]:[t],sorts:[{name:"sortIndex",order:"asc"}],paging:!1},s=await F(i),d=s.result[s.result.length-1];return l.total=d?d.sortIndex+1:1,{code:s.message,result:{data:(m=s.result)==null?void 0:m.filter(h=>![Q,W].includes(h.code)),pageIndex:s.pageIndex,pageSize:s.pageSize,total:s.total},status:s.status}},addChildren:e=>{var i;const t=((i=e==null?void 0:e.children)==null?void 0:i.length)||0;f.push(`/system/Menu/detail/:id?pid=${e.id}&basePath=${e.url||""}&sortIndex=${t+1}`)},toDetails:e=>{f.push(`/system/Menu/detail/${e.id||":id"}?pid=${e.pid||""}&basePath=${e.url||""}&sortIndex=${l.total}`)},clickDel:e=>{console.log(e.id),G(e.id).then(t=>{var i;t.status===200&&((i=y.value)==null||i.reload(),q.success("操作成功!"))})},refresh:()=>{y.value.reload()}});return(e,t)=>{const i=c("pro-search"),s=c("AIcon"),d=z,m=J,h=L,P=V,E=c("FullPage"),R=c("page-container");return C(),v(R,null,{default:o(()=>[K("div",Z,[a(i,{columns:I,target:"category",onSearch:T}),a(E,null,{default:o(()=>[a(P,{ref_key:"tableRef",ref:y,columns:I,request:n(l).getList,model:"TABLE",params:n(k),noPagination:"",expandedRowKeys:n(p),"onUpdate:expandedRowKeys":t[2]||(t[2]=r=>j(p)?p.value=r:null)},{headerTitle:o(()=>[a(x,{type:"primary",hasPermission:`${_}:add`,onClick:t[0]||(t[0]=r=>n(l).toDetails({}))},{default:o(()=>[a(s,{type:"PlusOutlined"}),u("新增 ")]),_:1},8,["hasPermission"]),n(b)?(C(),v(d,{key:0,style:{"margin-left":"12px"},onClick:t[1]||(t[1]=r=>n(f).push("/system/Menu/Setting"))},{default:o(()=>[u("菜单配置")]),_:1})):A("",!0)]),createTime:o(r=>[u(Y(n(H)(r.createTime).format("YYYY-MM-DD HH:mm:ss")),1)]),action:o(r=>[a(h,{size:16},{default:o(()=>[a(m,null,{title:o(()=>[u("编辑")]),default:o(()=>[a(d,{style:{padding:"0"},type:"link",onClick:D=>n(l).toDetails(r)},{default:o(()=>[a(s,{type:"EditOutlined"})]),_:2},1032,["onClick"])]),_:2},1024),a(x,{type:"link",hasPermission:`${_}:add`,tooltip:{title:"新增子菜单"},onClick:D=>n(l).addChildren(r)},{default:o(()=>[a(s,{type:"PlusCircleOutlined"})]),_:2},1032,["hasPermission","onClick"]),a(x,{type:"link",hasPermission:`${_}:delete`,tooltip:{title:"删除"},popConfirm:{title:"是否删除该菜单",onConfirm:()=>n(l).clickDel(r)}},{default:o(()=>[a(s,{type:"DeleteOutlined"})]),_:2},1032,["hasPermission","popConfirm"])]),_:2},1024)]),_:1},8,["request","params","expandedRowKeys"])]),_:1})])]),_:1})}}});const Ke=X(te,[["__scopeId","data-v-d8e3b7cf"]]);export{Ke as default};