|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState } from 'react'
|
|
|
-import { Form, Select, Button, Space } from 'antd'
|
|
|
+import { Form, Select, Button, Space, message } from 'antd'
|
|
|
import TaskForm from './TaskForm'
|
|
|
import TaskChartEditor from './TaskChartEditor'
|
|
|
import styled from 'styled-components'
|
|
@@ -43,16 +43,40 @@ const { Option } = Select
|
|
|
const TaskCreaterView = () => {
|
|
|
// 路由导航
|
|
|
const navigate = useNavigate()
|
|
|
-
|
|
|
const [taskType, setTaskType] = useState(null)
|
|
|
+ const [graphRef, setGraphRef] = useState(null)
|
|
|
const [taskTypeForm] = Form.useForm()
|
|
|
const [taskForm] = Form.useForm()
|
|
|
const onTaskTypeChange = value => {
|
|
|
setTaskType(value)
|
|
|
}
|
|
|
const onSubmit = () => {
|
|
|
- navigate(-1)
|
|
|
+ const cells = graphRef?.state.taskGraph.getCells()
|
|
|
+ const taskFormData = taskForm.getFieldsValue()
|
|
|
+ taskForm
|
|
|
+ .validateFields()
|
|
|
+ .then(() => {
|
|
|
+ const params = {
|
|
|
+ name: taskFormData.taskName,
|
|
|
+ type: taskType === 'singleTask' ? '单作业离线任务' : '多作业离线任务',
|
|
|
+ tag: taskFormData.taskTag,
|
|
|
+ cron_type: taskFormData.executionCycle,
|
|
|
+ user_id: 'test',
|
|
|
+ user_name: 'test',
|
|
|
+ project_id: 'test',
|
|
|
+ }
|
|
|
+ console.log('###', cells, taskFormData, params)
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ message.error('请检查表单数据是否完整')
|
|
|
+ })
|
|
|
+ // navigate(-1)
|
|
|
+ }
|
|
|
+
|
|
|
+ const onGraphRef = ref => {
|
|
|
+ setGraphRef(ref)
|
|
|
}
|
|
|
+
|
|
|
return (
|
|
|
<TaskCreater>
|
|
|
<div className="tasktype_label">配置任务类型:</div>
|
|
@@ -75,7 +99,7 @@ const TaskCreaterView = () => {
|
|
|
{taskType === 'multitasking' && (
|
|
|
<div className="tasktype_label">作业编排:</div>
|
|
|
)}
|
|
|
- {taskType === 'multitasking' && <TaskChartEditor />}
|
|
|
+ {taskType === 'multitasking' && <TaskChartEditor onRef={onGraphRef} />}
|
|
|
<Space className="tasktype_btns">
|
|
|
<Button onClick={() => navigate(-1)}>取消</Button>
|
|
|
<Button onClick={onSubmit}>提交</Button>
|