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