feat: 重新申请license

This commit is contained in:
caiyuchao
2025-08-04 10:22:21 +08:00
parent 2c0601a46b
commit 1fa117b8f2
3 changed files with 104 additions and 79 deletions

View File

@@ -64,7 +64,7 @@ const columns = [
title: '激活码', title: '激活码',
dataIndex: 'activationCodeMap', dataIndex: 'activationCodeMap',
key: 'activationCodeMap', key: 'activationCodeMap',
customRender: (data) => { customRender: (data: any) => {
if (data.value.new) { if (data.value.new) {
const after = h( const after = h(
'span', 'span',
@@ -82,18 +82,19 @@ const columns = [
}, },
{ {
title: 'License文件', title: 'License文件',
dataIndex: 'fileUrlList', dataIndex: 'fileUrlListMap',
key: 'fileUrlList', key: 'fileUrlListMap',
customRender: (data: any) => { customRender: (data: any) => {
if (!data.value) { const getFile = (dataValue: any) => {
if (!dataValue) {
return; return;
} }
if (!data.value[0]) { if (!dataValue[0]) {
return; return;
} }
const fileName = `${data.value[0]?.slice( const fileName = `${dataValue[0]?.slice(
Math.max(0, data.value[0].lastIndexOf('/') + 1), Math.max(0, dataValue[0].lastIndexOf('/') + 1),
data.value[0].lastIndexOf('_'), dataValue[0].lastIndexOf('_'),
)}.ini`; )}.ini`;
// 创建下载链接 // 创建下载链接
const link = h( const link = h(
@@ -111,7 +112,7 @@ const columns = [
Button, Button,
{ {
onClick: async () => { onClick: async () => {
const res = await fetch(data.value[0]); const res = await fetch(dataValue[0]);
if (!res.ok) { if (!res.ok) {
message.error($t('license.downloadFailed')); message.error($t('license.downloadFailed'));
return; return;
@@ -137,10 +138,10 @@ const columns = [
); );
let file1; let file1;
if (data.value[1]) { if (dataValue[1]) {
const fileName1 = `${data.value[1]?.slice( const fileName1 = `${dataValue[1]?.slice(
Math.max(0, data.value[1].lastIndexOf('/') + 1), Math.max(0, dataValue[1].lastIndexOf('/') + 1),
data.value[1].lastIndexOf('_'), dataValue[1].lastIndexOf('_'),
)}.ini`; )}.ini`;
// 创建下载链接 // 创建下载链接
const link1 = h( const link1 = h(
@@ -158,14 +159,17 @@ const columns = [
Button, Button,
{ {
onClick: async () => { onClick: async () => {
const res = await fetch(data.value[1]); const res = await fetch(dataValue[1]);
if (!res.ok) { if (!res.ok) {
message.error($t('license.downloadFailed')); message.error($t('license.downloadFailed'));
return; return;
} }
const blob1 = await res.blob(); const blob1 = await res.blob();
downloadFileFromBlobPart({ fileName: fileName1, source: blob1 }); downloadFileFromBlobPart({
fileName: fileName1,
source: blob1,
});
}, },
type: 'primary', type: 'primary',
}, },
@@ -184,8 +188,6 @@ const columns = [
[link1, button1], [link1, button1],
); );
} }
// 包裹容器
return h( return h(
'div', 'div',
{ {
@@ -193,6 +195,24 @@ const columns = [
}, },
[file, file1], [file, file1],
); );
};
// 包裹容器
// return getFile(data.value);
if (data.value.new) {
const after = h(
'span',
{
style: {
color: 'red',
},
},
[``, getFile(data.value.new)],
);
return h('div', {}, [getFile(data.value.old), after]);
}
return getFile(data.value.old);
}, },
}, },
]; ];

View File

@@ -388,7 +388,12 @@ export function useGridColumns(
{ {
code: 'reapply', code: 'reapply',
text: $t('license.reapply'), text: $t('license.reapply'),
show: hasAccessByCodes(['license:license:apply']), show: (values: LicenseApi.License) => {
return (
hasAccessByCodes(['license:license:apply']) &&
values.status === 3
);
},
}, },
{ {
code: 'generate', code: 'generate',
@@ -396,7 +401,7 @@ export function useGridColumns(
show: (values: LicenseApi.License) => { show: (values: LicenseApi.License) => {
return ( return (
hasAccessByCodes(['license:license:generate']) && hasAccessByCodes(['license:license:generate']) &&
values.status === 1 (values.status === 1 || values.status === 4)
); );
}, },
}, },

View File

@@ -136,7 +136,7 @@ getDetail(route.query.id);
<Button <Button
v-if=" v-if="
hasAccessByCodes(['license:license:generate']) && hasAccessByCodes(['license:license:generate']) &&
formData?.status === 1 (formData?.status === 1 || formData?.status === 4)
" "
type="primary" type="primary"
:loading="loading" :loading="loading"