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
ab1e447d
Commit
ab1e447d
authored
Dec 05, 2024
by
杨子龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化控件
parent
fe72f9e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
9 deletions
+43
-9
index.js
src/core/widgets/coord/DataTable/index.js
+43
-9
No files found.
src/core/widgets/coord/DataTable/index.js
View file @
ab1e447d
...
...
@@ -18,7 +18,8 @@ const DataTable = props => {
pagination
,
scrollX
,
scrollY
,
statusOption
statusOption
,
areaTaskShine
,
}
=
schema
;
const
[
dataSource
,
setDataSource
]
=
useState
([]);
...
...
@@ -225,7 +226,7 @@ const DataTable = props => {
return
arr
};
const
getData
=
()
=>
{
const
initRelationForm
=
()
=>
{
window
.
relationForm
=
{
configs
:
[
{
...
...
@@ -241,15 +242,42 @@ const DataTable = props => {
}
}
const
columns
=
getColumns
();
const
setRelationData
=
()
=>
{
const
data
=
[];
dataSource
.
forEach
(
item
=>
{
const
obj
=
{
type
:
item
.
type
||
'add'
,
accountTable
:
schema
.
accountName
,
values
:
[
{
fieldName
:
"工单编号"
,
fieldValue
:
""
}
]
}
useEffect
(()
=>
{
getData
();
Object
.
keys
(
item
).
forEach
(
key
=>
{
const
val
=
key
.
split
(
"-"
)[
1
]
const
isHas
=
areaTaskShine
.
find
(
s
=>
s
.
fromField
===
val
);
return
()
=>
{
eventEmitter
.
removeListener
(
addons
?.
dataPath
)
}
},
[]);
if
(
isHas
){
const
valuesObj
=
{
fieldName
:
isHas
.
fromField
,
fieldValue
:
item
[
key
]
}
obj
.
values
.
push
(
valuesObj
);
}
})
data
.
push
(
obj
);
})
window
.
relationForm
.
data
=
data
;
}
const
columns
=
getColumns
();
useEffect
(()
=>
{
eventEmitter
.
on
(
addons
?.
dataPath
,
(
res
)
=>
{
...
...
@@ -264,6 +292,12 @@ const DataTable = props => {
})
},
[]);
useEffect
(()
=>
{
initRelationForm
();
setRelationData
();
},
[
value
,
dataSource
]);
return
(
<
Fragment
>
...
...
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