king
2025-01-24 e1cee96b38805bcccf48e7bcb9d296f2bc54c720
src/mob/components/menubar/normal-menubar/index.jsx
@@ -16,7 +16,6 @@
const MenuComponent = asyncComponent(() => import('./menucomponent'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent'))
const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
@@ -41,12 +40,9 @@
      let _card = {
        uuid: card.uuid,
        type: card.type,
        tabId: '',
        parentId: '',
        format: 'object',   // 组件属性 - 数据格式
        pageable: false,    // 组件属性 - 是否可分页
        switchable: false,  // 组件属性 - 数据是否可切换
        dataName: card.dataName || '',
        width: card.width || 24,
        name: card.name,
        subtype: card.subtype,
@@ -63,20 +59,6 @@
        }]
      }
      if (card.config) {
        let config = fromJS(card.config).toJS()
        _card.wrap = config.wrap
        _card.wrap.name = card.name
        _card.style = config.style
        _card.headerStyle = config.headerStyle
        _card.subMenus = config.subMenus.map(item => {
          item.uuid = Utils.getuuid()
          return item
        })
      }
      this.setState({
        card: _card
      })
@@ -86,10 +68,6 @@
        card: fromJS(card).toJS()
      })
    }
  }
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -103,7 +81,6 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
  }
  /**
@@ -146,7 +123,7 @@
   */
  deleteCard = (cell, type) => {
    let card = fromJS(this.state.card).toJS()
    let _this = this
    let that = this
    if (type !== 'direct') {
      confirm({
@@ -154,8 +131,8 @@
        onOk() {
          card.subMenus = card.subMenus.filter(item => item.uuid !== cell.uuid)
  
          _this.setState({card})
          _this.props.updateConfig(card)
          that.setState({card})
          that.props.updateConfig(card)
        },
        onCancel() {}
      })
@@ -170,15 +147,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', 'clear'], 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
@@ -283,7 +256,13 @@
  clickComponent = (e) => {
    if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
      e.stopPropagation()
      MKEmitter.emit('clickComponent', this.state.card)
      MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => {
        let _card = {...this.state.card}
        _card.style = {..._card.style, ...style}
        this.setState({ card: _card })
        this.props.updateConfig(_card)
      })
    }
  }
@@ -304,7 +283,6 @@
            <CopyComponent type="menubar" card={card}/>
            <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)} />
            {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
            {card.wrap.datatype !== 'dynamic' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null}