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/tableshare/searchform/index.jsx | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/templates/tableshare/searchform/index.jsx b/src/templates/tableshare/searchform/index.jsx index 840f47d..660aa56 100644 --- a/src/templates/tableshare/searchform/index.jsx +++ b/src/templates/tableshare/searchform/index.jsx @@ -9,9 +9,10 @@ class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - formlist: PropTypes.any, // 琛ㄥ崟 - card: PropTypes.object // 鎼滅储鏉′欢淇℃伅 + dict: PropTypes.object, // 瀛楀吀椤� + formlist: PropTypes.any, // 琛ㄥ崟 + optionLibs: PropTypes.any, // 鑷畾涔変笅鎷夐泦 + card: PropTypes.object // 鎼滅储鏉′欢淇℃伅 } state = { @@ -26,14 +27,14 @@ * 2銆佷笅鎷夐�夋嫨锛屾牴鎹暟鎹簮绫诲瀷鏄剧ず鐩稿叧閰嶇疆 */ UNSAFE_componentWillMount () { - const { formlist } = this.props + const { formlist, optionLibs } = this.props let type = formlist.filter(cell => cell.key === 'type')[0].initVal let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal let _options = ['label', 'field', 'initval', 'type', 'match'] // 榛樿鏄剧ず椤� if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮 - _options = [..._options, 'resourceType', 'options', 'display'] + _options = [..._options, 'resourceType', 'options', 'display', 'quick'] } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙� _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] } @@ -68,6 +69,14 @@ } else if (type === 'dateweek' || type === 'daterange') { form.options = matchReg.daterange } + } 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.hidden = !_options.includes(form.key) return form @@ -98,7 +107,7 @@ let _options = ['label', 'field', 'initval', 'type', 'match'] if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓鸿嚜瀹氫箟璧勬簮 - _options = [..._options, 'resourceType', 'options', 'display'] + _options = [..._options, 'resourceType', 'options', 'display', 'quick'] } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 涓嬫媺閫夋嫨绫诲瀷銆侀�夐」涓哄悗鍙版暟鎹簮涓幏鍙� _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] } @@ -157,6 +166,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 + }) + }) } } @@ -171,7 +192,7 @@ let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display'] 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