From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 09 十二月 2022 15:53:32 +0800
Subject: [PATCH] 2022-12-09

---
 src/mob/components/menubar/common-menubar/index.jsx |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/mob/components/menubar/common-menubar/index.jsx b/src/mob/components/menubar/common-menubar/index.jsx
index 479cbf5..fd5fd14 100644
--- a/src/mob/components/menubar/common-menubar/index.jsx
+++ b/src/mob/components/menubar/common-menubar/index.jsx
@@ -36,12 +36,9 @@
       let _card = {
         uuid: card.uuid,
         type: card.type,
-        tabId: '',
-        parentId: '',
         format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
-        dataName: card.dataName || '',
         width: card.width || 24,
         name: card.name,
         subtype: card.subtype,
@@ -71,10 +68,6 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -86,7 +79,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
 
   /**
@@ -106,15 +98,11 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style)
+    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { card } = this.state
-
-    if (comIds.length !== 1 || comIds[0] !== card.uuid) return
-
-    let _card = {...card, style}
+  getStyle = (style) => {
+    let _card = {...this.state.card, style}
 
     this.setState({
       card: _card
@@ -145,7 +133,13 @@
   clickComponent = (e) => {
     if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
       e.stopPropagation()
-      MKEmitter.emit('clickComponent', this.state.card)
+      MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => {
+        let _card = {...this.state.card}
+        _card.style = {..._card.style, ...style}
+
+        this.setState({ card: _card })
+        this.props.updateConfig(_card)
+      })
     }
   }
 
@@ -182,6 +176,7 @@
             </div>
           </Col>
         </div>
+        <div className="component-name"><div className="center">{card.name}</div></div>
       </div>
     )
   }

--
Gitblit v1.8.0