| | |
| | | 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' |
| | |
| | | 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 = { |
| | |
| | | ], |
| | | scripts: [], |
| | | btnlog: [], |
| | | isNew: true |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | this.props.updateConfig(_card) |
| | | |
| | | this.filterOrigin(_card) |
| | | } else { |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | |
| | | 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 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | |
| | | component.width = component.wrap.width |
| | | component.name = component.wrap.name |
| | | |
| | | this.props.updateConfig(component) |
| | | this.filterOrigin(component) |
| | | } |
| | | |
| | | logButton = (id, item) => { |
| | |
| | | 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 = () => { |
| | |
| | | card: _card |
| | | }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | this.filterOrigin(_card) |
| | | } |
| | | |
| | | addColumns = () => { |
| | |
| | | this.setState({ |
| | | card: config |
| | | }) |
| | | this.props.updateConfig(config) |
| | | this.filterOrigin(config) |
| | | } |
| | | |
| | | setSubConfig = (item) => { |
| | |
| | | }) |
| | | |
| | | this.setState({card}) |
| | | this.props.updateConfig(card) |
| | | this.filterOrigin(card) |
| | | } |
| | | |
| | | handleLog = (type, logs, item) => { |
| | |
| | | card.btnlog = logs |
| | | |
| | | this.setState({ card }) |
| | | this.props.updateConfig(card) |
| | | this.filterOrigin(card) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '恢复成功!', |
| | |
| | | } else { |
| | | card.btnlog = logs |
| | | this.setState({ card }) |
| | | this.props.updateConfig(card) |
| | | this.filterOrigin(card) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '清除成功!', |