| | |
| | | |
| | | 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 |
| | |
| | | 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( |
| | |
| | | |
| | | |
| | | 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 { |