king
2020-04-01 2c0e07ad097eb692c9909efdc614cc40b8653de2
src/templates/zshare/createinterface/index.jsx
@@ -704,10 +704,12 @@
        let _fieldValue = []                     // 表单键值对field=value
        let _value = []                          // 表单值,用于错误提示
        let _labels = item.fieldlabel.split(',') // 表单提示文字
        let arr = [] // 验证主键
        item.field.split(',').forEach((_field, index) => {
          _fieldValue.push(`${_field}=@${_field}@`)
          _value.push(`${_labels[index] || ''}:'+@${_field}@+'`)
          arr.push(_field.toLowerCase())
        })
        let _verifyType = ''
@@ -715,8 +717,12 @@
          _verifyType = ' and deleted=0'
        }
        if (!arr.includes(primaryKey.toLowerCase())) {
          _fieldValue.push(`${primaryKey} !=@${primaryKey}@`)
        }
        _sql += `select @tbid='', @ErrorCode='',@retmsg=''
          select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')} and ${primaryKey} !=@${primaryKey}@${_verifyType}
          select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${_verifyType}
          If @tbid!=''
          Begin
            select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在'
@@ -820,8 +826,8 @@
      receiptKeys.push(item.key.toLowerCase())
    })
    if (!receiptKeys.includes(primaryKey)) {
      receiptKeys.push(primaryKey)
    if (!receiptKeys.includes(primaryKey.toLowerCase())) {
      receiptKeys.push(primaryKey.toLowerCase())
    }
    if (!receiptKeys.includes('bid') && BID) {
@@ -842,8 +848,8 @@
        values.push('@' + item.key + '@')
      })
      if (!keys.includes(primaryKey)) {
        keys.push(primaryKey)
      if (!keys.includes(primaryKey.toLowerCase())) {
        keys.push(primaryKey.toLowerCase())
        values.push(`@${primaryKey}@`)
      }
@@ -947,7 +953,7 @@
    _sql += `
      aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,'${_ltext}' as Ltext`
    console.log(_sql)
    return _sql
  }