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
51f420c0
Commit
51f420c0
authored
Jan 25, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
bcdf426a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
update-task.jsx
src/view/Manage/ModelCompare/update-task.jsx
+35
-14
No files found.
src/view/Manage/ModelCompare/update-task.jsx
View file @
51f420c0
...
...
@@ -59,9 +59,11 @@ const FC = (props) => {
const
save
=
async
()
=>
{
try
{
const
basicRows
=
await
basicFormRef
.
current
?.
validate
()
const
strategyRows
=
await
strategyRef
.
current
?.
validate
()
const
scheduleRows
=
await
scheduleFormRef
.
current
?.
validate
()
console
.
log
(
'basicRows'
,
basicRows
)
console
.
log
(
'strategyRows'
,
strategyRows
)
console
.
log
(
'scheduleRows'
,
scheduleRows
)
setWaiting
(
true
)
if
(
type
===
'add'
)
{
...
...
@@ -70,6 +72,7 @@ const FC = (props) => {
payload
:
{
data
:
{
...
basicRows
,
strategyItemPropertyTypes
:
strategyRows
,
jobSchedule
:
scheduleRows
,
}
},
...
...
@@ -87,6 +90,7 @@ const FC = (props) => {
data
:
{
...
task
,
...
basicRows
,
strategyItemPropertyTypes
:
strategyRows
,
jobSchedule
:
scheduleRows
,
}
},
...
...
@@ -362,8 +366,15 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
const
[
form
]
=
Form
.
useForm
()
const
tableRef
=
React
.
useRef
()
const
tableDataRef
=
React
.
useRef
()
const
selectablePropertyTypeRef
=
React
.
useRef
()
selectablePropertyTypeRef
.
current
=
selectablePropertyTypes
React
.
useImperativeHandle
(
ref
,
()
=>
({
validate
:
async
()
=>
{
await
save
()
return
tableDataRef
.
current
},
}),
[
tableData
,
editingKey
])
React
.
useEffect
(()
=>
{
setSelectablePropertyTypes
(
...
...
@@ -400,6 +411,9 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
}
const
save
=
async
()
=>
{
selectablePropertyTypeRef
.
current
=
selectablePropertyTypes
tableDataRef
.
current
=
tableData
if
(
!
editingKey
)
return
try
{
...
...
@@ -420,9 +434,14 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
metadataType
:
propertyTypes
[
modelIndex
].
supportedMetadataTypes
[
metadataIndex
],
});
setTableData
(
newTableData
)
selectablePropertyTypeRef
.
current
=
(
propertyTypes
??[]).
filter
(
item
=>
(
newTableData
??[]).
map
(
_item
=>
_item
.
modelType
?.
name
).
indexOf
(
item
.
modelType
?.
name
)
===-
1
)
tableDataRef
.
current
=
newTableData
}
}
setEditingKey
()
}
catch
(
e
)
{
throw
new
Error
()
...
...
@@ -436,18 +455,19 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
await
save
()
const
currentSelectablePropertyTypes
=
[...
selectablePropertyTypeRef
.
current
??[]]
if
(
(
currentSelectablePropertyTypes
??[]).
length
>
0
&&
(
currentSelectablePropertyTypes
[
0
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
currentSelectablePropertyTypes
[
0
].
supportedMetadataTypes
??[]).
length
>
0
)
{
setTableData
(
prevTableData
=>
{
return
[...
prev
TableData
??[],
{
modelType
:
currentSelectablePropertyTypes
[
0
].
modelType
,
operatorType
:
currentSelectablePropertyTypes
[
0
].
supportedOperatorTypes
[
0
],
metadataType
:
currentSelectablePropertyTypes
[
0
].
supportedMetadataTypes
[
0
],
}]
}
)
let
newTableData
=
[...
tableDataRef
.
current
??[]]
newTableData
=
[...
new
TableData
??[],
{
modelType
:
currentSelectablePropertyTypes
[
0
].
modelType
,
operatorType
:
currentSelectablePropertyTypes
[
0
].
supportedOperatorTypes
[
0
],
metadataType
:
currentSelectablePropertyTypes
[
0
].
supportedMetadataTypes
[
0
],
}]
setTableData
(
newTableData
)
setEditingKey
(
currentSelectablePropertyTypes
[
0
].
modelType
?.
name
)
setEditingModelKey
(
currentSelectablePropertyTypes
[
0
].
modelType
?.
name
)
...
...
@@ -467,12 +487,13 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
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
);
return
newTableData
;
})
return
newTableData
})
const
index
=
(
selectedRows
??[]).
findIndex
(
item
=>
item
.
modelType
?.
type
===
editingKey
)
if
(
index
!==
-
1
)
{
setEditingKey
()
...
...
@@ -506,8 +527,8 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
let
newTableData
=
[...
prevTableData
??[]];
const
index
=
(
newTableData
??[]).
findIndex
(
item
=>
item
.
modelType
?.
name
===
record
?.
modelType
?.
name
);
(
newTableData
??[]).
splice
(
index
,
1
);
return
newTableData
;
})
return
newTableData
})
}
const
onRightMenuItemClick
=
(
key
,
record
)
=>
{
...
...
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