From a9b02f6862522b54d0824152017bf2acfec2af7b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 21 三月 2024 10:29:50 +0800
Subject: [PATCH] 2024-03-21

---
 src/menu/components/card/cardcellcomponent/elementform/index.jsx |   93 +++++++++++++++++++++++-----------------------
 1 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index 8488fd1..dee9a31 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -10,6 +10,7 @@
 
 const { TextArea } = Input
 const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
+const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror'))
 const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent'))
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 
@@ -399,52 +400,26 @@
           </Col>
         )
       } else if (item.type === 'textarea') {
-        if (item.key === 'formula') {
-          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
-              }>
-                {getFieldDecorator(item.key, {
-                  initialValue: item.initVal || '',
-                  rules: [
-                    {
-                      required: item.readonly ? false : !!item.required,
-                      message: '璇疯緭鍏�' + item.label + '!'
-                    }
-                  ]
-                })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
-              </Form.Item>
-              <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click">
-                <span className="formula-icon">瀛楁闆�</span>
-              </Popover>
-            </Col>
-          )
-        } else {
-          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
-              }>
-                {getFieldDecorator(item.key, {
-                  initialValue: item.initVal || '',
-                  rules: [
-                    {
-                      required: item.readonly ? false : !!item.required,
-                      message: '璇疯緭鍏�' + item.label + '!'
-                    }
-                  ]
-                })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
-              </Form.Item>
-            </Col>
-          )
-        }
+        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
+            }>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal || '',
+                rules: [
+                  {
+                    required: item.readonly ? false : !!item.required,
+                    message: '璇疯緭鍏�' + item.label + '!'
+                  }
+                ]
+              })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
+            </Form.Item>
+          </Col>
+        )
       } else if (item.type === 'number') {
         fields.push(
           <Col span={12} key={index}>
@@ -614,6 +589,32 @@
             </Form.Item>
           </Col>
         )
+      } 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>
+            }>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal || '',
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: '璇疯緭鍏�' + item.label + '!'
+                  }
+                ]
+              })(
+                <CodeMirror mode="text/javascript"/>
+              )}
+            </Form.Item>
+            <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click">
+              <span className="formula-icon">瀛楁闆�</span>
+            </Popover>
+          </Col>
+        )
       }
     })
     return fields

--
Gitblit v1.8.0