/**
 * 天气接口
 */
import request from '@/utils/request'
import { getSignTimeStamp } from '@/utils/mathUtils'
import Vue from 'vue'

// 气象预报列表
export function getWeatherList(date) {
  const baseConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const { sign, username, timestamp } = getSignTimeStamp()
  return request({
    url: baseConfig.biUrl + '/factdata/index/getData',
    method: 'post',
    data: {
      'showField': 'WD51_20,WD51_21,WD51_22,WD51_08,WD51_10,WD51_12,WD51_14,WD51_15',
      'dimId': '4608441E9BD449159E06E46DBC2495E0',
      'distinct': true,
      'type': 1,
      'conditionList': [
        [
          {
            'condition': '1',
            'key': 'WD51_08',
            'value': [date]
          }
        ],
        [
          {
            'condition': '7',
            'key': 'WD51_21'
          }
        ]
      ],
      'pageNo': null,
      'pageSize': null,
      'sign': sign,
      'name': username,
      'time': timestamp
    }
  })
}
// 气象灾害列表
export function getDisasterList(date) {
  const baseConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const { sign, username, timestamp } = getSignTimeStamp()
  return request({
    url: baseConfig.biUrl + '/factdata/index/getData',
    method: 'post',
    data: {
      'showField': 'WD52_03,WD52_05,WD52_06,WD52_07,WD52_08,WD52_09,WD52_10,WD52_12,WD52_13',
      'dimId': '87A3F59488AA48EE9D336318B7E6A1B8',
      'distinct': true,
      'type': 1,
      'conditionList': [
        [
          {
            'condition': '3',
            'key': 'WD52_08',
            'indexDimValues': date
          }
        ]
      ],
      'pageNo': null,
      'pageSize': null,
      'sign': sign,
      'name': username,
      'time': timestamp
    }
  })
}
