king
2019-10-16 910e22f4bccbe5e5d8951398bd53a7d6d636b852
src/tabviews/datamanage/modules/action/index.jsx
@@ -157,9 +157,8 @@
                    top: 92,
                    message: _this.props.dict['main.action.confirm.success']
                  })
                  if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                    _this.props.refreshdata(item.ReloadForm)
                  }
                  _this.props.refreshdata(item.ReloadForm) // 刷新页面
                }
              } else {
                if (res.status) {
@@ -167,9 +166,8 @@
                    top: 92,
                    message: _this.props.dict['main.action.confirm.success']
                  })
                  if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                    _this.props.refreshdata(item.ReloadForm)
                  }
                  _this.props.refreshdata(item.ReloadForm) // 刷新页面
                } else {
                  notification.error({
                    top: 92,
@@ -202,9 +200,8 @@
                top: 92,
                message: this.props.dict['main.action.confirm.success']
              })
              if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                this.props.refreshdata(item.ReloadForm)
              }
              this.props.refreshdata(item.ReloadForm) // 刷新页面
            }
          } else {
            if (res.status) {
@@ -212,9 +209,8 @@
                top: 92,
                message: this.props.dict['main.action.confirm.success']
              })
              if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                this.props.refreshdata(item.ReloadForm)
              }
              this.props.refreshdata(item.ReloadForm) // 刷新页面
            } else {
              notification.error({
                top: 92,
@@ -227,7 +223,7 @@
    } else if (item.OpenType === 'newpage') { // 打开新页面
      let src = '#/' + item.LinkUrl + '?param=' + window.btoa(JSON.stringify({UserId: sessionStorage.getItem('UserID'), ID: datalist[0][ID[0]], BID: BID.length === 1 ? datalist[0][BID[0]] : ''}))
      window.open(src)
    } else if (item.OpenType === 'pop') {
    } else if (item.OpenType === 'pop') { // 模态框
      this.setState({
        formdata: this.props.columns.map(column => {
          column.readonly = false
@@ -242,7 +238,7 @@
        bidkey: BID.length === 1 ? BID[0] : '',
        tabledata: datalist[0] || ''
      })
    } else if (item.OpenType === 'tab') {
    } else if (item.OpenType === 'tab') { // 打开新标签页
      let menu = {
        MenuNo: this.props.MenuNo,
        MenuID: item.MenuID,
@@ -284,8 +280,21 @@
        tabs.splice(_index + 1, 0, menu)
      }
      this.props.modifyTabview(tabs)
    } else if (item.OpenType === 'blank') {
      this.props.switchview(item)
    } else if (item.OpenType === 'blank') { // 当前页面跳转
      this.props.switchformview({
        formdata: this.props.columns.map(column => {
          column.readonly = false
          if (column.ReadOnly.includes(item.MenuID)) {
            column.readonly = true
          }
          return column
        }),
        execAction: item,
        primarykey: ID[0],
        bidkey: BID.length === 1 ? BID[0] : '',
        tabledata: datalist[0] || '',
        defaultproc: this.state.defaultproc
      })
    } else {
      notification.warning({
        top: 92,
@@ -295,19 +304,8 @@
    }
  }
  changemenu(e) {
    let menu = {}
    let tabs = JSON.parse(JSON.stringify(this.props.tabviews))
    tabs = tabs.filter(tab => {
      tab.selected = false
      return tab.MenuID !== menu.MenuID
    })
    menu.selected = true
    tabs.push(menu)
    this.props.modifyTabview(tabs)
  }
  getModels = () => {
    // 获取弹窗表单信息
    if (!this.state.execAction) return
    let cols = +this.state.execAction.FormLineQty
    if (![1, 2, 3].includes(cols)) {
@@ -341,23 +339,31 @@
        confirmLoading: true
      })
      let values = []
      // 从表单中获取填写数据
      this.props.columns.forEach(column => {
        let value = ''
        if (res[column.FieldName] || res[column.FieldName] === 0) { // 依次选取表单值、表格数据值、初始值
        if (res.hasOwnProperty(column.FieldName)) { // 依次选取表单值、初始值
          value = res[column.FieldName]
        } else if (this.state.tabledata && this.state.tabledata[column.FieldName]) {
          value = this.state.tabledata[column.FieldName]
        } else if (column.InitVal) {
          value = column.InitVal
        }
        values.push(value)
      })
      Api.submitInterface({
      let queryparam = { // 请求参数
        func: this.state.execAction.AuditProc || this.state.defaultproc[this.state.execAction.Action],
        AddLongText: values.join(','), // 表单数据
        ID: (this.state.tabledata && this.state.primarykey) ? this.state.tabledata[this.state.primarykey] : '', // 主键字段
        BID: (this.state.tabledata && this.state.bidkey) ? this.state.tabledata[this.state.bidkey] : '' // BID字段
      }).then(result => {
      }
      // 添加和修改请求参数字段不同
      if (this.state.execAction.Action === 'Add') {
        queryparam.AddLongText = values.join(',')
      } else if (this.state.execAction.Action === 'Update') {
        queryparam.UptLongText = values.join(',')
      }
      // 提交请求
      Api.submitInterface(queryparam).then(result => {
        if (result.status) {
          notification.success({
            top: 92,
@@ -367,9 +373,8 @@
            confirmLoading: false,
            visible: false
          })
          if (this.state.execAction.ReloadForm && this.state.execAction.ReloadForm !== 'false' && this.state.execAction.ReloadForm !== 'singlegrid') {
            this.props.refreshdata(this.state.execAction.ReloadForm)
          }
          this.props.refreshdata(this.state.execAction.ReloadForm) // 刷新页面
        } else {
          this.setState({
            confirmLoading: false
@@ -385,15 +390,12 @@
  }
  handleCancel = () => {
    // 取消
    this.setState({
      confirmLoading: false,
      visible: false
    })
    this.formRef.handleReset()
  }
  UNSAFE_componentWillMount () {
  }
  render() {