2022-11-17 17:39:33 +08:00
|
|
|
<template>
|
2023-01-31 18:52:07 +08:00
|
|
|
<div>
|
|
|
|
<RouterButton :buttons="routerButton" />
|
|
|
|
<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>
|
|
|
|
</template>
|
|
|
|
<template #toolbar>
|
|
|
|
<el-button type="primary" @click="openSSL()">
|
|
|
|
{{ $t('ssl.create') }}
|
|
|
|
</el-button>
|
2023-10-31 16:01:50 +08:00
|
|
|
<el-button type="primary" @click="openUpload()">
|
|
|
|
{{ $t('ssl.upload') }}
|
|
|
|
</el-button>
|
2023-01-31 18:52:07 +08:00
|
|
|
<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>
|
|
|
|
<template #main>
|
|
|
|
<br />
|
2023-11-20 10:44:10 +08:00
|
|
|
<ComplexTable :data="data" :pagination-config="paginationConfig" @search="search()" v-loading="loading">
|
2023-01-31 18:52:07 +08:00
|
|
|
<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>
|
2023-11-20 10:44:10 +08:00
|
|
|
<el-table-column
|
|
|
|
:label="$t('ssl.applyType')"
|
|
|
|
fix
|
|
|
|
show-overflow-tooltip
|
|
|
|
prop="provider"
|
|
|
|
width="100px"
|
|
|
|
>
|
2023-01-31 18:52:07 +08:00
|
|
|
<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>
|
2023-11-20 10:44:10 +08:00
|
|
|
<el-table-column
|
|
|
|
:label="$t('commons.table.status')"
|
|
|
|
fix
|
|
|
|
show-overflow-tooltip
|
|
|
|
prop="status"
|
|
|
|
width="100px"
|
|
|
|
>
|
|
|
|
<template #default="{ row }">
|
|
|
|
<el-popover
|
|
|
|
v-if="
|
|
|
|
row.status === 'error' ||
|
|
|
|
row.status === 'applyError' ||
|
|
|
|
row.status === 'systemRestart'
|
|
|
|
"
|
|
|
|
placement="bottom"
|
|
|
|
:width="400"
|
|
|
|
trigger="hover"
|
|
|
|
:content="row.message"
|
|
|
|
>
|
|
|
|
<template #reference>
|
|
|
|
<Status :key="row.status" :status="row.status"></Status>
|
|
|
|
</template>
|
|
|
|
</el-popover>
|
|
|
|
<div v-else>
|
|
|
|
<Status :key="row.status" :status="row.status"></Status>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2023-01-31 18:52:07 +08:00
|
|
|
<el-table-column
|
|
|
|
:label="$t('website.brand')"
|
|
|
|
fix
|
|
|
|
show-overflow-tooltip
|
2023-06-06 16:29:22 +08:00
|
|
|
prop="organization"
|
2023-01-31 18:52:07 +08:00
|
|
|
></el-table-column>
|
2023-11-20 10:44:10 +08:00
|
|
|
<el-table-column :label="$t('ssl.autoRenew')" fix width="100px">
|
2023-03-21 14:42:50 +08:00
|
|
|
<template #default="{ row }">
|
|
|
|
<el-switch
|
|
|
|
:disabled="row.provider === 'dnsManual' || row.provider === 'manual'"
|
|
|
|
v-model="row.autoRenew"
|
|
|
|
@change="updateConfig(row)"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2023-01-31 18:52:07 +08:00
|
|
|
<el-table-column
|
|
|
|
prop="expireDate"
|
|
|
|
:label="$t('website.expireDate')"
|
|
|
|
:formatter="dateFormat"
|
|
|
|
show-overflow-tooltip
|
|
|
|
/>
|
|
|
|
<fu-table-operations
|
|
|
|
:ellipsis="3"
|
|
|
|
:buttons="buttons"
|
|
|
|
:label="$t('commons.table.operate')"
|
2023-05-24 16:36:54 +08:00
|
|
|
:fixed="mobile ? false : 'right'"
|
2023-01-31 18:52:07 +08:00
|
|
|
fix
|
|
|
|
/>
|
|
|
|
</ComplexTable>
|
|
|
|
</template>
|
|
|
|
<DnsAccount ref="dnsAccountRef"></DnsAccount>
|
|
|
|
<AcmeAccount ref="acmeAccountRef"></AcmeAccount>
|
|
|
|
<Create ref="sslCreateRef" @close="search()"></Create>
|
|
|
|
<Detail ref="detailRef"></Detail>
|
2023-10-31 16:01:50 +08:00
|
|
|
<SSLUpload ref="sslUploadRef" @close="search()"></SSLUpload>
|
2023-11-20 10:44:10 +08:00
|
|
|
<Apply ref="applyRef" @search="search" />
|
|
|
|
<OpDialog ref="opRef" @search="search" />
|
2023-01-31 18:52:07 +08:00
|
|
|
</LayoutContent>
|
|
|
|
</div>
|
2022-11-17 17:39:33 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-05-24 16:36:54 +08:00
|
|
|
import { onMounted, reactive, ref, computed } from 'vue';
|
2023-10-30 18:36:55 +08:00
|
|
|
import OpDialog from '@/components/del-dialog/index.vue';
|
2023-11-20 10:44:10 +08:00
|
|
|
import { DeleteSSL, ObtainSSL, SearchSSL, UpdateSSL } from '@/api/modules/website';
|
2022-11-17 17:39:33 +08:00
|
|
|
import DnsAccount from './dns-account/index.vue';
|
|
|
|
import AcmeAccount from './acme-account/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';
|
2022-11-17 17:39:33 +08:00
|
|
|
import i18n from '@/lang';
|
2022-12-13 17:20:13 +08:00
|
|
|
import { Website } from '@/api/interface/website';
|
2023-03-21 14:42:50 +08:00
|
|
|
import { MsgSuccess } from '@/utils/message';
|
2023-05-24 16:36:54 +08:00
|
|
|
import { GlobalStore } from '@/store';
|
2023-10-31 16:01:50 +08:00
|
|
|
import SSLUpload from './upload/index.vue';
|
2023-11-20 10:44:10 +08:00
|
|
|
import Apply from './apply/index.vue';
|
2022-11-17 17:39:33 +08:00
|
|
|
|
2023-11-14 18:44:09 +08:00
|
|
|
const globalStore = GlobalStore();
|
2022-11-17 17:39:33 +08:00
|
|
|
const paginationConfig = reactive({
|
2023-09-18 17:20:25 +08:00
|
|
|
cacheSizeKey: 'ssl-page-size',
|
2022-11-17 17:39:33 +08:00
|
|
|
currentPage: 1,
|
2023-04-06 16:38:16 +08:00
|
|
|
pageSize: 10,
|
2022-11-17 17:39:33 +08:00
|
|
|
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();
|
2023-10-31 16:01:50 +08:00
|
|
|
const data = ref();
|
|
|
|
const loading = ref(false);
|
2023-10-30 18:36:55 +08:00
|
|
|
const opRef = ref();
|
2023-10-31 16:01:50 +08:00
|
|
|
const sslUploadRef = ref();
|
2023-11-20 10:44:10 +08:00
|
|
|
const applyRef = ref();
|
2022-11-17 17:39:33 +08:00
|
|
|
|
2023-01-19 16:40:21 +08:00
|
|
|
const routerButton = [
|
|
|
|
{
|
|
|
|
label: i18n.global.t('website.ssl'),
|
|
|
|
path: '/websites/ssl',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2022-11-17 17:39:33 +08:00
|
|
|
const buttons = [
|
2022-12-29 14:55:20 +08:00
|
|
|
{
|
|
|
|
label: i18n.global.t('ssl.detail'),
|
2023-11-20 10:44:10 +08:00
|
|
|
disabled: function (row: Website.SSL) {
|
|
|
|
return row.status === 'init' || row.status === 'error';
|
|
|
|
},
|
2022-12-29 14:55:20 +08:00
|
|
|
click: function (row: Website.SSL) {
|
|
|
|
openDetail(row.id);
|
|
|
|
},
|
|
|
|
},
|
2022-11-17 17:39:33 +08:00
|
|
|
{
|
2023-11-20 10:44:10 +08:00
|
|
|
label: i18n.global.t('ssl.apply'),
|
2023-01-03 18:37:57 +08:00
|
|
|
disabled: function (row: Website.SSL) {
|
2023-11-20 10:44:10 +08:00
|
|
|
return row.status === 'applying';
|
2023-01-03 18:37:57 +08:00
|
|
|
},
|
2022-12-29 14:55:20 +08:00
|
|
|
click: function (row: Website.SSL) {
|
2023-11-20 10:44:10 +08:00
|
|
|
if (row.provider === 'dnsManual') {
|
|
|
|
applyRef.value.acceptParams({ ssl: row });
|
|
|
|
} else {
|
|
|
|
applySSL(row);
|
|
|
|
}
|
2022-11-17 17:39:33 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2023-06-29 22:38:12 +08:00
|
|
|
label: i18n.global.t('commons.button.delete'),
|
2022-12-29 14:55:20 +08:00
|
|
|
click: function (row: Website.SSL) {
|
2023-10-30 18:36:55 +08:00
|
|
|
deleteSSL(row);
|
2022-11-17 17:39:33 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2023-05-24 16:36:54 +08:00
|
|
|
const mobile = computed(() => {
|
|
|
|
return globalStore.isMobile();
|
|
|
|
});
|
|
|
|
|
2022-11-17 17:39:33 +08:00
|
|
|
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;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2023-03-21 14:42:50 +08:00
|
|
|
const updateConfig = (row: Website.SSL) => {
|
|
|
|
loading.value = true;
|
|
|
|
UpdateSSL({ id: row.id, autoRenew: row.autoRenew })
|
|
|
|
.then(() => {
|
|
|
|
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
loading.value = false;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-11-17 17:39:33 +08:00
|
|
|
const openAcmeAccount = () => {
|
|
|
|
acmeAccountRef.value.acceptParams();
|
|
|
|
};
|
|
|
|
const openDnsAccount = () => {
|
|
|
|
dnsAccountRef.value.acceptParams();
|
|
|
|
};
|
|
|
|
const openSSL = () => {
|
|
|
|
sslCreateRef.value.acceptParams();
|
|
|
|
};
|
2023-10-31 16:01:50 +08:00
|
|
|
const openUpload = () => {
|
|
|
|
sslUploadRef.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-11-17 17:39:33 +08:00
|
|
|
};
|
2022-12-29 14:55:20 +08:00
|
|
|
const openDetail = (id: number) => {
|
|
|
|
detailRef.value.acceptParams(id);
|
|
|
|
};
|
2022-11-17 17:39:33 +08:00
|
|
|
|
2023-11-20 10:44:10 +08:00
|
|
|
const applySSL = (row: Website.SSL) => {
|
|
|
|
if (row.status === 'init' || row.status === 'error') {
|
|
|
|
loading.value = true;
|
|
|
|
ObtainSSL({ ID: row.id })
|
|
|
|
.then(() => {
|
|
|
|
MsgSuccess(i18n.global.t('ssl.applyStart'));
|
|
|
|
search();
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
loading.value = false;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
openRenewSSL(row.id, row.websites);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-30 18:36:55 +08:00
|
|
|
const deleteSSL = async (row: any) => {
|
|
|
|
opRef.value.acceptParams({
|
|
|
|
title: i18n.global.t('commons.button.delete'),
|
|
|
|
names: [row.primaryDomain],
|
|
|
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
|
|
|
i18n.global.t('website.ssl'),
|
|
|
|
i18n.global.t('commons.button.delete'),
|
|
|
|
]),
|
|
|
|
api: DeleteSSL,
|
|
|
|
params: { id: row.id },
|
|
|
|
});
|
2022-11-17 17:39:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
search();
|
|
|
|
});
|
|
|
|
</script>
|