| | |
| | | let _card = { |
| | | uuid: card.uuid, |
| | | type: card.type, |
| | | floor: card.floor, |
| | | tabId: '', |
| | | parentId: '', |
| | | format: 'object', // 组件属性 - 数据格式 |
| | |
| | | name: card.name, |
| | | subtype: card.subtype, |
| | | setting: { interType: 'system' }, |
| | | wrap: { name: card.name, width: card.width || 24, title: '' }, |
| | | wrap: { name: card.name, width: card.width || 24, title: '', permission: 'true' }, |
| | | style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' }, |
| | | headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, |
| | | subMenus: [{ |
| | |
| | | /** |
| | | * @description 单个卡片信息更新 |
| | | */ |
| | | deleteCard = (cell) => { |
| | | deleteCard = (cell, type) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | |
| | | if (type !== 'direct') { |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | card.subMenus = card.subMenus.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | this.setState({card}) |
| | | this.props.updateConfig(card) |
| | | } |
| | | } |
| | | |
| | | changeStyle = () => { |
| | |
| | | |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | setting: { type: 'menu', width: 6, sign: 'icon', icon: 'user', name: '客户', url: '', color: '#ffffff', iconFont: 20, padding: 12, background: '#1890ff', imgWidth: '' }, |
| | | setting: { type: 'menu', width: 6, sign: 'icon', icon: '', name: '', url: '', color: '#ffffff', iconFont: 20, padding: 12, background: '#1890ff', imgWidth: '' }, |
| | | style: { |
| | | paddingTop: '15px', paddingBottom: '15px' |
| | | } |
| | |
| | | if (card.subMenus.length > 0) { |
| | | newcard = fromJS(card.subMenus.slice(-1)[0]).toJS() |
| | | newcard.uuid = Utils.getuuid() |
| | | |
| | | newcard.setting.clearMenu = 'true' |
| | | newcard.setting.icon = '' |
| | | newcard.setting.name = '' |
| | | newcard.setting.MenuNo = '' |
| | | newcard.setting.type = 'menu' |
| | | newcard.setting.copyMenuId = '' |
| | | newcard.setting.linkMenuId = '' |
| | | newcard.setting.linkurl = '' |
| | | newcard.setting.tip = '' |
| | | newcard.setting.url = '' |
| | | } |
| | | |
| | | card.subMenus.push(newcard) |
| | | |
| | | this.setState({card}) |
| | | this.props.updateConfig(card) |
| | | |
| | | setTimeout(() => { |
| | | let node = document.getElementById(newcard.uuid) |
| | | node && node.click() |
| | | }, 200) |
| | | } |
| | | |
| | | move = (item, direction) => { |
| | |
| | | render() { |
| | | const { card } = this.state |
| | | |
| | | let offset = 0 |
| | | if (card.wrap.cardFloat && card.wrap.cardFloat !== 'left') { |
| | | let _width = 0 |
| | | card.subMenus.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> |
| | | {card.subMenus.map((menu, index) => (<MenuComponent key={menu.uuid} offset={!index ? offset : 0} cards={card} card={menu} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | <div className={(card.wrap.layout || 'grid') + '-layout'}> |
| | | {card.subMenus.map((menu, index) => (<MenuComponent key={menu.uuid} cards={card} card={menu} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |