From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 一月 2022 17:21:25 +0800
Subject: [PATCH] 2022-01-21

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

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 7686036..db7b2ed 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -145,7 +145,14 @@
     let options = ['font', 'border', 'padding', 'margin', 'background']
 
     if (element.eleType === 'button') {
-      options.push('width', 'float')
+      if (element.OpenType === 'form') {
+        options = ['margin', 'float']
+      } else {
+        options.push('width', 'minHeight', 'float')
+      }
+      if (element.wrapStyle) {
+        _style.float = element.wrapStyle.textAlign || 'left'
+      }
     } else if (element.eleType === 'picture') {
       options = ['border', 'margin']
     } else if (element.eleType === 'slider') {
@@ -167,11 +174,11 @@
 
     if (comIds.length !== 3 || comIds[0] !== cards.uuid || comIds[1] !== cardCell.uuid || !card) return
 
-    if (card.eleType === 'button') {
-      if ((style.paddingLeft || style.paddingRight) && !style.width) {
-        style.width = 'auto'
-      }
-    }
+    // if (card.eleType === 'button') {
+    //   if ((style.paddingLeft || style.paddingRight) && !style.width) {
+    //     style.width = 'auto'
+    //   }
+    // }
 
     let _card = this.resetCardStyle(card, style)
 
@@ -229,7 +236,12 @@
 
       _card.innerHeight = _card.barHeight + (_card.displayValue === 'true' ? fontSize + 2 : 0)
     } else if (_card.eleType === 'button') { // 鎷嗗垎style
-      _card.style = style
+      _card.style = fromJS(style).toJS()
+
+      if (style.float) {
+        _card.wrapStyle = {textAlign: style.float}
+        delete _card.style.float
+      }
     } else {
       _card.style = style
     }
@@ -406,9 +418,13 @@
           }
           
           delete res.focus
-          let style = {}
 
-          if (res.class !== cell.class || res.show !== cell.show || !res.style) {
+          if (res.OpenType === 'form') {
+            if (cell.OpenType !== 'form') {
+              res.style = {}
+            }
+          } else if (res.class !== cell.class || res.show !== cell.show || !res.style) {
+            let style = {}
             if (res.show === 'link' || res.show === 'icon') {
               style.color = color[res.class]
               style.backgroundColor = 'transparent'
@@ -416,8 +432,8 @@
               style.color = '#ffffff'
               style.backgroundColor = color[res.class]
             }
+            res.style = {...res.style, ...style}
           }
-          res.style = {...res.style, ...style}
 
           return res
         }
@@ -591,6 +607,25 @@
     let btn = cards.action[index]
     btn.eleType = 'button'
 
+    if (!btn.width) {
+      btn.width = 12
+    }
+    if (btn.color) {
+      btn.style = btn.style || {}
+      btn.style.color = '#ffffff'
+      if (btn.color === 'primary') {
+        btn.style.backgroundColor = '#1677ff'
+      } else if (btn.color === 'danger') {
+        btn.style.backgroundColor = '#ff3141'
+      } else if (btn.color === 'warning') {
+        btn.style.backgroundColor = '#ff8f1f'
+      } else if (btn.color === 'success') {
+        btn.style.backgroundColor = '#00b578'
+      } else if (btn.color === 'light') {
+        btn.style.backgroundColor = '#cccccc'
+      }
+    }
+
     let _elements = [...this.state.elements, btn]
 
     this.setState({
@@ -622,9 +657,9 @@
         <div onDoubleClick={(e) => e.stopPropagation()}>
           {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
           <Modal
-            title={'缂栬緫鍏冪礌'}
+            title="缂栬緫鍏冪礌"
             visible={visible}
-            width={800}
+            width={850}
             maskClosable={false}
             onCancel={this.editModalCancel}
             onOk={this.handleSubmit}

--
Gitblit v1.8.0