From 4f2e4e84fd2cdca1407ac06c1b44319518be39b9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 十二月 2020 19:11:05 +0800
Subject: [PATCH] 2020-12-21

---
 src/menu/components/table/normal-table/index.jsx |   50 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx
index 9d2229c..0a90b78 100644
--- a/src/menu/components/table/normal-table/index.jsx
+++ b/src/menu/components/table/normal-table/index.jsx
@@ -57,9 +57,9 @@
           { origin: true, uuid: Utils.getuuid(), label: 'label', type: 'date', match: 'greater' }
         ],
         action: [
-          { origin: true, uuid: Utils.getuuid(), label: '娣诲姞', intertype: 'system', OpenType: 'pop', icon: 'plus', class: 'green' },
-          { origin: true, uuid: Utils.getuuid(), label: '淇敼', intertype: 'system', OpenType: 'pop', icon: 'form', class: 'purple' },
-          { origin: true, uuid: Utils.getuuid(), label: '鍒犻櫎', intertype: 'system', OpenType: 'prompt', icon: 'delete', class: 'red' }
+          { origin: true, uuid: Utils.getuuid(), label: '娣诲姞', intertype: 'system', OpenType: 'pop', icon: 'plus', class: 'green', btnstyle: {color: 'rgb(255, 255, 255)', background: 'rgb(38, 194, 129)', marginRight: '15px'} },
+          { origin: true, uuid: Utils.getuuid(), label: '淇敼', intertype: 'system', OpenType: 'pop', icon: 'form', class: 'purple', btnstyle: {color: 'rgb(255, 255, 255)', background: 'rgb(142, 68, 173)', marginRight: '15px'} },
+          { origin: true, uuid: Utils.getuuid(), label: '鍒犻櫎', intertype: 'system', OpenType: 'prompt', icon: 'delete', class: 'danger', btnstyle: {color: 'rgb(255, 255, 255)', background: 'rgb(255, 77, 79)', marginRight: '15px'} }
         ],
         name: card.name,
         subtype: card.subtype,
@@ -89,6 +89,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('submitStyle', this.getStyle)
+    MKEmitter.addListener('submitModal', this.handleSave)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -103,6 +104,7 @@
       return
     }
     MKEmitter.removeListener('submitStyle', this.getStyle)
+    MKEmitter.removeListener('submitModal', this.handleSave)
   }
 
   /**
@@ -218,7 +220,49 @@
   }
 
   setSubConfig = (btn) => {
+    const { card } = this.state
 
+    if (btn.OpenType === 'pop') {
+      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', card, btn)
+    }
+  }
+
+  handleSave = (_cards, btn, modal) => {
+    let card = fromJS(this.state.card).toJS()
+
+    if (card.uuid !== _cards.uuid) return
+
+    let _index = card.action.findIndex(cell => cell.uuid === btn.uuid)
+
+    if (_index === -1) return
+
+    card.action = card.action.map(cell => {
+      if (cell.uuid === btn.uuid) {
+        cell.modal = modal
+      }
+
+      return cell
+    })
+
+    this.setState({card})
+    this.props.updateConfig(card)
   }
 
   render() {

--
Gitblit v1.8.0