From ddddb07002201150da9551875c25e75499563249 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 一月 2021 15:22:55 +0800 Subject: [PATCH] 2021-01-15 --- src/menu/components/card/table-card/index.jsx | 59 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index efc6e15..b84b815 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -19,6 +19,7 @@ const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) 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 { confirm } = Modal @@ -40,29 +41,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, @@ -73,20 +51,48 @@ pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� dataName: card.dataName || '', - width: 12, + width: card.width || 12, search: [], name: card.name, subtype: card.subtype, setting: { interType: 'system' }, - wrap: { name: card.name, width: 12, title: '' }, + wrap: { name: card.name, width: card.width || 12, title: '' }, style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, columns: [], scripts: [], - subcards: subcards, + subcards: [{ + uuid: Utils.getuuid(), + setting: { width: 24, type: 'simple'}, + style: { + paddingTop: '5px', paddingBottom: '5px', paddingLeft: '15px', paddingRight: '15px', + }, + elements: [] + }], btnlog: [], } + if (card.config) { + let config = fromJS(card.config).toJS() + + _card.wrap = config.wrap + _card.wrap.name = card.name + _card.style = config.style + _card.headerStyle = config.headerStyle + + _card.subcards = config.subcards.map(scard => { + scard.uuid = Utils.getuuid() + scard.elements = scard.elements.map(elem => { + elem.uuid = Utils.getuuid() + return elem + }) + return scard + }) + _card.search = config.search.map(col => { + col.uuid = Utils.getuuid() + return col + }) + } this.setState({ card: _card }) @@ -331,6 +337,7 @@ <PasteComponent config={card} options={['cardcell', 'search', 'form']} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> + <UserComponent config={card}/> <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