loulijun2021
2022-10-13 ecaf70a4e7d72ecc1c18302fef31b3baab8e6513
src/utils/myEcharts.js
@@ -350,21 +350,38 @@
}
// 综合看板图
export function bar02() {
  const data = [70, 60, 50, 40, 30]
export function bar02(dataArr, titlenameArr) {
  // const data = [70, 60, 50, 40, 30]
  // const titlename = ['外观划伤', '表面油污', '尺寸', '颜色', '大小']
  // const data = val.map(i => i.cont)
  // const titlename = val.map(i => i.name)
  const data = dataArr.filter((item, index) => index < 5)
  const titlename = ['外观划伤', '表面油污', '尺寸', '颜色', '大小']
  const titlename = titlenameArr.filter((item, index) => index < 5)
  const length = titlename.length
  if (titlename.length < 5) {
    for (let i = 0; i < 5 - length; i++) {
      titlename.push('0')
    }
  }
  const valdata = [683, 500, 400, 300, 200]
  const myColor = ['#FF0000', '#FF5511', '#FF8800', '#FFBB00', '#FFFF00']
  // const myColor = ['#FF0000', '#FF5511', '#FF8800', '#FFBB00', '#FFFF00']
  // const myColor = ['#0000FF']
  // const myColor = ['#7af5f5', '#00FFFF', '#00FFFF', '#00FFFF', '#00FFFF']
  const myColor = ['rgba(122,245,245,1)', 'rgba(122,245,245,0.95)', 'rgba(122,245,245,0.9)', 'rgba(122,245,245,0.85)', 'rgba(122,245,245,0.8)']
  const option = {
    backgroundColor: 'transparent',
    title: {
      text: 'Top5不良',
      x: 'center',
      show: false,
      text: '一周内Top5不良:',
      x: '2%',
      y: '4%',
      textStyle: {
        color: '#fff',
        fontSize: '22'
        color: '#d8d7d9',
        fontSize: '18'
        // fontWeight: 'lighter'
      },
      subtextStyle: {
        color: '#90979c',
@@ -373,8 +390,8 @@
      }
    },
    grid: {
      left: '2%',
      right: '2%',
      left: '10%',
      right: '5%',
      bottom: '0%',
      top: '10%',
      containLabel: true
@@ -397,16 +414,29 @@
          show: false
        },
        axisLabel: {
          color: '#fff',
          fontSize: 14,
          formatter: function(value, index) {
            return [
              '{lg|' + (index + 1) + '、   }' + '{title|' + value + '} '
            ].join('\n')
          // color: '#fff',
          color: function(value, index) {
            return value === '0' ? 'transparent' : '#fff'
          },
          fontSize: 18,
          // formatter: function(value, index) {
          //   return [
          //     '{lg|' + (index + 1) + '、   }' + '{title|' + value + '} '
          //   ].join('\n')
          // },
          formatter: function(params) {
            var val = ''
            if (params.length > 8) {
              val = params.substr(0, 8) + '...'
              return val
            } else {
              return params
            }
          },
          rich: {
            lg: {
              // backgroundColor: '#339911',
              // color: '#d8d7d9',
              color: '#fff',
              borderRadius: 15,
              // padding: 5,
@@ -473,7 +503,7 @@
  return option
}
// 仓库管理看板图
// 仓库管理看板图   (弃用)
export function bar03(titleText) {
  const path = 'path://M214,1079l8-6h16l8,6-8,6H222Z'
  const zzx1 = ['800', '900', '700', '300', '500', '800', '700']
@@ -497,11 +527,13 @@
    },
    title: {
      text: titleText,
      x: '70%',
      x: '66%',
      y: '2%',
      textStyle: {
        color: '#fff',
        fontSize: '22'
        // color: '#fff',
        color: '#00ffff',
        fontSize: '18',
        fontWeight: 'lighter'
      },
      subtextStyle: {
        color: '#90979c',
@@ -684,3 +716,75 @@
  return option
}
// 采购订单图
export function pie01() {
  const option = {
    backgroundColor: 'transparent',
    title: {
      text: '60.21%',
      x: 'center',
      y: 'center',
      textStyle: {
        fontWeight: 'normal',
        color: '#fff',
        fontSize: 18
      }
    },
    color: ['rgba(176, 212, 251, 1)'],
    legend: {
      show: false,
      itemGap: 12,
      data: ['01', '02']
    },
    series: [
      {
        name: 'Line 1',
        type: 'pie',
        clockWise: true,
        radius: ['50%', '66%'],
        itemStyle: {
          normal: {
            label: {
              show: false
            },
            labelLine: {
              show: false
            }
          }
        },
        hoverAnimation: false,
        data: [
          {
            value: 80,
            name: '01',
            itemStyle: {
              normal: {
                color: { // 完成的圆环的颜色
                  colorStops: [{
                    offset: 0,
                    color: '#24d3ff' // 0% 处的颜色
                  }, {
                    offset: 1,
                    color: '#5580fe' // 100% 处的颜色
                  }]
                },
                label: {
                  show: false
                },
                labelLine: {
                  show: false
                }
              }
            }
          },
          {
            name: '02',
            value: 20
          }
        ]
      }]
  }
  return option
}