From 54f2a3e1e54a6d8289ccb8d5de158f23150d7a5e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 04 三月 2020 16:11:03 +0800 Subject: [PATCH] 2020-03-04 --- src/templates/ushare/modalform/index.jsx | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-) diff --git a/src/templates/ushare/modalform/index.jsx b/src/templates/ushare/modalform/index.jsx index 2e94ac3..993b39d 100644 --- a/src/templates/ushare/modalform/index.jsx +++ b/src/templates/ushare/modalform/index.jsx @@ -20,6 +20,7 @@ state = { openType: null, resourceType: null, + supField: '', formlist: null, linkSubFields: null } @@ -30,6 +31,7 @@ let type = '' let resourceType = '' + let supField = '' let linkSubFields = [] formlist.forEach(cell => { @@ -47,6 +49,8 @@ return false } }) + } else if (cell.key === 'supField') { + supField = cell.initVal } }) @@ -78,8 +82,17 @@ _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] } + if (type !== 'funcvar' && type !== 'linkMain') { + if (supField) { + _options.push('supField', 'supvalue') + } else { + _options.push('supField') + } + } + this.setState({ openType: type, + supField: supField, resourceType: resourceType, linkSubFields: linkSubFields, formlist: formlist.map(form => { @@ -148,6 +161,14 @@ } else if (value === 'linkMain') { _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] } + + if (value !== 'funcvar' && value !== 'linkMain') { + if (this.state.supField) { + _options.push('supField', 'supvalue') + } else { + _options.push('supField') + } + } this.setState({ openType: value, @@ -199,6 +220,19 @@ formlist: this.state.formlist.map(form => { if (form.key === 'options') { form.initVal = option.options + } + + return form + }) + }) + } else if (key === 'supField') { + this.setState({ + supField: value, + formlist: this.state.formlist.map(form => { + if (form.key === 'supvalue' && value) { + form.show = true + } else if (form.key === 'supvalue' && !value) { + form.show = false } return form @@ -381,7 +415,12 @@ } else if (item.type === 'select') { // 涓嬫媺鎼滅储 fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ -- Gitblit v1.8.0