goldpankit
Version:
GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。
2 lines (1 loc) • 4.6 kB
JavaScript
import{P as k}from"./Pagination-99fb188c.js";import{_ as P,E as $,m as I,r as h,A as w,o as i,c as p,a as n,t as o,B as N,F as A,g as z,h as d,b as m,w as g,e as f,j as B,p as E,l as M}from"./index-de119b2f.js";import{d as F,f as T}from"./user.service-8b974674.js";import{b as D}from"./service-1cd4347d.js";import{B as L}from"./BeanAmount-05af3f6c.js";import{S as V}from"./ServiceTitle-b6be4846.js";import{S as q}from"./ServiceStatus-5026d922.js";const j={components:{ServiceStatus:q,ServiceTitle:V,BeanAmount:L,Empty:$,Pagination:k},data(){return{loading:!1,pagination:{page:1,capacity:10,total:0},services:[]}},computed:{...I(["userInfo"])},methods:{openSettings(e){if(e.type==="MAIN"){this.$router.push({name:"ServiceSettings",query:{space:e.space.name,service:e.name}});return}this.$router.push({name:"PluginSettings",query:{space:e.space.name,service:e.mainService.name,plugin:e.name}})},deleteService(e){let a;e.type==="MAIN"?a={space:e.space.name,service:e.name}:a={space:e.space.name,service:e.mainService.name,plugin:e.name};let l=`确认删除「${e.label}」插件吗?删除后不可恢复!`;e.type==="MAIN"&&(l=`确认删除「${e.label}」服务吗?删除后不可恢复!`),this.deleteConfirm(l).then(()=>{F({id:e.id,...a}).then(()=>{this.services.length===1&&(this.pagination.page-=1),this.fetchPage(),this.$tip.success("删除成功")}).catch(s=>{this.$tip.apiFailed(s)})}).catch(()=>{})},handleCurrentChange(e){this.pagination.page=e,this.fetchPage()},handleSizeChange(e){this.pagination.capacity=e,this.fetchPage()},fetchPage(){this.loading||(this.loading=!0,this.pagination.page<1&&(this.pagination.page=1),T({...this.pagination,model:{}}).then(e=>{this.services=e.records,this.pagination.total=e.total,this.fetchLocalServices()}).catch(e=>{this.$tip.apiFailed(e)}).finally(()=>{this.loading=!1}))},fetchLocalServices(){D().then(e=>{this.services.forEach(a=>{if(a.codespace=null,a.type==="MAIN"){const s=e.find(c=>c.space===a.space.name&&c.name===a.name);s!=null&&(a.repository=s.repository,a.codespace=s.codespace);return}const l=e.find(s=>s.space===a.space.name&&s.service===a.mainService.name&&s.name===a.name);l!=null&&(a.repository=l.repository,a.codespace=l.codespace)})}).catch(e=>{this.$tip.apiFailed(e)})}},created(){this.fetchPage()}},O=e=>(E("data-v-be1e1403"),e=e(),M(),e),x={class:"page"},G={class:"wrap"},H={class:"header"},J={class:"service-list-wrap"},K={key:0,class:"service-list"},Q={class:"introduce"},R={class:"info"},U={class:"info"},W={class:"footer-info"},X=O(()=>n("span",null,"|",-1)),Y={class:"text-info-1 text-mini"},Z={key:2,class:"opera"};function ee(e,a,l,s,c,r){const _=h("ServiceTitle"),y=h("ServiceStatus"),u=h("el-button"),v=h("Empty"),b=h("Pagination"),C=w("loading");return i(),p("div",x,[n("div",G,[n("div",H,[n("h2",null,o(e.$t("user.leasedAndPrivateServices")),1)]),N((i(),p("div",J,[c.services.length>0?(i(),p("ul",K,[(i(!0),p(A,null,z(c.services,t=>(i(),p("li",{key:t.id},[t.type==="MAIN"?(i(),d(_,{key:0,space:t.space.name,service:t.name,"service-label":t.label,"with-type":!0},null,8,["space","service","service-label"])):(i(),d(_,{key:1,space:t.space.name,service:t.mainService.name,"service-label":t.mainService.label,plugin:t.name,"plugin-label":t.label,"with-type":!0},null,8,["space","service","service-label","plugin","plugin-label"])),n("p",Q,o(t.introduce),1),n("div",R,[n("label",null,o(e.$t("service.codespace"))+":",1),n("p",null,o(t.codespace),1)]),n("div",U,[n("label",null,o(e.$t("service.repository"))+":",1),n("p",null,o(t.repository),1)]),n("div",W,[m(y,{"with-private":t.withPrivate},null,8,["with-private"]),X,n("p",Y,o(t.lastPublish==null?e.$t("service.unPublish"):e.getDateOffsetText(t.lastPublish)),1)]),t.user!=null&&e.userInfo.id===t.user.id?(i(),p("ul",Z,[n("li",null,[t.type==="MAIN"?(i(),d(u,{key:0,type:"primary",size:"default",onClick:S=>r.openSettings(t)},{default:g(()=>[f(o(e.$t("service.serviceSettings")),1)]),_:2},1032,["onClick"])):(i(),d(u,{key:1,type:"primary",size:"default",onClick:S=>r.openSettings(t)},{default:g(()=>[f(o(e.$t("plugin.settings")),1)]),_:2},1032,["onClick"]))]),n("li",null,[m(u,{type:"important2",size:"default",onClick:S=>r.deleteService(t)},{default:g(()=>[f("删除")]),_:2},1032,["onClick"])])])):B("",!0)]))),128))])):(i(),d(v,{key:1,description:e.$t("service.noServices")},null,8,["description"])),m(b,{pagination:c.pagination,onCurrentChange:r.handleCurrentChange,onSizeChange:r.handleSizeChange},null,8,["pagination","onCurrentChange","onSizeChange"])])),[[C,c.loading]])])])}const ce=P(j,[["render",ee],["__scopeId","data-v-be1e1403"]]);export{ce as default};