import{a1 as O,w as V,M as P,N as z,J as S,O as G}from"./element-plus.ab0703f2.js";import{M as h,f as J,b as Q}from"./index.ae42b2c0.js";import{e as W,a as j}from"./menu.dc3be28d.js";import{u as q}from"./usePaging.fff444fa.js";import{_ as H}from"./edit.vue_vue_type_script_setup_true_lang.c106d16c.js";import{d as N,s as x,r as I,ap as K,o as i,c as v,W as n,Q as t,a as T,R as c,P as r,U as m,u as p,T as E,n as D}from"./@vue.340249d8.js";import"./lodash-es.edba6135.js";import"./@vueuse.e3650918.js";import"./@element-plus.558a564d.js";import"./@popperjs.36402333.js";import"./@ctrl.b082b0c1.js";import"./dayjs.9886411c.js";import"./axios.45058a27.js";import"./async-validator.fb49d0f5.js";import"./memoize-one.4ee5c96d.js";import"./normalize-wheel-es.8aeb3683.js";import"./@floating-ui.0f9ce7c3.js";import"./lodash.3d784a58.js";import"./vue-router.9ddb0e92.js";import"./pinia.97fe9b12.js";import"./css-color-function.5c1c877d.js";import"./color.97e03886.js";import"./clone.cfa55f7b.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.8c276ac9.js";import"./vue-clipboard3.44194d32.js";import"./clipboard.47836ecb.js";import"./echarts.8535e5a6.js";import"./zrender.3eba8991.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.309a94da.js";import"./picker.vue_vue_type_script_setup_true_lang.7ce3be23.js";import"./index.2a3b95e2.js";const X={class:"menu-lists"},Y={key:0},Z={key:1},ee={key:2},te={class:"flex"},oe=N({name:"menu"}),Ge=N({...oe,setup(ae){const b=x(),d=x();let y=!1;const _=I(!1),{pager:k,getLists:C}=q({fetchFun:j,params:{page_type:0}}),g=async a=>{var o,s;_.value=!0,await D(),a&&((o=d.value)==null||o.setFormData({pid:a})),(s=d.value)==null||s.open("add")},R=async a=>{var o,s;_.value=!0,await D(),(o=d.value)==null||o.open("edit"),(s=d.value)==null||s.getDetail(a)},$=async a=>{await J.confirm("\u786E\u5B9A\u8981\u5220\u9664\uFF1F"),await W({id:a}),C()},A=()=>{y=!y,w(k.lists,y)},w=(a,o=!0)=>{var s;for(const l in a)(s=b.value)==null||s.toggleRowExpansion(a[l],o),a[l].children&&w(a[l].children,o)};return C(),(a,o)=>{const s=Q,l=V,u=P,B=O,U=z,L=S,f=K("perms"),M=G;return i(),v("div",X,[n(L,{class:"!border-none",shadow:"never"},{default:t(()=>[T("div",null,[c((i(),r(l,{type:"primary",onClick:o[0]||(o[0]=e=>g())},{icon:t(()=>[n(s,{name:"el-icon-Plus"})]),default:t(()=>[m(" \u65B0\u589E ")]),_:1})),[[f,["auth.menu/add"]]]),n(l,{onClick:A},{default:t(()=>[m(" \u5C55\u5F00/\u6298\u53E0 ")]),_:1})]),c((i(),r(U,{ref_key:"tableRef",ref:b,class:"mt-4",size:"large",data:p(k).lists,"row-key":"id","tree-props":{children:"children",hasChildren:"hasChildren"}},{default:t(()=>[n(u,{label:"\u83DC\u5355\u540D\u79F0",prop:"name","min-width":"150","show-overflow-tooltip":""}),n(u,{label:"\u7C7B\u578B",prop:"type","min-width":"80"},{default:t(({row:e})=>[e.type==p(h).CATALOGUE?(i(),v("div",Y,"\u76EE\u5F55")):e.type==p(h).MENU?(i(),v("div",Z,"\u83DC\u5355")):e.type==p(h).BUTTON?(i(),v("div",ee,"\u6309\u94AE")):E("",!0)]),_:1}),n(u,{label:"\u56FE\u6807",prop:"icon","min-width":"80"},{default:t(({row:e})=>[T("div",te,[n(s,{name:e.icon,size:20},null,8,["name"])])]),_:1}),n(u,{label:"\u6743\u9650\u6807\u8BC6",prop:"perms","min-width":"150","show-overflow-tooltip":""}),n(u,{label:"\u72B6\u6001",prop:"is_disable","min-width":"100"},{default:t(({row:e})=>[e.is_disable==0?(i(),r(B,{key:0},{default:t(()=>[m("\u6B63\u5E38")]),_:1})):(i(),r(B,{key:1,type:"danger"},{default:t(()=>[m("\u505C\u7528")]),_:1}))]),_:1}),n(u,{label:"\u6392\u5E8F",prop:"sort","min-width":"100"}),n(u,{label:"\u66F4\u65B0\u65F6\u95F4",prop:"update_time","min-width":"180"}),n(u,{label:"\u64CD\u4F5C",width:"160",fixed:"right"},{default:t(({row:e})=>[e.type!==p(h).BUTTON?c((i(),r(l,{key:0,type:"primary",link:"",onClick:F=>g(e.id)},{default:t(()=>[m(" \u65B0\u589E ")]),_:2},1032,["onClick"])),[[f,["auth.menu/add"]]]):E("",!0),c((i(),r(l,{type:"primary",link:"",onClick:F=>R(e)},{default:t(()=>[m(" \u7F16\u8F91 ")]),_:2},1032,["onClick"])),[[f,["auth.menu/edit"]]]),c((i(),r(l,{type:"danger",link:"",onClick:F=>$(e.id)},{default:t(()=>[m(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[f,["auth.menu/delete"]]])]),_:1})]),_:1},8,["data"])),[[M,p(k).loading]])]),_:1}),p(_)?(i(),r(H,{key:0,ref_key:"editRef",ref:d,onSuccess:p(C),onClose:o[1]||(o[1]=e=>_.value=!1)},null,8,["onSuccess"])):E("",!0)])}}});export{Ge as default};