king
2019-12-13 a70940450c021a47e69abdf8fa8f7f98594601cc
src/utils/utils.js
@@ -189,14 +189,13 @@
  }
  /**
   * @description 拼接搜索条件
   * @description 初始化搜索条件
   * @param {Array}   searches     搜索条件
   * @return {String}  searchText  拼接结果
   * @return {String}  searches    格式化后结果
   */
  static mainjointsearchkey (searches) {
    if (!searches || searches.length === 0) return ''
  static initMainSearch (searches) {
    if (!searches || searches.length === 0) return []
    if (searches[0].hasOwnProperty('initval')) {
      let newsearches = []
      searches.forEach(search => {
        let item = {
@@ -218,8 +217,17 @@
        }
        newsearches.push(item)
      })
      searches = newsearches
    return newsearches
    }
  /**
   * @description 拼接搜索条件
   * @param {Array}   searches     搜索条件
   * @return {String}  searchText  拼接结果
   */
  static joinMainSearchkey (searches) {
    if (!searches || searches.length === 0) return ''
    let searchText = ''
    searches.forEach(item => {
@@ -231,15 +239,26 @@
        let str = item.match === '=' ? '' : '%'
        // eslint-disable-next-line
        searchText += item.key + ' ' + item.match + ' ' + '\'' + str + item.value + str + '\''
      } else if (item.type === 'date' || item.type === 'datemonth') {
      } else if (item.type === 'date') {
        let timetail = ' 00:00:00.000'
        if (item.match === '<' || item.match === '<=') {
          timetail = ' 23:59:59.999'
        }
        // eslint-disable-next-line
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + timetail + '\')'
      } else if (item.type === 'datemonth') {
        // eslint-disable-next-line
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')'
      } else if (item.type === 'dateweek') {
        let stimetail = ' 00:00:00.000'
        let etimetail = ' 23:59:59.999'
        // eslint-disable-next-line
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + '\' AND \'' + item.value[1] + '\')'
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + stimetail + '\' AND \'' + item.value[1] + etimetail + '\')'
      } else if (item.type === 'daterange') {
        let stimetail = ' 00:00:00.000'
        let etimetail = ' 23:59:59.999'
        // eslint-disable-next-line
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + '\' AND \'' + item.value[1] + '\')'
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + stimetail + '\' AND \'' + item.value[1] + etimetail + '\')'
      } else {
        // eslint-disable-next-line
        searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')'