From e5fc2d92b1036aabf9ffc2c9706ed401bd9735c8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 九月 2021 18:14:29 +0800
Subject: [PATCH] 2021-09-09

---
 src/menu/components/card/cardcellcomponent/index.jsx |  197 ++++++++++++++++++++++++++----------------------
 1 files changed, 106 insertions(+), 91 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index e46935d..58f38e9 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -161,6 +161,12 @@
 
     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'
+      }
+    }
+
     let _card = this.resetCardStyle(card, style)
 
     let _elements = elements.map(cell => {
@@ -178,7 +184,7 @@
   resetCardStyle = (card, style) => {
     let _card = fromJS(card).toJS()
     
-    if (_card.eleType === 'text' || _card.eleType === 'number') {
+    if (['text', 'number', 'formula'].includes(_card.eleType)) {
       _card.style = style
 
       let fontSize = 14
@@ -261,7 +267,7 @@
     if (usefulFields) {
       try {
         usefulFields = JSON.parse(usefulFields)
-      } catch {
+      } catch (e) {
         usefulFields = []
       }
     } else {
@@ -277,7 +283,7 @@
     if (menulist) {
       try {
         menulist = JSON.parse(menulist)
-      } catch {
+      } catch (e) {
         menulist = []
       }
     } else {
@@ -297,11 +303,15 @@
    * @description 鍙栨秷淇濆瓨锛屽鏋滃厓绱犱负鏂版坊鍏冪礌锛屽垯浠庡簭鍒椾腑鍒犻櫎
    */
   editModalCancel = () => {
-    const { card, elements } = this.state
+    const { card, elements, appType } = this.state
     let _elements = null
 
     if (card.focus) {
       _elements = elements.filter(item => item.uuid !== card.uuid)
+      
+      if (card.OpenType === 'popview' && appType !== 'mob') { // 寮圭獥鏍囩鎸夐挳锛屼粠澶嶅埗鍒楄〃涓垹闄�
+        MKEmitter.emit('delButtons', [card.uuid])
+      }
     } else {
       _elements = elements
     }
@@ -311,6 +321,8 @@
       elements: _elements,
       visible: false,
       actvisible: false
+    }, () => {
+      this.props.updateElement(_elements)
     })
   }
 
@@ -328,7 +340,7 @@
           if (res.eleType === 'splitline' && cell.eleType !== 'splitline') {
             res.style.paddingTop = '5px'
             res.style.paddingBottom = '5px'
-          } else if (res.eleType === 'text' || res.eleType === 'number') {
+          } else if (['text', 'number', 'formula'].includes(res.eleType)) {
             let fontSize = 14
             let lineHeight = 1.5
             let line = res.height || null
@@ -504,6 +516,8 @@
         MKEmitter.emit('changeEditMenu', {MenuID: btn.uuid, copyMenuId: btn.copyMenuId})
       } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'linkpage') {
         MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu})
+      } else {
+        this.handleElement(item)
       }
     } else {
       if (btn.link === 'page') {
@@ -567,12 +581,11 @@
     btn.eleType = 'button'
 
     let _elements = [...this.state.elements, btn]
-    let _action = cards.action.filter(item => item.uuid !== id)
 
     this.setState({
       elements: _elements
     }, () => {
-      this.props.updateElement(_elements, _action)
+      this.props.updateElement(_elements, btn)
     })
   }
 
@@ -595,94 +608,96 @@
           handleSubConfig={this.handleSubConfig}
           deleteMenu={this.deleteElement}
         />
-        {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
-        <Modal
-          title={'缂栬緫鍏冪礌'}
-          visible={visible}
-          width={800}
-          maskClosable={false}
-          onCancel={this.editModalCancel}
-          onOk={this.handleSubmit}
-          destroyOnClose
-        >
-          <ElementForm
-            dict={dict}
-            card={card}
-            formlist={this.state.formlist}
-            inputSubmit={this.handleSubmit}
-            config={cards}
-            wrappedComponentRef={(inst) => this.elementFormRef = inst}
-          />
-        </Modal>
-        {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
-        <Modal
-          title={dict['model.action'] + '-' + (card && card.copyType === 'action' ? dict['model.copy'] : dict['model.edit'])}
-          visible={actvisible}
-          width={800}
-          maskClosable={false}
-          onCancel={this.editModalCancel}
-          footer={[
-            <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
-            <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>{dict['model.confirm']}</Button>
-          ]}
-          destroyOnClose
-        >
-          <ActionForm
-            dict={dict}
-            type={cards.type === 'balcony' ? '' : 'card'}
-            card={card}
-            formlist={this.state.formlist}
-            inputSubmit={this.handleActionSubmit}
-            setting={cards.setting}
-            wrappedComponentRef={(inst) => this.actionFormRef = inst}
-          />
-        </Modal>
-        {/* 鎸夐挳浣跨敤绯荤粺瀛樺偍杩囩▼鏃讹紝楠岃瘉淇℃伅妯℃�佹 */}
-        <Modal
-          wrapClassName="model-table-action-verify-modal"
-          title={'楠岃瘉淇℃伅'}
-          visible={profVisible}
-          width={'75vw'}
-          maskClosable={false}
-          okText={dict['model.submit']}
-          onOk={this.verifySubmit}
-          onCancel={() => { this.setState({ profVisible: false }) }}
-          destroyOnClose
-        >
-          {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
-            <VerifyCard
-              card={card}
+        <div onDoubleClick={(e) => e.stopPropagation()}>
+          {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
+          <Modal
+            title={'缂栬緫鍏冪礌'}
+            visible={visible}
+            width={800}
+            maskClosable={false}
+            onCancel={this.editModalCancel}
+            onOk={this.handleSubmit}
+            destroyOnClose
+          >
+            <ElementForm
               dict={dict}
+              card={card}
+              formlist={this.state.formlist}
+              inputSubmit={this.handleSubmit}
               config={cards}
-              columns={cards.columns}
-              wrappedComponentRef={(inst) => this.verifyRef = inst}
-            /> : null
-          }
-          {card && card.execMode ?
-            <VerifyPrint
-              card={card}
+              wrappedComponentRef={(inst) => this.elementFormRef = inst}
+            />
+          </Modal>
+          {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
+          <Modal
+            title={dict['model.action'] + '-' + (card && card.copyType === 'action' ? dict['model.copy'] : dict['model.edit'])}
+            visible={actvisible}
+            width={800}
+            maskClosable={false}
+            onCancel={this.editModalCancel}
+            footer={[
+              <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
+              <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>{dict['model.confirm']}</Button>
+            ]}
+            destroyOnClose
+          >
+            <ActionForm
               dict={dict}
-              columns={cards.columns}
-              wrappedComponentRef={(inst) => this.verifyRef = inst}
-            /> : null
-          }
-          {card && card.OpenType === 'excelIn' ?
-            <VerifyExcelIn
+              type={cards.type === 'balcony' ? '' : 'card'}
               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
-          }
-        </Modal>
+              formlist={this.state.formlist}
+              inputSubmit={this.handleActionSubmit}
+              setting={cards.setting}
+              wrappedComponentRef={(inst) => this.actionFormRef = inst}
+            />
+          </Modal>
+          {/* 鎸夐挳浣跨敤绯荤粺瀛樺偍杩囩▼鏃讹紝楠岃瘉淇℃伅妯℃�佹 */}
+          <Modal
+            wrapClassName="model-table-action-verify-modal"
+            title={'楠岃瘉淇℃伅'}
+            visible={profVisible}
+            width={'75vw'}
+            maskClosable={false}
+            okText={dict['model.submit']}
+            onOk={this.verifySubmit}
+            onCancel={() => { this.setState({ profVisible: 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
+            }
+          </Modal>
+        </div>
       </div>
     )
   }

--
Gitblit v1.8.0