|
@@ -11,7 +11,6 @@ import EnumParam from '@/components/Metadata/EnumParam';
|
|
|
import ArrayParam from '@/components/Metadata/ArrayParam';
|
|
import ArrayParam from '@/components/Metadata/ArrayParam';
|
|
|
import { useIntl } from '@/.umi/plugin-locale/localeExports';
|
|
import { useIntl } from '@/.umi/plugin-locale/localeExports';
|
|
|
import Editable from '../EditTable';
|
|
import Editable from '../EditTable';
|
|
|
-import { registerValidateRules } from '@formily/core';
|
|
|
|
|
|
|
|
|
|
// 不算是自定义组件。只是抽离了JSONSchema
|
|
// 不算是自定义组件。只是抽离了JSONSchema
|
|
|
interface Props {
|
|
interface Props {
|
|
@@ -46,25 +45,6 @@ const JsonParam = observer((props: Props) => {
|
|
|
return _data;
|
|
return _data;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- registerValidateRules({
|
|
|
|
|
- checkLength(value) {
|
|
|
|
|
- if (value === undefined) return '';
|
|
|
|
|
- if (String(value).length > 64) {
|
|
|
|
|
- return {
|
|
|
|
|
- type: 'error',
|
|
|
|
|
- message: '最多可输入64个字符',
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (!(value % 1 === 0)) {
|
|
|
|
|
- return {
|
|
|
|
|
- type: 'error',
|
|
|
|
|
- message: '请输入非0正整数',
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- return '';
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
const checkArray: any = (arr: any) => {
|
|
const checkArray: any = (arr: any) => {
|
|
|
if (Array.isArray(arr) && arr.length) {
|
|
if (Array.isArray(arr) && arr.length) {
|
|
|
return arr.every((item: any) => {
|
|
return arr.every((item: any) => {
|
|
@@ -172,7 +152,17 @@ const JsonParam = observer((props: Props) => {
|
|
|
enum:
|
|
enum:
|
|
|
MetadataModel.type === 'functions'
|
|
MetadataModel.type === 'functions'
|
|
|
? DataTypeList.filter((item) => item.value !== 'file')
|
|
? DataTypeList.filter((item) => item.value !== 'file')
|
|
|
- : DataTypeList,
|
|
|
|
|
|
|
+ : DataTypeList.filter((item) =>
|
|
|
|
|
+ [
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'long',
|
|
|
|
|
+ 'float',
|
|
|
|
|
+ 'double',
|
|
|
|
|
+ 'string',
|
|
|
|
|
+ 'boolean',
|
|
|
|
|
+ 'date',
|
|
|
|
|
+ ].includes(item.value),
|
|
|
|
|
+ ),
|
|
|
},
|
|
},
|
|
|
booleanConfig: {
|
|
booleanConfig: {
|
|
|
title: '布尔值',
|
|
title: '布尔值',
|
|
@@ -270,6 +260,13 @@ const JsonParam = observer((props: Props) => {
|
|
|
'x-component': 'Select',
|
|
'x-component': 'Select',
|
|
|
enum: DateTypeList,
|
|
enum: DateTypeList,
|
|
|
'x-visible': false,
|
|
'x-visible': false,
|
|
|
|
|
+ default: 'string',
|
|
|
|
|
+ 'x-validator': [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请选择时间格式',
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
'x-reactions': {
|
|
'x-reactions': {
|
|
|
dependencies: ['..valueType.type'],
|
|
dependencies: ['..valueType.type'],
|
|
|
fulfill: {
|
|
fulfill: {
|
|
@@ -297,7 +294,12 @@ const JsonParam = observer((props: Props) => {
|
|
|
},
|
|
},
|
|
|
'x-validator': [
|
|
'x-validator': [
|
|
|
{
|
|
{
|
|
|
- checkLength: true,
|
|
|
|
|
|
|
+ max: 2147483647,
|
|
|
|
|
+ message: '请输入1-2147483647之间的正整数',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ min: 1,
|
|
|
|
|
+ message: '请输入1-2147483647之间的正整数',
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
'x-reactions': {
|
|
'x-reactions': {
|
|
@@ -318,9 +320,15 @@ const JsonParam = observer((props: Props) => {
|
|
|
'x-decorator': 'FormItem',
|
|
'x-decorator': 'FormItem',
|
|
|
'x-component': 'NumberPicker',
|
|
'x-component': 'NumberPicker',
|
|
|
'x-visible': false,
|
|
'x-visible': false,
|
|
|
|
|
+ default: 2,
|
|
|
'x-validator': [
|
|
'x-validator': [
|
|
|
{
|
|
{
|
|
|
- checkLength: true,
|
|
|
|
|
|
|
+ max: 2147483647,
|
|
|
|
|
+ message: '请输入0-2147483647之间的正整数',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ min: 0,
|
|
|
|
|
+ message: '请输入0-2147483647之间的正整数',
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
'x-component-props': {
|
|
'x-component-props': {
|