import{T as V}from"./index-f07f4b76.js";import{L as M}from"./index-a6ee13d3.js";import{E as h,a as r}from"./element-plus-91d6d961.js";import{H as w,_ as N,i as U,ah as a,o as p,c as A,V as t,P as o,a as H,T as m,O as u,S as f}from"./@vue-6dabbe94.js";import"./pinia-b6f74250.js";import"./vue-router-c1461dfc.js";import"./vue-i18n-b3581196.js";import"./@intlify-ea47d1db.js";import"./source-map-7d7e1c08.js";import"./vue-b1ba6f14.js";import"./js-cookie-edb2da2a.js";import"./@element-plus-64e6e14a.js";import"./nprogress-08a53ce8.js";import"./axios-4a70c6fc.js";import"./qs-c5b6dbf2.js";import"./side-channel-394f276c.js";import"./get-intrinsic-bd2830fd.js";import"./has-symbols-e8f3ca0e.js";import"./has-proto-f7d0b240.js";import"./function-bind-22e7ee79.js";import"./has-26d28e02.js";import"./call-bind-e5c1c8b0.js";import"./object-inspect-8fd4bade.js";import"./mitt-f7ef348c.js";import"./vue-grid-layout-ec2a62c3.js";import"./lodash-es-9851428c.js";import"./@vueuse-e129c873.js";import"./@popperjs-c75af06c.js";import"./@ctrl-f8748455.js";import"./dayjs-f6fdf7b4.js";import"./async-validator-dee29e8b.js";import"./memoize-one-297ddbcb.js";import"./escape-html-b8998962.js";import"./normalize-wheel-es-ed76fb12.js";import"./@floating-ui-880a26aa.js";const I={class:"mb15"},L=w({name:"articleManager"}),xe=w({...L,setup(P){const d=V(),s=N({tableData:[],limit:1,uploadUrl:"fastcms/api/admin/template/install",headers:{Authorization:M.get("token")}}),i=()=>{d.getTemplateList().then(e=>{s.tableData=e.data}).catch(()=>{})},b=e=>{h.confirm("此操作将卸载此["+e.id+"]模板, 是否继续?","提示",{confirmButtonText:"卸载",cancelButtonText:"取消",type:"warning"}).then(()=>{d.unInstallTemplate(e.id).then(()=>{r.success("卸载成功"),i()}).catch(c=>{r.error(c.message)})}).catch(()=>{})},v=e=>{h.confirm("确认启用["+e.id+"]模板吗?","提示",{confirmButtonText:"启用",cancelButtonText:"取消",type:"warning"}).then(()=>{d.enableTemplate(e.id).then(()=>{r.success("启用成功"),i()}).catch(c=>{r.error(c.message)})}).catch(()=>{})},x=e=>{e.code==200?(r.success("上传成功"),i()):r.error(e.message)},y=e=>{r.error("上传失败,"+e)},g=()=>{};return U(()=>{i()}),(e,c)=>{const T=a("ele-Plus"),k=a("el-icon"),_=a("el-button"),B=a("el-upload"),l=a("el-table-column"),C=a("el-tag"),E=a("el-table"),z=a("el-card");return p(),A("div",null,[t(z,{shadow:"hover"},{default:o(()=>[H("div",I,[t(B,{action:s.uploadUrl,name:"file",headers:s.headers,"show-file-list":!1,"on-success":x,"on-error":y,"on-exceed":g,accept:".zip"},{default:o(()=>[t(_,{class:"mt15",type:"primary",size:"default"},{default:o(()=>[t(k,null,{default:o(()=>[t(T)]),_:1}),m("安装模板")]),_:1})]),_:1},8,["action","headers"])]),t(E,{data:s.tableData,stripe:"",style:{width:"100%"}},{default:o(()=>[t(l,{prop:"id",label:"ID","show-overflow-tooltip":""}),t(l,{prop:"name",label:"模板名称","show-overflow-tooltip":""}),t(l,{prop:"path",label:"模板路径","show-overflow-tooltip":""}),t(l,{prop:"version",label:"版本","show-overflow-tooltip":""}),t(l,{prop:"provider",label:"作者","show-overflow-tooltip":""}),t(l,{prop:"description",label:"描述","show-overflow-tooltip":""}),t(l,{label:"操作",width:"160"},{default:o(n=>[n.row.active==!0?(p(),u(C,{key:0,type:"success"},{default:o(()=>[m("使用中")]),_:1})):f("",!0),n.row.active==!1?(p(),u(_,{key:1,size:"small",text:"",type:"primary",onClick:D=>v(n.row)},{default:o(()=>[m("启用")]),_:2},1032,["onClick"])):f("",!0),n.row.active==!1?(p(),u(_,{key:2,size:"small",text:"",type:"primary",onClick:D=>b(n.row)},{default:o(()=>[m("卸载")]),_:2},1032,["onClick"])):f("",!0)]),_:1})]),_:1},8,["data"])]),_:1})])}}});export{xe as default};
