From 9cf5fc474d2159aad973e3208fbef670f325307f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 25 十一月 2020 17:57:41 +0800 Subject: [PATCH] 2020-11-25 --- src/menu/components/table/normal-table/index.jsx | 87 +++++-------------------------------------- 1 files changed, 11 insertions(+), 76 deletions(-) diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index 4f408e0..bf244ea 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -38,29 +38,6 @@ const { card } = this.props if (card.isNew) { - let subcards = null - - if (card.config) { - subcards = JSON.parse(card.config) - subcards = subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - } else { - subcards = [{ - uuid: Utils.getuuid(), - setting: { width: 24, type: 'simple'}, - style: { - paddingTop: '5px', paddingBottom: '5px', paddingLeft: '15px', paddingRight: '15px', - }, - elements: [] - }] - } - let _card = { uuid: card.uuid, type: card.type, @@ -80,8 +57,7 @@ style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, headerStyle: { fontSize: '16px' }, columns: [], - scripts: [], - subcards: subcards + scripts: [] } this.setState({ @@ -127,34 +103,17 @@ this.props.updateConfig(component) } - /** - * @description 鍗曚釜鍗$墖淇℃伅鏇存柊 - */ - updateCard = (cell) => { - let card = fromJS(this.state.card).toJS() - - card.subcards = card.subcards.map(item => { - if (item.uuid === cell.uuid) return cell - return item - }) - - this.setState({card}) - - this.props.updateConfig(card) - } /** * @description 鍗曚釜鍗$墖淇℃伅鏇存柊 */ - deleteCard = (cell) => { + deleteCard = () => { let card = fromJS(this.state.card).toJS() let _this = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { - card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.setState({card}) _this.props.updateConfig(card) }, @@ -198,25 +157,14 @@ addCard = () => { let card = fromJS(this.state.card).toJS() - let newcard = { - uuid: Utils.getuuid(), - setting: { width: 6, type: 'simple'}, - style: { - paddingTop: '5px', paddingBottom: '5px', paddingLeft: '15px', paddingRight: '15px', - }, - elements: [] - } - - if (card.subcards.length > 0) { - newcard = fromJS(card.subcards[card.subcards.length - 1]).toJS() - newcard.uuid = Utils.getuuid() - newcard.elements = newcard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - } - - card.subcards.push(newcard) + // let newcard = { + // uuid: Utils.getuuid(), + // setting: { width: 6, type: 'simple'}, + // style: { + // paddingTop: '5px', paddingBottom: '5px', paddingLeft: '15px', paddingRight: '15px', + // }, + // elements: [] + // } this.setState({card}) this.props.updateConfig(card) @@ -257,20 +205,7 @@ return ( <div className="menu-normal-table-edit-box" style={{...card.style, height: card.wrap.height}}> - <SearchComponent - config={card} - updatesearch={this.updatesearch} - /> - <div className="table-header" style={card.headerStyle}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control"> - <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeTitleStyle} type="font-colors" /> - </div> - } trigger="hover"> - <span className="table-title">{card.wrap.title || ''}</span> - </Popover> - {/* <SearchComponent config={card} updatesearch={this.updateComponent}/> */} - </div> + <SearchComponent config={card} updatesearch={this.updatesearch}/> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鍗$墖" onClick={this.addCard} type="plus" /> -- Gitblit v1.8.0