From bfcacf54ad793bc33560f8bb15833508cf73aa5b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 31 三月 2023 01:18:44 +0800 Subject: [PATCH] 2023-03-31 --- src/menu/components/form/step-form/index.jsx | 119 ++++++++++------------------------------------------------- 1 files changed, 21 insertions(+), 98 deletions(-) diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 186c17c..71a2b3a 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -619,60 +619,29 @@ if (res.subtype === 'simpleform') { res = res.subcards[0] } - if (res.subButton) { - let card = fromJS(this.state.card).toJS() - res.uuid = Utils.getuuid() - res.sort = card.subcards.length + 1 + let card = fromJS(this.state.card).toJS() - res.fields.forEach(item => { - item.uuid = Utils.getuuid() - }) + res.uuid = Utils.getuuid() + res.sort = card.subcards.length + 1 - if (!res.prevButton) { - res.prevButton = {label: '涓婁竴姝�', type: 'prev', enable: 'false', style: {marginRight: '15px', paddingTop: '5px', paddingBottom: '5px'}} - } - if (!res.nextButton) { - res.nextButton = {label: '璺宠繃', type: 'next', enable: 'false', style: {paddingTop: '5px', paddingBottom: '5px'}} - } - - card.subcards.push(res) - - this.setState({ - group: res - }) - this.updateComponent(card) - - notification.success({ - top: 92, - message: '绮樿创鎴愬姛锛�', - duration: 2 - }) - return - } - - let _config = fromJS(this.state.group).toJS() - let fieldrepet = false // 瀛楁閲嶅 - - _config.fields.forEach(item => { - if (res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { - fieldrepet = true - } + res.fields.forEach(item => { + item.uuid = Utils.getuuid() }) - if (fieldrepet) { - notification.warning({ - top: 92, - message: '瀛楁宸插瓨鍦紒', - duration: 10 - }) - return + if (!res.prevButton) { + res.prevButton = {label: '涓婁竴姝�', type: 'prev', enable: 'false', style: {marginRight: '15px', paddingTop: '5px', paddingBottom: '5px'}} } - _config.fields.push(res) + if (!res.nextButton) { + res.nextButton = {label: '璺宠繃', type: 'next', enable: 'false', style: {paddingTop: '5px', paddingBottom: '5px'}} + } - this.updateGroup(_config) - - this.handleForm(res) + card.subcards.push(res) + + this.setState({ + group: res + }) + this.updateComponent(card) notification.success({ top: 92, @@ -723,58 +692,12 @@ }) } - parseForm = (g, res) => { - let _group = fromJS(g).toJS() - let _confirm = false - - if (res.copyType === 'form') { - let fieldrepet = false // 瀛楁閲嶅 - res.uuid = Utils.getuuid() - - _group.fields.forEach(item => { - if (res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { - fieldrepet = true - } - }) - - if (fieldrepet) { - notification.warning({ - top: 92, - message: '瀛楁宸插瓨鍦紒', - duration: 10 - }) - return - } - _group.fields.push(res) - } else { - if (_group.fields.length > 0) { - _confirm = true - } - - _group.fields = res.fields.map(item => { - item.uuid = Utils.getuuid() - return item - }) - } - - if (_confirm) { - let that = this - confirm({ - title: '纭畾鏇挎崲琛ㄥ崟鍚楋紵', - content: '鍘熻〃鍗曞皢鍒犻櫎銆�', - onOk() { - that.updateForms(_group) - }, - onCancel() {} - }) - } else { - this.updateForms(_group) - } - } - - updateForms = (_group) => { + parseForm = (g, forms) => { const { group } = this.state let card = fromJS(this.state.card).toJS() + let _group = fromJS(g).toJS() + + _group.fields = forms card.subcards = card.subcards.map(item => { if (item.uuid === _group.uuid) { @@ -821,7 +744,7 @@ <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <CopyComponent type="stepform" card={card}/> - <PasteComponent config={card} options={['form', 'formgroup', 'simpleform']} updateConfig={this.pasteForm} /> + <PasteComponent config={card} options={['formgroup', 'simpleform']} updateConfig={this.pasteForm} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> -- Gitblit v1.8.0