king
2020-04-15 02a05c4e82e74c290e80ae7710fbb394ed7cac7a
src/utils/utils.js
@@ -672,6 +672,12 @@
    let BID = param.BID
    let verify = btn.verify || {}
    let _formFieldValue = {}
    let _actionType = null
    if (verify.default !== 'false') { // 判断是否使用默认sql
      _actionType = btn.sqlType
    }
    // 需要声明的变量集
    // let _vars = ['tbid', 'ErrorCode', 'retmsg', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'UserName', 'FullName', 'ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey']
    let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode']
@@ -901,6 +907,7 @@
    }
    // 单号生成,使用上级id(BID)或列表数据,声明变量(检验)
    let _billcodesSql  = ''
    if (verify.billcodes && verify.billcodes.length > 0) {
      verify.billcodes.forEach(item => {
        let _ModularDetailCode = ''
@@ -932,7 +939,7 @@
          _vars.push(_key)
        }
        _sql += `${_declare}
        _billcodesSql += `${_declare}
          select @BillCode='', @${_key}='', @ModularDetailCode=''
          ${_lpline}
          exec s_get_BillCode
@@ -948,6 +955,10 @@
          set @${_key}=@BillCode
          `
      })
      if (_actionType !== 'insertOrUpdate') {
        _sql += _billcodesSql
      }
    }
    let hasvoucher = false
@@ -979,14 +990,7 @@
    let primaryKeyName = ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKey.toLowerCase()) ? primaryKey + '@' : primaryKey
    let _actionType = null
    if (verify.default !== 'false') { // 判断是否使用默认sql
      _actionType = btn.sqlType
    }
    let _insertsql = ''
    let _updatesql = ''
    if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { // 添加语句
      let keys = []
      let values = []
@@ -1032,7 +1036,10 @@
      keys = keys.join(',')
      values = values.join(',')
      _insertsql = `insert into ${btn.sql} (${keys}) select ${values};`
    } else if (_actionType === 'update' || _actionType === 'insertOrUpdate') { // 修改语句
    }
    let _updatesql = ''
    if (_actionType === 'update' || _actionType === 'insertOrUpdate') { // 修改语句
      let _form = []
      let _arr = []
@@ -1065,7 +1072,6 @@
          _form.push('FiYear=@FiYear')
        }
      }
      _form = _form.join(',')
      _updatesql = `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKeyName};`
    }
@@ -1094,9 +1100,14 @@
      _sql += `select @tbid=''
        select @tbid='X' from ${btn.sql} where ${primaryKey}=@ID@
        if @tbid=''
          begin
          ${_billcodesSql}
          ${_insertsql}
          end
        else
          begin
          ${_updatesql}
          end
      `
    }