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
bf9965fe
Commit
bf9965fe
authored
May 27, 2020
by
满振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改页面
parent
f0a14dfc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
DataViewReducer.ts
components/dataView-V2/DataViewReducer.ts
+2
-2
index.tsx
...onents/dataView-V2/_components/table/pagination/index.tsx
+2
-2
index.tsx
components/dataView-V2/index.tsx
+9
-2
No files found.
components/dataView-V2/DataViewReducer.ts
View file @
bf9965fe
export
interface
Pagination
{
// 分页数据
pageSize
?:
number
,
pageNum
?:
number
,
total
?:
number
total
?:
number
,
}
interface
State
{
loading
:
boolean
,
...
...
@@ -69,7 +69,7 @@ export const effect = (reduceArr: any, registerFun: { fetch: Function }) => {
newParams
=
await
registerFun
.
fetch
({
pagination
:
{
...
state
.
pagination
,
pageNum
:
payload
.
pageNum
}
})
break
case
'onSearch'
:
newParams
=
await
registerFun
.
fetch
({
searchForm
:
{
...
state
.
searchForm
,
...(
payload
.
searchForm
||
{})
}
})
newParams
=
await
registerFun
.
fetch
({
searchForm
:
{
...
state
.
searchForm
,
...(
payload
.
searchForm
||
{})
}
,
pagination
:
initState
.
pagination
})
break
case
'onResert'
:
newParams
=
await
registerFun
.
fetch
({
searchForm
:
null
,
pagination
:
initState
.
pagination
})
...
...
components/dataView-V2/_components/table/pagination/index.tsx
View file @
bf9965fe
...
...
@@ -10,10 +10,10 @@ import './style.less';
* */
const
BIPagination
=
(
props
:
any
)
=>
{
const
current
=
props
.
current
||
props
.
pageNum
;
return
(
<
div
style=
{
{
textAlign
:
'right'
,
paddingTop
:
'16px'
}
}
>
<
Pagination
{
...
props
}
/>
<
Pagination
{
...
props
}
current=
{
current
}
/>
</
div
>
);
...
...
components/dataView-V2/index.tsx
View file @
bf9965fe
...
...
@@ -66,13 +66,20 @@ const DataView = (props: Props, ref: Ref<any>) => {
dataSource
:
Array
.
isArray
(
dataSource
)
?
dataSource
.
slice
()
:
[],
}
}
async
function
_fetch
(
params
:
any
)
{
async
function
_fetch
(
params
=
{}
)
{
const
{
beforeFetch
,
fetch
,
afterFetch
}
=
props
;
const
onBeforeFetch
:
Function
=
beforeFetch
&&
typeof
beforeFetch
===
'function'
?
beforeFetch
:
_beforeFetch
;
const
onAfterFetch
:
Function
=
afterFetch
&&
typeof
afterFetch
===
'function'
?
afterFetch
:
_afterFetch
;
if
(
typeof
fetch
===
'function'
)
{
const
res
=
await
fetch
(
onBeforeFetch
.
bind
(
null
,
params
),
dispatch
);
return
await
onAfterFetch
(
res
)
const
{
dataSource
=
[],
pagination
=
{},
searchForm
=
{}
}
=
res
||
{};
return
await
onAfterFetch
({
dataSource
,
pagination
:
{
...(
params
.
pagination
||
{}),
...
pagination
,
searchForm
:
{
...(
params
.
searchForm
||
{}),
...
searchForm
}
}
})
}
}
useImperativeHandle
(
ref
,
()
=>
{
//第一个参数,要暴露给哪个(ref)?第二个参数要暴露出什么?
...
...
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