You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.3 KiB
128 lines
4.3 KiB
<template>
|
|
<w-grid
|
|
ref="announcementGridRef"
|
|
:title="$t('license.keygen.grid.title')"
|
|
:config-button="true"
|
|
selection="multiple"
|
|
:checkbox-selection="true"
|
|
db-click-operation="edit"
|
|
:data-url="Environment.apiContextPath('/api/license/keygen')"
|
|
:sort-by="['consumerName']"
|
|
:query-form-cols-num="2"
|
|
:query-form-fields="[{ name: 'consumerName', label: $t('license.keygen.grid.entity.consumerName'), type: 'w-text' }]"
|
|
:toolbar-configure="{ noIcon: false }"
|
|
:toolbar-actions="[
|
|
'query',
|
|
'refresh',
|
|
'separator',
|
|
'add',
|
|
'clone',
|
|
'edit',
|
|
'remove',
|
|
'separator',
|
|
{
|
|
name: 'keygen',
|
|
label: $t('license.keygen.grid.toolbar.keygen'),
|
|
icon: 'download',
|
|
enableIf: (arg) => {
|
|
return arg.selected;
|
|
},
|
|
click: (arg) => {
|
|
Downloader.get(Environment.apiContextPath('/api/license/keygen/generateLicenseFile/' + arg.selected.id), { loading: true });
|
|
},
|
|
},
|
|
'separator',
|
|
'view',
|
|
'separator',
|
|
'export',
|
|
]"
|
|
:columns="[
|
|
{ width: '*', name: 'consumerName', label: $t('license.keygen.grid.entity.consumerName') },
|
|
{
|
|
width: 200,
|
|
name: 'macAddresses',
|
|
label: $t('license.keygen.grid.entity.macAddressesOnly'),
|
|
format: (value, row) => {
|
|
if (value) {
|
|
let str = '';
|
|
const splits: string[] = value.split(',');
|
|
splits.forEach((split, index) => {
|
|
if (index === splits.length) {
|
|
str += split;
|
|
} else {
|
|
str += split + '<br>';
|
|
}
|
|
});
|
|
return str;
|
|
}
|
|
return value;
|
|
},
|
|
},
|
|
{
|
|
width: 150,
|
|
name: 'type',
|
|
label: $t('license.keygen.grid.entity.type'),
|
|
format: Formater.enum(LicenseTypeEnum),
|
|
},
|
|
{ width: 100, name: 'term', label: $t('license.keygen.grid.entity.term'), align: 'right' },
|
|
{ width: 200, name: 'expiredDate', label: $t('license.keygen.grid.entity.expiredDate') },
|
|
]"
|
|
:editor="{
|
|
dialog: {
|
|
width: '800px',
|
|
},
|
|
form: {
|
|
colsNum: 1,
|
|
fields: [
|
|
{ name: 'consumerName', label: $t('license.keygen.grid.entity.consumerName'), type: 'w-text' },
|
|
{ name: 'description', label: $t('license.keygen.grid.entity.description'), type: 'w-textarea' },
|
|
{ name: 'type', label: $t('license.keygen.grid.entity.type'), type: 'w-select', options: Options.enum(LicenseTypeEnum) },
|
|
{
|
|
name: 'term',
|
|
label: $t('license.keygen.grid.entity.term'),
|
|
type: 'w-number',
|
|
showIf: (arg) => {
|
|
return 'TERM' === arg.form.getFieldValue('type');
|
|
},
|
|
},
|
|
{
|
|
name: 'expiredDate',
|
|
label: $t('license.keygen.grid.entity.expiredDate'),
|
|
type: 'w-date',
|
|
showIf: (arg) => {
|
|
return 'EXPIRED' === arg.form.getFieldValue('type');
|
|
},
|
|
},
|
|
{
|
|
name: 'macAddresses',
|
|
label: $t('license.keygen.grid.entity.macAddresses'),
|
|
type: 'w-text',
|
|
},
|
|
],
|
|
},
|
|
}"
|
|
:viewer="{
|
|
panel: {
|
|
columnNum: 1,
|
|
fields: [
|
|
{ name: 'id', label: $t('id') },
|
|
{ name: 'consumerName', label: $t('license.keygen.grid.entity.consumerName') },
|
|
{ name: 'description', label: $t('license.keygen.grid.entity.description') },
|
|
{ name: 'type', label: $t('license.keygen.grid.entity.type') },
|
|
{ name: 'expiredDate', label: $t('license.keygen.grid.entity.expiredDate') },
|
|
{ name: 'macAddresses', label: $t('license.keygen.grid.entity.macAddresses') },
|
|
{ name: 'creator', label: $t('creator') },
|
|
{ name: 'createDate', label: $t('createDate') },
|
|
{ name: 'lastModifier', label: $t('lastModifier') },
|
|
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
|
|
],
|
|
},
|
|
}"
|
|
></w-grid>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import 'tailwindcss/utilities.css';
|
|
import { Environment, EnumTools, Options, Formater, Downloader } from 'platform-core';
|
|
|
|
const LicenseTypeEnum = await EnumTools.fetch('io.sc.platform.core.enums.LicenseType');
|
|
</script>
|
|
|