From aaa6ac0ea146ba9e26b1100b8be662b1d7ad8124 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 19 四月 2022 01:02:51 +0800 Subject: [PATCH] 2022-04-19 --- src/menu/components/card/cardcellcomponent/elementform/index.jsx | 47 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 8495d20..5395ef5 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -15,8 +15,8 @@ const cardTypeOptions = { sequence: ['eleType', 'width'], - text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'noValue', 'bgImage'], - number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'noValue'], + text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'noValue', 'bgImage', 'fixStyle'], + number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'], picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'], video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'noValue'], icon: ['eleType', 'icon', 'datatype', 'width'], @@ -24,8 +24,8 @@ splitline: ['eleType', 'color', 'width', 'borderWidth'], barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval', 'noValue'], qrcode: ['eleType', 'datatype', 'width', 'qrWidth', 'color', 'url', 'noValue'], - currentDate: ['eleType', 'width', 'dateFormat', 'prefix', 'postfix'], - formula: ['eleType', 'width', 'height', 'prefix', 'postfix', 'eval', 'formula'], + currentDate: ['eleType', 'width', 'dateFormat', 'prefix', 'postfix', 'fixStyle'], + formula: ['eleType', 'width', 'height', 'prefix', 'postfix', 'eval', 'formula', 'noValue', 'fixStyle'], } class MainSearch extends Component { @@ -43,12 +43,13 @@ datatype: '', showType: '', showInfo: 'false', + fixStyle: '', link: '' } UNSAFE_componentWillMount () { const { card, config } = this.props - let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo) + let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo, card.fixStyle || '') this.setState({ link: card.link, @@ -56,6 +57,7 @@ datatype: card.datatype, showType: card.showType || 'line', showInfo: card.showInfo || 'false', + fixStyle: card.fixStyle || '', formlist: this.props.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -99,7 +101,7 @@ }) } - getOptions = (eleType, datatype, link, showType, showInfo) => { + getOptions = (eleType, datatype, link, showType, showInfo, fixStyle) => { let _options = fromJS(cardTypeOptions[eleType]).toJS() // 閫夐」鍒楄〃 if (['text', 'number', 'picture', 'slider', 'barcode', 'qrcode', 'video'].includes(eleType)) { @@ -135,6 +137,9 @@ _options.push('tooltip') } } + if (_options.includes('fixStyle') && fixStyle === 'alone') { + _options.push('fixSize', 'fixColor', 'fixLeft', 'fixRight') + } return _options } @@ -147,10 +152,10 @@ */ selectChange = (key, value, option) => { const { card, config } = this.props - const { datatype, eleType, showType, showInfo } = this.state + const { datatype, eleType, showType, showInfo, fixStyle } = this.state if (key === 'eleType') { - let _options = this.getOptions(value, datatype, '', showType, showInfo) + let _options = this.getOptions(value, datatype, '', showType, showInfo, fixStyle) let _formlist = this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -193,6 +198,8 @@ item.required = value !== 'qrcode' } else if (item.key === 'showInfo') { item.initVal = showInfo + } else if (item.key === 'fixStyle') { + item.initVal = fixStyle } return item @@ -222,7 +229,7 @@ this.props.form.setFieldsValue({value: option.props.title}) } } else if (key === 'link') { - let _options = this.getOptions(eleType, datatype, value, showType, showInfo) + let _options = this.getOptions(eleType, datatype, value, showType, showInfo, fixStyle) this.setState({ link: value, formlist: this.state.formlist.map(item => { @@ -237,11 +244,11 @@ } onChange = (e, key) => { - const { eleType, datatype, link, showType, showInfo } = this.state + const { eleType, datatype, link, showType, showInfo, fixStyle } = this.state let value = e.target.value if (key === 'datatype') { - let _options = this.getOptions(eleType, value, link, showType, showInfo) + let _options = this.getOptions(eleType, value, link, showType, showInfo, fixStyle) this.setState({ datatype: value, @@ -252,7 +259,7 @@ }) }) } else if (key === 'link') { - let _options = this.getOptions(eleType, datatype, value, showType, showInfo) + let _options = this.getOptions(eleType, datatype, value, showType, showInfo, fixStyle) this.setState({ link: value, formlist: this.state.formlist.map(item => { @@ -264,7 +271,7 @@ }) }) } else if (key === 'showInfo') { - let _options = this.getOptions(eleType, datatype, link, showType, value) + let _options = this.getOptions(eleType, datatype, link, showType, value, fixStyle) this.setState({ showInfo: value, formlist: this.state.formlist.map(item => { @@ -276,7 +283,19 @@ this.setState({ showType: value }, () => { - let _options = this.getOptions(eleType, datatype, link, value, showInfo) + let _options = this.getOptions(eleType, datatype, link, value, showInfo, fixStyle) + this.setState({ + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + return item + }) + }) + }) + } else if (key === 'fixStyle') { + this.setState({ + fixStyle: value + }, () => { + let _options = this.getOptions(eleType, datatype, link, showType, showInfo, value) this.setState({ formlist: this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) -- Gitblit v1.8.0