import{u as e,r as a,ad as t,c as s,bQ as o,d as r,e as d,h as i,w as l,j as n,k as c,n as p,g as u,f as m,aO as g,E as f,q as v,p as h}from"./index.286e9b79.js";import{v as b}from"./loading.c49775a6.js";import{E as y,a as j}from"./table-column.7b4f59a2.js";import"./checkbox.f06171a4.js";import{E as x}from"./switch.197584d0.js";/* empty css            */import{E as w}from"./message-box.6a8eb828.js";import"./input.31de1b37.js";import"./overlay.2c1583ac.js";import{g as _}from"./http.f588794f.js";import"./_baseIteratee.9ead53a1.js";import"./_initCloneObject.fb8fbaea.js";import"./isEqual.57d72c4a.js";import"./debounce.caafe00b.js";import"./event.776e7e11.js";import"./validator.18338d56.js";import"./index.ed3ed02e.js";import"./scroll.a50153b5.js";const k={class:"table-wrap"},C={class:"table-box"},z={class:"toolbar"},E={class:"tabs-content"},q=i("span",{style:{"font-size":"14px","margin-left":"5px"}},"暂无数据",-1),B=i("div",{class:"page"},null,-1),O={__name:"index",setup(O){const T=e(),I=a([]);let Q=a(!1);const W=()=>{Q.value=!0,_("addons.category/index").then((e=>{Q.value=!1,e.code?I.value=e.data:f.error(e.msg)})).catch((e=>{Q.value=!1,f.error(e)}))};t((()=>{W()}));const A=()=>{T.push("/addons/category/editor")},D=(e,a,t)=>{_("addons.category/index",{id:e.id}).then((e=>{e.code&&t(e.data)}))};return(e,a)=>{const t=v,O=s("Warning"),F=h,G=y,H=x,J=j,K=o("auth"),L=b;return r(),d("div",null,[i("div",k,[i("div",C,[i("div",z,[l((r(),n(t,{onClick:A},{default:c((()=>[p("添加")])),_:1})),[[K,["addons.category/editor"]]])]),i("div",E,[l((r(),n(J,{data:u(I),size:"large",style:{width:"100%"},"row-key":"id",lazy:"",load:D,"tree-props":{children:"children",hasChildren:"hasChildren"}},{empty:c((()=>[m(F,{size:"18",style:{position:"relative",top:"4px"}},{default:c((()=>[m(O)])),_:1}),q])),default:c((()=>[m(G,{prop:"title",label:"分类名称","header-align":"left",align:"left"}),l((r(),n(G,{label:"状态","header-align":"center",align:"center",width:"80"},{default:c((e=>[m(H,{"model-value":e.row.status,onChange:a=>((e,a)=>{let t=0==e[a]?1:0;_("addons.category/status",{id:e.id,type:a,value:t}).then((s=>{s.code&&(e[a]=t)}))})(e.row,"status"),"active-value":1,"inactive-value":0},null,8,["model-value","onChange"])])),_:1})),[[K,["addons.category/status"]]]),m(G,{label:"操作","header-align":"center",align:"center",width:"110"},{default:c((e=>[l((r(),n(t,{type:"primary",size:"small",onClick:g((a=>{return t=e.row.id,void T.push({path:"/addons/category/editor",query:{id:t}});var t}),["prevent"]),link:""},{default:c((()=>[p("编辑")])),_:2},1032,["onClick"])),[[K,["addons.category/editor"]]]),l((r(),n(t,{type:"danger",size:"small",onClick:g((a=>{return t=e.row.id,void w.confirm("您确定要删除该分类吗","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{_("addons.category/delete",{id:t}).then((e=>{e.code?(f.success("删除成功"),I.value=[],W()):f.error(e.msg)}))}));var t}),["prevent"]),link:""},{default:c((()=>[p("删除")])),_:2},1032,["onClick"])),[[K,["addons.category/delete"]]])])),_:1})])),_:1},8,["data"])),[[L,u(Q)]])]),B])])])}}};export{O as default};
