| | |
| | | |
| | | class CardBoxComponent extends Component { |
| | | static propTpyes = { |
| | | offset: PropTypes.any, // 偏移量 |
| | | cards: PropTypes.object, // 卡片行配置信息 |
| | | card: PropTypes.object, // 卡片配置信息 |
| | | move: PropTypes.func, // 卡片移动 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { cards, offset } = this.props |
| | | const { cards } = this.props |
| | | const { card, elements, side, visible } = this.state |
| | | |
| | | let _style = {...card.style} |
| | |
| | | _style = resetStyle(_style) |
| | | |
| | | return ( |
| | | <Col span={card.setting.width || 6} offset={offset || 0}> |
| | | <Col span={card.setting.width || 6}> |
| | | <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onClick={this.clickComponent} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> |
| | | <CardCellComponent cards={cards} cardCell={card} side={side} elements={elements} updateElement={this.updateCard}/> |
| | | <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | |
| | | render() { |
| | | const { card, appType } = this.state |
| | | |
| | | let offset = 0 |
| | | if (card.wrap.cardFloat && card.wrap.cardFloat !== 'left') { |
| | | let _width = 0 |
| | | card.subcards.forEach(card => { |
| | | _width += card.setting.width |
| | | }) |
| | | offset = _width < 24 ? 24 - _width : 0 |
| | | if (card.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | | } |
| | | let _style = resetStyle(card.style) |
| | | |
| | | return ( |
| | |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <ActionComponent config={card} type="datacard" setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> |
| | | {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} offset={!index ? offset : 0} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | <div className={'float-' + (card.wrap.cardFloat || 'left')}> |
| | | {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | </div> |
| | | <div style={{clear: 'both'}}></div> |
| | | {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType !== 'mob' ? <Pagination total={85} size="small" showTotal={total => `共 ${total} 条`} pageSize={20} defaultCurrent={1}/> : null} |
| | | {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType === 'mob' ? <MobPagination /> : null} |
| | |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | .float-center { |
| | | text-align: center; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .float-right { |
| | | text-align: right; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .menu-data-card-edit-box::-webkit-scrollbar { |
| | |
| | | ], |
| | | controlFields: subtype !== 'propcard' ? [ |
| | | {field: 'printHeight', values: ['flex']}, |
| | | ] : [], |
| | | {field: 'cardFloat', values: ['grid']}, |
| | | ] : [{field: 'cardFloat', values: ['grid']}], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | |
| | | field: 'cardFloat', |
| | | label: '对齐方式', |
| | | initval: wrap.cardFloat || 'left', |
| | | tooltip: '设置为居中对齐或右对齐,只在卡片为1行时有效。', |
| | | tooltip: '设置卡片的对齐方式。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'left', label: '左对齐'}, |
| | |
| | | render() { |
| | | const { card } = this.state |
| | | |
| | | let offset = 0 |
| | | if (card.wrap.cardFloat && card.wrap.cardFloat !== 'left') { |
| | | let _width = 0 |
| | | card.subcards.forEach(card => { |
| | | _width += card.setting.width |
| | | }) |
| | | offset = _width < 24 ? 24 - _width : 0 |
| | | if (card.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | | } |
| | | |
| | | let _style = resetStyle(card.style) |
| | | |
| | | return ( |
| | |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <div className={(card.wrap.layout || 'grid') + '-layout'}> |
| | | {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} offset={!index ? offset : 0} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | <div className={(card.wrap.layout || 'grid') + '-layout float-' + (card.wrap.cardFloat || 'left')}> |
| | | {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | flex: 1; |
| | | } |
| | | } |
| | | .float-center { |
| | | text-align: center; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .float-right { |
| | | text-align: right; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | } |
| | | .menu-prop-card-edit-box::after { |
| | | display: block; |
| | |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | min-height: 50px; |
| | | min-height: 100px; |
| | | overflow-y: auto; |
| | | |
| | | .anticon-tool { |
| | |
| | | this.setState({loading: false}) |
| | | }) |
| | | } else if (activeKey === 'columns') { |
| | | if (this.datasource && this.datasource.state.editingKey) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段未保存,请保存后切换!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: val, |
| | | loading: false |
| | |
| | | reject() |
| | | }) |
| | | } else if (activeKey === 'columns') { |
| | | if (this.datasource && this.datasource.state.editingKey) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段未保存,请保存后提交!', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, false) |
| | | } else if (activeKey === 'scripts') { |
| | | let _loading = false |
| | |
| | | updatefield={this.updatefields} |
| | | /> |
| | | <CopyOutlined title="以逗号拼接形式复制字段" onClick={this.copyColumns} style={{position: 'absolute', cursor: 'pointer', zIndex: 1, top: '-35px', right: '0px', color: '#1890ff'}} /> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} type="datasourcefield" data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <span> |
| | |
| | | </Col> |
| | | ) |
| | | } else if (card.eleType === 'currentDate') { |
| | | let val = card.dateFormat ? moment().format(card.dateFormat) : '' |
| | | if (val !== '') { |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | let val = moment().format(card.dateFormat || 'YYYY-MM-DD') |
| | | |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> |
| | | } else { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | |
| | | return ( |
| | |
| | | _sync = false |
| | | } |
| | | |
| | | if (_config.wrap.cardFloat && _config.wrap.cardFloat !== 'left') { |
| | | let _width = 0 |
| | | precards.forEach(card => { |
| | | _width += card.setting.width |
| | | }) |
| | | nextcards.forEach(card => { |
| | | _width += card.setting.width |
| | | }) |
| | | |
| | | _config.$offset = _width |
| | | } else { |
| | | _config.wrap.cardFloat = null |
| | | } |
| | | |
| | | let selected = 'false' |
| | | if (_config.wrap.selected === 'always' || _config.wrap.selected === 'init') { |
| | | selected = _config.wrap.selected |
| | |
| | | |
| | | _config.wrap.selStyle = _config.wrap.selStyle || 'active' |
| | | _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : '' |
| | | _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout' |
| | | _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout float-' + (_config.wrap.cardFloat || 'left') |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}` |
| | | |
| | |
| | | _total = config.setting.pageSize * pageIndex |
| | | switchable = true |
| | | } |
| | | let offset = 0 |
| | | |
| | | if (config.wrap.cardFloat) { |
| | | let length = data ? data.length : 0 |
| | | if (card.setting.width * length + config.$offset < 24) { |
| | | offset = 24 - card.setting.width * length - config.$offset |
| | | if (config.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | |
| | | <div className={`data-zoom ${config.wrap.wrapClass}`}> |
| | | {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} |
| | | <Row className={'card-row-list ' + config.wrap.layout}> |
| | | {offset ? <Col span={offset} style={{height: '10px'}}> </Col> : null} |
| | | {precards.map((item, index) => ( |
| | | <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}> |
| | | <CardItem card={item} cards={config} data={extendData}/> |
| | |
| | | flex: 1; |
| | | } |
| | | } |
| | | .card-row-list.float-center { |
| | | text-align: center; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .card-row-list.float-right { |
| | | text-align: right; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .card-item-box { |
| | | position: relative; |
| | | background-color: #ffffff; |
| | |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | let _width = 0 |
| | | _config.subcards.forEach(card => { |
| | | if (card.setting.click === 'button' && !card.setting.linkbtn) { |
| | | card.elements.forEach(ele => { |
| | |
| | | card.setting.click = '' |
| | | } |
| | | } |
| | | _width += card.setting.width |
| | | card.elements = card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | |
| | | }) |
| | | }) |
| | | |
| | | let offset = 0 |
| | | if (_config.wrap.cardFloat && _config.wrap.cardFloat !== 'left' && _width < 24) { |
| | | offset = 24 - _width |
| | | if (_config.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | | _config.subcards[0].offset = offset |
| | | } |
| | | |
| | | let selected = _config.wrap.selected || 'false' |
| | | |
| | | _config.wrap.selStyle = _config.wrap.selStyle || 'active' |
| | | _config.wrap.priKeyType = _config.wrap.priKeyType || 'static' |
| | | _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : '' |
| | | _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout' |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale || ''}` |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale || ''} ${_config.wrap.layout || 'grid'}-layout float-${_config.wrap.cardFloat || 'left'}` |
| | | |
| | | this.setState({ |
| | | selected, |
| | |
| | | </div> : null |
| | | } |
| | | <NormalHeader config={config}/> |
| | | <Row className={`card-row-list data-zoom ${config.wrap.wrapClass} ${config.wrap.layout}`}> |
| | | <Row className={`card-row-list data-zoom ${config.wrap.wrapClass}`}> |
| | | {config.subcards.map((item, index) => { |
| | | let className = item.setting.click ? 'mk-card pointer ' : 'mk-card ' |
| | | if (activeKey === index) { |
| | |
| | | flex: 1; |
| | | } |
| | | } |
| | | .card-row-list.float-center { |
| | | text-align: center; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .card-row-list.float-right { |
| | | text-align: right; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .card-row-list.scale { |
| | | .mk-card:hover { |
| | | >.card-item-box { |
| | |
| | | height: 60px; |
| | | } |
| | | } |
| | | .tree-header + .ant-empty { |
| | | margin-top: 35px; |
| | | } |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 0px; |