From b8e1395f02c929eaa96b949cf6027ee2a43856a6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 九月 2022 19:03:37 +0800
Subject: [PATCH] 2022-09-06

---
 src/templates/sharecomponent/columncomponent/columnform/index.jsx |   97 +++++++++++++++++++++++++++---------------------
 1 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/src/templates/sharecomponent/columncomponent/columnform/index.jsx b/src/templates/sharecomponent/columncomponent/columnform/index.jsx
index c7ff675..ec356a5 100644
--- a/src/templates/sharecomponent/columncomponent/columnform/index.jsx
+++ b/src/templates/sharecomponent/columncomponent/columnform/index.jsx
@@ -1,16 +1,20 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader } from 'antd'
+import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { formRule } from '@/utils/option.js'
 import './index.scss'
 
+const { TextArea } = Input
 const columnTypeOptions = {
   text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'fieldlength', 'blacklist', 'perspective', 'rowspan'],
-  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum'],
+  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'],
   link: ['label', 'field', 'type', 'nameField', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'fieldlength', 'blacklist'],
   textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'fieldlength', 'blacklist'],
-  picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'maxHeight']
+  picture: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'span'], 
+  video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'fieldlength', 'blacklist', 'aspectRatio'],
+  index: ['label', 'type', 'Align', 'Width']
 }
 
 class MainSearch extends Component {
@@ -34,10 +38,10 @@
 
     let _options = JSON.parse(JSON.stringify(columnTypeOptions[card.type]))
     if (card.type === 'text' || card.type === 'number') {
-      if (card.perspective !== 'linkurl') {
-        _options.push('linkmenu')
-      } else {
-        _options.push('linkurl')
+      if (card.perspective === 'linkmenu') {
+        _options.push('linkmenu', 'linkfields')
+      } else if (card.perspective === 'linkurl') {
+        _options.push('linkurl', 'linkfields')
       }
     }
 
@@ -62,7 +66,7 @@
       try {
         let _form = document.getElementById('label')
         _form.select()
-      } catch {
+      } catch (e) {
         console.warn('琛ㄥ崟focus澶辫触锛�')
       }
     }
@@ -74,10 +78,10 @@
       let _options = JSON.parse(JSON.stringify(columnTypeOptions[value]))
 
       if (card.type === 'text' || card.type === 'number') {
-        if (card.perspective !== 'linkurl') {
-          _options.push('linkmenu')
-        } else {
-          _options.push('linkurl')
+        if (card.perspective === 'linkmenu') {
+          _options.push('linkmenu', 'linkfields')
+        } else if (card.perspective === 'linkurl') {
+          _options.push('linkurl', 'linkfields')
         }
       }
 
@@ -107,11 +111,10 @@
   changeRadio = (key, value) => {
     if (key === 'perspective') {
       let _options = JSON.parse(JSON.stringify(columnTypeOptions[this.state.type]))
-
-      if (value !== 'linkurl') {
-        _options.push('linkmenu')
-      } else {
-        _options.push('linkurl')
+      if (value === 'linkmenu') {
+        _options.push('linkmenu', 'linkfields')
+      } else if (value === 'linkurl') {
+        _options.push('linkurl', 'linkfields')
       }
 
       this.setState({
@@ -139,7 +142,7 @@
     this.state.formlist.forEach((item, index) => {
       if (item.hidden) return
 
-      if (item.type === 'text') { // 鏂囨湰鎼滅储
+      if (item.type === 'text') {
         let rules = []
         if (item.key === 'field' || item.key === 'nameField') {
           rules = [{
@@ -159,7 +162,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -176,12 +179,33 @@
             </Form.Item>
           </Col>
         )
+      } else if (item.type === 'textarea') {
+        fields.push(
+          <Col span={24} key={index} className="textarea">
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" title={item.tooltip}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal || '',
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.input'] + item.label + '!'
+                  }
+                ]
+              })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
+            </Form.Item>
+          </Col>
+        )
       } else if (item.type === 'number') {
         fields.push(
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -193,8 +217,8 @@
                     message: this.props.dict['form.required.input'] + item.label + '!'
                   }
                 ]
-              })(item.unlimit ? <InputNumber /> :
-                  <InputNumber min={item.min} max={item.max} precision={item.decimal} />)}
+              })(item.unlimit ? <InputNumber onPressEnter={this.handleSubmit}/> :
+                  <InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>)}
             </Form.Item>
           </Col>
         )
@@ -232,7 +256,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -283,7 +307,13 @@
           <Col span={12} key={index}>
             <Form.Item label={item.label}>
               {getFieldDecorator(item.key, {
-                initialValue: item.initVal || []
+                initialValue: item.initVal || [],
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.select'] + item.label + '!'
+                  }
+                ]
               })(
                 <Cascader
                   options={this.state.menulist}
@@ -300,31 +330,12 @@
   }
 
   handleConfirm = () => {
-    const { menulist } = this.state
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
           values.uuid = this.props.card.uuid
           values.marks = this.props.card.marks || ''
-          
-          if ((values.type === 'text' || values.type === 'number') && values.linkmenu && values.linkmenu.length > 0) {
-            let linkThdMenu = ''
-            menulist.forEach(menu => {
-              if (menu.value === values.linkmenu[0]) {
-                menu.children.forEach(item => {
-                  if (item.value === values.linkmenu[1]) {
-                    item.children.forEach(cell => {
-                      if (cell.value === values.linkmenu[2]) {
-                        linkThdMenu = cell
-                      }
-                    })
-                  }
-                })
-              }
-            })
-            values.linkThdMenu = linkThdMenu
-          }
           
           resolve(values)
         } else {

--
Gitblit v1.8.0