From 407c0f1765c7d085218a91ad8842784977383d05 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 23 十月 2020 00:18:13 +0800
Subject: [PATCH] 2020-10-23

---
 src/menu/components/card/cardcellcomponent/index.jsx |   80 +++++++++++++++++++++++++++------------
 1 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 6d5917b..7853bdf 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -25,7 +25,6 @@
 const VerifyPrint = asyncComponent(() => import('@/menu/actioncomponent/verifyprint'))
 const VerifyExcelIn = asyncComponent(() => import('@/menu/actioncomponent/verifyexcelin'))
 const VerifyExcelOut = asyncComponent(() => import('@/menu/actioncomponent/verifyexcelout'))
-// const ModalConfig = asyncComponent(() => import('@/menu/modalconfig'))
 
 class CardCellComponent extends Component {
   static propTpyes = {
@@ -43,7 +42,7 @@
     elements: null,      // 鎸夐挳缁�
     visible: false,      // 妯℃�佹鎺у埗
     actvisible: false,   // 鎸夐挳缂栬緫妯℃�佹
-    profVisible: false
+    profVisible: false,  // 楠岃瘉淇℃伅缂栬緫
   }
 
   /**
@@ -60,6 +59,7 @@
   componentDidMount () {
     MKEmitter.addListener('cardAddElement', this.cardAddElement)
     MKEmitter.addListener('submitStyle', this.getStyle)
+    MKEmitter.addListener('submitModal', this.handleSave)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -82,6 +82,8 @@
       return
     }
     MKEmitter.removeListener('cardAddElement', this.cardAddElement)
+    MKEmitter.removeListener('submitStyle', this.getStyle)
+    MKEmitter.removeListener('submitModal', this.handleSave)
   }
 
   cardAddElement = (ids, element) => {
@@ -406,9 +408,7 @@
     this.actionFormRef.handleConfirm().then(ele => {
       let _elements = elements.map(cell => {
         if (cell.uuid === ele.uuid) {
-          ele.eleType = 'button'
-          ele.style = cell.style || {}
-          ele.btnstyle = cell.btnstyle || {}
+          ele = {...cell, ...ele}
           return ele
         }
 
@@ -460,14 +460,12 @@
    * @description 楠岃瘉淇℃伅淇濆瓨
    */
   verifySubmit = () => {
-    const { elements } = this.state
-    
+    const { elements, card } = this.state
+
     this.verifyRef.handleConfirm().then(res => {
       let _elements = elements.map(cell => {
-        if (cell.uuid === res.uuid) {
-          res.eleType = 'button'
-          res.style = cell.style || {}
-          return res
+        if (cell.uuid === card.uuid) {
+          cell.verify = res
         }
 
         return cell
@@ -475,7 +473,7 @@
 
       this.setState({
         elements: _elements,
-        actvisible: false
+        profVisible: false
       }, () => {
         this.props.updateElement(_elements)
       })
@@ -483,7 +481,52 @@
   }
 
   handleSubConfig = (item) => {
+    const { cards } = this.props
 
+    if (item.eleType !== 'button') return
+    if (item.OpenType === 'pop') {
+      let btn = fromJS(item).toJS()
+      if (!btn.modal) {
+        btn.modal = {
+          setting: {
+            title: btn.label,
+            width: 60,
+            cols: '2',
+            container: 'tab',
+            focus: '',
+            finish: 'close',
+            clickouter: 'unclose',
+            display: 'modal'
+          },
+          tables: [],
+          groups: [],
+          fields: []
+        }
+      }
+
+      MKEmitter.emit('changeModal', cards, btn)
+    }
+  }
+
+  handleSave = (_cards, btn, modal) => {
+    const { cards } = this.props
+    const { elements } = this.state
+
+    if (cards.uuid !== _cards.uuid) return
+
+    let _elements = elements.map(cell => {
+      if (cell.uuid === btn.uuid) {
+        cell.modal = modal
+      }
+
+      return cell
+    })
+
+    this.setState({
+      elements: _elements
+    }, () => {
+      this.props.updateElement(_elements)
+    })
   }
 
   render() {
@@ -501,18 +544,6 @@
           handleSubConfig={this.handleSubConfig}
           deleteMenu={this.deleteElement}
         />
-          {/* <ModalConfig
-            menu={this.state.editMenu}
-            editTab={this.state.editTab}
-            tabConfig={this.state.tabConfig}
-            editSubTab={this.state.editSubTab}
-            subTabConfig={this.state.subTabConfig}
-            btnTab={this.state.btnTab}
-            btnTabConfig={this.state.btnTabConfig}
-            editAction={this.state.editAction}
-            subConfig={this.state.subConfig}
-            handleView={this.handleView}
-          /> */}
         {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
         <Modal
           title={'缂栬緫鍏冪礌'}
@@ -571,7 +602,6 @@
         >
           {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
             <VerifyCard
-              // floor={this.props.type}
               card={card}
               dict={dict}
               config={cards}

--
Gitblit v1.8.0