From f4b9504cad034ddcdef21c2081d14a4984fcd2d3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 七月 2024 17:14:48 +0800
Subject: [PATCH] 2024-07-15

---
 src/templates/sharecomponent/tabscomponent/tabform/index.jsx |   60 ++++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/src/templates/sharecomponent/tabscomponent/tabform/index.jsx b/src/templates/sharecomponent/tabscomponent/tabform/index.jsx
index ba87b46..b32a839 100644
--- a/src/templates/sharecomponent/tabscomponent/tabform/index.jsx
+++ b/src/templates/sharecomponent/tabscomponent/tabform/index.jsx
@@ -1,15 +1,18 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, Icon, Tooltip, Radio, InputNumber, notification } from 'antd'
+import { Form, Row, Col, Input, Select, Tooltip, Radio, InputNumber, notification } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
+
 import { formRule } from '@/utils/option.js'
 import Utils from '@/utils/utils.js'
-import './index.scss'
+import asyncComponent from '@/utils/asyncComponent'
+// import './index.scss'
 
+const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 
 class MainTab extends Component {
   static propTpyes = {
     tabs: PropTypes.array,       // 鍙叧鑱旀爣绛鹃泦
-    dict: PropTypes.object,      // 瀛楀吀椤�
     formlist: PropTypes.any,     // 琛ㄥ崟
     levels: PropTypes.any,       // 鏍囩鏄剧ず绾у埆
     card: PropTypes.object,      // 鏍囩椤典俊鎭�
@@ -114,18 +117,12 @@
       if (item.type === 'text') {
         let rules = []
 
-        if (item.key === 'foreignKey') {
-          rules.push({
-            pattern: /^[a-zA-Z_]*$/ig,
-            message: item.label + '瀛楁鍙厑璁稿寘鍚瓧姣嶅強涓嬪垝绾匡紒'
-          })
-        }
         fields.push(
           <Col span={12} key={index}>
             <Form.Item label={
               item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -134,7 +131,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   },
                   {
                     max: formRule.input.max,
@@ -152,7 +149,7 @@
             <Form.Item label={
               item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -161,10 +158,10 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   }
                 ]
-              })(<InputNumber disabled={item.readonly} min={item.min} max={item.max} precision={0} />)}
+              })(<InputNumber min={item.min} max={item.max} precision={0} />)}
             </Form.Item>
           </Col>
         )
@@ -177,7 +174,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
@@ -188,10 +185,33 @@
                 >
                   {item.options.map((option, i) =>
                     <Select.Option id={'mk' + i} title={option.text} key={'mk' + i} value={option.value}>
-                      {item.key === 'icon' && i !== 0 ? <Icon type={option.text} /> : option.text}
+                      {option.text}
                     </Select.Option>
                   )}
                 </Select>
+              )}
+            </Form.Item>
+          </Col>
+        )
+      } else if (item.type === 'icon') { // 涓嬫媺鎼滅储
+        fields.push(
+          <Col span={12} key={index}>
+            <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: '璇烽�夋嫨' + item.label + '!'
+                  }
+                ]
+              })(
+                <MkEditIcon options={['data', 'normal', 'edit', 'direction', 'hint']} allowClear/>
               )}
             </Form.Item>
           </Col>
@@ -202,7 +222,7 @@
             <Form.Item label={
               item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -227,7 +247,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -236,7 +256,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
@@ -303,7 +323,7 @@
       }
     }
     return (
-      <Form {...formItemLayout} className="model-tab-form">
+      <Form {...formItemLayout} style={{minHeight: '180px'}}>
         <Row gutter={24}>{this.getFields()}</Row>
       </Form>
     )

--
Gitblit v1.8.0