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() { export function getSimpleUserList() {
return requestClient.get<SystemUserApi.User[]>('/system/user/simple-list'); 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", "creationTime": "Creation Time",
"operation": "Operation", "operation": "Operation",
"list": "License List", "list": "License List",
"checkAll": "Check All" "checkAll": "Check All",
"licenseAdminHelp": "Assigned to personnel responsible for generating licenses"
} }

View File

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

View File

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

View File

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

View File

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