From d4ceae86a84c085d240ecf1e1a2c8b697b8a40bc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 18 十一月 2021 12:59:46 +0800 Subject: [PATCH] 2021-11-18 --- src/menu/components/card/cardcellcomponent/elementform/index.jsx | 40 +++++++++++++++++++++++++++++----------- 1 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index e44398f..ac785bb 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -42,18 +42,20 @@ eleType: '', datatype: '', showType: '', + showInfo: 'false', link: '' } UNSAFE_componentWillMount () { const { card, config } = this.props - let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line')) + let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo) this.setState({ link: card.link, eleType: card.eleType, datatype: card.datatype, showType: card.showType || 'line', + showInfo: card.showInfo || 'false', formlist: this.props.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -93,7 +95,7 @@ }) } - getOptions = (eleType, datatype, link, showType) => { + getOptions = (eleType, datatype, link, showType, showInfo) => { let _options = fromJS(cardTypeOptions[eleType]).toJS() // 閫夐」鍒楄〃 if (['text', 'number', 'picture', 'link', 'slider', 'barcode', 'qrcode', 'video'].includes(eleType)) { @@ -115,8 +117,13 @@ } } else if (eleType === 'picture' && !link) { _options.push('scale') - } else if (eleType === 'slider' && showType !== 'line') { - _options.push('outlineWidth', 'textAlign') + } else if (eleType === 'slider') { + if (showInfo === 'true') { + _options.push('infoColor') + } + if (showType !== 'line') { + _options.push('outlineWidth', 'textAlign', 'trailColor') + } } } else if (eleType === 'icon') { if (datatype === 'dynamic') { @@ -137,10 +144,10 @@ */ selectChange = (key, value, option) => { const { card, config } = this.props - const { datatype, eleType, showType } = this.state + const { datatype, eleType, showType, showInfo } = this.state if (key === 'eleType') { - let _options = this.getOptions(value, datatype, '', showType) + let _options = this.getOptions(value, datatype, '', showType, showInfo) let _formlist = this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -176,6 +183,8 @@ } } else if (item.key === 'url') { item.required = value !== 'qrcode' + } else if (item.key === 'showInfo') { + item.initVal = showInfo } return item @@ -203,7 +212,7 @@ this.props.form.setFieldsValue({value: option.props.title}) } } else if (key === 'link') { - let _options = this.getOptions(eleType, this.state.datatype, value, showType) + let _options = this.getOptions(eleType, datatype, value, showType, showInfo) this.setState({ link: value, formlist: this.state.formlist.map(item => { @@ -218,11 +227,11 @@ } onChange = (e, key) => { - const { eleType, datatype, link, showType } = this.state + const { eleType, datatype, link, showType, showInfo } = this.state let value = e.target.value if (key === 'datatype') { - let _options = this.getOptions(eleType, value, link, showType) + let _options = this.getOptions(eleType, value, link, showType, showInfo) this.setState({ datatype: value, @@ -233,7 +242,7 @@ }) }) } else if (key === 'link') { - let _options = this.getOptions(eleType, datatype, value, showType) + let _options = this.getOptions(eleType, datatype, value, showType, showInfo) this.setState({ link: value, formlist: this.state.formlist.map(item => { @@ -244,11 +253,20 @@ return item }) }) + } else if (key === 'showInfo') { + let _options = this.getOptions(eleType, datatype, link, showType, value) + this.setState({ + showInfo: value, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + return item + }) + }) } else if (key === 'showType') { this.setState({ showType: value }, () => { - let _options = this.getOptions(eleType, datatype, link, value) + let _options = this.getOptions(eleType, datatype, link, value, showInfo) this.setState({ formlist: this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) -- Gitblit v1.8.0