king
2024-06-21 2bccb9ec7bdefe23292a22bc153463cfa1479a49
src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -29,6 +29,7 @@
    disabled: false,
    hidden: false,
    primaryId: '',
    dict: window.GLOB.dict
  }
  UNSAFE_componentWillMount () {
@@ -106,57 +107,45 @@
  /**
   * @description 触发按钮操作
   */
  actionTrigger = (triggerId, record, type) => {
    const { setting, BID, btn, selectedData } = this.props
    const { loading, disabled } = this.state
  actionTrigger = (triggerId, record, type, lid) => {
    const { setting, BID, btn, selectedData, LID } = this.props
    const { loading, disabled, dict } = this.state
    if (loading || disabled) return
    if (triggerId && btn.uuid !== triggerId) return
    if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return
    let data = record || selectedData || []
    if (setting.supModule && !BID) {
      notification.warning({
        top: 92,
        message: '需要上级主键值!',
        message: dict['sup_key_req'] || '需要上级主键值!',
        duration: 5
      })
      return
    } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) {
      return
    }
    let data = record || selectedData || []
    if (btn.Ot === 'requiredSgl' && data.length !== 1) {
    } else if (btn.Ot === 'requiredSgl' && data.length !== 1) {
      // 需要选择单行时,校验数据
      notification.warning({
        top: 92,
        message: '请选择单行数据!',
        message: dict['select_single_row'] || '请选择单行数据!',
        duration: 5
      })
      return
    } else if (!btn.verify || !btn.verify.sheet || !btn.verify.columns || btn.verify.columns.length === 0) {
      notification.warning({
        top: 92,
        message: 'excel导入验证信息未设置!',
        duration: 5
    } else {
      let primaryId = '' // 导入时行Id
      if (btn.Ot === 'requiredSgl' && setting.primaryKey) {
        primaryId = data[0][setting.primaryKey] || ''
      }
      this.setState({
        selines: data,
        primaryId: primaryId
      }, () => {
        this.refs.excelIn.exceltrigger()
      })
      return
    }
    let primaryId = '' // 导入时行Id
    if (btn.Ot === 'requiredSgl' && setting.primaryKey) {
      primaryId = data[0][setting.primaryKey] || ''
    }
    this.setState({
      selines: data,
      primaryId: primaryId
    }, () => {
      this.refs.excelIn.exceltrigger()
    })
    if (window.GLOB.systemType === 'production') {
      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '导入Excel'})
      if (window.GLOB.systemType === 'production') {
        MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '导入Excel'})
      }
    }
  }
@@ -170,16 +159,18 @@
   */
  execSuccess = (res = {}) => {
    const { btn } = this.props
    const { dict } = this.state
    if (res.ErrCode === 'S' || !res.ErrCode) { // 执行成功
      notification.success({
        top: 92,
        message: res.message || '执行成功!',
        message: res.message || dict['exc_success'] || '执行成功!',
        duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2
      })
    } else if (res.ErrCode === 'Y') { // 执行成功
      Modal.success({
        title: res.message || '执行成功!'
        title: res.message || dict['exc_success'] || '执行成功!',
        okText: dict['got_it'] || '知道了',
      })
    } else if (res.ErrCode === '-1') { // 完成后不提示
@@ -232,6 +223,7 @@
   */
  execError = (res = {}) => {
    const { btn } = this.props
    const { dict } = this.state
    if (!['LoginError', 'C', '-2', 'E', 'N', 'F', 'NM'].includes(res.ErrCode)) {
      res.ErrCode = 'E'
@@ -239,23 +231,24 @@
    if (res.ErrCode === 'E') {
      Modal.error({
        title: res.message || '执行失败!',
        title: res.message || dict['exc_fail'] || '执行失败!',
        okText: dict['got_it'] || '知道了'
      })
    } else if (res.ErrCode === 'N') {
      notification.error({
        top: 92,
        message: res.message || '执行失败!',
        message: res.message || dict['exc_fail'] || '执行失败!',
        duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10
      })
    } else if (res.ErrCode === 'F') {
      notification.error({
        className: 'notification-custom-error',
        top: 92,
        message: res.message || '执行失败!',
        message: res.message || dict['exc_fail'] || '执行失败!',
        duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10
      })
    } else if (res.ErrCode === 'NM') {
      message.error(res.message || '执行失败!')
      message.error(res.message || dict['exc_fail'] || '执行失败!')
    }
    
    this.setState({
@@ -266,6 +259,24 @@
      MKEmitter.emit('popclose')
    } else if (btn.execError !== 'never') {
      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
      if (btn.syncComponentId) {
        if (btn.syncComponentId === 'multiComponent') {
          btn.syncComponentIds.forEach((id, i) => {
            setTimeout(() => {
              if (/\$focus/.test(id)) {
                MKEmitter.emit('reloadData', id.split('$')[0], id.split('$')[1])
              } else {
                MKEmitter.emit('reloadData', id)
              }
            }, 20 * i)
          })
        } else if (/\$focus/.test(btn.syncComponentId)) {
          MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1])
        } else {
          MKEmitter.emit('reloadData', btn.syncComponentId)
        }
      }
    }
    if (btn.execError === 'popclose' && btn.$tabId) { // 标签关闭刷新
@@ -342,6 +353,10 @@
        param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
      }
      if (btn.database === 'sso' && window.GLOB.mainSystemApi) {
        param.rduri = window.GLOB.mainSystemApi
      }
      param.menuname = btn.logLabel
      
      if (window.GLOB.probation) {
@@ -364,8 +379,10 @@
          } else if (res.ErrCode === 'C') {
            const _this = this
            confirm({
              title: '请确认',
              title: window.GLOB.dict['exec_sure'] || '请确认',
              content: res.message,
              okText: window.GLOB.dict['ok'] || '确定',
              cancelText: window.GLOB.dict['cancel'] || '取消',
              onOk() {
                return new Promise(resolve => {
                  Api.genericInterface(unCheckParam).then(result => {