From 4f2e4e84fd2cdca1407ac06c1b44319518be39b9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十二月 2020 19:11:05 +0800 Subject: [PATCH] 2020-12-21 --- src/menu/components/card/data-card/index.jsx | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 9180af2..7b76158 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -106,6 +106,7 @@ componentDidMount () { MKEmitter.addListener('submitStyle', this.getStyle) + MKEmitter.addListener('submitModal', this.handleSave) } shouldComponentUpdate (nextProps, nextState) { @@ -120,6 +121,7 @@ return } MKEmitter.removeListener('submitStyle', this.getStyle) + MKEmitter.removeListener('submitModal', this.handleSave) } /** @@ -238,8 +240,50 @@ MKEmitter.emit('addButton', card.uuid, newcard) } - setSubConfig = () => { + setSubConfig = (btn) => { + const { card } = this.state + if (btn.OpenType === 'pop') { + if (!btn.modal) { + btn.modal = { + setting: { + title: btn.label, + width: 60, + cols: '2', + container: 'tab', + focus: '', + finish: 'close', + clickouter: 'unclose', + display: 'modal' + }, + tables: [], + groups: [], + fields: [] + } + } + MKEmitter.emit('changeModal', card, btn) + } + } + + handleSave = (_cards, btn, modal) => { + let card = fromJS(this.state.card).toJS() + + if (card.uuid !== _cards.uuid) return + + let _index = card.action.findIndex(cell => cell.uuid === btn.uuid) + + if (_index === -1) return + + card.action = card.action.map(cell => { + if (cell.uuid === btn.uuid) { + cell.modal = modal + } + + return cell + }) + + this.setState({card}) + this.props.updateConfig(card) } render() { @@ -276,7 +320,7 @@ <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} offset={!index ? offset : 0} MenuType={menu ? menu.MenuType : ''} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} <div style={{clear: 'both'}}></div> - {card.wrap.pagestyle !== 'switch' && card.setting.laypage === 'true' ? <Pagination total={85} showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null} + {card.wrap.pagestyle !== 'switch' && card.setting.laypage === 'true' ? <Pagination total={85} size="small" showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null} </div> ) } -- Gitblit v1.8.0