feat: license到期报表
This commit is contained in:
38
apps/web-antd/src/api/report/expire/index.ts
Normal file
38
apps/web-antd/src/api/report/expire/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ExpireApi {
|
||||
/** 客户进展信息 */
|
||||
export interface Expire {
|
||||
id: number; // 主键
|
||||
customerId?: number; // 客户ID
|
||||
projectId?: number; // 项目ID
|
||||
serialNo?: string; // sn
|
||||
expiryDate: Dayjs | string; // 到期时间
|
||||
neList: number[]; // 网元
|
||||
userNumber: number; // 用户数
|
||||
ranNumber: number; // 基站数
|
||||
activationCode: string; // 激活码
|
||||
fileUrl: string; // 激活码
|
||||
licenseContent: string; // License内容
|
||||
applicant: number; // 申请人
|
||||
applicationTime: Dayjs | string; // 申请时间
|
||||
approver: number; // 审批人
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
applyCount: number; // 申请次数
|
||||
customerName?: string; // 客户名称
|
||||
projectName?: string; // 项目名称
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询License 到期分页 */
|
||||
export function getExpiryLicensePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ExpireApi.Expire>>(
|
||||
'/license/report/license/expire',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
285
apps/web-antd/src/views/report/expire/data.ts
Normal file
285
apps/web-antd/src/views/report/expire/data.ts
Normal file
@@ -0,0 +1,285 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ProgressApi } from '#/api/report/progress';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
import { getCustomerList } from '#/api/license/customer';
|
||||
import { getProjectList } from '#/api/license/project';
|
||||
import { $t } from '#/locales';
|
||||
import { DICT_TYPE, getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
// ==================== 未过期 ====================
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useExpiringGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'customerId',
|
||||
label: $t('license.customer'),
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getCustomerList,
|
||||
allowClear: true,
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.name.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'projectId',
|
||||
label: $t('license.project'),
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getProjectList,
|
||||
allowClear: true,
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.name.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'serialNo',
|
||||
label: 'SN',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'expiryDate',
|
||||
label: '到期时间',
|
||||
component: 'RangePicker',
|
||||
defaultValue: [dayjs(), dayjs().add(7, 'days')],
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
format: 'YYYY-MM-DD',
|
||||
showTime: false,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useExpiringGridColumns(): VxeTableGridOptions<ProgressApi.Progress>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'customerName',
|
||||
title: '客户名称',
|
||||
showOverflow: false,
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
field: 'projectName',
|
||||
title: '项目名称',
|
||||
showOverflow: false,
|
||||
minWidth: 80,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: $t('project.status'),
|
||||
minWidth: 40,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.LIC_PROJECT_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'serialNo',
|
||||
title: 'SN',
|
||||
showOverflow: false,
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'businessOwnerName',
|
||||
title: '业务负责人',
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerAName',
|
||||
title: '技术负责人1',
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerBName',
|
||||
title: '技术负责人2',
|
||||
visible: false,
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '项目开始时间',
|
||||
minWidth: 80,
|
||||
visible: false,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'expiryDate',
|
||||
title: '到期时间',
|
||||
minWidth: 80,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'expiryDateFormat',
|
||||
title: '距离到期',
|
||||
minWidth: 80,
|
||||
formatter: ({ cellValue }) => {
|
||||
if (!cellValue) return '';
|
||||
// const days = dayjs(cellValue).diff(dayjs(), 'day');
|
||||
// if (days > 0) {
|
||||
// return `${days} 天`;
|
||||
// }
|
||||
// if (days === 0) {
|
||||
// return '今天到期';
|
||||
// }
|
||||
return dayjs(cellValue).fromNow(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'applicationTime',
|
||||
title: '申请时间',
|
||||
minWidth: 80,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// ==================== 已过期 ====================
|
||||
export function useExpiredGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'customerId',
|
||||
label: $t('license.customer'),
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getCustomerList,
|
||||
allowClear: true,
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.name.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'projectId',
|
||||
label: $t('license.project'),
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getProjectList,
|
||||
allowClear: true,
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.name.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'serialNo',
|
||||
label: 'SN',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'expiryDate',
|
||||
label: '到期时间',
|
||||
component: 'RangePicker',
|
||||
defaultValue: [dayjs().subtract(7, 'days'), dayjs()],
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
format: 'YYYY-MM-DD',
|
||||
showTime: false,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useExpiredGridColumns(): VxeTableGridOptions<ProgressApi.Progress>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'customerName',
|
||||
title: '客户名称',
|
||||
showOverflow: false,
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
field: 'projectName',
|
||||
title: '项目名称',
|
||||
showOverflow: false,
|
||||
minWidth: 80,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: $t('project.status'),
|
||||
minWidth: 40,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.LIC_PROJECT_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'serialNo',
|
||||
title: 'SN',
|
||||
showOverflow: false,
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'businessOwnerName',
|
||||
title: '业务负责人',
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerAName',
|
||||
title: '技术负责人1',
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerBName',
|
||||
title: '技术负责人2',
|
||||
visible: false,
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '项目开始时间',
|
||||
minWidth: 80,
|
||||
visible: false,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'expiryDate',
|
||||
title: '到期时间',
|
||||
minWidth: 80,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'expiryDateFormat',
|
||||
title: '已到期',
|
||||
minWidth: 80,
|
||||
formatter: ({ cellValue }) => {
|
||||
if (!cellValue) return '';
|
||||
// const days = dayjs(cellValue).diff(dayjs(), 'day');
|
||||
// if (days > 0) {
|
||||
// return `${days} 天`;
|
||||
// }
|
||||
// if (days === 0) {
|
||||
// return '今天到期';
|
||||
// }
|
||||
return dayjs(cellValue).fromNow(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'applicationTime',
|
||||
title: '申请时间',
|
||||
minWidth: 80,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
];
|
||||
}
|
||||
30
apps/web-antd/src/views/report/expire/index.vue
Normal file
30
apps/web-antd/src/views/report/expire/index.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Tabs } from 'ant-design-vue';
|
||||
|
||||
import ExpiredList from './modules/expired.vue';
|
||||
import ExpiringList from './modules/expiring.vue';
|
||||
|
||||
const subTabsName = ref('project');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<div class="card-container">
|
||||
<Tabs
|
||||
v-model:active-key="subTabsName"
|
||||
:tab-bar-style="{ marginTop: '-10px' }"
|
||||
>
|
||||
<Tabs.TabPane key="project" tab="未过期">
|
||||
<ExpiringList />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="author" tab="已过期">
|
||||
<ExpiredList />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
60
apps/web-antd/src/views/report/expire/modules/expired.vue
Normal file
60
apps/web-antd/src/views/report/expire/modules/expired.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getExpiryLicensePage } from '#/api/report/expire';
|
||||
|
||||
import { useExpiredGridColumns, useExpiredGridFormSchema } from '../data';
|
||||
|
||||
const [Grid] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useExpiredGridFormSchema(),
|
||||
submitOnEnter: true,
|
||||
fieldMappingTime: [['expiryDate', ['expiryDateStart', 'expiryDateEnd']]],
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useExpiredGridColumns(),
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getExpiryLicensePage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
isExpired: true,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
},
|
||||
exportConfig: {},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
// export: true,
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: false,
|
||||
useKey: true,
|
||||
},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
border: true,
|
||||
virtualXConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
virtualYConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
headerCellStyle: { backgroundColor: '#fafafa' },
|
||||
} as VxeTableGridOptions<any>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Grid table-title="License到期" />
|
||||
</template>
|
||||
60
apps/web-antd/src/views/report/expire/modules/expiring.vue
Normal file
60
apps/web-antd/src/views/report/expire/modules/expiring.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getExpiryLicensePage } from '#/api/report/expire';
|
||||
|
||||
import { useExpiringGridColumns, useExpiringGridFormSchema } from '../data';
|
||||
|
||||
const [Grid] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useExpiringGridFormSchema(),
|
||||
submitOnEnter: true,
|
||||
fieldMappingTime: [['expiryDate', ['expiryDateStart', 'expiryDateEnd']]],
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useExpiringGridColumns(),
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getExpiryLicensePage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
isExpired: false,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
},
|
||||
exportConfig: {},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
// export: true,
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: false,
|
||||
useKey: true,
|
||||
},
|
||||
columnConfig: {
|
||||
useKey: true,
|
||||
},
|
||||
border: true,
|
||||
virtualXConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
virtualYConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
headerCellStyle: { backgroundColor: '#fafafa' },
|
||||
} as VxeTableGridOptions<any>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Grid table-title="License到期" />
|
||||
</template>
|
||||
Reference in New Issue
Block a user