From fa381753ef2a2b25b1c0722549ac17e333da79be Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 九月 2022 22:50:54 +0800
Subject: [PATCH] 2022-09-06

---
 src/menu/components/card/cardcellcomponent/index.jsx |  126 ++++++++++++++++++++++++-----------------
 1 files changed, 74 insertions(+), 52 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index c3a5a91..146bf94 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -66,7 +66,6 @@
   }
 
   componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('submitModal', this.handleSave)
     MKEmitter.addListener('cardAddElement', this.cardAddElement)
     MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
@@ -95,7 +94,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('submitModal', this.handleSave)
     MKEmitter.removeListener('cardAddElement', this.cardAddElement)
     MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
@@ -141,8 +139,6 @@
   }
 
   handleStyle = (element) => {
-    const { cards, cardCell } = this.props
-
     let _style = element.style ? fromJS(element.style).toJS() : {}
     let options = ['font', 'border', 'padding', 'margin', 'background']
 
@@ -157,6 +153,8 @@
       }
     } else if (element.eleType === 'picture') {
       options = ['border', 'margin']
+    } else if (element.eleType === 'text') {
+      options[0] = 'font2'
     } else if (element.eleType === 'slider') {
       options = ['padding', 'margin']
     } else if (element.eleType === 'splitline') {
@@ -167,14 +165,11 @@
       card: element
     })
 
-    MKEmitter.emit('changeStyle', [cards.uuid, cardCell.uuid, element.uuid], options, _style)
+    MKEmitter.emit('changeStyle', options, _style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { cards, cardCell } = this.props
+  getStyle = (style) => {
     const { card, elements } = this.state
-
-    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) {
@@ -312,7 +307,17 @@
       menulist = []
     }
 
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid) || []
+    let supId = ''
+    if (cards.setting && cards.setting.supModule) {
+      let pid = cards.setting.supModule[cards.setting.supModule.length - 1]
+      if (pid && pid !== 'empty') {
+        supId = pid
+      } else {
+        supId = ''
+      }
+    }
+
+    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId) || []
     let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || []
 
     this.setState({
@@ -415,14 +420,18 @@
     this.actionFormRef.handleConfirm().then(res => {
       let _elements = elements.map(cell => {
         if (cell.uuid === res.uuid) {
-          res = {...cell, ...res}
+          res.eleType = cell.eleType || null
+          res.style = cell.style || null
+          res.modal = cell.modal || null
+          res.wrapStyle = cell.wrapStyle || null
+          // res = {...cell, ...res}
 
-          if (!res.control) {
-            delete res.controlField
-            delete res.controlVal
-          }
+          // if (!res.control) {
+          //   delete res.controlField
+          //   delete res.controlVal
+          // }
           
-          delete res.focus
+          // delete res.focus
 
           if (res.OpenType === 'form') {
             if (cell.OpenType !== 'form') {
@@ -458,7 +467,7 @@
    * @description 鎸夐挳鍒犻櫎
    */
   deleteElement = (card) => {
-    const { cards, cardCell, side } = this.props
+    const { cardCell, side } = this.props
     const { dict, elements, appType } = this.state
     let _this = this
 
@@ -471,7 +480,7 @@
           card.$parentId = cardCell.uuid
           card.$side = side || ''
 
-          MKEmitter.emit('logButton', cards.uuid, card)
+          // MKEmitter.emit('logButton', cards.uuid, card)
         }
 
         _this.setState({
@@ -497,6 +506,7 @@
       profVisible: true,
       card: element
     })
+    MKEmitter.emit('modalStatus', '楠岃瘉淇℃伅')
   }
 
   /**
@@ -520,6 +530,8 @@
       }, () => {
         this.props.updateElement(_elements)
       })
+
+      MKEmitter.emit('modalStatus', false)
     })
   }
 
@@ -544,6 +556,8 @@
     } else if (btn.OpenType === 'popview') {
       MKEmitter.emit('changePopview', cards, btn)
     } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'linkpage') {
+      MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu})
+    } else if (btn.OpenType === 'funcbutton' && (btn.funcType === 'copyurl' || btn.funcType === 'scan') && btn.linkmenu) {
       MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu})
     } else {
       this.handleElement(item)
@@ -630,6 +644,44 @@
     })
   }
 
+  getVerify = (card) => {
+    const { cards } = this.props
+    const { dict } = this.state
+
+    if (!card) return null
+
+    if (['pop', 'prompt', 'exec'].includes(card.OpenType)) {
+      return <VerifyCard
+        card={card}
+        dict={dict}
+        config={cards}
+        columns={cards.columns}
+        wrappedComponentRef={(inst) => this.verifyRef = inst}
+      />
+    } else if (card.OpenType === 'excelIn') {
+      return <VerifyExcelIn
+        card={card}
+        dict={dict}
+        columns={cards.columns}
+        wrappedComponentRef={(inst) => this.verifyRef = inst}
+      />
+    } else if (card.OpenType === 'excelOut') {
+      return <VerifyExcelOut
+        card={card}
+        dict={dict}
+        config={cards}
+        wrappedComponentRef={(inst) => this.verifyRef = inst}
+      />
+    } else if (card.OpenType === 'funcbutton' && card.funcType === 'print') {
+      return <VerifyPrint
+        card={card}
+        dict={dict}
+        columns={cards.columns}
+        wrappedComponentRef={(inst) => this.verifyRef = inst}
+      />
+    }
+  }
+
   render() {
     const { cards, cardCell } = this.props
     const { elements, visible, actvisible, profVisible, card, dict, record } = this.state
@@ -673,7 +725,7 @@
           <Modal
             title="鎸夐挳路缂栬緫"
             visible={actvisible}
-            width={800}
+            width={920}
             maskClosable={false}
             onCancel={this.editModalCancel}
             footer={[
@@ -707,46 +759,16 @@
               if (this.verifyRef.handleCancel) {
                 this.verifyRef.handleCancel().then(() => {
                   this.setState({ profVisible: false })
+                  MKEmitter.emit('modalStatus', false)
                 })
               } else {
                 this.setState({ profVisible: false })
+                MKEmitter.emit('modalStatus', false)
               }
             }}
             destroyOnClose
           >
-            {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
-              <VerifyCard
-                card={card}
-                dict={dict}
-                config={cards}
-                columns={cards.columns}
-                wrappedComponentRef={(inst) => this.verifyRef = inst}
-              /> : null
-            }
-            {card && card.execMode ?
-              <VerifyPrint
-                card={card}
-                dict={dict}
-                columns={cards.columns}
-                wrappedComponentRef={(inst) => this.verifyRef = inst}
-              /> : null
-            }
-            {card && card.OpenType === 'excelIn' ?
-              <VerifyExcelIn
-                card={card}
-                dict={dict}
-                columns={cards.columns}
-                wrappedComponentRef={(inst) => this.verifyRef = inst}
-              /> : null
-            }
-            {card && card.OpenType === 'excelOut' ?
-              <VerifyExcelOut
-                card={card}
-                dict={dict}
-                config={cards}
-                wrappedComponentRef={(inst) => this.verifyRef = inst}
-              /> : null
-            }
+            {this.getVerify(card)}
           </Modal>
         </div>
       </div>

--
Gitblit v1.8.0