From f497f734966504bd8a7e98bf602da582a53d91e5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 12 九月 2021 02:55:59 +0800 Subject: [PATCH] 2021-09-12 --- src/menu/components/card/table-card/index.jsx | 68 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 1 deletions(-) diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 8f41080..4c49738 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -22,6 +22,7 @@ const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) +const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) const { confirm } = Modal @@ -71,6 +72,7 @@ }, elements: [] }], + action: [], btnlog: [], } @@ -94,14 +96,24 @@ col.uuid = Utils.getuuid() return col }) + if (config.action) { + _card.action = config.action.map(col => { + col.uuid = Utils.getuuid() + return col + }) + } } this.setState({ card: _card }) this.props.updateConfig(_card) } else { + let _card = fromJS(card).toJS() + if (!_card.action) { + _card.action = [] + } this.setState({ - card: fromJS(card).toJS() + card: _card }) } } @@ -443,6 +455,58 @@ } } + addButton = (copy) => { + const { card } = this.state + + let newcard = {} + + if (copy) { + newcard = copy + newcard.focus = true + } else { + newcard.uuid = Utils.getuuid() + newcard.focus = true + + newcard.label = 'label' + newcard.Ot = 'requiredSgl' + newcard.OpenType = 'pop' + newcard.icon = '' + newcard.class = 'green' + newcard.intertype = card.setting.interType || 'system' + newcard.innerFunc = card.setting.innerFunc || '' + newcard.sysInterface = card.setting.sysInterface || '' + newcard.outerFunc = card.setting.outerFunc || '' + newcard.interface = card.setting.interface || '' + newcard.execSuccess = 'grid' + newcard.execError = 'never' + newcard.verify = null + newcard.show = 'button' + newcard.style = {marginRight: '15px'} + } + + // 娉ㄥ唽浜嬩欢-娣诲姞鎸夐挳 + MKEmitter.emit('addButton', card.uuid, newcard) + } + + setSubConfig = (item) => { + const { card, appType } = this.state + let btn = fromJS(item).toJS() + + if (btn.OpenType === 'pop' || btn.execMode === 'pop') { + if (!btn.modal) { + btn.modal = { + setting: { title: btn.label, width: appType === 'mob' ? 100 : 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' }, + tables: [], + groups: [], + fields: [] + } + } + MKEmitter.emit('changeModal', card, btn) + } else if (btn.OpenType === 'popview' && appType !== 'mob') { + MKEmitter.emit('changePopview', card, btn) + } + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -461,6 +525,7 @@ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鍗$墖" onClick={() => this.addCard()} type="plus" /> {appType !== 'mob' ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={() => this.addSearch()} type="plus-circle" /> : null} + <Icon className="plus" title="娣诲姞鎸夐挳" onClick={() => this.addButton()} type="plus-square" /> <NormalForm title="琛ㄦ牸璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}> <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> @@ -475,6 +540,7 @@ } trigger="hover"> <Icon type="tool" /> </Popover> + <ActionComponent config={card} type="datacard" setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> <div style={{minHeight: 'calc(100% - 90px)'}}> {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))} </div> -- Gitblit v1.8.0