Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
17f1a944
提交
17f1a944
authored
9月 15, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
29413 【列表组件优化】是否隐藏查询
上级
a5d9c5b0
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
75 行增加
和
91 行删除
+75
-91
index.js
one_stop_public/libs/formList/index.js
+75
-91
没有找到文件。
one_stop_public/libs/formList/index.js
浏览文件 @
17f1a944
...
...
@@ -43,7 +43,7 @@ const Modal = getModal();
let
AllWidth
=
0
;
// 表格总长度
const
{
RangePicker
}
=
DatePicker
;
const
CreateForm
=
Form
.
create
()(
(
props
)
=>
{
const
CreateForm
=
Form
.
create
()(
props
=>
{
const
{
modalVisible
,
form
,
...
...
@@ -110,7 +110,8 @@ const CreateForm = Form.create()((props) => {
]
}
onOk
=
{
okHandle
}
onCancel
=
{()
=>
handleModalVisible
()}
>
onCancel
=
{()
=>
handleModalVisible
()}
>
{
formItem
.
map
((
item
,
index
)
=>
getItem
(
false
,
form
,
item
,
isAdd
,
formData
,
{
span
:
5
},
{
span
:
15
}),
)}
...
...
@@ -174,13 +175,13 @@ class FormList extends React.Component {
this
.
props
.
dispatch
({
type
:
'formList/getBatchOptions'
,
payload
:
{
ids
:
refIds
},
callback
:
(
options
)
=>
{
callback
:
options
=>
{
this
.
setState
({
options
:
{
...
this
.
state
.
options
,
...
options
}
});
},
});
}
};
modify
=
(
record
)
=>
{
modify
=
record
=>
{
// if (this.state.formItem.length < 10) {
this
.
getOptions
();
this
.
props
.
dispatch
({
...
...
@@ -191,7 +192,7 @@ class FormList extends React.Component {
value
:
record
[
this
.
state
.
primaryKey
],
isBase
:
false
,
},
callback
:
(
record2
)
=>
{
callback
:
record2
=>
{
this
.
setState
({
formData
:
record2
,
modalVisible
:
true
,
...
...
@@ -202,7 +203,7 @@ class FormList extends React.Component {
});
};
view
=
(
record
)
=>
{
view
=
record
=>
{
this
.
getOptions
();
this
.
setState
({
formData
:
record
,
...
...
@@ -212,7 +213,7 @@ class FormList extends React.Component {
});
};
isJSON
=
(
str
)
=>
{
isJSON
=
str
=>
{
if
(
typeof
str
==
'string'
)
{
try
{
var
obj
=
JSON
.
parse
(
str
);
...
...
@@ -229,7 +230,7 @@ class FormList extends React.Component {
console
.
log
(
'这不是个字符串'
);
};
delete
=
(
record
)
=>
{
delete
=
record
=>
{
//找出主键
let
Keys
=
{};
Keys
[
this
.
state
.
primaryKey
]
=
record
[
this
.
state
.
primaryKey
];
...
...
@@ -245,14 +246,14 @@ class FormList extends React.Component {
});
};
viewProcess
=
(
record
)
=>
{
viewProcess
=
record
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'formList/getAppId'
,
payload
:
{
code
:
record
.
process_biz_key
,
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
const
domainName
=
sessionStorage
.
getItem
(
'domainName'
)
?
sessionStorage
.
getItem
(
'domainName'
)
:
''
;
...
...
@@ -266,7 +267,7 @@ class FormList extends React.Component {
/**
* 宽度自适应函数
*/
resize
=
(
e
)
=>
{
resize
=
e
=>
{
let
scrollWidth
=
document
.
documentElement
.
clientWidth
||
document
.
body
.
clientWidth
;
//可使宽度
let
showMobileDiv
=
scrollWidth
-
77
;
if
(
document
.
querySelector
(
'#previewDiv'
))
{
...
...
@@ -296,7 +297,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'DataObj/findByCode'
,
payload
:
{
objCode
:
this
.
props
.
objCode
},
callback
:
(
dataObj
)
=>
{
callback
:
dataObj
=>
{
this
.
setState
(
{
objId
:
dataObj
.
id
,
...
...
@@ -306,14 +307,14 @@ class FormList extends React.Component {
dispatch
({
type
:
'DataRight/getUserRight'
,
payload
:
{
objId
:
this
.
state
.
objId
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
if
(
!
this
.
props
.
rights
)
{
this
.
setState
({
rights
:
data
});
}
dispatch
({
type
:
'DataRight/getUserColumnRight'
,
payload
:
{
objId
:
this
.
state
.
objId
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
this
.
setState
({
columnRights
:
data
});
this
.
initColumn
();
},
...
...
@@ -329,21 +330,21 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getObjDetail'
,
payload
:
{
id
:
this
.
state
.
objId
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
this
.
setState
({
isTable
:
data
.
isTable
});
},
});
dispatch
({
type
:
'DataRight/getUserRight'
,
payload
:
{
objId
:
this
.
state
.
objId
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
if
(
!
this
.
props
.
rights
)
{
this
.
setState
({
rights
:
data
});
}
dispatch
({
type
:
'DataRight/getUserColumnRight'
,
payload
:
{
objId
:
this
.
state
.
objId
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
this
.
setState
({
columnRights
:
data
});
this
.
initColumn
();
},
...
...
@@ -408,7 +409,7 @@ class FormList extends React.Component {
let
cacheChecked
=
[];
// 表头筛选逻辑
Array
.
isArray
(
value
.
columns
)
&&
value
.
columns
.
map
((
item
)
=>
{
value
.
columns
.
map
(
item
=>
{
if
(
item
.
dataIndex
!=
null
)
{
cacheList
.
push
({
label
:
item
.
title
,
...
...
@@ -429,7 +430,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getHead'
,
payload
:
{
dataObjId
:
this
.
state
.
objId
},
callback
:
(
datas
)
=>
{
callback
:
datas
=>
{
this
.
state
.
formItem
=
datas
;
const
querys
=
[];
const
groups
=
{};
...
...
@@ -445,7 +446,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getGroupList'
,
payload
:
{
columnId
:
datas
[
t
].
id
},
callback
:
(
gourp
)
=>
{
callback
:
gourp
=>
{
groups
[
datas
[
t
].
id
]
=
gourp
;
this
.
setState
({
groups
});
},
...
...
@@ -459,7 +460,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getBatchOptions'
,
payload
:
{
ids
:
refIds
},
callback
:
(
options
)
=>
{
callback
:
options
=>
{
this
.
setState
({
options
});
},
});
...
...
@@ -477,7 +478,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getHead'
,
payload
:
{
dataObjId
:
this
.
state
.
objId
},
callback
:
(
datas
)
=>
{
callback
:
datas
=>
{
const
querys
=
[];
const
refIds
=
[];
const
groups
=
{};
...
...
@@ -487,7 +488,7 @@ class FormList extends React.Component {
let
cacheList
=
[];
let
cacheChecked
=
[];
// 表头筛选逻辑
datas
.
map
((
item
)
=>
{
datas
.
map
(
item
=>
{
if
(
item
.
name
!=
null
)
{
cacheList
.
push
({
label
:
item
.
title
,
...
...
@@ -515,7 +516,7 @@ class FormList extends React.Component {
continue
;
}
if
(
date
.
includes
(
datas
[
t
].
type
))
{
column
.
render
=
(
val
)
=>
{
column
.
render
=
val
=>
{
if
(
val
==
null
)
{
return
val
;
}
...
...
@@ -526,10 +527,10 @@ class FormList extends React.Component {
}
};
}
else
if
(
datas
[
t
].
name
.
indexOf
(
'process_status'
)
>
-
1
)
{
column
.
render
=
(
val
)
=>
(
val
?
(
val
===
'0'
?
'审核通过'
:
'审核未通过'
)
:
null
);
column
.
render
=
val
=>
(
val
?
(
val
===
'0'
?
'审核通过'
:
'审核未通过'
)
:
null
);
}
else
if
(
datas
[
t
].
extendTypeId
&&
datas
[
t
].
extendTypeId
.
indexOf
(
'file'
)
>
-
1
)
{
//特殊处理附件
column
.
render
=
(
val
)
=>
{
column
.
render
=
val
=>
{
if
(
this
.
isJSON
(
val
))
{
val
=
JSON
.
parse
(
val
);
let
files
=
val
.
files
;
...
...
@@ -550,7 +551,7 @@ class FormList extends React.Component {
}
};
}
else
{
column
.
render
=
(
val
)
=>
column
.
render
=
val
=>
val
&&
val
.
length
>
100
?
(
<
Tooltip
title
=
{
val
}
overlayStyle
=
{{
width
:
1000
}}
>
<
span
...
...
@@ -561,7 +562,8 @@ class FormList extends React.Component {
whiteSpace
:
'nowrap'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
}}
>
}}
>
{
val
}
<
/span
>
<
/Tooltip
>
...
...
@@ -584,7 +586,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getGroupList'
,
payload
:
{
columnId
:
datas
[
t
].
id
},
callback
:
(
gourp
)
=>
{
callback
:
gourp
=>
{
groups
[
datas
[
t
].
id
]
=
gourp
;
this
.
setState
({
groups
});
},
...
...
@@ -599,7 +601,7 @@ class FormList extends React.Component {
dispatch
({
type
:
'formList/getBatchOptions'
,
payload
:
{
ids
:
refIds
},
callback
:
(
options
)
=>
{
callback
:
options
=>
{
this
.
setState
({
options
});
},
});
...
...
@@ -634,7 +636,7 @@ class FormList extends React.Component {
if
(
Number
(
objCode
)
===
1
)
{
if
(
callPage
)
{
callPage
(
params
,
(
data
)
=>
{
callPage
(
params
,
data
=>
{
if
(
!
this
.
state
.
isReady
)
{
this
.
setState
({
data
,
...
...
@@ -645,7 +647,7 @@ class FormList extends React.Component {
}
});
}
else
if
(
this
.
props
.
value
&&
this
.
props
.
value
.
getPage
)
{
this
.
props
.
value
.
getPage
(
params
,
(
data
)
=>
{
this
.
props
.
value
.
getPage
(
params
,
data
=>
{
if
(
!
this
.
state
.
isReady
)
{
this
.
setState
({
data
,
...
...
@@ -666,7 +668,7 @@ class FormList extends React.Component {
sql
:
this
.
sqlBs16
,
dataObjId
:
this
.
state
.
objId
,
},
callback
:
(
data
)
=>
{
callback
:
data
=>
{
if
(
!
this
.
state
.
isReady
)
{
this
.
setState
({
data
,
...
...
@@ -751,7 +753,7 @@ class FormList extends React.Component {
// }
};
handleSelectRows
=
(
rows
)
=>
{
handleSelectRows
=
rows
=>
{
if
(
this
.
props
.
onSelectRow
)
{
this
.
props
.
onSelectRow
(
rows
);
}
...
...
@@ -760,7 +762,7 @@ class FormList extends React.Component {
});
};
batchDelete
=
(
e
)
=>
{
batchDelete
=
e
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
selectedRows
}
=
this
.
state
;
...
...
@@ -772,7 +774,7 @@ class FormList extends React.Component {
for
(
let
i
in
columns
)
{
if
(
columns
[
i
].
isPrimaryKey
)
{
//key
Keys
[
columns
[
i
].
name
]
=
selectedRows
.
map
((
row
)
=>
row
[
columns
[
i
].
name
]).
join
(
','
);
Keys
[
columns
[
i
].
name
]
=
selectedRows
.
map
(
row
=>
row
[
columns
[
i
].
name
]).
join
(
','
);
}
}
this
.
props
.
dispatch
({
...
...
@@ -794,7 +796,7 @@ class FormList extends React.Component {
goBack
=
()
=>
{
router
.
goBack
();
};
handleSearch
=
(
e
)
=>
{
handleSearch
=
e
=>
{
e
.
preventDefault
();
const
{
dispatch
,
form
}
=
this
.
props
;
...
...
@@ -837,7 +839,7 @@ class FormList extends React.Component {
});
};
hanldeHighSearch
=
(
e
)
=>
{
hanldeHighSearch
=
e
=>
{
const
pagination
=
this
.
props
.
formList
.
data
.
pagination
;
let
params
=
{
pageNo
:
pagination
.
current
?
pagination
.
current
:
1
,
...
...
@@ -905,8 +907,9 @@ class FormList extends React.Component {
:
false
}
placeholder
=
"请选择"
allowClear
>
{
ops
.
map
((
r
)
=>
(
allowClear
>
{
ops
.
map
(
r
=>
(
<
Option
value
=
{
r
[
item
.
referenceCodeName
]}
key
=
{
r
[
item
.
referenceCodeName
]}
>
{
r
[
item
.
referenceNameName
]}
<
/Option
>
...
...
@@ -970,8 +973,9 @@ class FormList extends React.Component {
?
option
.
props
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
:
false
}
allowClear
>
{
ops
.
map
((
r
)
=>
(
allowClear
>
{
ops
.
map
(
r
=>
(
<
Option
value
=
{
r
.
value
}
key
=
{
r
.
value
}
>
{
r
.
value
}
<
/Option
>
...
...
@@ -1057,17 +1061,17 @@ class FormList extends React.Component {
};
renderForm
()
{
const
{
form
,
get
}
=
this
.
props
;
const
{
form
,
get
,
json
}
=
this
.
props
;
const
{
querys
}
=
this
.
state
;
if
(
querys
.
length
==
0
)
{
if
(
querys
.
length
===
0
||
json
?.
isHiddenSearch
===
true
)
{
return
''
;
}
return
(
<
Form
layout
=
"inline"
>
<
Row
style
=
{{
padding
:
'15px'
}}
>
{
querys
.
map
((
item
)
=>
(
{
querys
.
map
(
item
=>
(
<
Col
style
=
{{
height
:
58
}}
span
=
{
get
===
'mobile'
?
24
:
8
}
key
=
{
item
.
id
}
>
{
this
.
getItem
(
true
,
...
...
@@ -1086,7 +1090,8 @@ class FormList extends React.Component {
style
=
{{
textAlign
:
get
===
'mobile'
?
'right'
:
''
,
paddingRight
:
get
===
'mobile'
?
12
:
''
,
}}
>
}}
>
<
span
className
=
{
styles
.
submitButtons
}
>
<
Button
type
=
"primary"
loading
=
{
this
.
props
.
loading
}
onClick
=
{
this
.
handleSearch
}
>
查询
...
...
@@ -1110,15 +1115,15 @@ class FormList extends React.Component {
* @return:
*/
CheckboxChange
=
(
checkedValues
)
=>
{
CheckboxChange
=
checkedValues
=>
{
if
(
checkedValues
.
length
===
0
)
{
message
.
error
(
'至少选择一项'
);
return
;
}
const
{
cacheColumns
}
=
this
.
state
;
let
initList
=
[];
checkedValues
.
map
((
item
)
=>
{
let
ary
=
cacheColumns
.
filter
((
data
)
=>
data
.
dataIndex
===
item
);
checkedValues
.
map
(
item
=>
{
let
ary
=
cacheColumns
.
filter
(
data
=>
data
.
dataIndex
===
item
);
if
(
ary
.
length
!==
0
)
{
initList
.
push
(
ary
[
0
]);
}
...
...
@@ -1138,7 +1143,8 @@ class FormList extends React.Component {
style
=
{{
width
:
20
,
margin
:
'auto'
,
}}
>
}}
>
<
Spin
/>
<
/div
>
);
...
...
@@ -1228,7 +1234,8 @@ class FormList extends React.Component {
title
=
"确定删除该数据?"
onConfirm
=
{
this
.
delete
.
bind
(
this
,
record
)}
okText
=
"确定"
cancelText
=
"取消"
>
cancelText
=
"取消"
>
<
a
>
删除
<
/a
>
<
/Popconfirm>
,
);
...
...
@@ -1241,7 +1248,8 @@ class FormList extends React.Component {
textAlign
:
'center'
,
paddingLeft
:
'0px'
,
paddingRight
:
'0px'
,
}}
>
}}
>
{
Dom
&&
Dom
.
length
&&
Dom
.
map
((
x
,
index
)
=>
(
...
...
@@ -1304,7 +1312,8 @@ class FormList extends React.Component {
bodyStyle
=
{{
padding
:
0
,
width
:
json
.
twidth
?
json
.
twidth
:
'100%'
,
}}
>
}}
>
<
div
className
=
{
styles
.
tableList
}
>
<
div
className
=
{
styles
.
tableListForm
}
>
{
this
.
renderForm
()}
<
/div
>
<
div
className
=
{
styles
.
tableListOperator
}
>
...
...
@@ -1327,37 +1336,6 @@ class FormList extends React.Component {
custom
=
{
this
.
props
.
value
?
Base16Encode
(
JSON
.
stringify
(
this
.
props
.
value
))
:
null
}
sql
=
{
Base16Encode
(
this
.
props
.
sql
)}
/
>
{
/* {this.props.value && this.props.value.importConfig // 导入配置项
? this.props.value.importConfig.map((r, i) => (
<ImportUtil
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
importConfig={r}
objId={this.state.objId}
callback={() => {
this.getPage();
if (r.callback) r.callback();
}}
/>
))
: ''}*/
}
{
/* {this.props.value && this.props.value.exportConfig // 导出配置项
? this.props.value.exportConfig.map((r, i) => (
<ExportCurrentInfo
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={
this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null
}
index={i}
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
sql={Base16Encode(this.props.sql)}
/>
))
: ''}
*/
}
{
rights
&&
!
rights
.
includes
(
'add'
)
?
(
''
)
:
(
...
...
@@ -1406,7 +1384,8 @@ class FormList extends React.Component {
title
=
"确定删除该数据?"
onConfirm
=
{
this
.
batchDelete
}
okText
=
"确定"
cancelText
=
"取消"
>
cancelText
=
"取消"
>
<
Button
>
批量删除
<
/Button
>
<
/Popconfirm
>
<
/span
>
...
...
@@ -1419,7 +1398,8 @@ class FormList extends React.Component {
<
div
style
=
{{
width
:
150
,
}}
>
}}
>
<
Checkbox
.
Group
onChange
=
{
this
.
CheckboxChange
}
value
=
{
this
.
state
.
checkedList
}
...
...
@@ -1429,16 +1409,18 @@ class FormList extends React.Component {
}
title
=
"请选择表头展示"
trigger
=
"click"
placement
=
"bottom"
>
placement
=
"bottom"
>
<
Button
// 表头筛选控件
className
=
{
styles
.
filter_btn
}
icon
=
"filter"
>
icon
=
"filter"
>
表头筛选
<
/Button
>
<
/Popover
>
)}
{
btns
&&
btns
.
after
&&
btns
.
after
.
length
>
0
?
btns
.
after
.
map
((
r
)
=>
<
Button
{...
r
}
loading
=
{
loading
}
/>
)
?
btns
.
after
.
map
(
r
=>
<
Button
{...
r
}
loading
=
{
loading
}
/>
)
:
''
}
{
!!
this
.
props
.
otherProps
&&
...
...
@@ -1453,7 +1435,8 @@ class FormList extends React.Component {
overflow
:
'hidden'
,
width
:
isMobile
?
showMobileDiv
:
showDiv
,
height
:
'100%'
,
}}
>
}}
>
{
showDiv
&&
(
<
StandardTable
showHeader
=
{
this
.
props
.
showHeader
!=
null
?
this
.
props
.
showHeader
:
true
}
...
...
@@ -1480,7 +1463,8 @@ class FormList extends React.Component {
overflow
:
'hidden'
,
width
:
isMobile
?
showMobileDiv
:
showDiv
,
height
:
'100%'
,
}}
>
}}
>
<
div
>
{
get
===
'mobile'
?
<
div
>
手机端
,
请使用浏览器将手机横屏查看
<
/div> : null
}
{
showDiv
&&
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论