king
2021-09-03 b1725ffebe2166c2997d4943046307e5f87eaeb9
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: '清除成功!',