king
2021-09-27 54d01e6ef9ac31f10de4a0e92824eba50b77eda6
src/templates/sharecomponent/actioncomponent/index.jsx
@@ -16,6 +16,7 @@
import CreateInterface from '@/templates/zshare/createinterface'
import { updateForm } from '@/utils/utils-update.js'
import DragElement from './dragaction'
import MKEmitter from '@/utils/events.js'
import './index.scss'
const { confirm } = Modal
@@ -54,24 +55,22 @@
    })
  }
  /**
   * @description 监听到按钮复制时,触发按钮编辑
   */
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { actionlist } = this.state
    if (!is(fromJS(nextProps.config.action), fromJS(this.props.config.action)) && !is(fromJS(nextProps.config.action), fromJS(actionlist))) {
      let len = nextProps.config.action.length
      let item = nextProps.config.action[len - 1]
      if (item && item.focus) {
        this.handleAction(item)
      }
      this.setState({actionlist: fromJS(nextProps.config.action).toJS()})
    }
  }
  componentDidMount () {
    this.getBillPrintTemp()
    MKEmitter.addListener('pasteButton', this.pasteButton)
  }
  pasteButton = (MenuId, btn) => {
    const { config } = this.props
    const { actionlist } = this.state
    if (MenuId !== config.uuid) return
    this.setState({
      actionlist: [...actionlist, btn],
    }, () => {
      this.handleAction(btn)
    })
  }
  getBillPrintTemp = () => {
@@ -835,7 +834,7 @@
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
    return !is(fromJS(this.state), fromJS(nextState))
  }
  /**
@@ -845,6 +844,7 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('pasteButton', this.pasteButton)
  }
  render() {