1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-16 02:34:45 +08:00

164 lines
5.4 KiB
Vue
Raw Normal View History

<template>
2023-01-09 10:38:54 +08:00
<LayoutContent :title="$t('website.ssl')">
<template #prompt>
<el-alert type="info" :closable="false">
<template #default>
<span><span v-html="$t('website.encryptHelper')"></span></span>
</template>
</el-alert>
2023-01-09 10:38:54 +08:00
</template>
<template #main>
<br />
<ComplexTable :data="data" :pagination-config="paginationConfig" @search="search()">
<template #toolbar>
<el-button type="primary" icon="Plus" @click="openSSL()">
{{ $t('commons.button.create') }}
</el-button>
<el-button type="primary" plain @click="openAcmeAccount()">
{{ $t('website.acmeAccountManage') }}
</el-button>
<el-button type="primary" plain @click="openDnsAccount()">
{{ $t('website.dnsAccountManage') }}
</el-button>
</template>
<el-table-column
:label="$t('website.domain')"
fix
show-overflow-tooltip
prop="primaryDomain"
></el-table-column>
<el-table-column
:label="$t('website.otherDomains')"
fix
show-overflow-tooltip
prop="domains"
></el-table-column>
<el-table-column :label="$t('ssl.provider')" fix show-overflow-tooltip prop="provider">
<template #default="{ row }">{{ getProvider(row.provider) }}</template>
</el-table-column>
<el-table-column
:label="$t('ssl.acmeAccount')"
fix
show-overflow-tooltip
prop="acmeAccount.email"
></el-table-column>
<el-table-column :label="$t('website.brand')" fix show-overflow-tooltip prop="type"></el-table-column>
<el-table-column
prop="expireDate"
:label="$t('website.expireDate')"
2023-01-16 15:55:53 +08:00
:formatter="dateFormat"
show-overflow-tooltip
/>
<fu-table-operations
2022-12-29 14:55:20 +08:00
:ellipsis="3"
:buttons="buttons"
:label="$t('commons.table.operate')"
fixed="right"
fix
/>
</ComplexTable>
2023-01-09 10:38:54 +08:00
</template>
<DnsAccount ref="dnsAccountRef"></DnsAccount>
<AcmeAccount ref="acmeAccountRef"></AcmeAccount>
<Create ref="sslCreateRef" @close="search()"></Create>
<Renew ref="renewRef" @close="search()"></Renew>
<Detail ref="detailRef"></Detail>
</LayoutContent>
</template>
<script lang="ts" setup>
import LayoutContent from '@/layout/layout-content.vue';
import ComplexTable from '@/components/complex-table/index.vue';
import { onMounted, reactive, ref } from 'vue';
import { DeleteSSL, SearchSSL } from '@/api/modules/website';
import DnsAccount from './dns-account/index.vue';
import AcmeAccount from './acme-account/index.vue';
import Renew from './renew/index.vue';
import Create from './create/index.vue';
2022-12-29 14:55:20 +08:00
import Detail from './detail/index.vue';
2023-01-16 15:55:53 +08:00
import { dateFormat, getProvider } from '@/utils/util';
import i18n from '@/lang';
2022-12-13 17:20:13 +08:00
import { Website } from '@/api/interface/website';
import { useDeleteData } from '@/hooks/use-delete-data';
const paginationConfig = reactive({
currentPage: 1,
pageSize: 20,
total: 0,
});
const acmeAccountRef = ref();
const dnsAccountRef = ref();
const sslCreateRef = ref();
const renewRef = ref();
2022-12-29 14:55:20 +08:00
const detailRef = ref();
let data = ref();
let loading = ref(false);
const buttons = [
2022-12-29 14:55:20 +08:00
{
label: i18n.global.t('ssl.detail'),
click: function (row: Website.SSL) {
openDetail(row.id);
},
},
{
label: i18n.global.t('website.renewSSL'),
2023-01-03 18:37:57 +08:00
disabled: function (row: Website.SSL) {
return row.provider === 'manual';
},
2022-12-29 14:55:20 +08:00
click: function (row: Website.SSL) {
2023-01-04 14:26:22 +08:00
openRenewSSL(row.id, row.websites);
},
},
{
label: i18n.global.t('app.delete'),
2022-12-29 14:55:20 +08:00
click: function (row: Website.SSL) {
deleteSSL(row.id);
},
},
];
const search = () => {
const req = {
page: paginationConfig.currentPage,
pageSize: paginationConfig.pageSize,
};
loading.value = true;
SearchSSL(req)
.then((res) => {
data.value = res.data.items || [];
paginationConfig.total = res.data.total;
})
.finally(() => {
loading.value = false;
});
};
const openAcmeAccount = () => {
acmeAccountRef.value.acceptParams();
};
const openDnsAccount = () => {
dnsAccountRef.value.acceptParams();
};
const openSSL = () => {
sslCreateRef.value.acceptParams();
};
2023-01-04 14:26:22 +08:00
const openRenewSSL = (id: number, websites: Website.Website[]) => {
renewRef.value.acceptParams({ id: id, websites: websites });
};
2022-12-29 14:55:20 +08:00
const openDetail = (id: number) => {
detailRef.value.acceptParams(id);
};
const deleteSSL = async (id: number) => {
loading.value = true;
2022-12-23 11:08:28 +08:00
await useDeleteData(DeleteSSL, { id: id }, 'commons.msg.delete');
loading.value = false;
search();
};
onMounted(() => {
search();
});
</script>