king
2022-10-17 e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5
src/mob/components/menubar/normal-menubar/index.jsx
@@ -46,12 +46,11 @@
        format: 'object',   // 组件属性 - 数据格式
        pageable: false,    // 组件属性 - 是否可分页
        switchable: false,  // 组件属性 - 数据是否可切换
        dataName: card.dataName || '',
        width: card.width || 24,
        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: [{
@@ -88,10 +87,6 @@
    }
  }
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
  }
@@ -103,7 +98,6 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
  }
  /**
@@ -170,15 +164,11 @@
  changeStyle = () => {
    const { card } = this.state
    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style)
    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle)
  }
  getStyle = (comIds, style) => {
    const { card } = this.state
    if (comIds.length !== 1 || comIds[0] !== card.uuid) return
    let _card = {...card, style}
  getStyle = (style) => {
    let _card = {...this.state.card, style}
    this.setState({
      card: _card
@@ -221,6 +211,22 @@
    setTimeout(() => {
      let node = document.getElementById(newcard.uuid)
      node && node.click()
    }, 200)
  }
  filterComponent = (config) => {
    let item = null
    config.subMenus.forEach(menu => {
      if (menu.setting.type === 'linkmenu' && menu.setting.linkMenuId === '') {
        item = menu
      }
    })
    this.updateComponent(config)
    setTimeout(() => {
      let node = document.getElementById(item.uuid)
      node && node.click()
    }, 200)
  }
@@ -286,7 +292,7 @@
              <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
            <CopyComponent type="menubar" card={card}/>
            <PasteComponent config={card} options={['menucell']} updateConfig={this.updateComponent} />
            <PasteComponent config={card} options={['menucell']} updateConfig={this.filterComponent} />
            <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle} />
            <UserComponent config={card}/>
            <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} />
@@ -299,6 +305,7 @@
        <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 className="component-name"><div className="center">{card.name}</div></div>
      </div>
    )
  }