From 0c84df247914f893ef5e41d57a422e10a2dc814c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 12 十一月 2021 17:02:06 +0800
Subject: [PATCH] 2021-11-12

---
 src/templates/zshare/unattended/settingform/index.jsx |  105 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 96 insertions(+), 9 deletions(-)

diff --git a/src/templates/zshare/unattended/settingform/index.jsx b/src/templates/zshare/unattended/settingform/index.jsx
index 5191f35..b8b2e47 100644
--- a/src/templates/zshare/unattended/settingform/index.jsx
+++ b/src/templates/zshare/unattended/settingform/index.jsx
@@ -1,16 +1,20 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Tooltip, Icon, Select, Radio } from 'antd'
+import { Form, Row, Col, Tooltip, Select, Radio, InputNumber } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 
 // import './index.scss'
 
-class SettingForm extends Component {
+class UnattenSettingForm extends Component {
   static propTpyes = {
     autoMatic: PropTypes.object,
     actions: PropTypes.array
   }
 
-  state = {}
+  state = {
+    enable: this.props.autoMatic.enable,
+    onFinish: this.props.autoMatic.onFinish || 'over'
+  }
 
   handleConfirm = () => {
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -28,6 +32,7 @@
   render() {
     const { actions, autoMatic } = this.props
     const { getFieldDecorator } = this.props.form
+    const { enable, onFinish } = this.state
 
     const formItemLayout = {
       labelCol: {
@@ -43,22 +48,22 @@
     return (
       <Form {...formItemLayout}>
         <Row gutter={24}>
-          <Col span={20}>
+          <Col span={12}>
             <Form.Item label="鏄惁鍚敤">
               {getFieldDecorator('enable', {
                 initialValue: autoMatic.enable,
               })(
-                <Radio.Group>
+                <Radio.Group onChange={(e) => this.setState({enable: e.target.value})}>
                   <Radio value="true">鏄�</Radio>
                   <Radio value="false">鍚�</Radio>
                 </Radio.Group>
               )}
             </Form.Item>
           </Col>
-          <Col span={20}>
+          {enable === 'true' ? <Col span={12}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="鐢ㄤ簬鑷姩鎵ц鐨勬寜閽��">
-                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}} />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 鎸夐挳
               </Tooltip>
             }>
@@ -76,11 +81,93 @@
                 </Select>
               )}
             </Form.Item>
-          </Col>
+          </Col> : null}
+          {enable === 'true' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鎸夐挳鎵ц鎴愬姛锛屽悗缁殑澶勭悊鏂瑰紡銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鎴愬姛鍚�
+              </Tooltip>
+            }>
+              {getFieldDecorator('onSuccess', {
+                initialValue: autoMatic.onSuccess || 'stay',
+              })(
+                <Radio.Group>
+                  <Radio value="next">涓嬩竴琛�</Radio>
+                  <Radio value="stay">褰撳墠琛�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {enable === 'true' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鎸夐挳鎵ц澶辫触鏃讹紝鍚庣画鐨勫鐞嗘柟寮忋��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                澶辫触鍚�
+              </Tooltip>
+            }>
+              {getFieldDecorator('onFail', {
+                initialValue: autoMatic.onFail || 'stop',
+              })(
+                <Radio.Group style={{whiteSpace: 'nowrap'}}>
+                  <Radio value="next">涓嬩竴琛�</Radio>
+                  <Radio value="stay">褰撳墠琛�</Radio>
+                  <Radio value="stop">鍋滄</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {enable === 'true' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鐩搁偦涓ゆ潯鏁版嵁锛屾墽琛屾椂鐨勯棿闅旀椂闂达紝鏈�灏忎负1s銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鏁版嵁闂撮殧(s)
+              </Tooltip>
+            }>
+              {getFieldDecorator('gap', {
+                initialValue: autoMatic.gap || 2,
+              })(
+                <InputNumber style={{width: '100%'}} min={1} precision={0}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {enable === 'true' ? <Col span={12}>
+            <Form.Item label="瀹屾垚鍚�">
+              {getFieldDecorator('onFinish', {
+                initialValue: autoMatic.onFinish || 'over',
+              })(
+                <Radio.Group onChange={(e) => this.setState({onFinish: e.target.value})}>
+                  <Radio value="over">缁撴潫</Radio>
+                  <Radio value="restart">閲嶆柊鍚姩</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {enable === 'true' && onFinish === 'restart' ? <Col span={12}>
+            <Form.Item label="鍚姩闂撮殧(s)">
+              {getFieldDecorator('interval', {
+                initialValue: autoMatic.interval === 0 ? 0 : (autoMatic.interval || 600),
+              })(
+                <InputNumber style={{width: '100%'}} min={0} precision={0}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {enable === 'true' && onFinish === 'restart' ? <Col span={12}>
+            <Form.Item label="閲嶅惎鏃�">
+              {getFieldDecorator('restart', {
+                initialValue: autoMatic.restart || 'first',
+              })(
+                <Radio.Group>
+                  <Radio value="first">绗竴琛�</Radio>
+                  <Radio value="next">涓嬩竴琛�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
         </Row>
       </Form>
     )
   }
 }
 
-export default Form.create()(SettingForm)
\ No newline at end of file
+export default Form.create()(UnattenSettingForm)
\ No newline at end of file

--
Gitblit v1.8.0