king
2019-12-31 c41b93d4c5e2146a1d1568887fb8ce1e3144d7fb
src/utils/utils.js
@@ -227,6 +227,8 @@
        }
        item.value = _val ? [moment().subtract(_val[0], 'days').format('YYYY-MM-DD'),
          moment().subtract(_val[1], 'days').format('YYYY-MM-DD')] : ''
      } else if (item.type === 'multiselect') {
        item.value = item.value ? item.value.split(',').filter(Boolean) : []
      }
      newsearches.push(item)
    })
@@ -294,6 +296,8 @@
        item.key.split(',').forEach(field => { // 综合搜索,所字段拼接
          newsearches[field] = item.value
        })
      } else if (item.type === 'multiselect') {
        newsearches[item.key] = item.value.join(',')
      } else {
        newsearches[item.key] = item.value
      }
@@ -312,7 +316,8 @@
    let searchText = ''
    searches.forEach(item => {
      if (!item.value) return
      if (!item.value || (item.type === 'multiselect' && item.value.length === 0)) return
      searchText += (searchText !== '' ? ' AND ' : '')
      if (item.type === 'text') {
        let str = item.match === '=' ? '' : '%'
@@ -325,6 +330,13 @@
        let str = item.match === '=' ? '' : '%'
        searchText += item.key + ' ' + item.match + ' \'' + str + item.value + str + '\''
      } else if (item.type === 'multiselect') {
        let str = item.match === '=' ? '' : '%'
        let options = item.value.map(val => {
          return item.key + ' ' + item.match + ' \'' + str + val + str + '\''
        })
        searchText += '(' + options.join(' OR ') + ')'
      } else if (item.type === 'date') {
        let _val = item.value
        let timetail = ' 00:00:00.000'