function test() {
  console.log(123)
}
function waveImg(dataPersonal) {
  const xData = []
  const yData = []
  const sevenList = dataPersonal
  for (let i = 0; i < sevenList.length; i++) {
    const obj = sevenList[i]
    xData.push(obj.dayIns)
    yData.push(obj.insNum)
  }
  const echarts = require('echarts')
  const myChart = echarts.init(document.getElementById('waveImg'))
  myChart.setOption({
    title: {
      text: ''
    },
    tooltip: {},
    xAxis: {
      data: xData,
      boundaryGap: false,
      show: false,
      splitLine: {
        show: false
      }
    },
    yAxis: {
      show: false,
      splitLine: {
        show: false
      }
    },
    series: [
      {
        name: '',
        type: 'line',
        smooth: true,
        areaStyle: {},
        itemStyle: {
          normal: {
            color: 'lightblue', // 圈圈的颜色
            lineStyle: {
              color: 'lightblue' // 线的颜色
            }
          }
        },
        data: yData
      }
    ],
    grid: {
      top: 30,
      // left: 0,
      height: 60
    }
  })
  // setTimeout(() => {
  //   myChart.resize()
  // }, 1000)
}
function histogram(listSevenReceive) {
  const xData = []
  const yData = []
  const sevenList = listSevenReceive
  for (let i = 0; i < sevenList.length; i++) {
    const obj = sevenList[i]
    xData.push(obj.dayIns)
    yData.push(obj.insNum)
  }
  console.log(xData)
  console.log(yData)
  const echarts = require('echarts')
  const myChart = echarts.init(document.getElementById('histogram'))
  myChart.setOption({
    title: {
      text: ''
    },
    tooltip: {},
    xAxis: {
      data: xData,
      type: 'category',
      boundaryGap: true,
      show: false,
      splitLine: {
        show: false
      }
    },
    yAxis: {
      show: false,
      splitLine: {
        show: false
      }
    },
    series: [
      {
        name: '',
        type: 'bar',
        smooth: true,
        areaStyle: {},
        itemStyle: {
          normal: {
            color: 'lightblue', // 圈圈的颜色
            lineStyle: {
              color: 'lightblue' // 线的颜色
            }
          }
        },
        data: yData
      }
    ],
    grid: {
      top: 30,
      // left: 0,
      height: 60
    }
  })
}
function saleImg(itemNotOk) {
  const xData = []
  const yData = []
  const sevenList = itemNotOk
  for (let i = 0; i < sevenList.length; i++) {
    const obj = sevenList[i]
    xData.push(obj.name)
    yData.push(obj.number)
  }
  const echarts = require('echarts')
  const myChart = echarts.init(document.getElementById('saleImg'))
  myChart.setOption({
    color: ['#3398DB'],
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        // 坐标轴指示器，坐标轴触发有效
        type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
      }
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: xData,
        axisTick: {
          alignWithLabel: true
        }
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: [
      {
        name: '不合格数量',
        type: 'bar',
        barWidth: '60%',
        data: yData
      }
    ]
  })
}
function salesTrendImg(sampleList) {
  const xData = []
  const yData = []
  const sevenList = sampleList
  for (let i = 0; i < sevenList.length; i++) {
    const obj = sevenList[i]
    xData.push(obj.name)
    yData.push(obj.number)
  }
  const echarts = require('echarts')
  const myChart = echarts.init(document.getElementById('salesTrendImg'))
  myChart.setOption({
    color: ['lightblue'],
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        // 坐标轴指示器，坐标轴触发有效
        type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
      }
    },
    grid: {
      top: 10,
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: xData,
        axisTick: {
          alignWithLabel: true
        }
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: [
      {
        name: '',
        type: 'bar',
        barWidth: '60%',
        data: yData
      }
    ]
  })
}
function visitImg(data) {
  const xData = []
  const yData = []
  const zData = []
  const sevenList = data.sampleRank
  const sevenListItem = data.itemRank
  for (let i = 0; i < sevenList.length; i++) {
    const obj = sevenList[i]
    xData.push(obj.name)
    yData.push(obj.number)
  }
  for (let i = 0; i < sevenListItem.length; i++) {
    const obj = sevenListItem[i]
    zData.push(obj.number)
  }
  const echarts = require('echarts')
  const myChart = echarts.init(document.getElementById('visitImg'))
  myChart.setOption({
    title: {
      // text: '折线图堆叠'
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['报检量', '项目量']
    },
    grid: {
      top: 20,
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
      // height: 320
    },
    toolbox: {
      feature: {
        saveAsImage: {}
      }
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: xData
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: '报检量',
        type: 'line',
        data: yData
      },
      {
        name: '项目量',
        type: 'line',
        data: zData
      }
    ]
  })
  console.log('js加载完成')
}
export { test, waveImg, histogram, saleImg, salesTrendImg, visitImg }
