From 686bb0f74bc8872b9a363f448186e3bbca12345e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 16 六月 2020 14:23:08 +0800 Subject: [PATCH] 2020-06-16 --- src/components/header/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 3 src/tabviews/zshare/cardcomponent/index.jsx | 133 ++++++++++++++++++++++++++++++++++++++++---- src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx | 7 ++ src/tabviews/zshare/cardcomponent/index.scss | 35 ++++++++++- 5 files changed, 162 insertions(+), 18 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 4b0cebd..52532fa 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -678,7 +678,7 @@ {this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} {this.props.editState && !this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {/* {this.props.editState && !this.props.editLevel ? <a href="#/mobile" target="_blank" className="mobile" type="edit"> 绉诲姩绔� <Icon type="arrow-right" /></a> : null} */} + {this.props.editState && !this.props.editLevel ? <a href="#/mobile" target="_blank" className="mobile" type="edit"> 绉诲姩绔� <Icon type="arrow-right" /></a> : null} {/* 缂栬緫鑿滃崟 */} {this.props.editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} {/* 澶村儚銆佺敤鎴峰悕 */} diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 58365e2..19cdef0 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -25,7 +25,7 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 - columns: PropTypes.array, // 瀛楁鍒� + columns: PropTypes.any, // 瀛楁鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� @@ -1010,6 +1010,7 @@ {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} {show === 'text' ? <Button className="action-cell" loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} + {show && show.indexOf('plus') > -1 ? <Button className="action-cell" style={{fontSize: show.substring(4) + 'px'}} icon="plus" loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} {this.getModels()} </div> ) diff --git a/src/tabviews/zshare/cardcomponent/index.jsx b/src/tabviews/zshare/cardcomponent/index.jsx index e9e7cfe..42963c9 100644 --- a/src/tabviews/zshare/cardcomponent/index.jsx +++ b/src/tabviews/zshare/cardcomponent/index.jsx @@ -18,6 +18,7 @@ class CardCell extends Component { static propTpyes = { + type: PropTypes.any, // 鍗$墖绫诲瀷锛屾坊鍔犳寜閽负 insert BID: PropTypes.any, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� @@ -34,7 +35,10 @@ state = { extra: null, // 椤堕儴鎸夐挳淇℃伅 - actions: null // 搴曢儴鎸夐挳琛� + actions: null, // 搴曢儴鎸夐挳琛� + cardwidth: 0, + cardheight: 0, + plusSize: 0 } UNSAFE_componentWillMount () { @@ -54,6 +58,47 @@ shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount() { + if (this.insertRef) { + let _width = this.insertRef.offsetWidth + let _height = this.insertRef.offsetHeight + + if (this.props.card.header) { + _height += 46 + } + if (this.props.card.bottom) { + _height += 49 + } + this.setState({ + cardwidth: _width, + cardheight: _height, + plusSize: _width > _height ? _height / 2 : _width / 2 + }) + } + } + + componentDidUpdate() { + if (this.insertRef) { + let _width = this.insertRef.offsetWidth + let _height = this.insertRef.offsetHeight + + if (this.props.card.header) { + _height += 46 + } + if (this.props.card.bottom) { + _height += 49 + } + + if (_height !== this.state.cardheight || _width !== this.state.cardwidth) { + this.setState({ + cardwidth: _width, + cardheight: _height, + plusSize: _width > _height ? _height / 2 : _width / 2 + }) + } + } } /** @@ -286,9 +331,9 @@ } return ( - <div className={className}> + <span className={className}> {content} - </div> + </span> ) } else if (col.type === 'number') { let content = '' @@ -334,9 +379,9 @@ } return ( - <div className={className}> + <span className={className}> {content} - </div> + </span> ) } } @@ -376,8 +421,8 @@ } render() { - const { card, selectKey, data } = this.props - const { extra, actions } = this.state + const { card, selectKey, data, type } = this.props + const { extra, actions, plusSize } = this.state let title = null if (card.header) { @@ -390,7 +435,7 @@ return ( <div className={'chart-card-box ' + card.outclass} style={card.outstyle || null} > - <Card + {type !== 'insert' ? <Card size="small" className={'chart-card ' + (selectKey === data.key ? 'chart-card-selected' : '')} title={title} @@ -416,7 +461,35 @@ })} </div> </div> - </Card> + </Card> : null} + {type === 'insert' ? <Card + size="small" + className="chart-card insert" + title={card.header ? ' ' : null} + bordered={card.bordered} + actions={card.bottom.actions ? [''] : null} + > + <div className="ant-card-meta" ref={(ref) => this.insertRef = ref} style={card.flex ? {display: 'flex'} : null}> + {card.avatar ? <div className="ant-card-meta-avatar" style={card.avatar.class}> </div> : null } + <div className="ant-card-meta-detail" style={card.flex ? {flex: 1} : null}> + {card.details.map((detail, i) => (<div className={detail.class} style={detail.style} key={i}></div>))} + </div> + </div> + <div className="mk-card-insert"> + <NormalButton + BID={this.props.BID} + Tab={this.props.Tab} + btn={card.insertAction} + show={'plus' + plusSize} + BData={this.props.BData} + setting={this.props.setting} + columns={this.props.logcolumns} + selectedData={[]} + ContainerId={this.props.ContainerId} + updateStatus={this.updateStatus} + /> + </div> + </Card> : null} </div> ) } @@ -456,6 +529,7 @@ let actionMap = new Map() // 鎸夐挳缁� let columns = fromJS(config.columns).toJS() let actions = fromJS(config.action).toJS() + let insertAction = null columns.forEach(col => { if (col.field) { @@ -466,6 +540,8 @@ actions.forEach(item => { if ((item.Ot && item.Ot !== 'notRequired' && !['excelIn', 'excelOut'].includes(item.OpenType)) || item.funcType === 'changeuser') { actionMap.set(item.uuid, item) + } else if (plot.insert === 'true' && !insertAction && item.OpenType === 'pop' && item.sqlType === 'insert' && item.Ot === 'notRequired') { + insertAction = item } }) @@ -603,6 +679,8 @@ card.switch = plot.switch !== 'false' + card.insertAction = insertAction // 娣诲姞鍗$墖 + this.setState({card: card, colMap: colMap}) } @@ -622,9 +700,10 @@ const { plot } = this.props const { card } = this.state - let _flex = false if (card.avatar) { + let _flex = false let _cardWidth = 300 + if (plot.widthType === 'absolute') { _cardWidth = plot.cardWidth } else { @@ -695,6 +774,22 @@ /> )) } + {!loading && card.insertAction && plot.over !== 'roll' ? + <CardCell + key="insert" + type="insert" + BID={BID} + Tab={Tab} + card={card} + data={{key: 'insert'}} + BData={BData} + MenuID={MenuID} + setting={config.setting} + ContainerId={ContainerId} + switchCard={() => {}} + refreshdata={this.props.refreshdata} + /> : null + } {plot.over === 'roll' && data && data.length > 0 ? <Tabs activeKey=""> {data.map((item, i) => ( @@ -713,11 +808,25 @@ switchCard={this.switchCard} refreshdata={this.props.refreshdata} />} key={i}></TabPane> - ))} + {!loading && card.insertAction ? + <TabPane tab={<CardCell + type="insert" + BID={BID} + Tab={Tab} + card={card} + data={{key: 'insert'}} + BData={BData} + MenuID={MenuID} + setting={config.setting} + ContainerId={ContainerId} + switchCard={() => {}} + refreshdata={this.props.refreshdata} + />} key="insert"></TabPane> : null + } </Tabs> : null } - {!data || data.length === 0 ? <Empty description={false}/> : null} + {(loading || !card.insertAction) && (!data || data.length === 0) ? <Empty description={false}/> : null} <div className="clear"></div> </div> ) diff --git a/src/tabviews/zshare/cardcomponent/index.scss b/src/tabviews/zshare/cardcomponent/index.scss index eca2eef..bea0e34 100644 --- a/src/tabviews/zshare/cardcomponent/index.scss +++ b/src/tabviews/zshare/cardcomponent/index.scss @@ -27,7 +27,7 @@ .ant-card.chart-card { .ant-card-head { .ant-card-extra { - display: block; + opacity: 1; } } } @@ -83,18 +83,47 @@ } } + .ant-card.chart-card.insert { + .ant-card-head { + border-color: transparent; + } + .ant-card-actions { + border-color: transparent; + background: transparent; + } + .mk-card-insert { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + .mk-btn-wrap { + width: 100%; + height: 100%; + .ant-btn { + border: 0; + width: 100%; + height: 100%; + color: rgb(38, 194, 129); + } + } + } + } + .ant-card.chart-card { transition: all 0.3s; .ant-card-head { - min-height: 40px; + min-height: 45px; line-height: 2; .ant-card-head-title { font-weight: 500; } .ant-card-extra { padding: 0px; - display: none; + opacity: 0; + transition: opacity 0.3s; } } .ant-card-actions { diff --git a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx index e181185..5016c8f 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx @@ -409,7 +409,12 @@ } else if (item.type === 'radio') { fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ -- Gitblit v1.8.0