king
2021-04-20 d1657e9835a6b3350dee76956deae3029cfe4b11
src/utils/utils.js
@@ -729,6 +729,11 @@
      sql = sql.replace(/@\$|\$@/ig, '')
    }
    // 外联数据库替换
    if (window.GLOB.externalDatabase !== null) {
      sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase)
    }
    if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) {
      console.info(sql)
    }
@@ -1059,6 +1064,7 @@
  let datavars = {}                 // 声明的变量,表单及显示列
  let _actionType = null
  let _callbacksql = ''
  let foreignKey = tab && tab.foreignKey ? tab.foreignKey.toLowerCase() : ''
  if (verify.default !== 'false') { // 判断是否使用默认sql
    _actionType = btn.sqlType
@@ -1430,9 +1436,9 @@
        if (_key === 'bid' && !datavars.bid) { // 表单中没有bid则使用系统bid变量
          _fval = '@BID@'
        }
        if (_key === 'bid' && tab && tab.foreignKey) {
          arr.push(tab.foreignKey.toLowerCase())
          _fieldValue.push(`${tab.foreignKey}=${_fval}`)
        if (_key === 'bid' && foreignKey) {
          arr.push(foreignKey)
          _fieldValue.push(`${foreignKey}=${_fval}`)
        } else {
          arr.push(_key)
          _fieldValue.push(`${_key}=${_fval}`)
@@ -1553,14 +1559,14 @@
      values.push('@fullname')
    }
    if (!keys.includes('bid')) {
      if (tab && tab.foreignKey && !keys.includes(tab.foreignKey.toLowerCase())) {
        keys.push(tab.foreignKey.toLowerCase())
      if (foreignKey && !keys.includes(foreignKey)) {
        keys.push(foreignKey)
      } else {
        keys.push('bid')
      }
      values.push('@BID@')
    } else if (tab && tab.foreignKey && !keys.includes(tab.foreignKey.toLowerCase())) {
      keys.push(tab.foreignKey.toLowerCase())
    } else if (foreignKey && !keys.includes(foreignKey)) {
      keys.push(foreignKey)
      values.push('@BID@')
    }