Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xform
Project
Project
Details
Activity
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
田翔
xform
Commits
1656a41f
Commit
1656a41f
authored
Apr 19, 2023
by
田翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 接入组件
parent
fb513653
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
22 deletions
+43
-22
index.js
src/core/TableRender/components/TablePack/index.js
+6
-2
index.js
src/core/TableRender/index.js
+37
-20
No files found.
src/core/TableRender/components/TablePack/index.js
View file @
1656a41f
...
...
@@ -3,12 +3,16 @@ import { Table, Tooltip } from 'antd'
const
TablePack
=
(
props
)
=>
{
const
{
}
=
props
const
{
value
,
widget
}
=
props
// console.log('props', props)
if
(
widget
)
{
console
.
log
(
'widget'
,
widget
)
}
return
(
<
div
>
{
JSON
.
stringify
(
props
)
}
<
/div
>
<
div
>
{
value
}
<
/div
>
)
}
...
...
src/core/TableRender/index.js
View file @
1656a41f
import
React
,
{
useEffect
,
useMemo
,
useState
}
from
'react'
import
styles
from
'./index.less'
import
{
Table
,
Tooltip
}
from
'antd'
import
{
Table
,
Tooltip
,
message
}
from
'antd'
import
SearchGroup
from
'./components/SearchGroup'
import
TablePack
from
'./components/TablePack'
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
,
GetTableJson
}
from
'../../apis/process'
...
...
@@ -20,7 +20,6 @@ const getFileInfo = (formJson) => {
}
}
}
console
.
log
(
'obj'
,
obj
)
return
obj
}
...
...
@@ -28,18 +27,18 @@ const TableRender = (props) => {
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
{
accountName
}
=
props
const
[
params
,
setParams
]
=
useState
({
userID
:
userID
,
accountName
,
direction
:
'desc'
,
timeField
:
'录入时间'
,
pageIndex
:
1
,
pageSize
:
100
})
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
config
,
setConfig
]
=
useState
({
webShowFieldGroup
:
''
,
formJson
:
''
})
const
[
dataSource
,
setDataSource
]
=
useState
([])
const
c
olumns
=
useMemo
(()
=>
{
const
fileC
olumns
=
useMemo
(()
=>
{
const
{
webShowFieldGroup
,
formJson
}
=
config
let
showField
=
webShowFieldGroup
?
webShowFieldGroup
.
split
(
','
).
filter
(
v
=>
v
)
:
[]
let
json
=
getFileInfo
(
formJson
)
let
array
=
[]
showField
.
forEach
(
v
=>
{
array
.
push
({
key
:
new
Date
().
getTime
(),
title
:
json
[
v
]?.
title
||
v
,
dataIndex
:
v
,
width
:
120
,
...
...
@@ -55,38 +54,55 @@ const TableRender = (props) => {
return
array
},
[
config
])
const
columns
=
useMemo
(()
=>
{
return
[
{
title
:
'序号'
,
dataIndex
:
'r'
,
key
:
'r'
,
width
:
50
,
fixed
:
'left'
,
},
...
fileColumns
,
{
title
:
'操作'
,
width
:
50
,
fixed
:
'right'
,
render
:
(
r
)
=>
{
return
'详情'
}
}
]
},
[
fileColumns
])
const
search
=
(
values
)
=>
{
setParams
({
...
params
,
...
values
})
getDataSource
({
...
params
,
...
values
})
}
const
getConfig
=
async
()
=>
{
const
{
code
,
data
}
=
await
GetAccountConfigInfo
(
accountName
)
// if (code === 0) {
// setConfig(data)
// }
const
res
=
await
GetTableJson
(
accountName
)
if
(
code
===
0
&&
res
.
code
===
0
)
{
setConfig
({
...
data
,
formJson
:
res
.
data
})
}
}
const
getDataSource
=
async
(
param
)
=>
{
const
getDataSource
=
async
(
param
=
{}
)
=>
{
setLoading
(
true
)
let
params
=
{
userID
:
userID
,
accountName
:
''
,
direction
:
'desc'
,
timeField
:
'录入时间'
,
pageIndex
:
1
,
pageSize
:
100
,
...
param
,
}
const
{
code
,
data
}
=
await
GetAccountPageList
(
params
)
const
{
code
,
data
,
msg
}
=
await
GetAccountPageList
({
...
params
,
...
param
})
if
(
code
===
0
)
{
setDataSource
(
JSON
.
parse
(
data
.
jsonData
))
}
else
{
setDataSource
([])
message
.
error
(
msg
)
}
setLoading
(
false
)
}
const
getData
=
()
=>
{
getConfig
()
getDataSource
(
{
accountName
}
)
getDataSource
()
}
useEffect
(()
=>
{
...
...
@@ -96,11 +112,12 @@ const TableRender = (props) => {
return
(
<
div
className
=
{
styles
.
tableRender
}
>
<
div
className
=
{
styles
.
top
}
>
<
SearchGroup
/>
<
SearchGroup
onChange
=
{
search
}
/
>
<
/div
>
<
div
className
=
{
styles
.
bottom
}
>
<
Table
size
=
'small'
rowKey
=
'ID'
bordered
loading
=
{
loading
}
columns
=
{
columns
}
...
...
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