| | |
| | | } |
| | | MKEmitter.removeListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮状态改变 |
| | | */ |
| | | updateStatus = (type) => { |
| | | if (type === 'start') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } else if (type === 'over') { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | |
| | | } |
| | | |
| | | if (btn.execMode === 'pop') { |
| | | this.updateStatus('start') |
| | | let modal = this.state.btnconfig |
| | | if (!modal && btn.modal) { |
| | | modal = this.handleModelConfig(btn.modal) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | tabledata: data, |
| | | btnconfig: modal |
| | | }, () => { |
| | | this.improveAction() |
| | | }) |
| | | } else if (btn.execMode === 'prompt') { |
| | | this.updateStatus('start') |
| | | this.setState({ loading: true }) |
| | | confirm({ |
| | | title: this.state.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | _this.triggerPrint(data) |
| | | }, |
| | | onCancel() { |
| | | _this.updateStatus('over') |
| | | _this.setState({ loading: false }) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | this.updateStatus('over') |
| | | this.setState({ loading: false }) |
| | | } else if (!_LongParam || (btn.execMode === 'pop' && _LongParam.type !== 'Modal')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到按钮配置信息!', |
| | | duration: 5 |
| | | }) |
| | | this.updateStatus('over') |
| | | this.setState({ loading: false }) |
| | | } else { |
| | | _LongParam = updateForm(_LongParam) |
| | | _LongParam = this.handleModelConfig(_LongParam) |
| | |
| | | * @description 模态框(表单),确认 |
| | | */ |
| | | handleOk = () => { |
| | | const { btnconfig } = this.state |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | if (btnconfig.setting.finish !== 'unclose') { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | } |
| | | this.triggerPrint(this.state.tabledata, res) |
| | | }) |
| | | } |
| | |
| | | */ |
| | | handleCancel = () => { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | this.updateStatus('over') |
| | | } |
| | | |
| | | modelconfirm = () => { |
| | |
| | | _this.triggerPrint(tabledata, result) |
| | | }, |
| | | onCancel() { |
| | | _this.updateStatus('over') |
| | | _this.setState({ loading: false }) |
| | | } |
| | | }) |
| | | } |