king
2020-03-03 e603c97dbe7a4f1dbd6445e00383ed651182e0fe
src/templates/tableshare/tabform/index.jsx
@@ -8,11 +8,12 @@
class MainTab extends Component {
  static propTpyes = {
    tabs: PropTypes.array,   // 类型
    type: PropTypes.string,  // 类型
    dict: PropTypes.object,  // 字典项
    formlist: PropTypes.any, // 表单
    card: PropTypes.object   // 标签页信息
    tabs: PropTypes.array,       // 可关联标签集
    type: PropTypes.string,      // 类型
    dict: PropTypes.object,      // 字典项
    formlist: PropTypes.any,     // 表单
    card: PropTypes.object,      // 标签页信息
    inputSubmit: PropTypes.any   // 回车提交事件
  }
  state = {
@@ -26,10 +27,8 @@
    const { formlist } = this.props
    let type = formlist.filter(cell => cell.key === 'type')[0].initVal
    // let _initval = formlist.filter(cell => cell.key === 'linkTab')[0].initVal
    let _tabs = this.props.tabs.filter(tab => tab.type === type)
    // let initTab = _tabs.filter(tab => tab.uuid === _initval)[0]
    this.setState({
      formlist: formlist.map(item => {
@@ -41,9 +40,6 @@
            },
            ..._tabs
          ]
          // if (!initTab) {
          //   item.initVal = ''
          // }
        }
        return item
@@ -101,6 +97,14 @@
    }
  }
  handleSubmit = (e) => {
    e.preventDefault()
    if (this.props.inputSubmit) {
      this.props.inputSubmit()
    }
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const fields = []
@@ -124,7 +128,7 @@
                    message: formRule.input.message
                  }
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)}
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
        )