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
f7acd792
Commit
f7acd792
authored
Dec 07, 2020
by
李晓静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加表格头部自定义dom
parent
78492a54
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
34 deletions
+37
-34
index.js
components/DataView/index.js
+31
-28
index.less
components/SearchView/index.less
+6
-6
No files found.
components/DataView/index.js
View file @
f7acd792
...
...
@@ -4,6 +4,7 @@ import React from 'react';
import
{
Modal
,
message
}
from
'antd'
;
import
moment
from
'moment'
;
import
_
from
'lodash'
;
import
classNames
from
'classnames'
;
// ant_components 组件
import
BITable
from
'@/ant_components/BITable'
;
import
BIButton
from
'@/ant_components/BIButton'
;
...
...
@@ -14,7 +15,6 @@ import SelfPagination from '@/components/SelfPagination';
import
ButtonAuth
from
'@/components/AuthButton'
;
import
IconFont
from
'@/components/CustomIcon/IconFont'
;
// 样式
import
styles
from
'./index.less'
;
// 工具
import
antiAssign
from
'@/utils/anti-assign'
;
import
{
DATE_FORMAT
,
PAGINATION
}
from
'@/utils/constants'
;
...
...
@@ -23,6 +23,7 @@ import { getSift } from '@/services/comment';
import
{
getOptionName
,
replacePageNum
}
from
'@/utils/utils'
;
import
{
SIFT_TYPE
}
from
'@/utils/enum'
;
import
storage
from
'@/utils/storage'
;
/* eslint-disable react/sort-comp */
// 关闭下划线变量检测 // 关闭方法排序检测 // 多维数组降维成一维数组
import
styles
from
'./index.less'
;
/**
*
...
...
@@ -155,7 +156,7 @@ export function formatSelect(val, options) {
}
const
selectObj
=
options
.
find
((
item
)
=>
{
return
item
.
id
===
val
;
})
||
{}
})
||
{}
;
return
selectObj
;
}
...
...
@@ -274,7 +275,7 @@ export default class DataView extends React.Component {
current
:
(
page
&&
page
.
current
)
||
PAGINATION
.
current
,
onChange
:
(
nextPage
)
=>
{
this
.
fetchPage
(
nextPage
);
this
.
fetch
();
//
this.fetch();
window
.
history
.
replaceState
({
pageNum
:
nextPage
},
''
,
`?pageNum=
${
nextPage
}
`
);
},
onShowSizeChange
:
this
.
fetchPageSize
,
...
...
@@ -309,8 +310,7 @@ export default class DataView extends React.Component {
const
{
pageData
:
{
list
,
page
},
}
=
nextProps
;
const
newPage
=
page
.
total
>
0
const
newPage
=
page
.
total
>
0
?
{
current
:
page
.
pageNum
,
total
:
page
.
total
,
...
...
@@ -384,13 +384,13 @@ export default class DataView extends React.Component {
message
.
error
(
res
&&
res
.
message
);
}
}
initView
=
()
=>
{
// 该方法用于回调子空间的initView方法,只会执行一次
const
{
initView
}
=
this
.
props
;
const
{
searchForm
}
=
this
.
state
;
if
(
initView
)
{
initView
({
searchForm
,
instance
:
this
,
form
:
this
.
props
.
form
});
}
}
// eslint-disable-next-line react/sort-comp
...
...
@@ -528,8 +528,7 @@ export default class DataView extends React.Component {
result
=
{};
}
else
{
const
siftDataArr
=
Array
.
isArray
(
this
.
state
.
siftDataArr
)
?
this
.
state
.
siftDataArr
:
[];
const
obj
=
siftDataArr
.
find
((
item
)
=>
{
const
obj
=
siftDataArr
.
find
((
item
)
=>
{
return
item
.
queryLabelId
===
index
;
})
||
{};
try
{
...
...
@@ -568,6 +567,7 @@ export default class DataView extends React.Component {
}
return
data
;
};
filterSubComChangeParams
=
(
key
)
=>
{
const
{
searchCols
,
advancedSearchCols
}
=
this
.
props
;
const
sumSearchCols
=
[...(
searchCols
||
[]),
...(
advancedSearchCols
||
[])];
...
...
@@ -581,22 +581,22 @@ export default class DataView extends React.Component {
fn
=
onChangeParams
;
return
;
}
}
if
(
Array
.
isArray
(
data
))
{
data
.
map
(
ls
=>
filterFun
(
ls
));
}
data
.
map
((
ls
)
=>
{
return
filterFun
(
ls
);
});
}
};
filterFun
(
sumSearchCols
);
return
fn
;
}
// 更改查询条件
_changeSearchForm
=
async
(
props
,
changedValues
,
allValues
)
=>
{
let
newData
=
changeDateRange
(
props
,
changedValues
,
allValues
);
// 回调配置项里面changeParams方法
const
onChangeParams
=
this
.
filterSubComChangeParams
(
Object
.
keys
(
changedValues
)[
0
]);
if
(
onChangeParams
)
{
newData
=
await
onChangeParams
(
changedValues
,
newData
)
||
newData
newData
=
await
onChangeParams
(
changedValues
,
newData
)
||
newData
;
}
await
this
.
setState
({
searchForm
:
newData
,
...
...
@@ -639,9 +639,9 @@ export default class DataView extends React.Component {
// 回调配置项里面changeParams方法
const
onChangeParams
=
this
.
filterSubComChangeParams
(
values
.
key
);
if
(
onChangeParams
)
{
const
obj
=
{}
const
obj
=
{}
;
obj
[
values
.
key
]
=
undefined
;
formData
=
await
onChangeParams
(
obj
,
formData
)
||
formData
formData
=
await
onChangeParams
(
obj
,
formData
)
||
formData
;
}
this
.
setState
(
{
...
...
@@ -706,7 +706,9 @@ export default class DataView extends React.Component {
return
(
<
div
className
=
{
styles
.
row
}
>
{
btns
.
map
((
item
,
i
)
=>
{
const
{
label
,
onClick
,
authority
,
download
,
iconBtnSrc
,
type
}
=
item
;
const
{
label
,
onClick
,
authority
,
download
,
iconBtnSrc
,
type
,
}
=
item
;
const
style
=
{
marginLeft
:
'10px'
,
};
...
...
@@ -819,7 +821,7 @@ export default class DataView extends React.Component {
// };
render
()
{
const
{
style
,
hideForm
,
tips
}
=
this
.
props
;
const
{
style
,
hideForm
,
tips
,
selfCom
,
selfTableWrap
}
=
this
.
props
;
const
{
loading
}
=
this
.
state
;
return
(
<
div
className
=
{
styles
.
view
}
style
=
{
style
}
>
...
...
@@ -828,6 +830,7 @@ export default class DataView extends React.Component {
<>
<
div
className
=
{
styles
.
formWrap
}
>
{
/* 筛选条件 */
}
{
selfCom
||
null
}
{
this
.
_renderSearchForm
()}
{
/* 高级搜索 */
}
{
/* {advancedStatus ? this.renderAdvanced() : null} */
}
...
...
@@ -837,7 +840,7 @@ export default class DataView extends React.Component {
<
div
className
=
{
styles
.
split
}
/
>
<
/
>
)}
<
div
className
=
{
styles
.
tableWrap
}
>
<
div
className
=
{
classNames
(
styles
.
tableWrap
,
selfTableWrap
)
}
>
{
tips
?
this
.
_renderTips
()
:
this
.
_renderBtns
()}
{
this
.
_renderData
()}
{
this
.
_renderPagination
()}
...
...
components/SearchView/index.less
View file @
f7acd792
...
...
@@ -53,7 +53,7 @@
.label {
color: @textPrimaryColor;
margin-right: 25px;
width: 66px;
min-
width: 66px;
text-align: right;
}
...
...
@@ -83,7 +83,7 @@
}
}
}
.modalRowWrap{
.modalRowWrap
{
margin-bottom: 0px;
}
}
...
...
@@ -94,14 +94,14 @@
//background-color: blue;
//border-top: 1px solid red;
}
.formItem{
.formItem
{
display: flex;
align-items: center;
justify-content: flex-start;
:global .ant-form-item-control{
:global .ant-form-item-control
{
line-height: 1.2;
}
}
.timeStyle{
.timeStyle
{
max-width: 320px;
}
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