From 89949fc82a0194f985cb542abb7118724804bd5b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 19 五月 2020 11:41:06 +0800 Subject: [PATCH] 2020-05-19 --- src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx b/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx index dd31a0c..d469a9a 100644 --- a/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx +++ b/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 { -- Gitblit v1.8.0