feat: 恢复license可选
This commit is contained in:
@@ -35,7 +35,7 @@ async function initSetupVbenForm() {
|
||||
},
|
||||
// 选择项目必填国际化适配
|
||||
selectRequired: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null) {
|
||||
if (value === undefined || value === null || value.length === 0) {
|
||||
return $t('ui.formRules.selectRequired', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -90,7 +90,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'type',
|
||||
label: $t('customer.customerType'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
|
||||
@@ -109,7 +109,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'areaIds',
|
||||
label: $t('customer.area'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'ApiCascader',
|
||||
componentProps: {
|
||||
api: getAreaTree,
|
||||
|
||||
@@ -12,10 +12,7 @@ import { formatDate, formatDateTime } from '@vben/utils';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import {
|
||||
getCustomerList,
|
||||
getLicenseCustomerList,
|
||||
} from '#/api/license/customer';
|
||||
import { getCustomerList } from '#/api/license/customer';
|
||||
import { isLicenseSnUnique } from '#/api/license/license';
|
||||
import { getLicenseProjectList, getProjectList } from '#/api/license/project';
|
||||
import { getLicenseAdminList, getSimpleUserList } from '#/api/system/user';
|
||||
@@ -41,15 +38,13 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'customerId',
|
||||
label: $t('license.customer'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
dependencies: {
|
||||
triggerFields: ['id'],
|
||||
disabled: (values) => !!values.id,
|
||||
componentProps: async (values) => {
|
||||
customerList.value = await (values.id
|
||||
? getCustomerList()
|
||||
: getLicenseCustomerList());
|
||||
componentProps: async () => {
|
||||
customerList.value = await getCustomerList();
|
||||
|
||||
return {
|
||||
options: customerList,
|
||||
@@ -68,7 +63,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'projectId',
|
||||
label: $t('license.project'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: projectList,
|
||||
@@ -93,7 +88,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
return project.id === values.projectId;
|
||||
});
|
||||
if (!hasProject) {
|
||||
values.projectId = '';
|
||||
values.projectId = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +138,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'expiryDate',
|
||||
label: $t('license.expiryDate'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
// showTime: true,
|
||||
@@ -168,7 +163,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
fieldName: 'approver',
|
||||
label: $t('license.approver'),
|
||||
component: 'ApiSelect',
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
help: $t('license.licenseAdminHelp'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
|
||||
@@ -89,7 +89,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'customerId',
|
||||
label: $t('project.belongCustomer'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
@@ -118,7 +118,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'businessStatus',
|
||||
label: $t('project.businessStatus'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_BUSINESS_STATUS, 'number'),
|
||||
@@ -127,7 +127,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: $t('project.status'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_PROJECT_STATUS, 'number'),
|
||||
@@ -136,7 +136,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'businessOwner',
|
||||
label: $t('project.businessOwner'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: userList,
|
||||
@@ -157,7 +157,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'technicalOwnerA',
|
||||
label: $t('project.technicalOwnerA'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: userList,
|
||||
@@ -201,7 +201,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
fieldName: 'startTime',
|
||||
label: $t('project.startTime'),
|
||||
component: 'DatePicker',
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'x',
|
||||
@@ -219,7 +219,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'envInfo',
|
||||
label: $t('project.envInfo'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_ENV_INFO, 'number'),
|
||||
@@ -228,7 +228,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'operatingSystem',
|
||||
label: $t('project.operatingSystem'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_OPERATING_SYSTEM, 'number'),
|
||||
@@ -237,7 +237,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{
|
||||
fieldName: 'softwareVersion',
|
||||
label: $t('project.softwareVersion'),
|
||||
rules: 'required',
|
||||
rules: 'selectRequired',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_SOFTWARE_VERSION, 'number'),
|
||||
|
||||
Reference in New Issue
Block a user