From b1725ffebe2166c2997d4943046307e5f87eaeb9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 九月 2021 11:13:35 +0800
Subject: [PATCH] 2021-09-03

---
 src/menu/components/table/normal-table/index.jsx |   54 ++++++++++++++++++++++++++----------------------------
 1 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx
index f7b5e07..fe7b530 100644
--- a/src/menu/components/table/normal-table/index.jsx
+++ b/src/menu/components/table/normal-table/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Icon, Popover, Modal, notification } from 'antd'
+import { Icon, Popover, notification } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
@@ -23,8 +23,6 @@
 const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
 const ColumnComponent = asyncComponent(() => import('./columns'))
 const WrapComponent = asyncIconComponent(() => import('./wrapsetting'))
-
-const { confirm } = Modal
 
 class TableCardEditComponent extends Component {
   static propTpyes = {
@@ -79,6 +77,7 @@
         ],
         scripts: [],
         btnlog: [],
+        isNew: true
       }
 
       if (card.config) {
@@ -126,7 +125,8 @@
       this.setState({
         card: _card
       })
-      this.props.updateConfig(_card)
+
+      this.filterOrigin(_card)
     } else {
       this.setState({
         card: fromJS(card).toJS()
@@ -173,6 +173,21 @@
     return col
   }
 
+  filterOrigin = (component) => {
+    if (component.isNew) {
+      let item = fromJS(component).toJS()
+      item.search = item.search.filter(a => !a.origin)
+      item.action = item.action.filter(a => !a.origin)
+      item.cols = item.cols.filter(a => !a.origin)
+
+      delete item.isNew
+
+      this.props.updateConfig(item)
+    } else {
+      this.props.updateConfig(component)
+    }
+  }
+
   /**
    * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級
    */
@@ -184,7 +199,7 @@
     component.width = component.wrap.width
     component.name = component.wrap.name
 
-    this.props.updateConfig(component)
+    this.filterOrigin(component)
   }
 
   logButton = (id, item) => {
@@ -198,24 +213,7 @@
     this.setState({
       card: {...card, btnlog}
     })
-    this.props.updateConfig({...card, btnlog})
-  }
-
-  /**
-   * @description 鍗曚釜鍗$墖淇℃伅鏇存柊
-   */
-  deleteCard = () => {
-    let card = fromJS(this.state.card).toJS()
-    let _this = this
-
-    confirm({
-      content: '纭畾鍒犻櫎鍗$墖鍚楋紵',
-      onOk() {
-        _this.setState({card})
-        _this.props.updateConfig(card)
-      },
-      onCancel() {}
-    })
+    this.filterOrigin({...card, btnlog})
   }
 
   changeStyle = () => {
@@ -240,7 +238,7 @@
       card: _card
     })
     
-    this.props.updateConfig(_card)
+    this.filterOrigin(_card)
   }
 
   addColumns = () => {
@@ -294,7 +292,7 @@
     this.setState({
       card: config
     })
-    this.props.updateConfig(config)
+    this.filterOrigin(config)
   }
 
   setSubConfig = (item) => {
@@ -334,7 +332,7 @@
     })
 
     this.setState({card})
-    this.props.updateConfig(card)
+    this.filterOrigin(card)
   }
 
   handleLog = (type, logs, item) => {
@@ -359,7 +357,7 @@
       card.btnlog = logs
 
       this.setState({ card })
-      this.props.updateConfig(card)
+      this.filterOrigin(card)
       notification.success({
         top: 92,
         message: '鎭㈠鎴愬姛锛�',
@@ -368,7 +366,7 @@
     } else {
       card.btnlog = logs
       this.setState({ card })
-      this.props.updateConfig(card)
+      this.filterOrigin(card)
       notification.success({
         top: 92,
         message: '娓呴櫎鎴愬姛锛�',

--
Gitblit v1.8.0