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 |  104 ++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 85 insertions(+), 19 deletions(-)

diff --git a/src/templates/zshare/unattended/settingform/index.jsx b/src/templates/zshare/unattended/settingform/index.jsx
index b023ff9..b8b2e47 100644
--- a/src/templates/zshare/unattended/settingform/index.jsx
+++ b/src/templates/zshare/unattended/settingform/index.jsx
@@ -1,6 +1,7 @@
 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'
 
@@ -11,7 +12,8 @@
   }
 
   state = {
-    enable: this.props.autoMatic.enable
+    enable: this.props.autoMatic.enable,
+    onFinish: this.props.autoMatic.onFinish || 'over'
   }
 
   handleConfirm = () => {
@@ -30,7 +32,7 @@
   render() {
     const { actions, autoMatic } = this.props
     const { getFieldDecorator } = this.props.form
-    const { enable } = this.state
+    const { enable, onFinish } = this.state
 
     const formItemLayout = {
       labelCol: {
@@ -46,7 +48,7 @@
     return (
       <Form {...formItemLayout}>
         <Row gutter={24}>
-          <Col span={20}>
+          <Col span={12}>
             <Form.Item label="鏄惁鍚敤">
               {getFieldDecorator('enable', {
                 initialValue: autoMatic.enable,
@@ -58,17 +60,17 @@
               )}
             </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>
             }>
               {getFieldDecorator('action', {
                 initialValue: autoMatic.action || '',
                 rules: [{
-                  required: enable === 'true',
+                  required: true,
                   message: '璇烽�夋嫨鎵ц鎸夐挳锛�'
                 }]
               })(
@@ -79,25 +81,89 @@
                 </Select>
               )}
             </Form.Item>
-          </Col>
-          <Col span={20}>
+          </Col> : null}
+          {enable === 'true' ? <Col span={12}>
             <Form.Item label={
-              <Tooltip placement="topLeft" title="鎸夐挳鎵ц澶辫触鏃讹紝鍚庣画鐨勫鐞嗘柟寮忋��">
-                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}} />
-                鎶ラ敊鏃�
+              <Tooltip placement="topLeft" title="鎸夐挳鎵ц鎴愬姛锛屽悗缁殑澶勭悊鏂瑰紡銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鎴愬姛鍚�
               </Tooltip>
             }>
-              {getFieldDecorator('onFail', {
-                initialValue: autoMatic.onFail,
+              {getFieldDecorator('onSuccess', {
+                initialValue: autoMatic.onSuccess || 'stay',
               })(
-                <Radio.Group onChange={(e) => this.setState({enable: e.target.value})}>
-                  <Radio value="stop">鍋滄</Radio>
-                  <Radio value="skip">璺宠繃</Radio>
-                  <Radio value="again">閲嶆柊鎵ц</Radio>
+                <Radio.Group>
+                  <Radio value="next">涓嬩竴琛�</Radio>
+                  <Radio value="stay">褰撳墠琛�</Radio>
                 </Radio.Group>
               )}
             </Form.Item>
-          </Col>
+          </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>
     )

--
Gitblit v1.8.0