import F from"./menuDialog.7c146fae.js";import{g as L,m as M}from"./menuManage.5914ee25.js";import{d as E,b as f,r as h,o as I,c as s,e as R,f as S,h as t,i as l,j as b,g as _,F as W,x as A}from"./index.5bb861d3.js";const G={class:"flex justify-between items-center"},U=_("span",null,"\u83DC\u5355\u5217\u8868",-1),q=["onClick"],H=["onClick"],J=E({name:"menuManage"}),Z=Object.assign(J,{setup(K){const{proxy:g}=A(),r=f({title:void 0}),C=f([{label:"\u83DC\u5355\u540D\u79F0",key:"title",prop:"title",minWidth:"200"},{label:"\u6392\u5E8F",key:"sort",prop:"sort"},{label:"\u56FE\u6807",key:"icon",prop:"icon"},{label:"\u9875\u9762\u8DEF\u5F84",key:"path",prop:"path",minWidth:"200"},{label:"\u521B\u5EFA\u65F6\u95F4",key:"createOn",prop:"createOn",width:"180"},{label:"\u64CD\u4F5C",slot:"action",width:"120",fixed:"right"}]),d=h(),D=h(0),u=h([]),c=async(n=d.value.pageParams)=>{const a=await L({...r});u.value=a.data},x=()=>{u.value=v(u.value,r.title)},v=(n,a)=>n.map(e=>(e&&e.children&&(e.children=v(e.children,a)),e)).filter(e=>{var o;return a===""||e.title.indexOf(a)>-1||((o=e.children)==null?void 0:o.length)>0}),V=()=>{r.title=void 0,d.value.pageParams.pageNumber=1,d.value.pageParams.pageSize=10,c()},i=f({visible:!1,rowData:void 0}),P=()=>{i.visible=!0,i.rowData=void 0},$=n=>{i.visible=!0,i.rowData=n},w=n=>{const a=[];return n.forEach(e=>{var o;(o=e.children)!=null&&o.length&&w(e.children),a.push(e.id)}),a},B=n=>{const a=w([n]);g.$messageBox.confirm("\u662F\u5426\u5220\u9664\u8BE5\u6570\u636E?","\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await M(a),g.$message.success("\u5220\u9664\u6210\u529F\uFF01"),c()})},N=n=>{i.visible=!1,n&&c()};return I(()=>{c()}),(n,a)=>{const e=s("el-input"),o=s("el-form-item"),y=s("el-col"),p=s("el-button"),O=s("el-row"),T=s("el-form"),k=s("el-card"),j=s("table-list");return R(),S(W,null,[t(k,{shadow:"never",class:"search mb-16"},{default:l(()=>[t(T,{"label-suffix":":",model:r,size:"small"},{default:l(()=>[t(O,{gutter:16},{default:l(()=>[t(y,{span:8},{default:l(()=>[t(o,{label:"\u83DC\u5355\u540D\u79F0"},{default:l(()=>[t(e,{modelValue:r.title,"onUpdate:modelValue":a[0]||(a[0]=m=>r.title=m),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),t(y,{span:16},{default:l(()=>[t(o,{class:"btn"},{default:l(()=>[t(p,{type:"primary",onClick:x},{default:l(()=>[b("\u67E5\u8BE2")]),_:1}),t(p,{onClick:V},{default:l(()=>[b("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(k,{shadow:"never"},{header:l(()=>[_("div",G,[U,t(p,{type:"primary",icon:"Plus",size:"small",onClick:P},{default:l(()=>[b(" \u65B0\u589E\u83DC\u5355 ")]),_:1})])]),default:l(()=>[t(j,{ref_key:"tableListRef",ref:d,column:C,data:u.value,total:D.value,"row-key":"id",pagination:!1,onGetTableData:c},{action:l(({scope:m})=>[_("a",{class:"text-primary",onClick:z=>$(m.row)},"\u7F16\u8F91",8,q),_("a",{class:"text-danger",onClick:z=>B(m.row)},"\u5220\u9664",8,H)]),_:1},8,["column","data","total"])]),_:1}),t(F,{visible:i.visible,data:i.rowData,onClose:N},null,8,["visible","data"])],64)}}});export{Z as default};
