From 8aef701cff785fbc13da30067cd41b6214e56b11 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 十二月 2020 15:24:19 +0800 Subject: [PATCH] 2020-12-24 --- src/menu/components/card/table-card/index.jsx | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 48 insertions(+), 1 deletions(-) diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 9ce09b3..de7ee8f 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { Icon, Popover, Modal, Pagination } from 'antd' +import { Icon, Popover, Modal, Pagination, notification } from 'antd' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -16,6 +16,7 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const WrapComponent = asyncIconComponent(() => import('../data-card/wrapsetting')) const CardComponent = asyncComponent(() => import('./cardcomponent')) +const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const { confirm } = Modal @@ -259,6 +260,51 @@ MKEmitter.emit('addSearch', card.uuid, newcard) } + handleLog = (type, logs, item) => { + let card = fromJS(this.state.card).toJS() + + if (type === 'revert') { + let done = false + if (item.$parentId) { + card.subcards.forEach(col => { + if (item.$parentId === col.uuid) { + if (item.$side !== 'back') { + col.elements = col.elements ? [...col.elements, item] : [item] + } else { + col.backElements = col.backElements ? [...col.backElements, item] : [item] + } + done = true + } + }) + } + + card.btnlog = logs + + this.setState({ card }) + if (!done) { + notification.warning({ + top: 92, + message: '闄勫睘鍗$墖宸插垹闄わ紒', + duration: 2 + }) + } else { + notification.success({ + top: 92, + message: '鎭㈠鎴愬姛锛�', + duration: 2 + }) + } + } else { + card.btnlog = logs + this.setState({ card }) + notification.success({ + top: 92, + message: '娓呴櫎鎴愬姛锛�', + duration: 2 + }) + } + } + render() { const { menu } = this.props const { card } = this.state @@ -272,6 +318,7 @@ <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> {menu ? <WrapComponent config={card} MenuType={menu.MenuType} updateConfig={this.updateComponent} /> : null} <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> + <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} </div> -- Gitblit v1.8.0