| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('revert', this.revert) |
| | | MKEmitter.addListener('addButton', this.addButton) |
| | | } |
| | | |
| | | /** |
| | | * @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))) { |
| | | this.setState({actionlist: fromJS(nextProps.config.action).toJS()}) |
| | | } |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('revert', this.revert) |
| | | MKEmitter.removeListener('addButton', this.addButton) |
| | | MKEmitter.removeListener('submitModal', this.handleSave) |
| | | } |
| | | |
| | | revert = () => { |
| | | this.setState({ |
| | | actionlist: fromJS(this.props.config.action).toJS() |
| | | }) |
| | | } |
| | | |
| | | handleSave = (componentId, btnId, modal) => { |
| | | const { config } = this.props |
| | | |
| | | if (config.uuid !== componentId) return |
| | | |
| | | const { actionlist } = this.state |
| | | |
| | | let _index = actionlist.findIndex(cell => cell.uuid === btnId) |
| | | |
| | | if (_index === -1) return |
| | | |
| | | let _actionlist = actionlist.map(cell => { |
| | | if (cell.uuid === btnId) { |
| | | cell.modal = modal |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | |
| | | this.setState({ |
| | | actionlist: _actionlist |
| | | }, () => { |
| | | this.props.updateaction({...config, action: _actionlist}) |
| | | }) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | profVisible: true, |
| | | card: element |
| | | }) |
| | | MKEmitter.emit('modalStatus', '验证信息') |
| | | } |
| | | |
| | | /** |
| | |
| | | }, () => { |
| | | this.props.updateaction({...config, action: _actionlist}) |
| | | }) |
| | | MKEmitter.emit('modalStatus', false) |
| | | }) |
| | | } |
| | | |
| | |
| | | if (this.verifyRef.handleCancel) { |
| | | this.verifyRef.handleCancel().then(() => { |
| | | this.setState({ profVisible: false }) |
| | | MKEmitter.emit('modalStatus', false) |
| | | }) |
| | | } else { |
| | | this.setState({ profVisible: false }) |
| | | MKEmitter.emit('modalStatus', false) |
| | | } |
| | | }} |
| | | destroyOnClose |