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
174dbf1c
Commit
174dbf1c
authored
Jan 22, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对比策略
parent
cc969f8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
172 additions
and
0 deletions
+172
-0
update-task.jsx
src/view/Manage/ModelCompare/update-task.jsx
+172
-0
No files found.
src/view/Manage/ModelCompare/update-task.jsx
View file @
174dbf1c
import
React
from
'react'
import
React
from
'react'
import
{
Button
,
Modal
,
Spin
,
Space
,
Divider
,
Form
,
Row
,
Col
,
Input
,
Select
,
Checkbox
,
Radio
,
Switch
,
TimePicker
}
from
'antd'
import
{
Button
,
Modal
,
Spin
,
Space
,
Divider
,
Form
,
Row
,
Col
,
Input
,
Select
,
Checkbox
,
Radio
,
Switch
,
TimePicker
}
from
'antd'
import
{
useClickAway
}
from
'ahooks'
import
moment
from
'moment'
import
moment
from
'moment'
import
{
dispatch
}
from
'../../../model'
import
{
dispatch
}
from
'../../../model'
import
Table
from
'../../../util/Component/Table'
const
FC
=
(
props
)
=>
{
const
FC
=
(
props
)
=>
{
const
{
visible
,
type
,
item
,
onCancel
}
=
props
const
{
visible
,
type
,
item
,
onCancel
}
=
props
...
@@ -11,6 +13,7 @@ const FC = (props) => {
...
@@ -11,6 +13,7 @@ const FC = (props) => {
const
[
task
,
setTask
]
=
React
.
useState
()
const
[
task
,
setTask
]
=
React
.
useState
()
const
basicFormRef
=
React
.
useRef
(
null
)
const
basicFormRef
=
React
.
useRef
(
null
)
const
strategyRef
=
React
.
useRef
(
null
)
const
scheduleFormRef
=
React
.
useRef
(
null
)
const
scheduleFormRef
=
React
.
useRef
(
null
)
const
title
=
React
.
useMemo
(()
=>
{
const
title
=
React
.
useMemo
(()
=>
{
...
@@ -123,6 +126,8 @@ const FC = (props) => {
...
@@ -123,6 +126,8 @@ const FC = (props) => {
<
Spin
spinning=
{
loading
||
waiting
}
>
<
Spin
spinning=
{
loading
||
waiting
}
>
<
Header
title=
'基本信息'
/>
<
Header
title=
'基本信息'
/>
<
BasicForm
ref=
{
basicFormRef
}
type=
{
type
}
task=
{
task
}
/>
<
BasicForm
ref=
{
basicFormRef
}
type=
{
type
}
task=
{
task
}
/>
<
Header
title=
'对比策略'
/>
<
Strategy
ref=
{
strategyRef
}
type=
{
type
}
task=
{
task
}
/>
<
Header
title=
'调度配置'
/>
<
Header
title=
'调度配置'
/>
<
ScheduleForm
ref=
{
scheduleFormRef
}
type=
{
type
}
task=
{
task
}
/>
<
ScheduleForm
ref=
{
scheduleFormRef
}
type=
{
type
}
task=
{
task
}
/>
</
Spin
>
</
Spin
>
...
@@ -343,6 +348,173 @@ const BasicForm = React.forwardRef(function ({ type, task }, ref) {
...
@@ -343,6 +348,173 @@ const BasicForm = React.forwardRef(function ({ type, task }, ref) {
)
)
})
})
const
Strategy
=
React
.
forwardRef
(
function
({
type
,
task
},
ref
)
{
const
[
loadingPropertyTypes
,
setLoadingPropertyTypes
]
=
React
.
useState
(
false
)
const
[
propertyTypes
,
setPropertyTypes
]
=
React
.
useState
()
const
[
selectedRows
,
setSelectedRows
]
=
React
.
useState
()
const
[
tableData
,
setTableData
]
=
React
.
useState
()
const
[
editingKey
,
setEditingKey
]
=
React
.
useState
(
''
)
const
[
form
]
=
Form
.
useForm
()
const
tableRef
=
React
.
useRef
()
const
isEditing
=
(
record
)
=>
record
.
modelType
?.
name
===
editingKey
useClickAway
(()
=>
{
save
()
},
tableRef
)
React
.
useEffect
(()
=>
{
if
(
type
===
'edit'
)
{
getPropertyTypes
()
}
},
[
type
])
const
selectablePropertyTypes
=
React
.
useMemo
(()
=>
{
return
(
propertyTypes
??[]).
filter
(
item
=>
(
tableData
??[]).
map
(
_item
=>
_item
.
modelType
?.
name
).
indexOf
(
item
.
modelType
?.
name
)
)
},
[
propertyTypes
,
tableData
])
const
getPropertyTypes
=
()
=>
{
setLoadingPropertyTypes
(
true
)
dispatch
({
type
:
'datamodel.getStrategyItemPropertyTypes'
,
callback
:
data
=>
{
setLoadingPropertyTypes
(
false
)
setPropertyTypes
(
data
)
},
error
:
()
=>
{
setLoadingPropertyTypes
(
false
)
}
})
}
const
save
=
async
()
=>
{
try
{
await
form
.
validateFields
()
}
catch
(
e
)
{
}
}
const
onRightMenuItemClick
=
(
key
,
record
)
=>
{
}
const
columns
=
[
{
title
:
'序号'
,
dataIndex
:
'index'
,
width
:
60
,
editable
:
false
,
render
:(
_
,
__
,
index
)
=>
((
args
.
page
-
1
)
*
args
.
size
+
index
+
1
)
},
{
title
:
'模型属性'
,
dataIndex
:
'modelType'
,
editable
:
true
,
render
:
(
_
,
record
)
=>
record
.
modelType
?.
name
},
{
title
:
'匹配规则'
,
dataIndex
:
'operatorType'
,
editable
:
true
,
render
:
(
_
,
record
)
=>
record
.
operatorType
?.
name
},
{
title
:
'元数据属性'
,
dataIndex
:
'metadataType'
,
editable
:
true
,
render
:
(
_
,
record
)
=>
record
.
metadataType
?.
name
},
]
const
mergedColumns
=
columns
.
map
((
col
)
=>
{
if
(
!
col
.
editable
)
{
return
col
;
}
return
{
...
col
,
onCell
:
(
record
)
=>
({
record
,
inputType
:
'select'
,
dataIndex
:
col
.
dataIndex
,
title
:
col
.
title
,
editing
:
isEditing
(
record
),
}),
}
})
return
(
<
Spin
spinning=
{
loadingPropertyTypes
}
>
<
div
>
<
Space
>
<
Button
>
新建
</
Button
>
<
Button
>
删除
</
Button
>
</
Space
>
<
div
ref=
{
tableRef
}
>
<
Form
form=
{
form
}
component=
{
false
}
>
<
Table
extraColWidth=
{
32
}
columns=
{
mergedColumns
??[]
}
dataSource=
{
tableData
??[]
}
bodyCell=
{
EditableCell
}
rowSelection=
{
{
selectedRowKeys
:
(
selectedRows
??[]).
map
(
item
=>
item
.
id
),
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
setSelectedRows
(
selectedRows
)
},
}
}
pagination=
{
false
}
shouldRowContextMenu=
{
(
record
)
=>
{
return
true
}
}
menuData=
{
[
'执行'
,
'编辑'
,
'删除'
]
}
menuPermissions=
{
[
'执行'
,
'编辑'
,
'删除'
]
}
onMenuItemClick=
{
onRightMenuItemClick
}
/>
</
Form
>
</
div
>
</
div
>
</
Spin
>
)
})
const
EditableCell
=
({
editing
,
dataIndex
,
title
,
record
,
index
,
inputNode
,
children
,
...
restProps
})
=>
{
return
(
<
td
{
...
restProps
}
>
{
editing
?
(
<
Form
.
Item
name=
{
dataIndex
}
style=
{
{
margin
:
0
,
}
}
rules=
{
[
{
required
:
true
,
message
:
`请选择${title}`
,
},
]
}
>
{
inputNode
}
</
Form
.
Item
>
)
:
(
children
)
}
</
td
>
);
}
const
ScheduleForm
=
React
.
forwardRef
(
function
({
type
,
task
},
ref
)
{
const
ScheduleForm
=
React
.
forwardRef
(
function
({
type
,
task
},
ref
)
{
const
[
scheduleEnable
,
setScheduleEnable
]
=
React
.
useState
(
false
)
const
[
scheduleEnable
,
setScheduleEnable
]
=
React
.
useState
(
false
)
...
...
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