diff --git a/apps/web-antd/src/api/system/user/index.ts b/apps/web-antd/src/api/system/user/index.ts index 52d8cdd..8ab688e 100644 --- a/apps/web-antd/src/api/system/user/index.ts +++ b/apps/web-antd/src/api/system/user/index.ts @@ -81,3 +81,10 @@ export function updateUserStatus(id: number, status: number) { export function getSimpleUserList() { return requestClient.get('/system/user/simple-list'); } + +/** 获取License管理员的用户列表 */ +export function getLicenseAdminList() { + return requestClient.get( + '/system/user/list-license-admin', + ); +} diff --git a/apps/web-antd/src/locales/langs/en-US/license.json b/apps/web-antd/src/locales/langs/en-US/license.json index 60e4865..f3926ee 100644 --- a/apps/web-antd/src/locales/langs/en-US/license.json +++ b/apps/web-antd/src/locales/langs/en-US/license.json @@ -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" } diff --git a/apps/web-antd/src/locales/langs/zh-CN/license.json b/apps/web-antd/src/locales/langs/zh-CN/license.json index f6c0e00..8e832d2 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/license.json +++ b/apps/web-antd/src/locales/langs/zh-CN/license.json @@ -10,9 +10,10 @@ "applicant": "申请人", "approver": "License管理员", "status": "状态", - "remark": "备注", + "remark": "说明", "creationTime": "创建时间", "operation": "操作", "list": "License列表", - "checkAll": "全选" + "checkAll": "全选", + "licenseAdminHelp": "指派给负责生成license的人员" } diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index 735fc33..3897dca 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -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'), diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue index 097a939..c175eec 100644 --- a/apps/web-antd/src/views/license/license/index.vue +++ b/apps/web-antd/src/views/license/license/index.vue @@ -82,6 +82,8 @@ function onActionClick({ code, row }: OnActionClickParams) { const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { + collapsed: true, + collapsedRows: 2, schema: useGridFormSchema(), }, gridOptions: { diff --git a/apps/web-antd/src/views/license/license/modules/form.vue b/apps/web-antd/src/views/license/license/modules/form.vue index 03d1109..26e4a67 100644 --- a/apps/web-antd/src/views/license/license/modules/form.vue +++ b/apps/web-antd/src/views/license/license/modules/form.vue @@ -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({