|
@@ -0,0 +1,97 @@
|
|
|
+import React, { useState } from 'react'
|
|
|
+import styled from 'styled-components'
|
|
|
+import { Form, Select, Input, Radio, Space } from 'antd'
|
|
|
+
|
|
|
+const FormWrapper = styled.div`
|
|
|
+ .singletask_form {
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ .form_executionCycle {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+`
|
|
|
+
|
|
|
+const FormItem = Form.Item
|
|
|
+
|
|
|
+const { Option } = Select
|
|
|
+
|
|
|
+const RadioGroup = Radio.Group
|
|
|
+
|
|
|
+const layout = {
|
|
|
+ labelCol: {
|
|
|
+ span: 2,
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ span: 8,
|
|
|
+ },
|
|
|
+}
|
|
|
+
|
|
|
+const TaskForm = ({ taskForm, taskType }) => {
|
|
|
+ const [radioValue, setRadioValue] = useState(null)
|
|
|
+
|
|
|
+ const onRadioChange = e => {
|
|
|
+ setRadioValue(e.target.value)
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <FormWrapper>
|
|
|
+ <Form {...layout} form={taskForm} className="singletask_form">
|
|
|
+ <FormItem
|
|
|
+ name="taskName"
|
|
|
+ label="任务名称"
|
|
|
+ rules={[{ required: true, message: '请输入任务名称!' }]}>
|
|
|
+ <Input />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ name="taskTag"
|
|
|
+ label="任务分类"
|
|
|
+ rules={[{ required: true, message: '请选择任务分类!' }]}>
|
|
|
+ <Select placeholder="选择任务分类" allowClear>
|
|
|
+ <Option value="1">业务预测</Option>
|
|
|
+ <Option value="2">监测</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ {taskType !== 'multitasking' && (
|
|
|
+ <FormItem
|
|
|
+ name="job"
|
|
|
+ label="选择作业"
|
|
|
+ rules={[{ required: true, message: '请选择作业!' }]}>
|
|
|
+ <Select placeholder="选择作业" allowClear>
|
|
|
+ <Option value="1">作业1</Option>
|
|
|
+ <Option value="2">作业2</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ <FormItem
|
|
|
+ name="executionCycle"
|
|
|
+ label="设置执行周期"
|
|
|
+ rules={[{ required: true, message: '请设置执行周期!' }]}>
|
|
|
+ <RadioGroup onChange={onRadioChange}>
|
|
|
+ <Space direction="vertical">
|
|
|
+ <Radio value={1}>只执行一次,下次手动执行</Radio>
|
|
|
+ <Radio value={2}>
|
|
|
+ 执行周期
|
|
|
+ {radioValue === 2 ? (
|
|
|
+ <Space className="form_executionCycle">
|
|
|
+ <span>每</span>
|
|
|
+ <input />
|
|
|
+ <Select placeholder="选择数" allowClear>
|
|
|
+ <Option value="min">分</Option>
|
|
|
+ <Option value="hour">时</Option>
|
|
|
+ <Option value="day">日</Option>
|
|
|
+ <Option value="week">周</Option>
|
|
|
+ <Option value="month">月</Option>
|
|
|
+ </Select>
|
|
|
+ <span>执行1次</span>
|
|
|
+ </Space>
|
|
|
+ ) : null}
|
|
|
+ </Radio>
|
|
|
+ </Space>
|
|
|
+ </RadioGroup>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </FormWrapper>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+export default TaskForm
|