let themonth = moment().format('YYYYMM')
let year = moment().year()
if (moment().startOf('month').format("D") == moment().format('D')) {
  themonth = moment().subtract(1, 'months').format('YYYYMM')
}
year = moment().subtract(1,'months').format('YYYY')
export const param = {
  date: moment().add(-1, 'day').format('YYYYMM'),
  month: moment().add(-1, 'months').format('YYYYMM'),
  themonth,
  quarter: String(moment().year()) + moment().quarter() - 1,
  year: String(year),
  theyear: String(moment().year()),
  today: moment().format('YYYYMMDD'),
  yesterday: moment().add(-1, 'day').format('YYYYMMDD'),
  lart30: moment().subtract('days', 30).format('YYYYMMDD'),
  startTime: moment().add(-12, 'months').format('YYYYMM'),
  endTime: moment().add(-1, 'months').format('YYYYMM'),
}
export const commonFiled = {
  date: moment().add(-1, 'day').format('D'),
  month: moment().add(-1, 'months').format('M'),
  quarter: String(moment().year()) + moment().quarter() - 1,
  year: String(moment().year()),
  theyear: String(moment().year()),
}
export const filedList = {
  'date': '日期',
  'month': '月份',
  'quarter': '季度',
  'year': '年',
  'theyear': '去年',
  'screening': '全局筛选参数',
}
export const config = {
  width: 1920,
  height: 1080,
  scale: 1,
  mark: {
    show: false,
    text: '水印',
    fontSize: 20,
    textStyle: 'rgba(100,100,100,0.2)',
    degree: -20
  },
  backgroundImage: '',
  "backgroundColor": "rgba(255, 255, 255, 1)",
  query: {}
};
// 颜色的配置
export const colorOption = {
  menuWidth: 150,
  refreshBtn: false,
  columnBtn: false,
  labelWidth: 100,
  column: [{
      label: '颜色1',
      prop: 'color1',
      type: 'color',
    },
    {
      label: '渐变色',
      prop: 'color2',
      type: 'color',
    },
    {
      label: '位置',
      prop: 'postion',
      type: 'number'
    }
  ]
}

// 表格的列配置
export const tableOption = {
  menuWidth: 150,
  refreshBtn: false,
  columnBtn: false,
  labelWidth: 100,
  column: [{
    label: '名称',
    prop: 'label',
  }, {
    label: 'key值',
    prop: 'prop',
  }, {
    label: '宽度',
    prop: 'width',
  }]
}
//一些字典的配置
export const dicOption = {
  line: [{
    label: '线条',
    value: 'line'
  }, {
    label: '圆环',
    value: 'circle'
  }],
  fontWeight: [{
    label: '默认',
    value: 'normal'
  }, {
    label: '粗',
    value: 'bold'
  }, {
    label: '更粗',
    value: 'bolder'
  }, {
    label: '细',
    value: 'ligter'
  }],
  border: [{
    label: '无边框',
    value: ''
  }, {
    label: '内置图片',
    value: 'img'
  }, {
    label: '内置边框',
    value: 'border'
  }],
  textAlign: [{
    label: '居中',
    value: 'center'
  }, {
    label: '左对齐',
    value: 'left'
  }, {
    label: '右对齐',
    value: 'right'
  }],
  dataType: [{
    label: '静态数据',
    value: 0
  }, {
    label: '动态数据',
    value: 1
  }],
  orientList: [{
    label: '竖排',
    value: 'vertical'
  }, {
    label: '横排',
    value: 'horizontal'
  }],
  positionList: [{
    label: '左上',
    value: '0'
  }, {
    label: '右上',
    value: '1'
  }, {
    label: '左下',
    value: '2'
  }, {
    label: '右下',
    value: '3'
  }],
  dataMethod: [{
    label: 'POST',
    value: 'post'
  }, {
    label: 'GET',
    value: 'get'
  }],
  mapTypes: [{
    label: '区域地图',
    value: '1'
  }, {
    label: '点地图',
    value: '2'
  }, {
    label: '矩形地图',
    value: '3'
  }],
  pointTypes: [{
    label: '颜色渐变',
    value: '1'
  }, {
    label: '大小渐变',
    value: '2'
  }],
  eventList: ['tabs'],
  dataList: ['customflop', 'common', 'customdatav', 'area', 'bartest', 'customFunnel', 'customtable','crosstable', 'customdatavflop', 'customlunbotable', 'custommap', 'customtext', 'wordcloud', 'customwordcloud', 'customprogress', 'customgauge', 'customlineprogress', 'tabs', 'map', 'pie', 'pictorialbar', 'flop', 'bar', 'line', 'progress', 'table', 'gauge', 'gauge', 'funnel', 'customscatter', 'custombubble', 'radar', 'customarea', 'mapline', "mapnew", 'mapbubble','toplabel'],
  singleList: ['customdatav', 'customdatavflop', 'customprogress', 'customlineprogress', 'customgauge'],
  themeList: [{
    label: '默认配色',
    value: 'avue'
  }, {
    label: '紫色主题',
    value: 'macarons'
  }, {
    label: '绿色主题',
    value: 'wonderland'
  }],
  barList: ['bar', 'line'],
  titleList: ['bar', 'pie', 'line', 'radar', 'funnel'],
  labelList: ['bar', 'line', 'pie', 'radar', 'bartest'],
  legendList: ['bar', 'pie', 'line', 'radar', 'funnel', 'bartest', 'custombubble'],
  colorList: ['bar', 'pie', 'line', 'gauge', 'funnel', 'radar', 'bartest', 'area', 'customscatter', 'custombubble', 'customarea'],
  tipList: ['bar', 'pie', 'line', 'gauge', 'funnel', 'radar'],
  postionList: ['bar', 'line', 'pictorialbar'],
  formatterList: ['bar', 'map', 'line', 'pie', 'gauge', 'funnel', 'customscatter', 'custombubble', 'area', 'radar', 'customlunbotable', 'custommap', 'bartest', 'customFunnel', 'customarea'],
  clickFormatterList: ['map'],
  labelFormatterList: ['bar'],
  tabsTypeList: [{
    label: '选项卡',
    value: 'tabs',
  }, {
    label: '选择框',
    value: 'select',
  }],
  mapType: [{
    label: '原生',
    value: 0
  }],
  target: [{
    label: '本窗口',
    value: '_parent'
  }, {
    label: '新窗口',
    value: '_blank',
  }],
  swiperType: [{
    label: '普通',
    value: ''
  }, {
    label: '立体',
    value: 'card'
  }],
  swiperIndicator: [{
    label: '外部',
    value: 'indicator'
  }, {
    label: '不显示',
    value: 'none'
  }],
  format: [{
    label: '日期',
    value: 'yyyy-MM-dd'
  }, {
    label: '日期+时分',
    value: 'yyyy-MM-dd hh:mm'
  }, {
    label: '日期+时分秒',
    value: 'yyyy-MM-dd hh:mm:ss'
  }, {
    label: '日期(无年)',
    value: 'MM-dd'
  }, {
    label: '时分',
    value: 'hh:mm'
  }, {
    label: '时分秒',
    value: 'hh:mm:ss'
  }, {
    label: '星期',
    value: 'day'
  }]
}


function concat(prop, count, type, extend = [], defaults) {
  let list = [];
  for (let i = 1; i <= count; i++) {
    list.push({
      label: prop + i,
      value: `/img/${prop}/${prop}${i}.${extend.includes(i) ? defaults : type}`
    })
  }
  return list;
}

//加载图片素材库
export const imgOption = [
  concat('bg', 19, 'jpg', [1, 2, 3], 'png'),
  concat('border', 16, 'png'),
  concat('source', 260, 'svg', [1, 15, 16, 20, 239.240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260], 'png'),
  concat('banner', 10, 'png'),
]

export const excludeSwitchComps = ['iswiper', 'customvideo', 'img']
