Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
46db6be3
提交
46db6be3
authored
6月 05, 2020
作者:
徐立
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增表格表头筛选功能
上级
1e9edc31
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
104 行增加
和
19 行删除
+104
-19
TableList.less
one_stop_public/libs/formList/TableList.less
+23
-14
index.js
one_stop_public/libs/formList/index.js
+81
-5
没有找到文件。
one_stop_public/libs/formList/TableList.less
浏览文件 @
46db6be3
@import '~antd/lib/style/themes/default.less';
@import '~antd/lib/style/themes/default.less';
@import './utils.less';
@import './utils.less';
.clearfix{
.clearfix
{
width:110px;
width:
110px;
height:90px;
height:
90px;
}
}
.headBox{
.headBox
{
position: absolute;
position: absolute;
top:55px;
top:
55px;
right: 100px;
right: 100px;
}
}
.infoBox label{
.infoBox label
{
width: 100px;
width: 100px;
text-align: right
text-align: right
;
}
}
.pagBox{
.pagBox
{
position: relative;
position: relative;
width: 100%;
width: 100%;
}
}
.infoBox{
.infoBox
{
position: relative;
position: relative;
width: 100%;
width: 100%;
}
}
.boxTitle{
.boxTitle
{
font-size: 18px;
font-size: 18px;
border-bottom: 1px solid #
F0F0F
0;
border-bottom: 1px solid #
f0f0f
0;
color:#333;
color:
#333;
padding-bottom:10px;
padding-bottom:
10px;
}
}
.tableList {
.tableList {
.tableListOperator {
.tableListOperator {
...
@@ -74,3 +73,13 @@
...
@@ -74,3 +73,13 @@
margin-right: 8px;
margin-right: 8px;
}
}
}
}
.filter_btn {
font-size: 14px;
font-weight: 400;
color: #1998f0;
height: 30px;
background: #ffffff;
border-radius: 2px;
border-color: #1998f0;
}
one_stop_public/libs/formList/index.js
浏览文件 @
46db6be3
...
@@ -16,6 +16,8 @@ import {
...
@@ -16,6 +16,8 @@ import {
Popconfirm
,
Popconfirm
,
Tooltip
,
Tooltip
,
Spin
,
Spin
,
Popover
,
Checkbox
,
}
from
'antd'
;
}
from
'antd'
;
import
{
connect
}
from
'dva'
;
import
{
connect
}
from
'dva'
;
import
PageHeaderWrapper
from
'./PageHeaderWrapper'
;
import
PageHeaderWrapper
from
'./PageHeaderWrapper'
;
...
@@ -35,6 +37,8 @@ import { isEmpty } from 'lodash';
...
@@ -35,6 +37,8 @@ import { isEmpty } from 'lodash';
import
FilePreview
from
'@/webPublic/one_stop_public/filePreview'
;
import
FilePreview
from
'@/webPublic/one_stop_public/filePreview'
;
import
{
queryApiActionPath
}
from
'@/webPublic/one_stop_public/utils/queryConfig'
;
import
{
queryApiActionPath
}
from
'@/webPublic/one_stop_public/utils/queryConfig'
;
import
UploadCom
from
'@/webPublic/one_stop_public/libs/UploadCom'
;
import
UploadCom
from
'@/webPublic/one_stop_public/libs/UploadCom'
;
import
ButtonDiy
from
'../../App/ButtonDiy/ButtonDiy'
;
import
{
cloneDeep
}
from
'../../copy/index'
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
let
AllWidth
=
0
;
// 表格总长度
let
AllWidth
=
0
;
// 表格总长度
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
...
@@ -176,9 +180,12 @@ class FormList extends React.Component {
...
@@ -176,9 +180,12 @@ class FormList extends React.Component {
showDiv
:
''
,
showDiv
:
''
,
showMobileDiv
:
''
,
showMobileDiv
:
''
,
isView
:
false
,
isView
:
false
,
checkedList
:
[],
// 复选框默认选中
cacheColumns
:
''
,
// 初始表头缓存数据 后续不做增删改查
};
};
columns
=
[];
columns
=
[];
checkList
=
[];
// 复选框内容
getOptions
=
()
=>
{
getOptions
=
()
=>
{
const
refIds
=
[];
const
refIds
=
[];
for
(
var
i
=
0
;
i
<
this
.
state
.
formItem
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
state
.
formItem
.
length
;
i
++
)
{
...
@@ -308,7 +315,6 @@ class FormList extends React.Component {
...
@@ -308,7 +315,6 @@ class FormList extends React.Component {
showMobileDiv
,
showMobileDiv
,
});
});
}
}
console
.
log
(
showMobileDiv
);
};
};
//渲染值
//渲染值
componentDidMount
()
{
componentDidMount
()
{
...
@@ -432,7 +438,20 @@ class FormList extends React.Component {
...
@@ -432,7 +438,20 @@ class FormList extends React.Component {
if
(
datas
)
{
if
(
datas
)
{
this
.
state
.
formItem
=
datas
;
this
.
state
.
formItem
=
datas
;
let
i
=
0
;
let
i
=
0
;
let
cacheList
=
[];
let
cacheChecked
=
[];
// 表头筛选逻辑
datas
.
map
(
item
=>
{
cacheList
.
push
({
label
:
item
.
title
,
value
:
item
.
name
,
});
cacheChecked
.
push
(
item
.
name
);
});
this
.
checkList
=
cacheList
;
this
.
setState
({
checkedList
:
cacheChecked
,
});
for
(
let
t
in
datas
)
{
for
(
let
t
in
datas
)
{
if
(
datas
[
t
].
isPrimaryKey
)
this
.
state
.
primaryKey
=
datas
[
t
].
name
;
if
(
datas
[
t
].
isPrimaryKey
)
this
.
state
.
primaryKey
=
datas
[
t
].
name
;
if
(
datas
[
t
].
isHidden
)
{
if
(
datas
[
t
].
isHidden
)
{
...
@@ -506,7 +525,9 @@ class FormList extends React.Component {
...
@@ -506,7 +525,9 @@ class FormList extends React.Component {
this
.
setState
({
tableWidth
:
(
datas
.
length
-
1
)
*
200
});
this
.
setState
({
tableWidth
:
(
datas
.
length
-
1
)
*
200
});
this
.
columns
.
push
(
column
);
this
.
columns
.
push
(
column
);
this
.
setState
({
cacheColumns
:
this
.
columns
,
});
if
(
datas
[
t
].
isShowQuery
)
{
if
(
datas
[
t
].
isShowQuery
)
{
querys
.
push
(
datas
[
t
]);
querys
.
push
(
datas
[
t
]);
if
(
datas
[
t
].
referenceObjId
!=
null
)
{
if
(
datas
[
t
].
referenceObjId
!=
null
)
{
...
@@ -994,6 +1015,30 @@ class FormList extends React.Component {
...
@@ -994,6 +1015,30 @@ class FormList extends React.Component {
<
/Form
>
<
/Form
>
);
);
}
}
/**
* @description: 表头筛选复选框 根据用户筛选将表头内容重置
* @param { Array<string> } 用户选择参数
* @return:
*/
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
);
if
(
ary
.
length
!==
0
)
{
initList
.
push
(
ary
[
0
]);
}
});
this
.
columns
=
initList
;
this
.
setState
({
checkedList
:
checkedValues
,
});
};
render
()
{
render
()
{
const
{
modalVisible
,
selectedRows
,
querys
,
tableWidth
,
rights
,
data
,
isReady
}
=
this
.
state
;
const
{
modalVisible
,
selectedRows
,
querys
,
tableWidth
,
rights
,
data
,
isReady
}
=
this
.
state
;
if
(
!
isReady
)
{
if
(
!
isReady
)
{
...
@@ -1155,8 +1200,10 @@ class FormList extends React.Component {
...
@@ -1155,8 +1200,10 @@ class FormList extends React.Component {
!
isEmpty
(
this
.
columns
[
this
.
columns
.
length
-
1
])
&&
!
isEmpty
(
this
.
columns
[
this
.
columns
.
length
-
1
])
&&
this
.
columns
[
this
.
columns
.
length
-
1
].
title
===
'操作'
this
.
columns
[
this
.
columns
.
length
-
1
].
title
===
'操作'
)
{
)
{
this
.
columns
[
this
.
columns
.
length
-
2
].
width
=
''
;
if
(
this
.
columns
[
this
.
columns
.
length
-
2
])
{
AllWidth
+=
100
;
this
.
columns
[
this
.
columns
.
length
-
2
].
width
=
''
;
AllWidth
+=
100
;
}
}
}
}
}
const
xxxx
=
(
const
xxxx
=
(
...
@@ -1224,6 +1271,35 @@ class FormList extends React.Component {
...
@@ -1224,6 +1271,35 @@ class FormList extends React.Component {
<
/Popconfirm
>
<
/Popconfirm
>
<
/span
>
<
/span
>
)}
)}
{
rights
&&
!
rights
.
includes
(
'headerFilter'
)
?
(
''
)
:
(
<
Popover
// 划入选择栏
content
=
{
<
div
style
=
{{
width
:
150
,
}}
>
<
Checkbox
.
Group
onChange
=
{
this
.
CheckboxChange
}
value
=
{
this
.
state
.
checkedList
}
options
=
{
this
.
checkList
}
/
>
<
/div
>
}
title
=
"请选择表头展示"
trigger
=
"click"
placement
=
"bottom"
>
<
Button
// 表头筛选控件
className
=
{
styles
.
filter_btn
}
icon
=
"filter"
>
表头筛选
<
/Button
>
<
/Popover
>
)}
<
/div
>
<
/div
>
{
!
istableCom
||
(
this
.
props
.
value
&&
this
.
props
.
value
.
columns
)
?
(
{
!
istableCom
||
(
this
.
props
.
value
&&
this
.
props
.
value
.
columns
)
?
(
<
StandardTable
<
StandardTable
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论