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
bcdf426a
Commit
bcdf426a
authored
Jan 25, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
bb55b171
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
33 deletions
+44
-33
update-task.jsx
src/view/Manage/ModelCompare/update-task.jsx
+44
-33
No files found.
src/view/Manage/ModelCompare/update-task.jsx
View file @
bcdf426a
...
...
@@ -357,10 +357,21 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
const
[
tableData
,
setTableData
]
=
React
.
useState
()
const
[
editingKey
,
setEditingKey
]
=
React
.
useState
(
''
)
const
[
editingModelKey
,
setEditingModelKey
]
=
React
.
useState
(
''
)
const
[
selectablePropertyTypes
,
setSelectablePropertyTypes
]
=
React
.
useState
()
const
[
form
]
=
Form
.
useForm
()
const
tableRef
=
React
.
useRef
()
const
selectablePropertyTypesRef
=
React
.
useRef
()
const
selectablePropertyTypeRef
=
React
.
useRef
()
selectablePropertyTypeRef
.
current
=
selectablePropertyTypes
React
.
useEffect
(()
=>
{
setSelectablePropertyTypes
(
(
propertyTypes
??[]).
filter
(
item
=>
(
tableData
??[]).
map
(
_item
=>
_item
.
modelType
?.
name
).
indexOf
(
item
.
modelType
?.
name
)
===-
1
||
item
.
modelType
?.
name
===
editingKey
)
)
},
[
propertyTypes
,
tableData
,
editingKey
])
const
isEditing
=
(
record
)
=>
record
.
modelType
?.
name
===
editingKey
...
...
@@ -402,16 +413,13 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
const
metadataIndex
=
(
propertyTypes
[
modelIndex
].
supportedMetadataTypes
??[]).
findIndex
(
item
=>
item
.
name
===
rows
.
metadataType
)
if
(
operatorIndex
!==
-
1
&&
metadataIndex
!==
-
1
)
{
setTableData
(
prevTableData
=>
{
let
newTableData
=
[...
prevTableData
??[]];
(
newTableData
??[]).
splice
(
index
,
1
,
{
modelType
:
propertyTypes
[
modelIndex
].
modelType
,
operatorType
:
propertyTypes
[
modelIndex
].
supportedOperatorTypes
[
operatorIndex
],
metadataType
:
propertyTypes
[
modelIndex
].
supportedMetadataTypes
[
metadataIndex
],
});
return
newTableData
;
})
const
newTableData
=
[...
tableData
??[]];
(
newTableData
??[]).
splice
(
index
,
1
,
{
modelType
:
propertyTypes
[
modelIndex
].
modelType
,
operatorType
:
propertyTypes
[
modelIndex
].
supportedOperatorTypes
[
operatorIndex
],
metadataType
:
propertyTypes
[
modelIndex
].
supportedMetadataTypes
[
metadataIndex
],
});
setTableData
(
newTableData
)
}
}
...
...
@@ -427,30 +435,31 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
try
{
await
save
()
const
currentSelectablePropertyTypes
=
[...
selectablePropertyTypeRef
.
current
??[]]
if
(
(
selectablePropertyTypesRef
.
current
??[]).
length
>
0
&&
(
selectablePropertyTypesRef
.
current
[
0
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypesRef
.
current
[
0
].
supportedMetadataTypes
??[]).
length
>
0
(
currentSelectablePropertyTypes
??[]).
length
>
0
&&
(
currentSelectablePropertyTypes
[
0
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
currentSelectablePropertyTypes
[
0
].
supportedMetadataTypes
??[]).
length
>
0
)
{
const
selectablePropertyTypes
=
[...
selectablePropertyTypesRef
.
current
??[]]
setTableData
(
prevTableData
=>
{
return
[...
prevTableData
??[],
{
modelType
:
s
electablePropertyTypes
[
0
].
modelType
,
operatorType
:
s
electablePropertyTypes
[
0
].
supportedOperatorTypes
[
0
],
metadataType
:
s
electablePropertyTypes
[
0
].
supportedMetadataTypes
[
0
],
modelType
:
currentS
electablePropertyTypes
[
0
].
modelType
,
operatorType
:
currentS
electablePropertyTypes
[
0
].
supportedOperatorTypes
[
0
],
metadataType
:
currentS
electablePropertyTypes
[
0
].
supportedMetadataTypes
[
0
],
}]
})
setEditingKey
(
s
electablePropertyTypes
[
0
].
modelType
?.
name
)
setEditingModelKey
(
s
electablePropertyTypes
[
0
].
modelType
?.
name
)
setEditingKey
(
currentS
electablePropertyTypes
[
0
].
modelType
?.
name
)
setEditingModelKey
(
currentS
electablePropertyTypes
[
0
].
modelType
?.
name
)
form
?.
setFieldsValue
({
modelType
:
s
electablePropertyTypes
[
0
].
modelType
?.
name
,
operatorType
:
s
electablePropertyTypes
[
0
].
supportedOperatorTypes
[
0
].
id
,
metadataType
:
s
electablePropertyTypes
[
0
].
supportedMetadataTypes
[
0
].
name
,
modelType
:
currentS
electablePropertyTypes
[
0
].
modelType
?.
name
,
operatorType
:
currentS
electablePropertyTypes
[
0
].
supportedOperatorTypes
[
0
].
id
,
metadataType
:
currentS
electablePropertyTypes
[
0
].
supportedMetadataTypes
[
0
].
name
,
})
}
else
{
showMessage
(
'warn'
,
'模型属性都设置了策略'
)
}
}
catch
(
e
)
{
}
...
...
@@ -477,6 +486,12 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
setEditingKey
(
record
?.
modelType
?.
name
)
setEditingModelKey
(
record
?.
modelType
?.
name
)
form
?.
setFieldsValue
({
modelType
:
record
?.
modelType
?.
name
,
operatorType
:
record
?.
operatorType
?.
id
,
metadataType
:
record
?.
metadataType
?.
name
,
})
}
catch
(
e
)
{
}
...
...
@@ -504,14 +519,14 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
if
(
changedValues
.
hasOwnProperty
(
'modelType'
))
{
setEditingModelKey
(
changedValues
[
'modelType'
])
const
index
=
(
selectablePropertyTypes
Ref
.
current
??[]).
findIndex
(
item
=>
item
.
modelType
?.
name
===
changedValues
[
'modelType'
])
const
index
=
(
selectablePropertyTypes
??[]).
findIndex
(
item
=>
item
.
modelType
?.
name
===
changedValues
[
'modelType'
])
if
(
index
!==
-
1
&&
(
selectablePropertyTypes
Ref
.
current
[
index
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
Ref
.
current
[
index
].
supportedMetadataTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
[
index
].
supportedOperatorTypes
??[]).
length
>
0
&&
(
selectablePropertyTypes
[
index
].
supportedMetadataTypes
??[]).
length
>
0
)
{
form
?.
setFieldsValue
({
operatorType
:
selectablePropertyTypes
Ref
.
current
[
index
].
supportedOperatorTypes
[
0
].
id
,
metadataType
:
selectablePropertyTypes
Ref
.
current
[
index
].
supportedMetadataTypes
[
0
].
name
,
operatorType
:
selectablePropertyTypes
[
index
].
supportedOperatorTypes
[
0
].
id
,
metadataType
:
selectablePropertyTypes
[
index
].
supportedMetadataTypes
[
0
].
name
,
})
}
}
...
...
@@ -557,15 +572,11 @@ const Strategy = React.forwardRef(function ({ type, task }, ref) {
title
:
col
.
title
,
editing
:
isEditing
(
record
),
editingModelKey
,
propertyTypes
:
selectablePropertyTypes
Ref
.
current
,
propertyTypes
:
selectablePropertyTypes
,
}),
}
})
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
>
...
...
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