From 52faefc67ffef29e3d208d2233c2547fc0ee47d3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 04 三月 2023 21:11:41 +0800
Subject: [PATCH] 2023-03-04

---
 src/views/systemproc/proc/index.jsx                               |    2 
 src/views/systemproc/proc/index.scss                              |    4 ++
 src/menu/components/table/base-table/columns/editColumn/index.jsx |   10 ++++
 src/templates/zshare/codemirror/index.scss                        |    3 +
 src/utils/utils-custom.js                                         |   55 +++++++++++++++++++++------
 src/templates/zshare/codemirror/index.jsx                         |   10 +++-
 6 files changed, 67 insertions(+), 17 deletions(-)

diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx
index 044e8ad..f7b9799 100644
--- a/src/menu/components/table/base-table/columns/editColumn/index.jsx
+++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx
@@ -167,7 +167,15 @@
 
       if (item.type === 'text') {
         let rules = []
-        if (item.key !== 'linkurl') {
+        if (item.key === 'field') {
+          rules = [{
+            pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
+            message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+          }, {
+            max: formRule.input.max,
+            message: formRule.input.message
+          }]
+        } else if (item.key !== 'linkurl') {
           rules = [{
             max: formRule.input.max,
             message: formRule.input.message
diff --git a/src/templates/zshare/codemirror/index.jsx b/src/templates/zshare/codemirror/index.jsx
index 24f6872..aa4698f 100644
--- a/src/templates/zshare/codemirror/index.jsx
+++ b/src/templates/zshare/codemirror/index.jsx
@@ -23,6 +23,7 @@
     value: PropTypes.string, // 鍐呭
     mode: PropTypes.any,     // 鍙�夛紝璇█妯″紡锛岄粯璁や负sql
     theme: PropTypes.any,    // 鍙�夛紝涓婚鏍峰紡
+    func: PropTypes.any,     // 缂栬緫瀛樺偍杩囩▼
     onChange: PropTypes.func // 鍐呭鍙樺寲鏃跺洖璋�
   }
 
@@ -38,6 +39,8 @@
   editor = null
 
   UNSAFE_componentWillMount () {
+    const { func } = this.props
+
     let options = {
       lineNumbers: true,
       lineWrapping: true,
@@ -50,6 +53,7 @@
     }
 
     this.setState({
+      style: func ? {fontSize: '14px', lineHeight: '25px'} : {fontSize: '18px', lineHeight: '32px'},
       value: this.props.value || '',
       defaultVal: this.props.value || '',
       options
@@ -146,7 +150,7 @@
   }
 
   render() {
-    const { mode } = this.props
+    const { mode, func } = this.props
     const { defaultVal, options, fullScreen, style, display } = this.state
     const menu = (
       <Menu>
@@ -190,11 +194,11 @@
     )
 
     return (
-      <div className="code-mirror-wrap" style={fullScreen ? style : null}>
+      <div className="code-mirror-wrap" style={fullScreen || func ? style : null}>
         {!mode && !fullScreen ? <FormatPainterOutlined onClick={this.handleFormat}/> : null}
         {!fullScreen ? <FullscreenOutlined onClick={this.fullScreenChange}/> : null}
         {fullScreen ? <FullscreenExitOutlined onClick={this.fullScreenChange}/> : null}
-        {fullScreen ? <Dropdown overlay={menu} placement="bottomRight">
+        {fullScreen || func ? <Dropdown overlayClassName="mk-mirror-font" overlay={menu} placement="bottomRight">
           <FontSizeOutlined />
         </Dropdown> : null}
         {display ? <CodeMirror
diff --git a/src/templates/zshare/codemirror/index.scss b/src/templates/zshare/codemirror/index.scss
index 6444614..2ee7018 100644
--- a/src/templates/zshare/codemirror/index.scss
+++ b/src/templates/zshare/codemirror/index.scss
@@ -87,4 +87,7 @@
       background: #f5f5f5;
     }
   }
+}
+.mk-mirror-font {
+  z-index: 1200!important;
 }
\ No newline at end of file
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index eb12ca9..3d8f378 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -453,16 +453,21 @@
             }
           }
 
+          if (card.setting.click === 'button' && card.setting.linkbtn) {
+            card.setting.linkbtn = md5(commonId + card.setting.linkbtn)
+          }
+
           if (card.elements) {
             card.elements = card.elements.map(cell => {
-              cell.uuid = this.getuuid()
-
               if (cell.eleType === 'button') {
+                cell.uuid = md5(commonId + cell.uuid)
                 if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                   cell.pageTemplate = ''
                   cell.linkmenu = ''
                 }
                 this.resetBtn(cell, commonId)
+              } else {
+                cell.uuid = this.getuuid()
               }
               
               return cell
@@ -470,14 +475,15 @@
           }
           if (card.backElements) {
             card.backElements = card.backElements.map(cell => {
-              cell.uuid = this.getuuid()
-
               if (cell.eleType === 'button') {
+                cell.uuid = md5(commonId + cell.uuid)
                 if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                   cell.pageTemplate = ''
                   cell.linkmenu = ''
                 }
                 this.resetBtn(cell, commonId)
+              } else {
+                cell.uuid = this.getuuid()
               }
 
               return cell
@@ -488,16 +494,20 @@
         if (item.wrap.datatype === 'public' && item.wrap.publicId) {
           item.wrap.publicId = md5(commonId + item.wrap.publicId)
         }
+        if (item.wrap.linkbtn) {
+          item.wrap.linkbtn = md5(commonId + item.wrap.linkbtn)
+        }
         if (item.elements) {
           item.elements = item.elements.map(cell => {
-            cell.uuid = this.getuuid()
-
             if (cell.eleType === 'button') {
+              cell.uuid = md5(commonId + cell.uuid)
               if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                 cell.pageTemplate = ''
                 cell.linkmenu = ''
               }
               this.resetBtn(cell, commonId)
+            } else {
+              cell.uuid = this.getuuid()
             }
 
             return cell
@@ -518,7 +528,7 @@
               })
             } else if (c.type === 'action' && c.elements) {
               c.elements = c.elements.map(cell => {
-                cell.uuid = this.getuuid()
+                cell.uuid = md5(commonId + cell.uuid)
 
                 if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) {
                   cell.pageTemplate = ''
@@ -548,7 +558,7 @@
             })
           } else if (col.type === 'action' && col.elements) {
             col.elements = col.elements.map(cell => {
-              cell.uuid = this.getuuid()
+              cell.uuid = md5(commonId + cell.uuid)
               this.resetBtn(cell, commonId)
               return cell
             })
@@ -721,12 +731,21 @@
     } else if (['card', 'carousel', 'timeline'].includes(item.type)) {
       item.subcards.forEach(card => {
         card.uuid = this.getuuid()
+
+        if (card.setting.click === 'button' && card.setting.linkbtn) {
+          card.setting.linkbtn = md5(commonId + card.setting.linkbtn)
+        }
+
         if (card.elements) {
           if (sessionStorage.getItem('editMenuType') === 'popview') {
             card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton')
           }
           card.elements = card.elements.map(cell => {
-            cell.uuid = this.getuuid()
+            if (cell.eleType === 'button') {
+              cell.uuid = md5(commonId + cell.uuid)
+            } else {
+              cell.uuid = this.getuuid()
+            }
             return cell
           })
         }
@@ -735,7 +754,11 @@
             card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton')
           }
           card.backElements = card.backElements.map(cell => {
-            cell.uuid = this.getuuid()
+            if (cell.eleType === 'button') {
+              cell.uuid = md5(commonId + cell.uuid)
+            } else {
+              cell.uuid = this.getuuid()
+            }
             return cell
           })
         }
@@ -745,8 +768,15 @@
         if (sessionStorage.getItem('editMenuType') === 'popview') {
           item.elements = item.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton')
         }
+        if (item.wrap.linkbtn) {
+          item.wrap.linkbtn = md5(commonId + item.wrap.linkbtn)
+        }
         item.elements = item.elements.map(cell => {
-          cell.uuid = this.getuuid()
+          if (cell.eleType === 'button') {
+            cell.uuid = md5(commonId + cell.uuid)
+          } else {
+            cell.uuid = this.getuuid()
+          }
           return cell
         })
       }
@@ -784,7 +814,8 @@
             col.elements = col.elements.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton')
           }
           col.elements = col.elements.map(cell => {
-            cell.uuid = this.getuuid()
+            cell.uuid = md5(commonId + cell.uuid)
+
             return cell
           })
         }
diff --git a/src/views/systemproc/proc/index.jsx b/src/views/systemproc/proc/index.jsx
index 6f13864..cad4d02 100644
--- a/src/views/systemproc/proc/index.jsx
+++ b/src/views/systemproc/proc/index.jsx
@@ -376,7 +376,7 @@
             </div>
           </div>
           <div className="edit-wrap">
-            <CodeMirror value={content} onChange={(val) => this.setState({content: val})}/>
+            <CodeMirror value={content} func={true} onChange={(val) => this.setState({content: val})}/>
           </div>
         </div>
         <Modal
diff --git a/src/views/systemproc/proc/index.scss b/src/views/systemproc/proc/index.scss
index 653bc5c..e0a327c 100644
--- a/src/views/systemproc/proc/index.scss
+++ b/src/views/systemproc/proc/index.scss
@@ -109,6 +109,10 @@
       background-color: #ffffff;
     }
   }
+
+  .code-mirror-wrap .anticon-font-size {
+    position: absolute;
+  }
 }
 
 .mk-create-func {

--
Gitblit v1.8.0