king
2022-02-25 d82fec9e2a4238ff1833e67c01bc9b34e525d904
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -85,6 +85,10 @@
    if (btn.OpenType === 'form') {
      let data = selectedData && selectedData[0] ? selectedData[0] : null
      this.setState({check: data && data[btn.field] === btn.openVal})
    } else if (btn.OpenType === 'formSubmit') {
      this.setState({
        selines: selectedData || []
      })
    }
  }
@@ -142,6 +146,10 @@
    if (btn.OpenType === 'form') {
      let data = nextProps.selectedData && nextProps.selectedData[0] ? nextProps.selectedData[0] : null
      this.setState({check: data && data[btn.field] === btn.openVal})
    } else if (btn.OpenType === 'formSubmit') {
      this.setState({
        selines: nextProps.selectedData || []
      })
    }
  }
@@ -164,13 +172,39 @@
  }
  actionSubmit = (res) => {
    const { btn } = this.props
    const { btn, setting, BID } = this.props
    const { selines } = this.state
    if (btn.uuid !== res.menuId) return
    let data = selines || []
    if (setting.supModule && !BID) {
      notification.warning({
        top: 92,
        message: '需要上级主键值!',
        duration: 3
      })
      return
    } else if (btn.Ot !== 'notRequired' && data.length === 0) {
      notification.warning({
        top: 92,
        message: '请选择行!',
        duration: 5
      })
      return
    } else if (btn.Ot === 'requiredSgl' && data.length !== 1) {
      notification.warning({
        top: 92,
        message: '请选择单行数据!',
        duration: 5
      })
      return
    }
    this.setState({ loading: true })
    this.execSubmit(this.state.selines, () => {}, res.form)
    this.execSubmit(data, () => {}, res.form)
  }
  resetModuleParam = (menuId, btnId, param) => {
@@ -300,12 +334,14 @@
    })
    
    if (btn.OpenType === 'formSubmit') {
      MKEmitter.emit('mkFormSubmit', btn.uuid)
      this.setState({}, () => {
        MKEmitter.emit('mkFormSubmit', btn.uuid)
      })
      return
    } else if (btn.OpenType === 'prompt') {
      this.setState({loading: true})
      confirm({
        title: this.state.dict['main.action.confirm.tip'],
        title: btn.tipTitle || this.state.dict['main.action.confirm.tip'],
        onOk() {
          return new Promise(resolve => {
            _this.execSubmit(data, resolve)
@@ -985,6 +1021,12 @@
      _resolve()
    })
  }
  // xml调用方式
  // Api.directRequest('http://localhost:3001/test.xml', 'get', null, 'true').then(res => {
  //   let $x2js = new x2js()
  //   let jsonObj = $x2js.xml2js(res);
  //   console.info(jsonObj)
  // })
  /**
   * @description 自定义请求循环执行
@@ -1449,7 +1491,7 @@
    const { btn } = this.props
    const { btnconfig, autoMatic } = this.state
    if ((res && res.ErrCode === 'S') || autoMatic) { // 执行成功
    if ((res && (res.ErrCode === 'S' || !res.ErrCode)) || autoMatic) { // 执行成功
      notification.success({
        top: 92,
        message: res.ErrMesg || this.state.dict['main.action.confirm.success'],
@@ -1485,6 +1527,15 @@
    if (btn.output) {
      id = res.mk_b_id || res[btn.output] || ''
    }
    let tabId = ''
    if (btn.refreshTab && btn.refreshTab.length > 0) {
      tabId = btn.refreshTab[btn.refreshTab.length - 1]
    }
    if (tabId && btn.$MenuID === tabId) { // 刷新当前菜单时,停止其他操作
      MKEmitter.emit('reloadMenuView', tabId, 'table')
      return
    }
    if (btn.execSuccess === 'closetab') {
      MKEmitter.emit('closeTabView', btn.$MenuID)
@@ -1494,9 +1545,10 @@
      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines)
    }
    if (btn.refreshTab && btn.refreshTab.length > 0) {
      MKEmitter.emit('reloadMenuView', btn.refreshTab[btn.refreshTab.length - 1], 'table')
    if (tabId) {
      MKEmitter.emit('reloadMenuView', tabId, 'table')
    }
    if (btn.switchTab && btn.switchTab.length > 0) {
      let id = btn.switchTab[btn.switchTab.length - 1]
      let node = document.getElementById('tab' + id)
@@ -1855,7 +1907,7 @@
  }
  modelconfirm = () => {
    const { BData } = this.props
    const { BData, btn } = this.props
    const { btnconfig, selines } = this.state
    let _this = this
@@ -1931,7 +1983,7 @@
      this.execSubmit(selines, () => {}, result)
    } else {
      confirm({
        title: this.state.dict['main.action.confirm.tip'],
        title: btn.tipTitle || this.state.dict['main.action.confirm.tip'],
        onOk() {
          return new Promise(resolve => {
            _this.execSubmit(selines, resolve, result)