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
4fdb291a
Commit
4fdb291a
authored
Jul 21, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'delDetail' into dev
parents
c05c522a
8b53279a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
50 deletions
+35
-50
index.tsx
components/apolloTable/editFormV3/index.tsx
+35
-50
No files found.
components/apolloTable/editFormV3/index.tsx
View file @
4fdb291a
...
...
@@ -15,14 +15,14 @@
* */
import
React
,
{
Component
}
from
'react'
;
import
{
Form
,
Button
}
from
'antd'
;
import
{
emptyModel
}
from
'@/submodule/components/apolloTable/component/base/_utils/setFormatter'
;
import
{
defaultLocale
}
from
'@/submodule/components/apolloTable/locale'
;
import
_
from
'lodash'
;
import
styles
from
'./index.less'
;
import
{
config
}
from
'../component/base/config'
;
import
{
transferAttr
}
from
'../component/base/_utils/transferAttr'
;
import
{
getFormat
,
setFormat
}
from
'../component/base'
;
import
{
Provider
}
from
'../component/context'
;
import
{
emptyModel
}
from
'@/submodule/components/apolloTable/component/base/_utils/setFormatter'
;
import
{
defaultLocale
}
from
'@/submodule/components/apolloTable/locale'
;
import
_
from
'lodash'
;
const
FormItem
=
Form
.
Item
;
...
...
@@ -31,9 +31,10 @@ class FormWrap extends Component {
handleSubmit
=
(
e
)
=>
{
e
.
preventDefault
();
e
.
stopPropagation
();
const
{
rowId
,
form
,
handleSubmit
,
data
,
rowData
,
detailType
}
=
this
.
props
;
const
{
rowId
,
form
,
handleSubmit
,
data
,
rowData
,
detailType
,
}
=
this
.
props
;
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
console
.
log
(
data
,
8888
)
if
(
!
err
)
{
const
newValues
:
any
[]
=
[];
_
.
keys
(
values
).
map
((
key
)
=>
{
...
...
@@ -90,7 +91,7 @@ class FormWrap extends Component {
};
renderEditForm
=
(
item
)
=>
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
getFieldDecorator
,
validateFieldsAndScroll
}
=
this
.
props
.
form
;
const
{
rowData
,
rowId
,
getInstanceDetail
,
onBlurFn
}
=
this
.
props
;
const
{
columnType
,
...
...
@@ -119,24 +120,28 @@ class FormWrap extends Component {
const
transferColumn
=
transferAttr
(
columnType
,
newProps
);
const
disabled
=
readOnlyFlag
||
(
dynamicCellConfigDTO
&&
dynamicCellConfigDTO
.
readonlyFlag
);
const
onBlurFn1
=
(
changedValue
:
any
,
newVal
:
any
)
=>
{
let
temp
:
any
[]
=
[];
value
.
map
((
item
:
any
)
=>
{
temp
.
push
({
text
:
item
.
text
,
value
:
item
.
value
});
validateFieldsAndScroll
((
err
:
any
)
=>
{
// 即时编辑时需要对表单必填等规则校验
if
(
!
err
)
{
let
temp
:
any
[]
=
[];
value
.
map
((
item
:
any
)
=>
{
temp
.
push
({
text
:
item
.
text
,
value
:
item
.
value
});
});
if
(
temp
.
length
===
0
)
{
temp
=
emptyModel
;
}
if
(
!!
item
.
requiredFlag
&&
Array
.
isArray
(
newVal
)
&&
!
newVal
[
0
].
value
)
{
return
;
}
if
(
_
.
isEqual
(
temp
,
newVal
))
{
return
;
}
if
(
typeof
onBlurFn
===
'function'
)
{
onBlurFn
(
changedValue
);
}
}
});
if
(
temp
.
length
===
0
)
{
temp
=
emptyModel
;
}
if
(
!!
item
.
requiredFlag
&&
Array
.
isArray
(
newVal
)
&&
!
newVal
[
0
].
value
)
{
return
}
if
(
_
.
isEqual
(
temp
,
newVal
))
{
return
;
}
if
(
typeof
onBlurFn
===
'function'
)
{
onBlurFn
(
changedValue
)
}
}
};
return
(
<
FormItem
key=
{
columnName
}
label=
{
this
.
renderLabel
(
item
)
}
>
{
getFieldDecorator
(
columnName
,
{
...
...
@@ -182,12 +187,14 @@ class FormWrap extends Component {
};
render
()
{
const
{
loading
,
isShowDelBtn
,
data
,
btnWrapStyle
,
name
,
colsNum
,
delLabel
,
hideOperateBtn
}
=
this
.
props
;
const
{
loading
,
isShowDelBtn
,
data
,
btnWrapStyle
,
name
,
colsNum
,
delLabel
,
hideOperateBtn
,
}
=
this
.
props
;
return
(
<
Provider
value=
{
{
locale
:
this
.
getContext
()
}
}
>
<
div
className=
{
styles
.
wrap
}
>
<
p
className=
{
styles
.
titleCls
}
>
{
name
||
'客户跟进'
}
</
p
>
<
p
className=
{
styles
.
titleCls
}
>
{
name
}
</
p
>
<
div
id=
"gotop"
className=
{
styles
.
formItemCls
}
...
...
@@ -224,7 +231,7 @@ class FormWrap extends Component {
)
:
null
}
<
Button
onClick=
{
this
.
handleCancel
}
className=
{
styles
.
btnCls
}
>
取消
</
Button
>
</
Button
>
<
Button
onClick=
{
this
.
handleSubmit
}
type=
"primary"
...
...
@@ -233,7 +240,7 @@ class FormWrap extends Component {
id=
"submitBtn"
// 用于业务监听此dom节点
>
确定
</
Button
>
</
Button
>
</
div
>
</
div
>
)
...
...
@@ -245,26 +252,4 @@ class FormWrap extends Component {
}
}
function
mapPropsToFields
(
props
)
{
const
returnObj
=
{};
const
{
data
,
renderEditForm
,
rowData
}
=
props
;
data
.
forEach
((
el
)
=>
{
// let detailConfig: any;
// if (typeof renderEditForm === 'function') {
// detailConfig = renderEditForm({ cellData: el.value, rowData, columnConfig: el });
// } else {
// detailConfig = config[String(el.columnType)] || config['1'];
// }
// const formatValue = getFormat(detailConfig, el, el.value);
// console.log('formatValue',formatValue)
returnObj
[
el
.
columnType
]
=
Form
.
createFormField
({
value
:
el
.
value
,
});
});
return
returnObj
;
}
function
onValuesChange
(
props
:
any
,
changedValues
:
any
,
allValues
:
any
)
{
if
(
props
.
changeValue
)
{
}
}
export
default
Form
.
create
({
name
:
'form_view'
})(
FormWrap
);
export
default
Form
.
create
({
name
:
'editFormV3'
})(
FormWrap
);
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