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
efac719e
Commit
efac719e
authored
2 years ago
by
田翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 表格初始化
parent
248b636c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
166 additions
and
2 deletions
+166
-2
data.js
examples/base/data.js
+0
-0
test.js
examples/base/test.js
+3
-2
index.js
src/core/TableRender/components/Search/index.js
+12
-0
index.js
src/core/TableRender/components/TablePack/index.js
+42
-0
index.js
src/core/TableRender/index.js
+77
-0
index.less
src/core/TableRender/index.less
+29
-0
index.js
src/index.js
+3
-0
No files found.
examples/base/data.js
View file @
efac719e
This diff is collapsed.
Click to expand it.
examples/base/test.js
View file @
efac719e
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
FormRender
,
FormDesigner
}
from
'../../src/index'
;
import
{
FormRender
,
FormDesigner
,
TableRender
}
from
'../../src/index'
;
import
{
schemaValues
}
from
'./data'
;
import
{
Button
,
Tabs
}
from
'antd'
;
...
...
@@ -3468,9 +3468,10 @@ const Test = (props) => {
return
(
<
div
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
>
<
FormDesigner
ref
=
{
formDesignerRef
}
extra
=
{
true
}
tableName
=
'事件工单_测试一键布局'
/>
{
/* <FormDesigner ref={formDesignerRef} extra={true} tableName='事件工单_测试一键布局' /> */
}
{
/* <FormRender ref={formRenderRef} schemaValues={schemaValues} /> */
}
{
/* <div onClick={submit}>提交</div> */
}
<
TableRender
accountName
=
{
'形态测试台账WY'
}
/
>
<
/div
>
)
...
...
This diff is collapsed.
Click to expand it.
src/core/TableRender/components/Search/index.js
0 → 100644
View file @
efac719e
import
React
from
'react'
const
Search
=
()
=>
{
return
(
<
div
><
/div
>
)
}
export
default
Search
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/core/TableRender/components/TablePack/index.js
0 → 100644
View file @
efac719e
import
React
,
{
useMemo
}
from
'react'
import
{
Table
,
Tooltip
}
from
'antd'
const
TablePack
=
(
props
)
=>
{
const
{
loading
,
showField
,
formJson
,
dataSource
}
=
props
const
columns
=
useMemo
(()
=>
{
let
array
=
[]
showField
.
forEach
(
v
=>
{
array
.
push
({
key
:
new
Date
().
getTime
(),
title
:
v
,
dataIndex
:
v
,
width
:
120
,
ellipsis
:
true
,
render
:
(
value
,
r
)
=>
{
return
(
<
Tooltip
placement
=
"top"
title
=
{
value
}
>
{
value
}
<
/Tooltip
>
)
}
})
})
return
array
},
[
showField
])
return
(
<
Table
size
=
'small'
bordered
loading
=
{
loading
}
columns
=
{
columns
}
dataSource
=
{
dataSource
}
pagination
=
{
false
}
scroll
=
{{
y
:
'calc(100% - 50px)'
}}
/
>
)
}
export
default
TablePack
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/core/TableRender/index.js
0 → 100644
View file @
efac719e
import
React
,
{
useEffect
,
useMemo
,
useState
}
from
'react'
import
styles
from
'./index.less'
import
Search
from
'./components/Search'
import
TablePack
from
'./components/TablePack'
import
{
GetAccountConfigInfo
,
GetAccountPageList
,
getStationListByUserID
,
GetTableJson
}
from
'../../apis/process'
const
TableRender
=
(
props
)
=>
{
const
userID
=
window
?.
globalConfig
?.
userInfo
?.
OID
||
1
const
{
accountName
}
=
props
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
config
,
setConfig
]
=
useState
({
webShowFieldGroup
:
''
,
formJson
:
''
})
const
[
dataSource
,
setDataSource
]
=
useState
([])
const
showField
=
useMemo
(()
=>
{
const
{
webShowFieldGroup
}
=
config
return
webShowFieldGroup
.
split
(
','
).
filter
(
v
=>
v
)
},
[
config
])
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
)
=>
{
setLoading
(
true
)
let
params
=
{
userID
:
userID
,
accountName
:
''
,
direction
:
'desc'
,
timeField
:
'录入时间'
,
pageIndex
:
1
,
pageSize
:
100
,
...
param
,
}
const
{
code
,
data
}
=
await
GetAccountPageList
(
params
)
if
(
code
===
0
)
{
setDataSource
(
JSON
.
parse
(
data
.
jsonData
))
}
setLoading
(
false
)
}
const
getData
=
()
=>
{
getConfig
()
getDataSource
({
accountName
})
}
useEffect
(()
=>
{
getData
()
},
[])
return
(
<
div
className
=
{
styles
.
tableRender
}
>
<
div
className
=
{
styles
.
top
}
>
<
Search
/>
<
/div
>
<
div
className
=
{
styles
.
bottom
}
>
<
TablePack
loading
=
{
loading
}
showField
=
{
showField
}
formJson
=
{
config
.
formJson
}
dataSource
=
{
dataSource
}
/
>
<
/div
>
<
/div
>
)
}
export
default
TableRender
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/core/TableRender/index.less
0 → 100644
View file @
efac719e
@import '~antd/es/style/themes/default.less';
.tableRender {
width: 100%;
height: 100%;
.top {
width: 100%;
height: 50px;
}
.bottom {
width: 100%;
height: calc(100% - 100px);
.@{ant-prefix}-table-wrapper {
height: 100%;
.@{ant-prefix}-spin-nested-loading {
height: 100%;
}
.@{ant-prefix}-spin-container {
height: 100%;
}
.@{ant-prefix}-table {
height: 100%;
.@{ant-prefix}-table-container {
height: 100%;
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/index.js
View file @
efac719e
import
FormRender
from
'./core/FormRender'
import
FormDesigner
from
'./core/FormDesigner'
import
TableRender
from
'./core/TableRender'
import
'./main.less'
export
{
FormRender
,
FormDesigner
,
TableRender
,
}
\ No newline at end of file
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