king
2020-05-19 89949fc82a0194f985cb542abb7118724804bd5b
src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx
@@ -15,16 +15,22 @@
  state = {
    formlist: null,
    columns: null
    columns: null,
    actions: []
  }
  UNSAFE_componentWillMount () {
    const { card } = this.props
    let columns = this.props.formlist.filter(item => item.key === 'field')[0].options
    let actions = []
    if (card.actions) {
      actions = this.props.formlist.filter(item => item.key === 'actions')[0].options
    }
    this.setState({
      columns: columns,
      actions: actions,
      formlist: this.props.formlist.map(item => {
        if (item.key === 'content' && card.datatype === 'dynamic') {
          item.hidden = true
@@ -74,7 +80,7 @@
    const { getFieldDecorator } = this.props.form
    const fields = []
    this.state.formlist.forEach((item, index) => {
      if (item.hidden) return
      if (item.hidden || item.forbid) return
      if (item.type === 'text') { // 文本搜索
        fields.push(
@@ -205,16 +211,21 @@
  
  handleConfirm = () => {
    const { columns } = this.state
    const { columns, actions } = this.state
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
      this.props.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          values.uuid = this.props.card.uuid || ''
          if (this.props.card.uuid) {
            values.uuid = this.props.card.uuid
          }
          if (values.field && !values.content) {
            values.content = columns.filter(col => col.value === values.field)[0].text
          }
          if (values.actions) {
            values.actions = values.actions.map(item => actions.filter(action => action.value === item)[0])
          }
          resolve(values)
        } else {