feat: License管理员用户类别和表单调整

This commit is contained in:
caiyuchao
2025-07-04 11:52:35 +08:00
parent 8641ffe6bf
commit f989e74616
6 changed files with 145 additions and 98 deletions

View File

@@ -81,3 +81,10 @@ export function updateUserStatus(id: number, status: number) {
export function getSimpleUserList() {
return requestClient.get<SystemUserApi.User[]>('/system/user/simple-list');
}
/** 获取License管理员的用户列表 */
export function getLicenseAdminList() {
return requestClient.get<SystemUserApi.User[]>(
'/system/user/list-license-admin',
);
}

View File

@@ -14,5 +14,6 @@
"creationTime": "Creation Time",
"operation": "Operation",
"list": "License List",
"checkAll": "Check All"
"checkAll": "Check All",
"licenseAdminHelp": "Assigned to personnel responsible for generating licenses"
}

View File

@@ -10,9 +10,10 @@
"applicant": "申请人",
"approver": "License管理员",
"status": "状态",
"remark": "备注",
"remark": "说明",
"creationTime": "创建时间",
"operation": "操作",
"list": "License列表",
"checkAll": "全选"
"checkAll": "全选",
"licenseAdminHelp": "指派给负责生成license的人员"
}

View File

@@ -6,6 +6,7 @@ import { useAccess } from '@vben/access';
import { getCustomerList } from '#/api/license/customer';
import { getProjectList } from '#/api/license/project';
import { getLicenseAdminList, getSimpleUserList } from '#/api/system/user';
import { $t } from '#/locales';
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
@@ -91,6 +92,7 @@ export function useFormSchema(): VbenFormSchema[] {
{
fieldName: 'expirationTime',
label: $t('license.expirationTime'),
rules: 'required',
component: 'DatePicker',
componentProps: {
showTime: true,
@@ -102,8 +104,55 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'neSwitch',
label: $t('license.neSwitch'),
component: 'CheckboxGroup',
formItemClass: 'col-span-2',
modelPropName: 'modelValue',
},
// {
// fieldName: 'baseStationNum',
// label: $t('license.baseStationNum'),
// component: 'InputNumber',
// componentProps: {
// min: 0,
// },
// },
{
fieldName: 'activationCode',
label: $t('license.activationCode'),
component: 'Textarea',
formItemClass: 'col-span-2',
},
// {
// fieldName: 'licenseContent',
// label: $t('license.licenseContent'),
// component: 'Textarea',
// },
// {
// fieldName: 'applicant',
// label: $t('license.applicant'),
// component: 'Select',
// componentProps: {
// options: [],
// },
// },
{
fieldName: 'approver',
label: $t('license.approver'),
component: 'ApiSelect',
help: $t('license.licenseAdminHelp'),
componentProps: {
allowClear: true,
api: async () => {
const data = await getLicenseAdminList();
return data.map((item) => ({
label: item.nickname,
value: item.id,
}));
},
showSearch: true,
filterOption: (input: string, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
},
},
{
fieldName: 'userNum',
label: $t('license.userNum'),
@@ -112,54 +161,21 @@ export function useFormSchema(): VbenFormSchema[] {
min: 0,
},
},
{
fieldName: 'baseStationNum',
label: $t('license.baseStationNum'),
component: 'InputNumber',
componentProps: {
min: 0,
},
},
{
fieldName: 'activationCode',
label: $t('license.activationCode'),
component: 'Textarea',
},
{
fieldName: 'licenseContent',
label: $t('license.licenseContent'),
component: 'Textarea',
},
{
fieldName: 'applicant',
label: $t('license.applicant'),
component: 'Select',
componentProps: {
options: [],
},
},
{
fieldName: 'approver',
label: $t('license.approver'),
component: 'Select',
componentProps: {
options: [],
},
},
{
fieldName: 'status',
label: $t('license.status'),
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.LIC_LICENSE_STATUS, 'number'),
buttonStyle: 'solid',
optionType: 'button',
},
},
// {
// fieldName: 'status',
// label: $t('license.status'),
// component: 'Select',
// componentProps: {
// options: getDictOptions(DICT_TYPE.LIC_LICENSE_STATUS, 'number'),
// buttonStyle: 'solid',
// optionType: 'button',
// },
// },
{
fieldName: 'remark',
label: $t('license.remark'),
component: 'Textarea',
formItemClass: 'col-span-2',
},
];
}
@@ -213,54 +229,72 @@ export function useGridFormSchema(): VbenFormSchema[] {
option.label.toLowerCase().includes(input.toLowerCase()),
},
},
{
fieldName: 'userNum',
label: $t('license.userNum'),
component: 'Input',
componentProps: {
allowClear: true,
},
},
{
fieldName: 'baseStationNum',
label: $t('license.baseStationNum'),
component: 'Input',
componentProps: {
allowClear: true,
},
},
{
fieldName: 'activationCode',
label: $t('license.activationCode'),
component: 'Input',
componentProps: {
allowClear: true,
},
},
{
fieldName: 'licenseContent',
label: $t('license.licenseContent'),
component: 'Input',
componentProps: {
allowClear: true,
},
},
// {
// fieldName: 'userNum',
// label: $t('license.userNum'),
// component: 'Input',
// componentProps: {
// allowClear: true,
// },
// },
// {
// fieldName: 'baseStationNum',
// label: $t('license.baseStationNum'),
// component: 'Input',
// componentProps: {
// allowClear: true,
// },
// },
// {
// fieldName: 'activationCode',
// label: $t('license.activationCode'),
// component: 'Input',
// componentProps: {
// allowClear: true,
// },
// },
// {
// fieldName: 'licenseContent',
// label: $t('license.licenseContent'),
// component: 'Input',
// componentProps: {
// allowClear: true,
// },
// },
{
fieldName: 'applicant',
label: $t('license.applicant'),
component: 'Select',
component: 'ApiSelect',
componentProps: {
allowClear: true,
options: [],
api: async () => {
const data = await getSimpleUserList();
return data.map((item) => ({
label: item.nickname,
value: item.id,
}));
},
showSearch: true,
filterOption: (input: string, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
},
},
{
fieldName: 'approver',
label: $t('license.approver'),
component: 'Select',
component: 'ApiSelect',
componentProps: {
allowClear: true,
options: [],
api: async () => {
const data = await getLicenseAdminList();
return data.map((item) => ({
label: item.nickname,
value: item.id,
}));
},
showSearch: true,
filterOption: (input: string, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
},
},
{
@@ -272,14 +306,14 @@ export function useGridFormSchema(): VbenFormSchema[] {
options: getDictOptions(DICT_TYPE.LIC_LICENSE_STATUS, 'number'),
},
},
{
fieldName: 'remark',
label: $t('license.remark'),
component: 'Input',
componentProps: {
allowClear: true,
},
},
// {
// fieldName: 'remark',
// label: $t('license.remark'),
// component: 'Input',
// componentProps: {
// allowClear: true,
// },
// },
{
fieldName: 'createTime',
label: $t('license.creationTime'),
@@ -332,11 +366,11 @@ export function useGridColumns(
title: $t('license.userNum'),
minWidth: 120,
},
{
field: 'baseStationNum',
title: $t('license.baseStationNum'),
minWidth: 120,
},
// {
// field: 'baseStationNum',
// title: $t('license.baseStationNum'),
// minWidth: 120,
// },
{
field: 'activationCode',
title: $t('license.activationCode'),

View File

@@ -82,6 +82,8 @@ function onActionClick({ code, row }: OnActionClickParams<LicenseApi.License>) {
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
collapsed: true,
collapsedRows: 2,
schema: useGridFormSchema(),
},
gridOptions: {

View File

@@ -39,12 +39,14 @@ const [Form, formApi] = useVbenForm({
componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
// formItemClass: 'col-span-2',
labelWidth: 80,
},
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
// 大屏一行显示3个中屏一行显示2个小屏一行显示1个
wrapperClass: 'grid-cols-1 md:grid-cols-2',
});
const onCheckAllChange = (e: any) => {
@@ -115,7 +117,7 @@ const [Modal, modalApi] = useVbenModal({
</script>
<template>
<Modal :title="getTitle">
<Modal :title="getTitle" class="w-[800px]">
<Form class="mx-4">
<template #neSwitch="slotProps">
<a-row>