king
2024-03-26 c4564064afe704f73acab29dded85e8c85dcc182
src/tabviews/zshare/actionList/tabbutton/index.jsx
@@ -15,6 +15,7 @@
    btn: PropTypes.object,            // 按钮
    selectedData: PropTypes.any,      // 子表中选择数据
    disabled: PropTypes.any,          // 行按钮禁用
    name: PropTypes.any
  }
  state = {
@@ -111,7 +112,15 @@
    
    let data = record || selectedData || []
    if (btn.Ot === 'requiredSgl' && data.length !== 1) {
    if (btn.Ot !== 'notRequired' && data.length === 0) {
      // 需要选择行时,校验数据
      notification.warning({
        top: 92,
        message: '请选择行!',
        duration: 5
      })
      return false
    } else if (btn.Ot === 'requiredSgl' && data.length !== 1) {
      // 需要选择单行时,校验数据
      notification.warning({
        top: 92,
@@ -125,6 +134,10 @@
    if (btn.Ot === 'requiredSgl') {
      primaryId = data[0].$$uuid || ''
    } else if (btn.Ot === 'requiredOnce') {
      let ids = data.map(d => (d.$$uuid || ''))
      ids = ids.filter(Boolean)
      primaryId = ids.join(',')
    } else if (btn.Ot === 'notRequired' && BID) {
      primaryId = BID
    }
@@ -185,43 +198,29 @@
  }
  render() {
    const { btn } = this.props
    const { btn, name } = this.props
    const { disabled, hidden } = this.state
    if (hidden) return null
    let label = ''
    let icon = ''
    let type = 'link'
    let className = ''
    if (btn.show === 'button') {
      label = btn.label
      icon = btn.icon || ''
    } else if (btn.show === 'link') {
      label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
      icon = ''
    if (btn.show === 'link') {
      label = <span>{name || btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon} /> : ''}</span>
    } else if (btn.show === 'icon') {
      icon = btn.icon || ''
    } else if (!btn.$toolbtn) {
      icon = btn.icon || ''
      label = btn.label
      className = 'mk-btn mk-' + btn.class
      label = <MkIcon type={btn.icon} />
    } else {
      type = ''
      icon = btn.icon || ''
      label = btn.label
      className = 'mk-btn mk-' + btn.class
      label = <span>{btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{name || btn.label}</span>
    }
    return (
      <Button
        type={type}
        type="link"
        id={'button' + btn.uuid}
        title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
        style={btn.style || null}
        disabled={disabled}
        icon={icon}
        className={className}
        className={btn.$toolbtn ? (btn.hover || '') : ''}
        onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
      >{label}</Button>
    )