From 9f9d68cf40f1d7470bfb49220266b26663cbb722 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 23 十一月 2019 14:55:11 +0800 Subject: [PATCH] 2019-11-23-01 --- src/templates/comtableconfig/editcard/index.jsx | 53 +++++++++++++++++++++++++++++------------------------ 1 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/templates/comtableconfig/editcard/index.jsx b/src/templates/comtableconfig/editcard/index.jsx index c7b8b25..9223eba 100644 --- a/src/templates/comtableconfig/editcard/index.jsx +++ b/src/templates/comtableconfig/editcard/index.jsx @@ -6,8 +6,21 @@ constructor(props) { super(props) + let _type = props.card.type + if (props.type === 'columns') { + if (_type !== 'picture') { + _type = 'text' + } + } else if (props.type === 'search') { + if (_type === 'number') { + _type = 'text' + } else if (_type === 'datetime') { + _type = 'date' + } + } + this.state = { - card: props.card, + card: {...props.card, type: _type}, type: props.type } } @@ -28,34 +41,26 @@ render() { const { card, type } = this.state - let _type = card.type - if (type === 'columns') { - if (_type !== 'picture') { - _type = 'text' - } - } else if (type === 'search') { - if (_type === 'number') { - _type = 'text' - } else if (_type === 'datetime') { - _type = 'date' - } - } return ( <div className={'ant-card ant-card-bordered ' + (card.selected ? 'selected' : '')} > <div className="base" onClick={this.changeSelect}> <Icon type="check" /> - <p title={card.field}>瀛楁鍚�: <span>{card.field}</span></p> - <p title={card.label}>鎻愮ず鏂囧瓧: <span>{card.label}</span></p> + <p title={card.field}>瀛楁锛� <span>{card.field}</span></p> + <p title={card.label}>鍚嶇О锛� <span>{card.label}</span></p> </div> - {type === 'search' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> - <Radio value="text">text</Radio> - <Radio value="select">select</Radio> - <Radio value="date">date</Radio> - </Radio.Group>} - {type === 'columns' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> - <Radio value="text">text</Radio> - <Radio value="picture">picture</Radio> - </Radio.Group>} + {type === 'search' ? + <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> + <Radio value="text">text</Radio> + <Radio value="select">select</Radio> + <Radio value="date">date</Radio> + </Radio.Group> : null + } + {type === 'columns' ? + <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> + <Radio value="text">text</Radio> + <Radio value="picture">picture</Radio> + </Radio.Group> : null + } </div> ) } -- Gitblit v1.8.0