From 6c44bc79e5edc338b44fdc469220ddf0e3fc4028 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 14 九月 2021 22:51:27 +0800
Subject: [PATCH] 2021-09-14

---
 src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx |  131 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 116 insertions(+), 15 deletions(-)

diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx
index 53ea2eb..055561e 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx
@@ -1,14 +1,16 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Radio, Tooltip, Icon, notification, Select } from 'antd'
+import { Form, Row, Col, Input, Radio, Tooltip, Icon, notification, Select, InputNumber } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
 import { formRule } from '@/utils/option.js'
 import Utils from '@/utils/utils.js'
-import CodeMirror from '@/templates/zshare/codemirror'
+import asyncComponent from '@/utils/asyncComponent'
 import './index.scss'
 
+const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror'))
+const MKColor = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkColor'))
 const { TextArea } = Input
 
 class SettingForm extends Component {
@@ -19,11 +21,12 @@
     setting: PropTypes.object,    // 鏁版嵁婧愰厤缃�
     columns: PropTypes.array,     // 鍒楄缃�
     scripts: PropTypes.array,     // 鑷畾涔夎剼鏈�
+    updateStatus: PropTypes.func, // 鐘舵�佹洿鏂�
   }
 
   state = {
     interType: 'system',
-    procMode: 'system',
+    procMode: 'script',
     requestMode: 'system',
     funcTooltip: '',
     funcRules: []
@@ -36,7 +39,7 @@
     if (usefulFields) {
       try {
         usefulFields = JSON.parse(usefulFields)
-      } catch {
+      } catch (e) {
         usefulFields = []
       }
     } else {
@@ -59,7 +62,7 @@
 
     this.setState({
       interType: setting.interType || 'system',
-      procMode: setting.procMode || 'system',
+      procMode: setting.procMode || 'script',
       requestMode: setting.requestMode || 'system',
       funcTooltip: tooltip,
       funcRules: rules
@@ -175,6 +178,7 @@
         interface: window.GLOB.mainSystemApi || ''
       })
     }
+    this.props.updateStatus({[key]: value})
   }
 
   primaryKeyChange = (val) => {
@@ -214,6 +218,10 @@
                       required: true,
                       message: dict['form.required.input'] + '琛ㄥ悕!'
                     },
+                    {
+                      max: 50,
+                      message: '琛ㄥ悕鏈�闀夸负50涓瓧绗�!'
+                    }
                   ]
                 })(<Input placeholder={''} autoComplete="off" />)}
               </Form.Item>
@@ -279,7 +287,7 @@
                   ]
                 })(
                 <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onRadioChange(e, 'procMode')}}>
-                  <Radio value="system">鍓嶇疆鑴氭湰</Radio>
+                  <Radio value="script">鍓嶇疆鑴氭湰</Radio>
                   <Radio value="inner">鍓嶇疆鍑芥暟</Radio>
                 </Radio.Group>)}
               </Form.Item>
@@ -291,8 +299,8 @@
                   鍓嶇疆鍑芥暟
                 </Tooltip>
               }>
-                {getFieldDecorator('innerFunc', {
-                  initialValue: setting.innerFunc || '',
+                {getFieldDecorator('prevFunc', {
+                  initialValue: setting.prevFunc || '',
                   rules: [
                     {
                       required: true,
@@ -308,19 +316,19 @@
               </Form.Item>
             </Col> : null}
             {interType === 'outer' || interType === 'custom' ? <Col className="data-source" span={24}>
-              <Form.Item label="鎺ュ彛鍦板潃">
+              <Form.Item label="娴嬭瘯鍦板潃">
                 {getFieldDecorator('interface', {
                   initialValue: setting.interface || '',
                   rules: [
                     {
                       required: true,
-                      message: dict['form.required.input'] + '鎺ュ彛鍦板潃!'
+                      message: dict['form.required.input'] + '娴嬭瘯鍦板潃!'
                     },
                   ]
                 })(<TextArea rows={2} />)}
               </Form.Item>
             </Col> : null}
-            {interType === 'custom' ? <Col className="data-source" span={24}>
+            {interType === 'outer' || interType === 'custom' ? <Col className="data-source" span={24}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title="姝e紡绯荤粺鎵�浣跨敤鐨勭殑鎺ュ彛鍦板潃銆�">
                   <Icon type="question-circle" />
@@ -330,6 +338,23 @@
                 {getFieldDecorator('proInterface', {
                   initialValue: setting.proInterface || ''
                 })(<TextArea rows={2} />)}
+              </Form.Item>
+            </Col> : null}
+            {interType === 'custom' ? <Col span={12}>
+              <Form.Item label="璇锋眰鏂瑰紡">
+                {getFieldDecorator('method', {
+                  initialValue: setting.method || 'post',
+                  rules: [
+                    {
+                      required: true,
+                      message: dict['form.required.select'] + '璇锋眰鏂瑰紡!'
+                    },
+                  ]
+                })(
+                <Radio.Group>
+                  <Radio value="get">GET</Radio>
+                  <Radio value="post">POST</Radio>
+                </Radio.Group>)}
               </Form.Item>
             </Col> : null}
             {interType === 'custom' ? <Col span={12}>
@@ -390,7 +415,7 @@
             </Col> : null}
             {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}>
               <Form.Item help={'鏁版嵁ID锛�' + menu.MenuID} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } label={
-                <Tooltip placement="topLeft" title={'浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� \'\'銆� @$ -> */ 鎴� \'\''}>
+                <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''锛涙煡璇㈡浛鎹㈢ $select@ -> /* 鎴� ''銆� @select$ -> */ 鎴� ''锛涚粺璁℃浛鎹㈢ $sum@ -> /* 鎴� ''銆� @sum$ -> */ 鎴� ''銆俙}>
                   <Icon type="question-circle" />
                   鏁版嵁婧�
                 </Tooltip>
@@ -446,7 +471,7 @@
             <Col span={12}>
               <Form.Item label="榛樿鎺掑簭">
                 {getFieldDecorator('order', {
-                  initialValue: setting.order || '',
+                  initialValue: setting.order || 'ID desc',
                   rules: [
                     {
                       required: true,
@@ -463,12 +488,29 @@
             {interType === 'custom' ? <Col span={12}>
               <Form.Item label="鍥炶皟鏂瑰紡">
                 {getFieldDecorator('callbackType', {
-                  initialValue: setting.callbackType || 'default'
+                  initialValue: setting.callbackType || 'script'
                 })(
-                <Radio.Group>
+                <Radio.Group onChange={(e) => {this.onRadioChange(e, 'callbackType')}}>
                   <Radio value="default">榛樿鑴氭湰</Radio>
                   <Radio value="script">鑷畾涔夎剼鏈�</Radio>
                 </Radio.Group>)}
+              </Form.Item>
+            </Col> : null}
+            {interType === 'custom' ? <Col span={12}>
+              <Form.Item label="鍥炶皟琛ㄥ悕">
+                {getFieldDecorator('cbTable', {
+                  initialValue: setting.cbTable || '',
+                  rules: [
+                    {
+                      required: true,
+                      message: dict['form.required.input'] + '鍥炶皟琛ㄥ悕!'
+                    },
+                    {
+                      max: formRule.input.max,
+                      message: formRule.input.message
+                    }
+                  ]
+                })(<Input placeholder={''} autoComplete="off" />)}
               </Form.Item>
             </Col> : null}
             {interType === 'custom' ? <Col span={12}>
@@ -484,6 +526,22 @@
                 <Radio.Group>
                   <Radio value="sync">鍚屾</Radio>
                   <Radio value="async">寮傛</Radio>
+                </Radio.Group>)}
+              </Form.Item>
+            </Col> : null}
+            {interType === 'custom' ? <Col span={12}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title={'濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�'}>
+                  <Icon type="question-circle" />
+                  璺ㄥ煙璇锋眰
+                </Tooltip>
+              }>
+                {getFieldDecorator('cross', {
+                  initialValue: setting.cross || 'true'
+                })(
+                <Radio.Group>
+                  <Radio value="true">鏀寔</Radio>
+                  <Radio value="false">涓嶆敮鎸�</Radio>
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
@@ -560,6 +618,18 @@
             </Col>
             <Col span={12}>
               <Form.Item label={
+                <Tooltip placement="topLeft" title="楂樼骇鎼滅储寮圭獥鐨勫搴︼紝娉細褰撳搴﹀�煎皬浜�100鏃惰〃绀哄崰绐楀彛鐨勭櫨鍒嗘瘮锛屽ぇ浜�100鏃惰〃绀哄搴︾殑缁濆鍊笺��">
+                  <Icon type="question-circle" />
+                  楂樼骇鎼滅储
+                </Tooltip>
+              }>
+                {getFieldDecorator('advanceWidth', {
+                  initialValue: setting.advanceWidth || 1000
+                })(<InputNumber min={10} max={3000} precision={0}/>)}
+              </Form.Item>
+            </Col>
+            <Col span={12}>
+              <Form.Item label={
                 <Tooltip placement="topLeft" title="鍙屽嚮琛ㄦ牸涓锛岃Е鍙戠殑鎸夐挳銆�">
                   <Icon type="question-circle" />
                   鍙屽嚮浜嬩欢
@@ -576,6 +646,37 @@
                 )}
               </Form.Item>
             </Col>
+            <Col span={12}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="绌哄�兼椂楂樺害鑷�傚簲銆�">
+                  <Icon type="question-circle" />
+                  table楂樺害
+                </Tooltip>
+              }>
+                {getFieldDecorator('height', {
+                  initialValue: setting.height
+                })(<InputNumber min={10} max={3000} precision={0}/>)}
+              </Form.Item>
+            </Col>
+            <Col span={12}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="榛樿鍊紃gba(0, 0, 0, 0.65)">
+                  <Icon type="question-circle" />
+                  瀛椾綋棰滆壊
+                </Tooltip>
+              }>
+                {getFieldDecorator('color', {
+                  initialValue: setting.color
+                })(<MKColor config={{initval: setting.color || 'rgba(0, 0, 0, 0.65)'}} />)}
+              </Form.Item>
+            </Col>
+            <Col span={12}>
+              <Form.Item label="瀛椾綋澶у皬">
+                {getFieldDecorator('fontSize', {
+                  initialValue: setting.fontSize || 14
+                })(<InputNumber min={12} max={50} precision={0}/>)}
+              </Form.Item>
+            </Col>
           </Row>
         </Form>
       </div>

--
Gitblit v1.8.0