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
bb55b171
Commit
bb55b171
authored
Jan 24, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
2ecb0e30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
24 deletions
+29
-24
update-task.jsx
src/view/Manage/ModelCompare/update-task.jsx
+29
-24
No files found.
src/view/Manage/ModelCompare/update-task.jsx
View file @
bb55b171
...
...
@@ -360,6 +360,7 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
const
[
form
]
=
Form
.
useForm
()
const
tableRef
=
React
.
useRef
()
const
selectablePropertyTypesRef
=
React
.
useRef
()
const
isEditing
=
(
record
)
=>
record
.
modelType
?.
name
===
editingKey
...
...
@@ -373,12 +374,6 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
}
},
[
type
])
const
selectablePropertyTypes
=
React
.
useMemo
(()
=>
{
return
(
propertyTypes
??[]).
filter
(
item
=>
(
tableData
??[]).
map
(
_item
=>
_item
.
modelType
?.
name
).
indexOf
(
item
.
modelType
?.
name
)
===-
1
||
item
.
modelType
?.
name
===
editingKey
)
},
[
propertyTypes
,
tableData
,
editingKey
])
const
getPropertyTypes
=
()
=>
{
setLoadingPropertyTypes
(
true
)
dispatch
({
...
...
@@ -433,10 +428,11 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
await
save
()
if
(
(
selectablePropertyTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
[
0
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
[
0
].
supportedMetadataTypes
??[]).
length
>
0
(
selectablePropertyTypes
Ref
.
current
??[]).
length
>
0
&&
(
selectablePropertyTypes
Ref
.
current
[
0
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
Ref
.
current
[
0
].
supportedMetadataTypes
??[]).
length
>
0
)
{
const
selectablePropertyTypes
=
[...
selectablePropertyTypesRef
.
current
??[]]
setTableData
(
prevTableData
=>
{
return
[...
prevTableData
??[],
{
modelType
:
selectablePropertyTypes
[
0
].
modelType
,
...
...
@@ -460,7 +456,8 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
}
}
const
onBatchDeleteClick
=
()
=>
{
const
onBatchDeleteClick
=
(
e
)
=>
{
e
.
stopPropagation
()
setTableData
(
prevTableData
=>
{
let
newTableData
=
[...
prevTableData
??[]];
newTableData
=
(
newTableData
??[]).
filter
(
item
=>
(
selectedRows
??[]).
map
(
_item
=>
_item
.
modelType
?.
name
).
indexOf
(
item
?.
modelType
?.
name
)
===-
1
);
...
...
@@ -474,16 +471,16 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
setSelectedRows
()
}
// const onRight
EditClick = async (record) => {
//
try {
//
await save()
const
on
EditClick
=
async
(
record
)
=>
{
try
{
await
save
()
//
setEditingKey(record?.modelType?.name)
//
setEditingModelKey(record?.modelType?.name)
//
} catch(e) {
setEditingKey
(
record
?.
modelType
?.
name
)
setEditingModelKey
(
record
?.
modelType
?.
name
)
}
catch
(
e
)
{
//
}
//
}
}
}
const
onRightDeleteClick
=
(
record
)
=>
{
if
(
isEditing
(
record
))
{
...
...
@@ -507,14 +504,14 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
if
(
changedValues
.
hasOwnProperty
(
'modelType'
))
{
setEditingModelKey
(
changedValues
[
'modelType'
])
const
index
=
(
selectablePropertyTypes
??[]).
findIndex
(
item
=>
item
.
modelType
?.
name
===
changedValues
[
'modelType'
])
const
index
=
(
selectablePropertyTypes
Ref
.
current
??[]).
findIndex
(
item
=>
item
.
modelType
?.
name
===
changedValues
[
'modelType'
])
if
(
index
!==
-
1
&&
(
selectablePropertyTypes
[
index
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
[
index
].
supportedMetadataTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
Ref
.
current
[
index
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
Ref
.
current
[
index
].
supportedMetadataTypes
??[]).
length
>
0
)
{
form
?.
setFieldsValue
({
operatorType
:
selectablePropertyTypes
[
index
].
supportedOperatorTypes
[
0
].
id
,
metadataType
:
selectablePropertyTypes
[
index
].
supportedMetadataTypes
[
0
].
name
,
operatorType
:
selectablePropertyTypes
Ref
.
current
[
index
].
supportedOperatorTypes
[
0
].
id
,
metadataType
:
selectablePropertyTypes
Ref
.
current
[
index
].
supportedMetadataTypes
[
0
].
name
,
})
}
}
...
...
@@ -560,11 +557,15 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
title
:
col
.
title
,
editing
:
isEditing
(
record
),
editingModelKey
,
propertyTypes
:
selectablePropertyTypes
,
propertyTypes
:
selectablePropertyTypes
Ref
.
current
,
}),
}
})
selectablePropertyTypesRef
.
current
=
(
propertyTypes
??[]).
filter
(
item
=>
(
tableData
??[]).
map
(
_item
=>
_item
.
modelType
?.
name
).
indexOf
(
item
.
modelType
?.
name
)
===-
1
||
item
.
modelType
?.
name
===
editingKey
)
return
(
<
Spin
spinning=
{
loadingPropertyTypes
}
>
<
div
>
...
...
@@ -588,6 +589,10 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
setSelectedRows
(
selectedRows
)
},
}
}
onRowClick=
{
(
event
,
record
)
=>
{
event
.
stopPropagation
()
onEditClick
(
record
)
}
}
pagination=
{
false
}
shouldRowContextMenu=
{
(
record
)
=>
{
return
true
...
...
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