From decf1f6555b6e003860401a692faea259cc565af Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 23 三月 2021 21:00:08 +0800 Subject: [PATCH] 2021-03-23 --- src/menu/components/form/formaction/index.jsx | 62 ++++++++++-------------------- 1 files changed, 21 insertions(+), 41 deletions(-) diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx index e09e7af..c4dd07e 100644 --- a/src/menu/components/form/formaction/index.jsx +++ b/src/menu/components/form/formaction/index.jsx @@ -26,7 +26,6 @@ dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, card: null, // 缂栬緫涓厓绱� formlist: null, // 琛ㄥ崟淇℃伅 - elements: null, // 鎸夐挳缁� visible: false, // 妯℃�佹鎺у埗 profVisible: false, // 楠岃瘉淇℃伅缂栬緫 } @@ -130,38 +129,28 @@ * @description 鍏冪礌淇敼鍚庢彁浜や繚瀛� */ handleActionSubmit = () => { - const { elements } = this.state - let color = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666' } + const { card } = this.state this.actionFormRef.handleConfirm().then(res => { - let _elements = elements.map(cell => { - if (cell.uuid === res.uuid) { - res = {...cell, ...res} - delete res.focus - let btnstyle = {} + res.type = card.type + if (card.verify) { + res.verify = card.verify + } - if (res.class !== cell.class || res.show !== cell.show || !res.btnstyle) { - if (res.show === 'link' || res.show === 'icon') { - btnstyle.color = color[res.class] - btnstyle.backgroundColor = 'transparent' - } else { - btnstyle.color = '#ffffff' - btnstyle.backgroundColor = color[res.class] - } - } - res.btnstyle = {...res.btnstyle, ...btnstyle} + let group = fromJS(this.props.group).toJS() - return res - } - return cell - }) + if (res.type === 'prev') { + group.prevButton = res + } else if (res.type === 'submit') { + group.subButton = res + } else if (res.type === 'next') { + group.nextButton = res + } this.setState({ - elements: _elements, visible: false - }, () => { - this.props.updateElement(_elements) }) + this.props.updateconfig(group) }) } @@ -178,23 +167,15 @@ * @description 楠岃瘉淇℃伅淇濆瓨 */ verifySubmit = () => { - const { elements, card } = this.state - this.verifyRef.handleConfirm().then(res => { - let _elements = elements.map(cell => { - if (cell.uuid === card.uuid) { - cell.verify = res - } + let group = fromJS(this.props.group).toJS() - return cell - }) + group.subButton.verify = res this.setState({ - elements: _elements, profVisible: false - }, () => { - this.props.updateElement(_elements) }) + this.props.updateconfig(group) }) } @@ -221,14 +202,14 @@ } trigger="hover"> <Button type="link" className="submit mk-primary" style={group.subButton.style}>{group.subButton.label}</Button> </Popover> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + {group.sort !== config.subcards.length ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.handleAction(group.nextButton)} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.nextButton)} type="font-colors" /> </div> } trigger="hover"> - <Button type="link" className="skip" style={group.nextButton.style}>{group.nextButton.label}</Button> - </Popover> + <Button type="link" className={'skip ' + group.nextButton.enable} style={group.nextButton.style}>{group.nextButton.label}</Button> + </Popover> : null} {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} <Modal title={dict['model.edit']} @@ -244,7 +225,6 @@ > <ActionForm dict={dict} - type="card" card={card} setting={config.setting} formlist={this.state.formlist} @@ -265,7 +245,7 @@ destroyOnClose > <VerifyCard - card={group.subButton} + card={{...group.subButton, modal: {fields: group.fields}}} dict={dict} config={config} columns={config.columns} -- Gitblit v1.8.0