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 |   98 +++++++++++++-----------------------------------
 1 files changed, 27 insertions(+), 71 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index efc66b8..992eff8 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -194,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')
         }
@@ -400,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: [
@@ -437,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: [
@@ -453,7 +458,8 @@
                     {
                       max: formRule.input.max,
                       message: formRule.input.message
-                    }
+                    },
+                    ...rules
                   ]
                 })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
               </Form.Item>
@@ -463,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: [
@@ -485,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: [{
@@ -504,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: [{
@@ -524,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: [{
@@ -557,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: [{
@@ -578,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: [{
@@ -605,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: [
@@ -628,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: [
@@ -651,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: [
@@ -674,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: [
@@ -697,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