Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
cc8ae7d1
Commit
cc8ae7d1
authored
Jul 23, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改表单校验
parent
897f03ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
index.tsx
...Table/component/base/extra/dataEntry/textSelect/index.tsx
+5
-5
index.tsx
components/apolloTable/editFormV3/index.tsx
+29
-1
No files found.
components/apolloTable/component/base/extra/dataEntry/textSelect/index.tsx
View file @
cc8ae7d1
...
...
@@ -137,11 +137,7 @@ class TextSelect extends React.Component<Props, State> {
onChange
=
(
obj
)
=>
{
const
{
onChange
}
=
this
.
props
;
if
(
typeof
onChange
===
'function'
)
{
if
(
!
obj
||
(
!
obj
.
label
&&
!
obj
.
value
))
{
onChange
(
undefined
);
}
else
{
onChange
(
obj
);
}
onChange
(
obj
);
}
};
...
...
@@ -158,7 +154,11 @@ class TextSelect extends React.Component<Props, State> {
};
onVisibleChange
=
(
tempVisible
)
=>
{
const
{
onDropdownVisibleChange
}
=
this
.
props
;
this
.
setState
({
tempVisible
});
if
(
onDropdownVisibleChange
)
{
onDropdownVisibleChange
(
tempVisible
);
}
};
renderList
=
()
=>
{
...
...
components/apolloTable/editFormV3/index.tsx
View file @
cc8ae7d1
...
...
@@ -89,6 +89,30 @@ class FormWrap extends Component {
);
};
validateRequired
=
(
item
,
rule
,
value
,
callback
)
=>
{
if
(
!
item
.
requiredFlag
)
{
return
callback
();
}
if
(
!
value
)
{
return
callback
(
'必填项不能为空'
);
}
if
(
Array
.
isArray
(
value
))
{
if
(
value
.
length
===
0
)
{
return
callback
(
'必填项不能为空'
);
}
const
[
first
]
=
value
;
if
(
!
first
.
text
&&
first
.
text
!==
0
&&
!
first
.
value
&&
first
.
value
!==
0
)
{
return
callback
(
'必填项不能为空'
);
}
}
if
(
typeof
value
===
'object'
)
{
if
(
!
value
.
text
&&
value
.
text
!==
0
&&
!
value
.
value
&&
value
.
value
!==
0
)
{
return
callback
(
'必填项不能为空'
);
}
}
return
callback
();
};
renderEditForm
=
(
item
)
=>
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
rowData
,
rowId
,
getInstanceDetail
,
onBlurFn
}
=
this
.
props
;
...
...
@@ -141,7 +165,11 @@ class FormWrap extends Component {
{
getFieldDecorator
(
columnName
,
{
validateFirst
,
validateTrigger
,
rules
:
[{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
...
rules
],
rules
:
[
{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
{
validator
:
this
.
validateRequired
.
bind
(
this
,
item
)
},
...
rules
,
],
initialValue
:
getFormat
(
detailConfig
,
item
,
value
),
})(
<
EditComp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment