king
2020-12-16 06404e701a89955958cbf56213e2eec618d8644d
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -20,9 +20,9 @@
class NormalButton extends Component {
  static propTpyes = {
    show: PropTypes.any,              // 按钮显示样式控制
    position: PropTypes.any,          // 按钮位置,工具栏为toolbar
    BID: PropTypes.string,            // 主表ID
    BData: PropTypes.any,             // 主表数据
    MenuName: PropTypes.any,          // 菜单名称
    style: PropTypes.any,             // 按钮样式
    selectedData: PropTypes.any,      // 子表中选择数据
    Tab: PropTypes.any,               // 如果当前元素为标签时,tab为标签信息
@@ -49,9 +49,9 @@
  }
  componentDidMount () {
    const { show } = this.props
    const { position } = this.props
    if (show === 'actionList') {
    if (position === 'toolbar') {
      MKEmitter.addListener('triggerBtnId', this.actionTrigger)
    }
  }
@@ -82,7 +82,7 @@
  /**
   * @description 触发按钮操作
   */
  actionTrigger = (triggerId) => {
  actionTrigger = (triggerId, record) => {
    const { setting, Tab, BID, btn, selectedData } = this.props
    const { loading } = this.state
@@ -98,7 +98,7 @@
    }
    let _this = this
    let data = selectedData || []
    let data = record || selectedData || []
    if (btn.Ot !== 'notRequired' && data.length === 0) {
      // 需要选择行时,校验数据
@@ -191,7 +191,7 @@
   * @description 按钮提交执行
   */
  execSubmit = (data, _resolve, formdata) => {
    const { setting, columns, btn, MenuName } = this.props
    const { setting, columns, btn } = this.props
    if (btn.intertype === 'inner' || btn.intertype === 'system') {
      // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求
      // 打开方式为模态框,使用内部函数添加(有批量添加场景,已去除)
@@ -233,14 +233,10 @@
              param.LText = param.LText.replace(/@\$|\$@/ig, '')
            }
            let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
            param.LText2 = LText2
            param.LText1 = LText1
            param.LText = LText
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
            param.secretkey = Utils.encrypt('', param.timestamp)
            param.LText = Utils.formatOptions(param.LText)
          }
        } else if (btn.OpenType === 'pop') { // 表单
          if (btn.innerFunc) {
@@ -274,14 +270,10 @@
              param.LText = param.LText.replace(/@\$|\$@/ig, '')
            }
            let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
            param.LText2 = LText2
            param.LText1 = LText1
            param.LText = LText
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
            param.secretkey = Utils.encrypt('', param.timestamp)
            param.LText = Utils.formatOptions(param.LText)
          } else if (btn.sql) {
            param.ID = primaryId
            param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab) // 数据源
@@ -293,14 +285,10 @@
              param.LText = param.LText.replace(/@\$|\$@/ig, '')
            }
            let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
            param.LText2 = LText2
            param.LText1 = LText1
            param.LText = LText
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
            param.secretkey = Utils.encrypt('', param.timestamp)
            param.LText = Utils.formatOptions(param.LText)
          }
        }
@@ -313,7 +301,7 @@
        }
        if (param.func === 'sPC_TableData_InUpDe') {
          param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}`
          param.menuname = btn.logLabel
        }
        Api.genericInterface(param).then((res) => {
@@ -365,13 +353,10 @@
                param.LText = param.LText.replace(/@\$|\$@/ig, '')
              }
              let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
              param.LText2 = LText2
              param.LText1 = LText1
              param.LText = LText
              param.exec_type = 'y' // 后台解码
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
              param.secretkey = Utils.encrypt('', param.timestamp)
              param.LText = Utils.formatOptions(param.LText)
            }
          } else if (btn.OpenType === 'pop') { // 表单
            if (index !== 0) {
@@ -404,14 +389,10 @@
                param.LText = param.LText.replace(/@\$|\$@/ig, '')
              }
              let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
              param.LText2 = LText2
              param.LText1 = LText1
              param.LText = LText
              param.exec_type = 'y' // 后台解码
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
              param.secretkey = Utils.encrypt('', param.timestamp)
              param.LText = Utils.formatOptions(param.LText)
            } else if (btn.sql) {
              param.ID = primaryId
              param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab) // 数据源
@@ -423,14 +404,10 @@
                param.LText = param.LText.replace(/@\$|\$@/ig, '')
              }
              let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
              param.LText2 = LText2
              param.LText1 = LText1
              param.LText = LText
              param.exec_type = 'y' // 后台解码
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
              param.secretkey = Utils.encrypt('', param.timestamp)
              param.LText = Utils.formatOptions(param.LText)
            }
          }
@@ -443,7 +420,7 @@
          }
          if (param.func === 'sPC_TableData_InUpDe') {
            param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}`
            param.menuname = btn.logLabel
          }
          return param
@@ -1173,7 +1150,7 @@
    const { btn, show, style } = this.props
    const { loadingNumber, loading } = this.state
    if (show === 'actionList' || show === 'button') {
    if (show === 'actionList') {
      return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
        <Button
          style={style}
@@ -1199,8 +1176,8 @@
      return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
        <Button
          type="link"
          style={style}
          loading={loading}
          style={btn.btnstyle || style}
          icon={show === 'text' ? '' : (btn.icon || '')}
          onClick={() => {this.actionTrigger()}}
        >{show === 'icon' && btn.icon ? '' : btn.label}</Button>