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: '激活码',
dataIndex: 'activationCodeMap',
key: 'activationCodeMap',
customRender: (data) => {
customRender: (data: any) => {
if (data.value.new) {
const after = h(
'span',
@@ -82,117 +82,137 @@ const columns = [
},
{
title: 'License文件',
dataIndex: 'fileUrlList',
key: 'fileUrlList',
dataIndex: 'fileUrlListMap',
key: 'fileUrlListMap',
customRender: (data: any) => {
if (!data.value) {
return;
}
if (!data.value[0]) {
return;
}
const fileName = `${data.value[0]?.slice(
Math.max(0, data.value[0].lastIndexOf('/') + 1),
data.value[0].lastIndexOf('_'),
)}.ini`;
// 创建下载链接
const link = h(
'span',
{
style: {
marginRight: '15px',
},
},
fileName,
);
// 创建下载按钮
const button = h(
Button,
{
onClick: async () => {
const res = await fetch(data.value[0]);
if (!res.ok) {
message.error($t('license.downloadFailed'));
return;
}
const blob = await res.blob();
downloadFileFromBlobPart({ fileName, source: blob });
},
type: 'primary',
},
() => $t('license.download'),
);
const file = h(
'div',
{
style: {
display: 'flex',
alignItems: 'center',
},
},
[link, button],
);
let file1;
if (data.value[1]) {
const fileName1 = `${data.value[1]?.slice(
Math.max(0, data.value[1].lastIndexOf('/') + 1),
data.value[1].lastIndexOf('_'),
const getFile = (dataValue: any) => {
if (!dataValue) {
return;
}
if (!dataValue[0]) {
return;
}
const fileName = `${dataValue[0]?.slice(
Math.max(0, dataValue[0].lastIndexOf('/') + 1),
dataValue[0].lastIndexOf('_'),
)}.ini`;
// 创建下载链接
const link1 = h(
const link = h(
'span',
{
style: {
marginRight: '15px',
},
},
fileName1,
fileName,
);
// 创建下载按钮
const button1 = h(
const button = h(
Button,
{
onClick: async () => {
const res = await fetch(data.value[1]);
const res = await fetch(dataValue[0]);
if (!res.ok) {
message.error($t('license.downloadFailed'));
return;
}
const blob1 = await res.blob();
const blob = await res.blob();
downloadFileFromBlobPart({ fileName: fileName1, source: blob1 });
downloadFileFromBlobPart({ fileName, source: blob });
},
type: 'primary',
},
() => $t('license.download'),
);
file1 = h(
const file = h(
'div',
{
style: {
display: 'flex',
alignItems: 'center',
margin: '8px 0 0 0',
},
},
[link1, button1],
[link, button],
);
}
let file1;
if (dataValue[1]) {
const fileName1 = `${dataValue[1]?.slice(
Math.max(0, dataValue[1].lastIndexOf('/') + 1),
dataValue[1].lastIndexOf('_'),
)}.ini`;
// 创建下载链接
const link1 = h(
'span',
{
style: {
marginRight: '15px',
},
},
fileName1,
);
// 创建下载按钮
const button1 = h(
Button,
{
onClick: async () => {
const res = await fetch(dataValue[1]);
if (!res.ok) {
message.error($t('license.downloadFailed'));
return;
}
const blob1 = await res.blob();
downloadFileFromBlobPart({
fileName: fileName1,
source: blob1,
});
},
type: 'primary',
},
() => $t('license.download'),
);
file1 = h(
'div',
{
style: {
display: 'flex',
alignItems: 'center',
margin: '8px 0 0 0',
},
},
[link1, button1],
);
}
return h(
'div',
{
style: {},
},
[file, file1],
);
};
// 包裹容器
return h(
'div',
{
style: {},
},
[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',
text: $t('license.reapply'),
show: hasAccessByCodes(['license:license:apply']),
show: (values: LicenseApi.License) => {
return (
hasAccessByCodes(['license:license:apply']) &&
values.status === 3
);
},
},
{
code: 'generate',
@@ -396,7 +401,7 @@ export function useGridColumns(
show: (values: LicenseApi.License) => {
return (
hasAccessByCodes(['license:license:generate']) &&
values.status === 1
(values.status === 1 || values.status === 4)
);
},
},

View File

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