| | |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { Button, Affix, Modal, notification } from 'antd' |
| | | import MutilForm from '@/components/mutilform' |
| | | import MutilForm from '../mutilform' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | |
| | | MenuID: PropTypes.string, |
| | | actions: PropTypes.array, // 搜索条件列表 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any |
| | | setting: PropTypes.any, |
| | | configMap: PropTypes.object |
| | | } |
| | | |
| | | state = { |
| | |
| | | this.props.refreshdata(item, type) |
| | | } |
| | | actionTrigger = (item) => { |
| | | const { setting } = this.props |
| | | const { setting, configMap } = this.props |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | |
| | |
| | | this.execSubmit(item, data, () => { |
| | | this.setState({loadingUuid: ''}) |
| | | }) |
| | | } else if (item.OpenType === 'pop') { |
| | | let param = configMap[item.uuid] |
| | | |
| | | if (!param || param.type !== 'Modal') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到按钮配置信息!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | execAction: {...param, ...item}, |
| | | tabledata: data |
| | | }) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | } |
| | | |
| | | getModels = () => { |
| | | return ( |
| | | <Modal |
| | | wrapClassName='action-modal' |
| | | title={(this.state.execAction && this.state.execAction.MenuName) || ''} |
| | | visible={this.state.visible} |
| | | width={(this.state.execAction && +this.state.execAction.PopWidth) || 520} |
| | | onOk={this.handleOk} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.handleCancel} |
| | | > |
| | | {this.state.formdata && |
| | | <MutilForm |
| | | dict={this.props.dict} |
| | | formlist={this.state.formdata} |
| | | data={this.state.tabledata} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | </Modal> |
| | | ) |
| | | } |
| | | |
| | | handleOk = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | console.log(res) |
| | | Api.setActionSubmit({ |
| | | func: 'SetActionSubmitSuccess' |
| | | }).then((res) => { |
| | | if (res.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.success'] |
| | | }) |
| | | this.setState({ |
| | | confirmLoading: false, |
| | | visible: false |
| | | }) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message |
| | | }) |
| | | } |
| | | }) |
| | | // Api.setActionSubmit({ |
| | | // func: 'SetActionSubmitSuccess' |
| | | // }).then((res) => { |
| | | // if (res.status) { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: this.props.dict['main.action.confirm.success'] |
| | | // }) |
| | | // this.setState({ |
| | | // confirmLoading: false, |
| | | // visible: false |
| | | // }) |
| | | // } else { |
| | | // notification.error({ |
| | | // top: 92, |
| | | // message: res.message |
| | | // }) |
| | | // } |
| | | // }) |
| | | }, () => {}) |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | this.formRef.handleReset() |
| | | } |
| | | |
| | | getModels = () => { |
| | | const { execAction } = this.state |
| | | let title = '' |
| | | let width = '62vw' |
| | | if (execAction && execAction.setting) { |
| | | title = execAction.setting.title |
| | | width = execAction.setting.width + 'vw' |
| | | } |
| | | |
| | | return ( |
| | | <Modal |
| | | wrapClassName='action-modal' |
| | | title={title} |
| | | visible={this.state.visible} |
| | | width={width} |
| | | onOk={this.handleOk} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.handleCancel} |
| | | destroyOnClose |
| | | > |
| | | <MutilForm |
| | | dict={this.props.dict} |
| | | action={execAction} |
| | | data={this.state.tabledata} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | | ) |
| | | } |
| | | |
| | | render() { |
| | |
| | | ) |
| | | } |
| | | })} |
| | | {this.getModels()} |
| | | </div> |
| | | ) |
| | | } |