From 5ff23c882da8bd2dca0848ae1a97d23f6bfecd9d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 27 六月 2021 23:10:07 +0800 Subject: [PATCH] 2021-06-27 --- src/menu/components/form/normal-form/index.jsx | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx index fb1ae1f..78ceb56 100644 --- a/src/menu/components/form/normal-form/index.jsx +++ b/src/menu/components/form/normal-form/index.jsx @@ -8,6 +8,7 @@ import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' import { getModalForm } from '@/templates/zshare/formconfig' +import { resetStyle } from '@/utils/utils-custom.js' import ModalForm from '@/templates/zshare/modalform' import MKEmitter from '@/utils/events.js' import Utils from '@/utils/utils.js' @@ -68,7 +69,7 @@ name: card.name, subtype: card.subtype, setting: { }, - wrap: { name: card.name, width: card.width || 24, datatype: 'static', color: '#1890ff' }, + wrap: { name: card.name, width: card.width || 24, datatype: 'static', groupLabel: 'show', color: '#1890ff' }, style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' }, columns: [], scripts: [], @@ -449,6 +450,7 @@ group.fields = group.fields.filter(item => !item.focus) this.setState({group, visible: false, editform: null}) + this.updateGroup(group) } /** @@ -621,6 +623,47 @@ }) } + pasteForm = (res) => { + let _config = fromJS(this.state.group).toJS() + let fieldrepet = false // 瀛楁閲嶅 + let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 + + _config.fields.forEach(item => { + if (res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { + fieldrepet = true + } else if (res.label && item.label === res.label) { + labelrepet = true + } + }) + + if (fieldrepet) { + notification.warning({ + top: 92, + message: '瀛楁宸插瓨鍦紒', + duration: 10 + }) + return + } else if (labelrepet) { + notification.warning({ + top: 92, + message: '鍚嶇О宸插瓨鍦紒', + duration: 10 + }) + return + } + _config.fields.push(res) + + this.updateGroup(_config) + + this.handleForm(res) + + notification.success({ + top: 92, + message: '绮樿创鎴愬姛锛�', + duration: 2 + }) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -632,13 +675,13 @@ const { card, dict, group, appType } = this.state return ( - <div className="menu-normal-form-edit-box" style={{...card.style}} onClick={this.clickComponent} id={card.uuid}> + <div className="menu-normal-form-edit-box" style={resetStyle(card.style)} onClick={this.clickComponent} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鍒嗙粍" onClick={this.addCard} type="plus" /> <WrapComponent config={card} updateConfig={this.updateComponent} /> <CopyComponent type="propcard" card={card}/> - <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> + <PasteComponent config={card} options={['form']} updateConfig={this.pasteForm} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <UserComponent config={card}/> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> -- Gitblit v1.8.0