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
2 years ago
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'
...
@@ -3,12 +3,16 @@ import { Table, Tooltip } from 'antd'
const
TablePack
=
(
props
)
=>
{
const
TablePack
=
(
props
)
=>
{
const
{
}
=
props
const
{
value
,
widget
}
=
props
// console.log('props', props)
// console.log('props', props)
if
(
widget
)
{
console
.
log
(
'widget'
,
widget
)
}
return
(
return
(
<
div
>
{
JSON
.
stringify
(
props
)
}
<
/div
>
<
div
>
{
value
}
<
/div
>
)
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/TableRender/index.js
View file @
1656a41f
import
React
,
{
useEffect
,
useMemo
,
useState
}
from
'react'
import
React
,
{
useEffect
,
useMemo
,
useState
}
from
'react'
import
styles
from
'./index.less'
import
styles
from
'./index.less'
import
{
Table
,
Tooltip
}
from
'antd'
import
{
Table
,
Tooltip
,
message
}
from
'antd'
import
SearchGroup
from
'./components/SearchGroup'
import
SearchGroup
from
'./components/SearchGroup'
import
TablePack
from
'./components/TablePack'
import
TablePack
from
'./components/TablePack'
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
,
GetTableJson
}
from
'../../apis/process'
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
,
GetTableJson
}
from
'../../apis/process'
...
@@ -20,7 +20,6 @@ const getFileInfo = (formJson) => {
...
@@ -20,7 +20,6 @@ const getFileInfo = (formJson) => {
}
}
}
}
}
}
console
.
log
(
'obj'
,
obj
)
return
obj
return
obj
}
}
...
@@ -28,18 +27,18 @@ const TableRender = (props) => {
...
@@ -28,18 +27,18 @@ const TableRender = (props) => {
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
{
accountName
}
=
props
const
{
accountName
}
=
props
const
[
params
,
setParams
]
=
useState
({
userID
:
userID
,
accountName
,
direction
:
'desc'
,
timeField
:
'录入时间'
,
pageIndex
:
1
,
pageSize
:
100
})
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
config
,
setConfig
]
=
useState
({
webShowFieldGroup
:
''
,
formJson
:
''
})
const
[
config
,
setConfig
]
=
useState
({
webShowFieldGroup
:
''
,
formJson
:
''
})
const
[
dataSource
,
setDataSource
]
=
useState
([])
const
[
dataSource
,
setDataSource
]
=
useState
([])
const
c
olumns
=
useMemo
(()
=>
{
const
fileC
olumns
=
useMemo
(()
=>
{
const
{
webShowFieldGroup
,
formJson
}
=
config
const
{
webShowFieldGroup
,
formJson
}
=
config
let
showField
=
webShowFieldGroup
?
webShowFieldGroup
.
split
(
','
).
filter
(
v
=>
v
)
:
[]
let
showField
=
webShowFieldGroup
?
webShowFieldGroup
.
split
(
','
).
filter
(
v
=>
v
)
:
[]
let
json
=
getFileInfo
(
formJson
)
let
json
=
getFileInfo
(
formJson
)
let
array
=
[]
let
array
=
[]
showField
.
forEach
(
v
=>
{
showField
.
forEach
(
v
=>
{
array
.
push
({
array
.
push
({
key
:
new
Date
().
getTime
(),
title
:
json
[
v
]?.
title
||
v
,
title
:
json
[
v
]?.
title
||
v
,
dataIndex
:
v
,
dataIndex
:
v
,
width
:
120
,
width
:
120
,
...
@@ -55,38 +54,55 @@ const TableRender = (props) => {
...
@@ -55,38 +54,55 @@ const TableRender = (props) => {
return
array
return
array
},
[
config
])
},
[
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
getConfig
=
async
()
=>
{
const
{
code
,
data
}
=
await
GetAccountConfigInfo
(
accountName
)
const
{
code
,
data
}
=
await
GetAccountConfigInfo
(
accountName
)
// if (code === 0) {
// setConfig(data)
// }
const
res
=
await
GetTableJson
(
accountName
)
const
res
=
await
GetTableJson
(
accountName
)
if
(
code
===
0
&&
res
.
code
===
0
)
{
if
(
code
===
0
&&
res
.
code
===
0
)
{
setConfig
({
...
data
,
formJson
:
res
.
data
})
setConfig
({
...
data
,
formJson
:
res
.
data
})
}
}
}
}
const
getDataSource
=
async
(
param
)
=>
{
const
getDataSource
=
async
(
param
=
{}
)
=>
{
setLoading
(
true
)
setLoading
(
true
)
let
params
=
{
const
{
code
,
data
,
msg
}
=
await
GetAccountPageList
({
...
params
,
...
param
})
userID
:
userID
,
accountName
:
''
,
direction
:
'desc'
,
timeField
:
'录入时间'
,
pageIndex
:
1
,
pageSize
:
100
,
...
param
,
}
const
{
code
,
data
}
=
await
GetAccountPageList
(
params
)
if
(
code
===
0
)
{
if
(
code
===
0
)
{
setDataSource
(
JSON
.
parse
(
data
.
jsonData
))
setDataSource
(
JSON
.
parse
(
data
.
jsonData
))
}
else
{
setDataSource
([])
message
.
error
(
msg
)
}
}
setLoading
(
false
)
setLoading
(
false
)
}
}
const
getData
=
()
=>
{
const
getData
=
()
=>
{
getConfig
()
getConfig
()
getDataSource
(
{
accountName
}
)
getDataSource
()
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -96,11 +112,12 @@ const TableRender = (props) => {
...
@@ -96,11 +112,12 @@ const TableRender = (props) => {
return
(
return
(
<
div
className
=
{
styles
.
tableRender
}
>
<
div
className
=
{
styles
.
tableRender
}
>
<
div
className
=
{
styles
.
top
}
>
<
div
className
=
{
styles
.
top
}
>
<
SearchGroup
/>
<
SearchGroup
onChange
=
{
search
}
/
>
<
/div
>
<
/div
>
<
div
className
=
{
styles
.
bottom
}
>
<
div
className
=
{
styles
.
bottom
}
>
<
Table
<
Table
size
=
'small'
size
=
'small'
rowKey
=
'ID'
bordered
bordered
loading
=
{
loading
}
loading
=
{
loading
}
columns
=
{
columns
}
columns
=
{
columns
}
...
...
This diff is collapsed.
Click to expand it.
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