From ab60d53b67f802878662aaa5a5b52580cca421b8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 26 九月 2020 08:52:46 +0800 Subject: [PATCH] 2020-09-26 --- src/menu/components/card/data-card/index.jsx | 64 +++++++++++++++++++++++++++++++- 1 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 2cd1ab4..7c7d866 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -7,6 +7,7 @@ import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' +import MKEmitter from '@/utils/events.js' import Utils from '@/utils/utils.js' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' @@ -58,7 +59,7 @@ name: card.name, subtype: card.subtype, setting: { interType: 'system' }, - wrap: { name: card.name, width: 24, height: 200, cardWidth: 6, addable: 'false', switch: 'false' }, + wrap: { name: card.name, width: 24, cardWidth: 6, addable: 'false', switch: 'false' }, columns: [], scripts: [], action: [], @@ -103,6 +104,53 @@ this.props.updateConfig(component) } + addElement = () => { + const { card } = this.state + + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + newcard.eleType = 'text' + newcard.datatype = 'dynamic' + newcard.color = 'rgba(0,0,0,0.85)' + newcard.padding = '5px' + newcard.align = 'left' + + // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 + MKEmitter.emit('cardAddElement', card.uuid, newcard) + } + + addButton = () => { + const { card } = this.state + + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + newcard.label = 'button' + newcard.sqlType = '' + newcard.Ot = 'requiredSgl' + newcard.OpenType = 'prompt' + newcard.icon = '' + newcard.class = 'default' + newcard.intertype = 'system' + newcard.method = 'POST' + newcard.execSuccess = 'grid' + newcard.execError = 'never' + newcard.popClose = 'never' + newcard.errorTime = 10 + newcard.verify = null + newcard.show = 'link' + + // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 + MKEmitter.emit('addButton', card.uuid, newcard) + } + + changeStyle = () => { + // MKEmitter.emit('changeStyle', card.uuid, newcard) + } + render() { const { card } = this.state @@ -119,8 +167,20 @@ </Popover> <div className={'ant-col card-item ant-col-' + (card.wrap.cardWidth || 6)} style={{height: card.wrap.height ? card.wrap.height + 'px' : 'auto'}}> <CardCellComponent config={card} updateElement={this.updateComponent}/> - <ActionComponent config={card} updateaction={this.updateComponent}/> + <ActionComponent plus="false" config={card} updateaction={this.updateComponent}/> + <div className="card-control"> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <Icon className="plus" title="娣诲姞鍏冪礌" onClick={this.addElement} type="plus" /> + <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> + <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> + </div> + } trigger="hover"> + <Icon type="tool" /> + </Popover> + </div> </div> + {card.wrap.addable === 'true' ? <div className="card-add-button"><Icon type="plus" /></div> : null} </div> ) } -- Gitblit v1.8.0