king
2020-04-03 4c6bdfe1f3557e49a315c1564bcb6164c0bc7faa
src/templates/modalconfig/index.jsx
@@ -400,6 +400,7 @@
      let oInput = document.createElement('input')
      let val = JSON.parse(JSON.stringify(card))
      val.copyType = 'form'
      val.uuid = Utils.getuuid()
      delete val.originUuid
@@ -540,6 +541,7 @@
      }
      let fieldrepet = false // 字段重复
      let labelrepet = false // 提示文字重复
      if (modalType === 'copy' && card.originUuid) {
        if (_config.groups.length > 0) {
@@ -552,6 +554,8 @@
              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
              }
            })
@@ -570,6 +574,8 @@
            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
            }
          })
@@ -581,6 +587,8 @@
            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) {
@@ -594,6 +602,8 @@
          _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) {
@@ -608,12 +618,19 @@
      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({
@@ -1159,23 +1176,13 @@
    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)
        }
@@ -1183,13 +1190,6 @@
          notification.warning({
            top: 92,
            message: '不支持此表单类型!',
            duration: 10
          })
          return
        } else if (repeat) {
          notification.warning({
            top: 92,
            message: '此表单字段已存在!',
            duration: 10
          })
          return
@@ -1276,7 +1276,6 @@
              </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>
@@ -1285,6 +1284,7 @@
                  <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 => {
@@ -1383,6 +1383,7 @@
          <SettingForm
            config={config}
            dict={this.state.dict}
            isSubTab={!!this.props.editTab}
            inputSubmit={this.settingSave}
            wrappedComponentRef={(inst) => this.settingRef = inst}
          />