Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
c0bfe3ef
提交
c0bfe3ef
authored
5月 27, 2021
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
把tableCompon 中的getFieldValue 方法 全部改为了 getFieldsValue 方法
具体原因:
https://github.com/ant-design/ant-design/issues/11205
可能存在不稳定性; 测试后再说
上级
cdaaffa4
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
85 行增加
和
87 行删除
+85
-87
index.jsx
one_stop_public/Table/index.jsx
+2
-2
ChildForm.jsx
one_stop_public/libs/ChildForm.jsx
+27
-27
index.jsx
one_stop_public/tableCompon/index.jsx
+56
-58
没有找到文件。
one_stop_public/Table/index.jsx
浏览文件 @
c0bfe3ef
...
...
@@ -771,7 +771,7 @@ export default class ZdyTable extends Component {
const
key
=
r
.
sqls
[
r
.
sqls
.
length
-
1
];
const
value
=
defaultValues
[
key
];
if
(
value
==
null
)
{
if
(
value
==
=
null
||
value
===
undefined
)
{
return
''
;
}
...
...
@@ -949,7 +949,7 @@ export default class ZdyTable extends Component {
const
key
=
r
.
sqls
[
r
.
sqls
.
length
-
1
];
const
value
=
defaultValues
[
key
];
if
(
value
==
null
)
{
if
(
value
==
=
null
||
value
===
undefined
)
{
return
''
;
}
...
...
one_stop_public/libs/ChildForm.jsx
浏览文件 @
c0bfe3ef
import
React
from
'react'
;
import
{
Button
,
Row
,
Col
,
message
}
from
'antd'
;
import
{
Button
,
Row
,
Col
,
message
}
from
'antd'
;
import
ZdyTable
from
'../Table'
;
import
UUID
from
'react-native-uuid'
;
import
{
Card
,
WingBlank
}
from
'antd-mobile'
;
import
{
Card
,
WingBlank
}
from
'antd-mobile'
;
export
default
class
ChildForm
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -12,6 +12,7 @@ export default class ChildForm extends React.Component {
this
.
state
=
value
;
}
triggerChange
=
changedValue
=>
{
// Should provide an event to pass value to Form.
const
onChange
=
this
.
props
.
onChange
;
...
...
@@ -19,6 +20,7 @@ export default class ChildForm extends React.Component {
onChange
(
changedValue
);
}
};
componentWillReceiveProps
(
nextProps
)
{
// Should be a controlled component.
if
(
'value'
in
nextProps
)
{
...
...
@@ -27,6 +29,7 @@ export default class ChildForm extends React.Component {
this
.
state
=
value
;
}
}
componentDidMount
=
()
=>
{
if
(
Object
.
keys
(
this
.
state
).
length
==
0
&&
this
.
props
.
isEdit
)
{
if
(
this
.
props
.
num
!=
null
&&
this
.
props
.
num
>
0
)
{
...
...
@@ -42,16 +45,16 @@ export default class ChildForm extends React.Component {
}
if
(
!
(
'value'
in
this
.
props
))
{
this
.
setState
(
objs
);
this
.
setState
(
objs
);
}
this
.
triggerChange
(
objs
);
this
.
triggerChange
(
objs
);
}
}
};
delete
=
uuid
=>
{
const
objs
=
this
.
state
;
const
{
json
:
{
numCode
},
json
:
{
numCode
},
form
,
base52
,
}
=
this
.
props
;
...
...
@@ -60,26 +63,23 @@ export default class ChildForm extends React.Component {
return
;
}
const
x
=
form
.
getFieldValue
(
base52
);
const
x
=
form
.
getFieldsValue
()[
base52
];
delete
x
[
uuid
];
delete
x
[
""
];
if
(
!
(
'value'
in
this
.
props
))
{
this
.
state
=
x
this
.
state
=
x
}
this
.
triggerChange
(
x
);
if
(
numCode
!=
null
)
{
this
.
props
.
form
.
setFieldsValue
({
[
numCode
]:
Object
.
keys
(
objs
).
length
});
this
.
props
.
form
.
setFieldsValue
({
[
numCode
]:
Object
.
keys
(
objs
).
length
});
}
};
add
=
()
=>
{
const
objs
=
this
.
state
;
const
{
json
:
{
numCode
},
json
:
{
numCode
},
form
,
base52
,
}
=
this
.
props
;
...
...
@@ -95,7 +95,7 @@ export default class ChildForm extends React.Component {
}
this
.
triggerChange
(
objs
);
if
(
numCode
!=
null
)
{
this
.
props
.
form
.
setFieldsValue
({
[
numCode
]:
Object
.
keys
(
objs
).
length
});
this
.
props
.
form
.
setFieldsValue
({
[
numCode
]:
Object
.
keys
(
objs
).
length
});
}
};
...
...
@@ -134,7 +134,7 @@ export default class ChildForm extends React.Component {
<
WingBlank
size=
"lg"
>
{
Object
.
keys
(
objs
).
length
>
1
||
rights
.
includes
(
'add'
)
?
(
<
Card
>
<
Card
.
Body
style=
{
{
minHeight
:
10
}
}
>
<
Card
.
Body
style=
{
{
minHeight
:
10
}
}
>
{
Object
.
keys
(
objs
).
map
(
r
=>
{
if
(
r
==
''
)
{
return
''
;
...
...
@@ -149,13 +149,13 @@ export default class ChildForm extends React.Component {
>
<
ZdyTable
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
trees=
{
this
.
props
.
trees
}
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
trees=
{
this
.
props
.
trees
}
key=
{
r
}
taskId=
{
taskId
}
modalInit=
{
modalInit
}
hfInstance=
{
hfInstance
}
currentFormTitle=
{
getCurrentFormTitle
?
getCurrentFormTitle
(
json
.
childFormKey
):
null
}
currentFormTitle=
{
getCurrentFormTitle
?
getCurrentFormTitle
(
json
.
childFormKey
)
:
null
}
getCellValue=
{
getCellValue
}
hfInstance=
{
hfInstance
}
getCellValue=
{
getCellValue
}
...
...
@@ -180,7 +180,7 @@ export default class ChildForm extends React.Component {
/>
</
Col
>
{
rights
.
includes
(
'delete'
)
&&
isEdit
?
(
<
Col
style=
{
{
textAlign
:
'right'
}
}
>
<
Col
style=
{
{
textAlign
:
'right'
}
}
>
<
Button
type=
"danger"
size=
"small"
onClick=
{
this
.
delete
.
bind
(
this
,
r
)
}
>
{
deleteName
||
'删除'
}{
' '
}
</
Button
>
{
' '
}
...
...
@@ -194,11 +194,11 @@ export default class ChildForm extends React.Component {
{
rights
.
includes
(
'add'
)
&&
isEdit
?
(
<
Row
>
<
Col
style=
{
{
textAlign
:
'center'
}
}
>
<
Col
style=
{
{
textAlign
:
'center'
}
}
>
<
Button
type=
"primary"
size=
"small"
style=
{
{
margin
:
'auto'
}
}
style=
{
{
margin
:
'auto'
}
}
onClick=
{
this
.
add
}
>
{
addName
||
'新增'
}
...
...
@@ -222,22 +222,22 @@ export default class ChildForm extends React.Component {
* 子表单
* */
return
(
<
div
style=
{
{
width
:
'100%'
}
}
>
<
div
style=
{
{
width
:
'100%'
}
}
>
<
Row
gutter=
{
gutter
}
>
{
Object
.
keys
(
objs
).
map
(
r
=>
{
if
(
r
==
''
)
{
return
''
;
}
console
.
log
(
'子表单'
,
r
);
//
console.log('子表单', r);
// console.log(form.getFieldsValue());
return
(
<
Col
span=
{
span
}
key=
{
r
}
>
<
ZdyTable
taskId=
{
taskId
}
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
taskId=
{
taskId
}
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
modalInit=
{
modalInit
}
hfInstance=
{
hfInstance
}
currentFormTitle=
{
getCurrentFormTitle
?
getCurrentFormTitle
(
json
.
childFormKey
):
null
}
currentFormTitle=
{
getCurrentFormTitle
?
getCurrentFormTitle
(
json
.
childFormKey
)
:
null
}
getCellValue=
{
getCellValue
}
formConfig=
{
datas
}
key=
{
r
}
...
...
@@ -288,8 +288,8 @@ export default class ChildForm extends React.Component {
</
Row
>
{
rights
.
includes
(
'add'
)
&&
isEdit
?
(
<
Row
>
<
Col
span=
{
24
}
style=
{
{
textAlign
:
'center'
}
}
>
<
Button
style=
{
{
margin
:
'auto'
}
}
type=
"primary"
onClick=
{
this
.
add
}
size=
"small"
>
<
Col
span=
{
24
}
style=
{
{
textAlign
:
'center'
}
}
>
<
Button
style=
{
{
margin
:
'auto'
}
}
type=
"primary"
onClick=
{
this
.
add
}
size=
"small"
>
{
addName
||
'新增'
}
</
Button
>
</
Col
>
{
' '
}
...
...
one_stop_public/tableCompon/index.jsx
浏览文件 @
c0bfe3ef
...
...
@@ -16,12 +16,9 @@ import {
DatePicker
,
Radio
,
Switch
,
Modal
,
TimePicker
,
Row
,
Col
,
Select
,
Upload
,
Form
,
Table
,
Cascader
,
...
...
@@ -32,17 +29,9 @@ import {EditorState, Editor} from 'draft-js';
import
MyBlockRenderer
from
'../App/MyBlockRender'
;
import
CronEditor
from
'antd-cron-editor'
;
import
{
InputItem
as
MobileInputItem
,
ImagePicker
as
MobileImagePicker
,
Modal
as
MobileModal
,
DatePicker
as
MobileDatePicker
,
List
as
MobileList
,
Picker
as
MobilePicker
,
Flex
,
Card
,
Toast
,
Checkbox
as
MobileCheckbox
,
TextareaItem
as
MobileTextareaItem
,
Switch
as
MobileSwitch
,
}
from
'antd-mobile'
;
import
ReactEcharts
from
'echarts-for-react'
;
...
...
@@ -101,9 +90,7 @@ const codeMessage = {
};
const
{
TextArea
}
=
Input
;
const
{
Option
}
=
Select
;
const
must
=
<
span
style=
{
{
color
:
'#FF5350'
,
marginLeft
:
5
,
marginRight
:
5
}
}
>
*
</
span
>;
const
{
MonthPicker
,
RangePicker
}
=
DatePicker
;
const
AgreeItem
=
MobileCheckbox
.
AgreeItem
;
const
{
RangePicker
}
=
DatePicker
;
const
errorHandler
=
error
=>
{
const
{
response
}
=
error
;
...
...
@@ -128,30 +115,33 @@ const errorHandler = error => {
loading
:
loading
.
models
.
DataColumn
||
loading
.
models
.
SqlManageEntity
||
loading
.
models
.
formList
,
}))
export
default
class
tableCom
extends
Component
{
state
=
{
options
:
this
.
props
.
options
||
[],
labels
:
[],
url
:
null
,
selectDis
:
true
,
// 让下拉框在获取到数据前失效,防止网络卡顿用户点击时造成页面白屏
isDate
:
true
,
// 避免重复调用
sqlKeys
:
{},
searchText
:
''
,
reqUrls
:
{},
res
:
null
,
option
:
{},
sqlModel
:
{},
columns
:
[],
sqlContent
:
null
,
modalProps
:
{},
modalTitle
:
''
,
modalInit
:
{},
modalCode
:
null
,
dataSource
:
{
list
:
[],
pagination
:
false
,
},
};
excludeKeys
=
[
'defaultValues'
,
''
];
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
options
:
this
.
props
.
options
||
[],
labels
:
[],
url
:
null
,
selectDis
:
true
,
// 让下拉框在获取到数据前失效,防止网络卡顿用户点击时造成页面白屏
isDate
:
true
,
// 避免重复调用
sqlKeys
:
{},
searchText
:
''
,
reqUrls
:
{},
res
:
null
,
option
:
{},
sqlModel
:
{},
columns
:
[],
sqlContent
:
null
,
modalProps
:
{},
modalTitle
:
''
,
modalInit
:
{},
modalCode
:
null
,
dataSource
:
{
list
:
[],
pagination
:
false
,
},
};
this
.
excludeKeys
=
[
'defaultValues'
,
''
];
}
closeModal
=
(
fk
,
callback
)
=>
{
const
{
dispatch
}
=
this
.
props
;
const
x
=
this
.
props
.
DataColumn
.
isShowModal
...
...
@@ -724,7 +714,7 @@ export default class tableCom extends Component {
this
.
getFunctionValue
(
json
.
funcs
,
{
base52
:
this
.
props
.
uuid
},
json
,
()
=>
{
if
(
init
!=
null
&&
Object
.
keys
(
init
).
length
>
0
)
{
let
base52
=
dataColumn
.
base52
;
let
vlu
=
this
.
props
.
form
.
getField
Value
(
base52
)
;
let
vlu
=
this
.
props
.
form
.
getField
sValue
()[
base52
]
;
const
labs
=
[];
this
.
searchJson
(
vlu
,
this
.
state
.
options
,
0
,
labs
)
...
...
@@ -747,7 +737,7 @@ export default class tableCom extends Component {
this
.
getFunctionValue
(
json
.
funcs
,
{
base52
:
this
.
props
.
uuid
},
json
,
()
=>
{
if
(
init
!=
null
&&
Object
.
keys
(
init
).
length
>
0
)
{
let
base52
=
dataColumn
.
base52
;
let
vlu
=
this
.
props
.
form
.
getField
Value
(
base52
);
let
vlu
=
this
.
props
.
form
.
getField
sValue
()[
base52
]
const
labs
=
[];
if
(
vlu
instanceof
Array
)
{
for
(
var
i
=
0
;
i
<
this
.
state
.
options
.
length
;
i
++
)
{
...
...
@@ -1217,7 +1207,7 @@ export default class tableCom extends Component {
isEdit
:
this
.
props
.
isEdit
,
taskAssignee
:
this
.
props
.
taskAssignee
,
userId
:
this
.
props
.
userId
,
taskId
:
this
.
props
.
taskId
,
taskId
:
this
.
props
.
taskId
,
},
this
.
props
.
index
,
this
.
props
.
fatherCode
,
...
...
@@ -1337,7 +1327,7 @@ export default class tableCom extends Component {
callback
:
options
=>
{
const
optionsx
=
[];
let
base52
=
dataColumn
.
base52
;
let
vl
=
this
.
props
.
form
.
getField
Value
(
base52
)
;
let
vl
=
this
.
props
.
form
.
getField
sValue
()[
base52
]
;
let
isExist
=
false
;
for
(
var
i
=
0
;
i
<
options
.
length
;
i
++
)
{
if
(
vl
==
options
[
i
][
valueName
]
&&
!
isExist
)
{
...
...
@@ -1376,7 +1366,7 @@ export default class tableCom extends Component {
payload
:
{
sqlKey
,
allValues
},
callback
:
options
=>
{
let
base52
=
dataColumn
.
base52
;
let
vl
=
this
.
props
.
form
.
getField
Value
(
base52
)
;
let
vl
=
this
.
props
.
form
.
getField
sValue
()[
base52
]
;
const
optionsx
=
[];
let
isExist
=
false
;
for
(
var
i
=
0
;
i
<
options
.
length
;
i
++
)
{
...
...
@@ -1557,7 +1547,7 @@ export default class tableCom extends Component {
if
(
json
.
comName
==
'PartForm'
)
{
const
fk
=
this
.
props
.
form
.
getField
Value
(
this
.
props
.
uuid
)
||
json
.
childFormKey
;
const
fk
=
this
.
props
.
form
.
getField
sValue
()[
this
.
props
.
uuid
]
||
json
.
childFormKey
;
if
(
fk
==
null
)
{
return
<></>;
}
...
...
@@ -1570,7 +1560,7 @@ export default class tableCom extends Component {
initialValue
:
fk
,
})(<
Input
type=
"hidden"
/>)
}{
' '
}
<
ZdyTable
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
hfInstance=
{
this
.
props
.
hfInstance
}
currentFormTitle=
{
this
.
props
.
getCurrentFormTitle
?
this
.
props
.
getCurrentFormTitle
(
fk
)
:
null
}
...
...
@@ -1637,7 +1627,7 @@ export default class tableCom extends Component {
return
(
<>
{
this
.
props
.
form
.
getFieldDecorator
(
uid
,
{
initialValue
:
this
.
props
.
form
.
getField
Value
(
uid
)
||
json
.
initialValue
,
initialValue
:
this
.
props
.
form
.
getField
sValue
()[
uid
]
||
json
.
initialValue
,
})(<
Input
type=
"hidden"
/>)
}
<
span
style=
{
{
...
...
@@ -1647,7 +1637,7 @@ export default class tableCom extends Component {
}
}
{
...
json
.
props
}
>
{
this
.
props
.
form
.
getField
Value
(
uid
)
}
{
this
.
props
.
form
.
getField
sValue
()[
uid
]
}
</
span
>
</>
);
...
...
@@ -1993,6 +1983,10 @@ export default class tableCom extends Component {
}
}
if
(
initValue
===
null
||
initValue
===
undefined
){
initValue
=
''
;
}
if
(
!
isEdit
)
{
if
(
this
.
props
.
fatherCode
)
{
if
(
bindObj
!=
null
)
{
...
...
@@ -2346,7 +2340,7 @@ export default class tableCom extends Component {
cm
=
(
<
ChildForm
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
modalInit=
{
modalInit
}
trees=
{
this
.
props
.
trees
}
...
...
@@ -2510,6 +2504,7 @@ export default class tableCom extends Component {
);
}
}
else
{
// console.log(JSON.stringify(this.props.form.getFieldsValue()), '----formValue----');
cm
=
getFieldDecorator
(
dataColumn
.
base52
,
{
initialValue
:
initValue
,
rules
:
...
...
@@ -2529,7 +2524,7 @@ export default class tableCom extends Component {
case
'Switch'
:
if
(
get
===
'mobile'
)
{
if
(
dataColumn
==
null
||
json
.
formula
!=
null
)
{
cm
=
this
.
props
.
form
.
getField
Value
(
this
.
props
.
uuid
)
;
cm
=
this
.
props
.
form
.
getField
sValue
()[
this
.
props
.
uuid
]
;
break
;
}
cm
=
(
...
...
@@ -3135,11 +3130,14 @@ export default class tableCom extends Component {
}
break
;
case
'ChildForm'
:
cm
=
getFieldDecorator
(
dataColumn
.
base52
,
{
initialValue
:
initValue
||
{},
})(
// console.log(dataColumn.base52, '----key-ChildForm--'); // KUSyCzEhdCJ
// console.log(JSON.stringify(this.props.form.getFieldsValue()), '----formValue----');
// console.log(JSON.stringify(initValue)); // undefined
cm
=
getFieldDecorator
(
dataColumn
.
base52
,
{
initialValue
:
initValue
||
{},})(
<
ChildForm
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
setRealTimeValues=
{
this
.
props
.
setRealTimeValues
}
rights=
{
json
.
rights
||
[]
}
hfInstance=
{
this
.
props
.
hfInstance
}
...
...
@@ -3313,7 +3311,7 @@ export default class tableCom extends Component {
title=
{
modalTitle
}
>
<
ZdyTable
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
taskAssignee=
{
taskAssignee
}
userId=
{
userId
}
trees=
{
this
.
props
.
trees
}
...
...
@@ -3395,7 +3393,7 @@ export default class tableCom extends Component {
title=
{
modalTitle
}
>
<
ZdyTable
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
taskAssignee=
{
taskAssignee
}
userId=
{
userId
}
trees=
{
this
.
props
.
trees
}
...
...
@@ -3432,7 +3430,7 @@ export default class tableCom extends Component {
title=
{
modalTitle
}
>
<
ZdyTable
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
taskAssignee=
{
taskAssignee
}
userId=
{
userId
}
trees=
{
this
.
props
.
trees
}
...
...
@@ -3476,7 +3474,7 @@ export default class tableCom extends Component {
title=
{
modalTitle
}
>
<
ZdyTable
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
taskAssignee=
{
taskAssignee
}
userId=
{
userId
}
modalInit=
{
modalInit
}
...
...
@@ -3514,7 +3512,7 @@ export default class tableCom extends Component {
title=
{
modalTitle
}
>
<
ZdyTable
taskId=
{
this
.
props
.
taskId
}
taskId=
{
this
.
props
.
taskId
}
taskAssignee=
{
taskAssignee
}
userId=
{
userId
}
trees=
{
this
.
props
.
trees
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论