king
2019-12-10 bd06958321afa706f32287c71bd219eb0622c86c
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>
      )
    }