From bd06958321afa706f32287c71bd219eb0622c86c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 10 十二月 2019 16:31:45 +0800 Subject: [PATCH] 2019-12-10 --- src/tabviews/commontable/mainAction/index.jsx | 115 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 70 insertions(+), 45 deletions(-) diff --git a/src/tabviews/commontable/mainAction/index.jsx b/src/tabviews/commontable/mainAction/index.jsx index e028e73..22fd0a8 100644 --- a/src/tabviews/commontable/mainAction/index.jsx +++ b/src/tabviews/commontable/mainAction/index.jsx @@ -2,7 +2,7 @@ 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' @@ -13,7 +13,8 @@ MenuID: PropTypes.string, actions: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 dict: PropTypes.object, // 瀛楀吀椤� - setting: PropTypes.any + setting: PropTypes.any, + configMap: PropTypes.object } state = { @@ -29,7 +30,7 @@ this.props.refreshdata(item, type) } actionTrigger = (item) => { - const { setting } = this.props + const { setting, configMap } = this.props let _this = this let data = this.props.gettableselected() || [] @@ -74,6 +75,22 @@ 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, @@ -442,53 +459,31 @@ }) } - 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 + // }) + // } + // }) }, () => {}) } @@ -496,7 +491,36 @@ 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() { @@ -557,6 +581,7 @@ ) } })} + {this.getModels()} </div> ) } -- Gitblit v1.8.0