| | |
| | | const { MonthPicker } = DatePicker |
| | | const { TextArea } = Input |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, editCard, closeCard, hasDrop }) => { |
| | | const Card = ({ id, card, cols, moveCard, findCard, editCard, closeCard, hasDrop }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes.form, id, originalIndex }, |
| | |
| | | selectval = '全部' |
| | | } |
| | | } |
| | | let labelCol = 'ant-col-sm-8' |
| | | let wrapCol = 'ant-col-sm-16' |
| | | if (card.type === 'textarea') { |
| | | if (cols === '2') { |
| | | labelCol = 'ant-col-sm-4' |
| | | wrapCol = 'ant-col-sm-20' |
| | | } else if (cols === '3') { |
| | | labelCol = 'ant-col-cuslabel' |
| | | wrapCol = 'ant-col-cuswrap' |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {<div className="ant-row ant-form-item"> |
| | | <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> |
| | | <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}> |
| | | <label title={card.label}>{card.label}</label> |
| | | </div> |
| | | <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16"> |
| | | <div className={'ant-col ant-form-item-control-wrapper ant-col-xs-24 ' + wrapCol}> |
| | | {card.type === 'text' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> |
| | | } |
| | |
| | | <DatePicker showTime defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} /> |
| | | } |
| | | {card.type === 'textarea' && |
| | | <TextArea autoSize={{ minRows: 2, maxRows: 6 }} /> |
| | | <TextArea autosize={{ minRows: 2, maxRows: 6 }} /> |
| | | } |
| | | {card.type === 'fileupload' && |
| | | <Button> |