Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
418afe84
Commit
418afe84
authored
Aug 02, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拖拽崩溃的问题
parent
180cea55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
55 deletions
+25
-55
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+9
-24
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+16
-31
No files found.
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
418afe84
...
...
@@ -277,6 +277,9 @@ const ImportActionIndex = (props) => {
const
[
filterData
,
setFilterData
]
=
useState
([]);
const
dataRef
=
useRef
();
dataRef
.
current
=
data
;
//规则改变的时候 数据表为可编辑状态
useEffect
(()
=>
{
setEditingKey
(
null
);
...
...
@@ -286,6 +289,7 @@ const ImportActionIndex = (props) => {
setAttributes
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]);
setData
(
modelerData
.
easyDataModelerIndices
||
[]);
dataRef
.
current
=
(
modelerData
.
easyDataModelerIndices
||
[]);
const
_filterData
=
(
modelerData
.
easyDataModelerIndices
||
[]).
filter
(
item
=>
(
item
.
name
||
''
).
indexOf
(
keyword
)
!==-
1
);
...
...
@@ -610,39 +614,20 @@ const ImportActionIndex = (props) => {
return
hasValidateReports
?
includeValidateColumn
:
columns
;
}
//解决拖动自动滚动问题
//https://codesandbox.io/s/react-dnd-example-12-s3nnf
let
pendingUpdateFn
=
undefined
;
let
requestedFrame
=
undefined
;
const
drawFrame
=
()
=>
{
const
newData
=
update
(
data
,
pendingUpdateFn
);
onChange
&&
onChange
(
newData
);
pendingUpdateFn
=
undefined
;
requestedFrame
=
undefined
;
};
const
scheduleUpdate
=
(
updateFn
)
=>
{
pendingUpdateFn
=
updateFn
;
if
(
!
requestedFrame
)
{
requestedFrame
=
requestAnimationFrame
(
drawFrame
);
}
}
const
moveRow
=
useCallback
(
(
dragIndex
,
hoverIndex
)
=>
{
const
dragRow
=
data
[
dragIndex
];
scheduleUpdate
(
{
const
dragRow
=
data
Ref
.
current
[
dragIndex
];
const
newData
=
update
(
dataRef
.
current
,
{
$splice
:
[
[
dragIndex
,
1
],
[
hoverIndex
,
0
,
dragRow
],
],
});
})
onChange
&&
onChange
(
newData
);
},
//eslint-disable-next-line react-hooks/exhaustive-deps
[
data
],
[
data
Ref
.
current
],
);
const
onSearchInputChange
=
(
e
)
=>
{
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
418afe84
...
...
@@ -247,19 +247,22 @@ const ImportActionTable = (props) => {
const
onChangeRef
=
useRef
();
onChangeRef
.
current
=
onChange
;
const
dataRef
=
useRef
();
dataRef
.
current
=
data
;
//规则改变的时候 数据表为可编辑状态
useEffect
(()
=>
{
setEditingKey
(
''
);
},
[
constraint
,
template
,
modelerData
])
useEffect
(()
=>
{
setData
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]);
setFilterData
((
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
filter
(
item
=>
(
item
.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
));
dataRef
.
current
=
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]);
setFilterData
((
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
filter
(
item
=>
(
item
?.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
));
},
[
modelerData
,
keyword
])
const
isEditing
=
(
record
)
=>
record
.
iid
===
editingKey
;
const
isEditing
=
(
record
)
=>
record
?
.
iid
===
editingKey
;
const
onAddClick
=
()
=>
{
...
...
@@ -481,7 +484,7 @@ const ImportActionTable = (props) => {
editable
:
true
,
ellipsis
:
true
,
render
:
(
_
,
record
,
__
)
=>
{
if
(
record
.
datatype
)
{
if
(
record
?
.
datatype
)
{
let
_text
=
`名称:
${
record
.
datatype
.
name
||
''
}
`
;
...
...
@@ -694,39 +697,21 @@ const ImportActionTable = (props) => {
return
hasValidateReports
?
includeValidateColumn
:
columns
;
}
//解决拖动自动滚动问题
//https://codesandbox.io/s/react-dnd-example-12-s3nnf
let
pendingUpdateFn
=
undefined
;
let
requestedFrame
=
undefined
;
const
drawFrame
=
()
=>
{
const
newData
=
update
(
data
,
pendingUpdateFn
);
onChangeRef
.
current
&&
onChangeRef
.
current
(
newData
);
pendingUpdateFn
=
undefined
;
requestedFrame
=
undefined
;
};
const
scheduleUpdate
=
(
updateFn
)
=>
{
pendingUpdateFn
=
updateFn
;
if
(
!
requestedFrame
)
{
requestedFrame
=
requestAnimationFrame
(
drawFrame
);
}
}
const
moveRow
=
useCallback
(
(
dragIndex
,
hoverIndex
)
=>
{
const
dragRow
=
data
[
dragIndex
];
scheduleUpdate
({
const
dragRow
=
dataRef
.
current
[
dragIndex
];
const
newData
=
update
(
dataRef
.
current
,
{
$splice
:
[
[
dragIndex
,
1
],
[
hoverIndex
,
0
,
dragRow
],
],
});
})
onChangeRef
.
current
&&
onChangeRef
.
current
(
newData
);
},
//eslint-disable-next-line react-hooks/exhaustive-deps
[
data
],
[
data
Ref
.
current
],
);
const
onSearchInputChange
=
(
e
)
=>
{
...
...
@@ -788,9 +773,9 @@ const ImportActionTable = (props) => {
},
}
}
rowClassName=
{
(
record
,
index
)
=>
{
if
(
record
.
modelingTemplateTag
&&
record
.
modelingTemplateTag
!==
{})
{
return
'editable-row template-highlight-row'
;
}
//
if (record.modelingTemplateTag && record.modelingTemplateTag!==
{})
{
//
return 'editable-row template-highlight-row';
//
}
return
'editable-row'
;
}
}
...
...
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