From b69b5f6329ca5f87932436b7a6c1ddfc3377e10f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 五月 2024 10:56:41 +0800
Subject: [PATCH] 2024-05-16

---
 src/menu/components/card/cardcellcomponent/elementform/index.jsx |  112 +++++++++++++++++--------------------------------------
 1 files changed, 35 insertions(+), 77 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index ae23509..992eff8 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -118,12 +118,14 @@
         } else if (item.key === 'formula') {
           item.fields = []
 
-          config.columns.forEach(col => {
-            item.fields.push(col.field)
-          })
-          
-          if (config.subColumns) {
-            config.subColumns.forEach(col => {
+          if (side === 'sub') {
+            if (config.subColumns) {
+              config.subColumns.forEach(col => {
+                item.fields.push(col.field)
+              })
+            }
+          } else {
+            config.columns.forEach(col => {
               item.fields.push(col.field)
             })
           }
@@ -192,14 +194,14 @@
       if (['text', 'picture'].includes(this.record.eleType) && this.record.link) {
         _options.push('linkType')
         if (this.record.linkType === 'linkmenu') {
-          _options.push('open', 'joint')
+          _options.push('open')
           if (this.record.link === 'static') {
             _options.push('linkmenu')
           } else {
             _options.push('linkurl')
           }
         } else if (this.record.linkType === 'other') {
-          _options.push('linkurl', 'joint', 'open')
+          _options.push('linkurl', 'open')
         } else {
           _options.push('linkurl')
         }
@@ -398,11 +400,21 @@
     this.state.formlist.forEach((item, index) => {
       if (item.hidden || item.forbid) return
 
+      let label = item.label
+      if (item.tooltip) {
+        if (item.toolWidth) {
+          label = <Tooltip placement="topLeft" overlayStyle={{maxWidth: item.toolWidth}} title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip>
+        } else {
+          label = <Tooltip placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip>
+        }
+      }
+
       if (item.type === 'text') {
+        let rules = item.rules || []
         if (item.options && item.options.length > 0) {
           fields.push(
             <Col span={12} key={index}>
-              <Form.Item label={item.label}>
+              <Form.Item label={label}>
                 {getFieldDecorator(item.key, {
                   initialValue: item.initVal || '',
                   rules: [
@@ -435,12 +447,7 @@
         } else {
           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
-              }>
+              <Form.Item label={label}>
                 {getFieldDecorator(item.key, {
                   initialValue: item.initVal || '',
                   rules: [
@@ -451,7 +458,8 @@
                     {
                       max: formRule.input.max,
                       message: formRule.input.message
-                    }
+                    },
+                    ...rules
                   ]
                 })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
               </Form.Item>
@@ -461,12 +469,7 @@
       } else if (item.type === 'textarea') {
         fields.push(
           <Col span={24} className="textarea" key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || '',
                 rules: [
@@ -483,12 +486,7 @@
         if (item.help) {
           fields.push(
             <Col span={12} key={index}>
-              <Form.Item help={item.help} label={item.tooltip ?
-                <Tooltip placement="topLeft" title={item.tooltip}>
-                  <QuestionCircleOutlined className="mk-form-tip" />
-                  {item.label}
-                </Tooltip> : item.label
-              }>
+              <Form.Item help={item.help} label={label}>
                 {getFieldDecorator(item.key, {
                   initialValue: item.initVal,
                   rules: [{
@@ -502,12 +500,7 @@
         } else {
           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
-              }>
+              <Form.Item label={label}>
                 {getFieldDecorator(item.key, {
                   initialValue: item.initVal,
                   rules: [{
@@ -522,12 +515,7 @@
       } else if (item.type === 'select') { // 涓嬫媺鎼滅储
         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
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || '',
                 rules: [{
@@ -555,12 +543,7 @@
       } 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
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || '',
                 rules: [{
@@ -576,12 +559,7 @@
       } else if (item.type === 'radio') {
         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
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal,
                 rules: [{
@@ -603,7 +581,7 @@
       } else if (item.type === 'color') {
         fields.push(
           <Col span={12} key={index} className="color-form">
-            <Form.Item label={item.label}>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal,
                 rules: [
@@ -626,12 +604,7 @@
 
         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
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal,
                 rules: [
@@ -649,12 +622,7 @@
       } else if (item.type === 'cascader') {
         fields.push(
           <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || [],
                 rules: [
@@ -672,12 +640,7 @@
       } else if (item.type === 'table') {
         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
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || '',
                 rules: [
@@ -695,12 +658,7 @@
       } else if (item.type === 'codemirror') {
         fields.push(
           <Col span={24} key={index} className="textarea">
-            <Form.Item label={
-              <Tooltip placement="topLeft" overlayStyle={{width: 500, maxWidth: 500}} title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip>
-            }>
+            <Form.Item label={label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || '',
                 rules: [

--
Gitblit v1.8.0