| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | |
| | | 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}> |
| | | {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>} |
| | | {type === 'columns' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> |
| | | </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>} |
| | | </Radio.Group> : null |
| | | } |
| | | </div> |
| | | ) |
| | | } |