feat: license操作按钮调整
This commit is contained in:
@@ -26,6 +26,7 @@ export namespace LicenseApi {
|
||||
action: number; // 操作
|
||||
neCodeList: NeCode[]; // 操作
|
||||
oldLicense: License;
|
||||
hasHistory: boolean;
|
||||
}
|
||||
export interface NeCode {
|
||||
id: number; // 主键
|
||||
|
||||
@@ -369,59 +369,8 @@ export function useGridColumns(
|
||||
field: 'operation',
|
||||
title: $t('license.operation'),
|
||||
minWidth: 200,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
headerAlign: 'center',
|
||||
showOverflow: false,
|
||||
cellRender: {
|
||||
attrs: {
|
||||
nameField: 'serialNo',
|
||||
nameTitle: 'License',
|
||||
onClick: onActionClick,
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
{
|
||||
code: 'detail',
|
||||
text: $t('license.detail'),
|
||||
},
|
||||
{
|
||||
code: 'history',
|
||||
text: $t('license.history'),
|
||||
},
|
||||
{
|
||||
code: 'reapply',
|
||||
text: $t('license.reapply'),
|
||||
show: (values: LicenseApi.License) => {
|
||||
return (
|
||||
hasAccessByCodes(['license:license:apply']) &&
|
||||
values.status === 3
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
code: 'generate',
|
||||
text: $t('license.generate'),
|
||||
show: (values: LicenseApi.License) => {
|
||||
return (
|
||||
hasAccessByCodes(['license:license:generate']) &&
|
||||
(values.status === 1 || values.status === 4)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
code: 'download',
|
||||
text: $t('license.download'),
|
||||
show: (values: LicenseApi.License) => {
|
||||
return values.status === 3;
|
||||
},
|
||||
},
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['license:license:delete']),
|
||||
},
|
||||
],
|
||||
},
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { LicenseApi } from '#/api/license/license';
|
||||
|
||||
import { useRouter } from 'vue-router';
|
||||
@@ -111,36 +108,6 @@ async function onExport() {
|
||||
downloadFileFromBlobPart({ fileName: 'License.xls', source: data });
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({ code, row }: OnActionClickParams<LicenseApi.License>) {
|
||||
switch (code) {
|
||||
case 'delete': {
|
||||
onDelete(row);
|
||||
break;
|
||||
}
|
||||
case 'detail': {
|
||||
onDetail(row);
|
||||
break;
|
||||
}
|
||||
case 'download': {
|
||||
onDownload(row);
|
||||
break;
|
||||
}
|
||||
case 'generate': {
|
||||
onGenerate(row);
|
||||
break;
|
||||
}
|
||||
case 'history': {
|
||||
onHistory(row);
|
||||
break;
|
||||
}
|
||||
case 'reapply': {
|
||||
onReapply(row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
collapsed: true,
|
||||
@@ -148,7 +115,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(onActionClick),
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
@@ -206,6 +173,58 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('license.detail'),
|
||||
type: 'link',
|
||||
onClick: onDetail.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('license.generate'),
|
||||
type: 'link',
|
||||
ifShow: row.status === 1 || row.status === 4,
|
||||
auth: ['license:license:generate'],
|
||||
onClick: onGenerate.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('license.download'),
|
||||
type: 'link',
|
||||
ifShow: row.status === 3,
|
||||
auth: ['license:license:query'],
|
||||
onClick: onDownload.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
auth: ['license:license:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.serialNo]),
|
||||
confirm: onDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
label: $t('license.reapply'),
|
||||
type: 'link',
|
||||
ifShow: row.status === 3,
|
||||
auth: ['license:license:query'],
|
||||
onClick: onReapply.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('license.history'),
|
||||
type: 'link',
|
||||
ifShow: row.hasHistory,
|
||||
auth: ['license:license:query'],
|
||||
onClick: onHistory.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user