From 592ff0aa0f2d45d143872b672a1468e268d3157f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 22 二月 2020 17:25:20 +0800 Subject: [PATCH] 2020-02-22 --- src/templates/ushare/modalform/index.jsx | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/templates/ushare/modalform/index.jsx b/src/templates/ushare/modalform/index.jsx index 063fa5c..6df7446 100644 --- a/src/templates/ushare/modalform/index.jsx +++ b/src/templates/ushare/modalform/index.jsx @@ -10,7 +10,8 @@ class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� + dict: PropTypes.object, // 瀛楀吀椤� + optionLibs: PropTypes.any, // 鑷畾涔変笅鎷夐泦 formlist: PropTypes.any, card: PropTypes.object } @@ -23,6 +24,7 @@ } UNSAFE_componentWillMount () { + const { optionLibs } = this.props let formlist = JSON.parse(JSON.stringify(this.props.formlist)) let type = '' @@ -50,7 +52,7 @@ let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] // 榛樿鏄剧ず椤� if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮 - _options = [..._options, 'resourceType', 'options'] + _options = [..._options, 'resourceType', 'options', 'quick'] } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮 _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] } else if (type === 'number') { @@ -87,7 +89,16 @@ form.type = 'number' form.initVal = form.initVal || 0 form.required = true + } else if (form.key === 'quick') { + form.options = [...optionLibs.values()].filter(cell => cell.uuid !== this.props.card.uuid) + form.options = form.options.map(cell => { + return { + value: cell.uuid, + text: cell.label + '(' + cell.parname + ')' + } + }) } + form.show = _options.includes(form.key) return form }) @@ -108,11 +119,12 @@ } openTypeChange = (key, value) => { + if (key === 'type') { let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮 - _options = [..._options, 'resourceType', 'options'] + _options = [..._options, 'resourceType', 'options', 'quick'] } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮 _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] } else if (value === 'number') { @@ -180,6 +192,18 @@ }) }) }) + } else if (key === 'quick') { + let option = this.props.optionLibs.get(value) + + this.setState({ + formlist: this.state.formlist.map(form => { + if (form.key === 'options') { + form.initVal = option.options + } + + return form + }) + }) } } @@ -211,7 +235,7 @@ if (key === 'resourceType') { let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin'] if (value === '0') { - _options = [..._options, 'options'] + _options = [..._options, 'options', 'quick'] } else if (value === '1') { _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] } -- Gitblit v1.8.0