| | |
| | | let oInput = document.createElement('input') |
| | | let val = JSON.parse(JSON.stringify(card)) |
| | | val.copyType = 'form' |
| | | val.uuid = Utils.getuuid() |
| | | |
| | | delete val.originUuid |
| | | |
| | |
| | | } |
| | | |
| | | let fieldrepet = false // 字段重复 |
| | | let labelrepet = false // 提示文字重复 |
| | | |
| | | if (modalType === 'copy' && card.originUuid) { |
| | | if (_config.groups.length > 0) { |
| | |
| | | |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.field && item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.field && item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | }) |
| | | |
| | |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.field && item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | |
| | | if (item.uuid === res.uuid) { |
| | |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.field && item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | |
| | | if (item.uuid === res.uuid) { |
| | |
| | | if (fieldrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段名重复!', |
| | | message: '字段已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (labelrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '名称已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | |
| | | _config.fields = _config.fields.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (res.copyType === 'form') { |
| | | let repeat = false |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | let item = group.sublist.filter(cell => cell.field === res.field)[0] |
| | | if (item) { |
| | | repeat = true |
| | | } |
| | | |
| | | if (group.default) { |
| | | group.sublist.push(res) |
| | | } |
| | | }) |
| | | } else { |
| | | let item = _config.fields.filter(cell => cell.field === res.field)[0] |
| | | if (item) { |
| | | repeat = true |
| | | } |
| | | _config.fields.push(res) |
| | | } |
| | | |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不支持此表单类型!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (repeat) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '此表单字段已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <Icon type="setting" onClick={this.changeSetting} /> |
| | | <Icon type="snippets" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({pasteVisible: true})}} /> |
| | | <div className="ant-modal-content" style={{width: config.setting.width + '%'}}> |
| | | <button type="button" className="ant-modal-close"> |
| | | <span className="ant-modal-close-x"><Icon type="close"/></span> |
| | |
| | | <div className="ant-modal-title">{config.setting.title}</div> |
| | | </div> |
| | | <div className="ant-modal-body"> |
| | | <Icon className="paste-Icon" type="snippets" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({pasteVisible: true})}} /> |
| | | <div className="modal-form"> |
| | | {config.groups.length > 0 && |
| | | config.groups.map(group => { |
| | |
| | | <SettingForm |
| | | config={config} |
| | | dict={this.state.dict} |
| | | isSubTab={!!this.props.editTab} |
| | | inputSubmit={this.settingSave} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |