<template>
  <div class="view-container">
    <div class="title">
      <div style="position: absolute;">
        <img src="@/assets/22title.png" alt="">
      </div>
      <div class="text">
        <div> 维保系统数据大屏展示平台</div>
        <div style="font-size: 15px;color: #A7DBFF;">Maintain large screen display platform of system data</div>
      </div>
    </div>
    <div class="content">
      <div class="content-left">
        <div class="content-left-top">
          <div style="padding:20px;display: flex; justify-content: space-between; position: relative;">
            <div>维修单数</div>
            <div
              style="text-align:center; width: 106px;height: 27px;background: #091E64;border-radius: 14px; font-size: 18px;color: #A2ABCD;">最近6个月</div>
            <div
              style="z-index: 999; text-align:center; width: 176px;height: 29px;background: #04154D;position: absolute;top:60px;left:50%;transform: translateX(-50%);font-size: 18px;color: #BBCFE8;">总数：1234</div>
          </div>
          <div id="chart1"></div>
          <div style="padding:0 20px;font-size: 18px;font-weight: 400;">
            <div style="padding-bottom:10px; font-size: 18px;font-weight: 400;color:#B9BFD6;">故障排行榜</div>
            <thead>
              <tr style="display: flex;justify-content: space-around;width: 483px;height: 26px;font-weight: 400">
                <th class="list-header discolor" v-for="col in columns" :key="col.key">{{ col.title }}</th>
              </tr>
            </thead>
            <tbody>
              <tr :class="{discolor: i%2}" v-for="(list,i) in data1" :key="i" style="display: flex;justify-content: space-around;">
                <td class="list-header" style=" color: #B9BFD6;box-shadow:none; font-size: 14px;font-weight: 400;">{{ list.type }}</td>
                <td class="list-header" style="color: #B9BFD6;box-shadow:none; font-size: 16px;font-weight: 400;">{{ list.num }}</td>
                <td class="list-header" style="color: #B9BFD6;box-shadow:none; font-size: 16px;font-weight: 400;">{{ list.sb }}</td>
                <td class="list-header" style="color: #B9BFD6;box-shadow:none;font-size: 16px;font-weight: 400;">{{ list.fee }}</td>
              </tr>
            </tbody>
          </div>
        </div>
        <div class="content-left-bottom">
          <div style="padding-bottom: 20px; font-size: 24px;font-weight: 800;color: #24D1F0;">维修通知</div>
          <div
            class="demo-infinite-container"
          >
            <a-list :split="false" size="small" :data-source="information">
              <a-list-item style="color:#B9BFD6 " slot="renderItem" slot-scope="item">
                <a-list-item-meta>
                  <div slot="title" style="color:#B9BFD6 " :href="item.href">
                    <span style="display: inline-block; width: 10px;height: 10px;background: #AB1AE1;border-radius: 50%;"></span>
                    {{ item.name }}
                  </div>
                </a-list-item-meta>
                <div>
                  {{ item.time }}
                </div>
              </a-list-item>
            </a-list>
          </div>
        </div>
      </div>
      <div class="content-middle">
        <div class="content-middle-top">
          <div style="padding:20px;display: flex; justify-content: space-between; position: relative;">
            <div style="display: flex">维修费用统计 &nbsp;
              <div style="display:flex;justify-content: space-between; position: relative;">
                <span class="card-num">1</span>
                <span class="card-num">2</span>
                <span class="card-num">3</span>
                <span class="card-num">4</span>
                <span class="card-num">5</span>
                <span class="card-num">6</span>
              </div>
            </div>
            <div
              style="text-align:center; width: 106px;height: 27px;background: #091E64;border-radius: 14px; font-size: 18px;color: #A2ABCD;">最近1年</div>

          </div>
          <div id="chart2"></div>
        </div>
        <div class="content-middle-bottom">
          <div style="padding-bottom: 20px; font-size: 24px;font-weight: 800;color: #24D1F0;">维保核心数据</div>
          <div class="middle-bottom-tag">
            <a-row type="flex">
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#24D1F0" type="icon-youjiantou" />&nbsp;维修单数</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#9C24F0" type="icon-youjiantou" />&nbsp;维修费用</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#0E33BC" type="icon-youjiantou" />&nbsp;内部单数</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#F0DF24" type="icon-youjiantou" />&nbsp;内部费用</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#24D1F0" type="icon-youjiantou" />&nbsp;委外单数</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#9C24F0" type="icon-youjiantou" />&nbsp;委外费用</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#0E33BC" type="icon-youjiantou" />&nbsp;保养任务</div>
                  <div>2400</div>
                </div>
              </a-col>
              <a-col :span="6" class="border-bottom">
                <div class="middle-bottom-tag-list border-right">
                  <div style="font-size: 16px;color: #B9BFD6;"><my-icon style="color:#F0DF24" type="icon-youjiantou" />&nbsp;延迟任务</div>
                  <div>2400</div>
                </div>
              </a-col>
            </a-row>
          </div>
          <div style="padding-top:10px; font-size: 24px;font-weight: 800;color: #24D1F0;">维修费用类别</div>
          <div id="chart3"></div>
        </div>
      </div>
      <div class="content-right">
        <div class="content-right-top">
          <div style="padding-bottom: 20px; font-size: 24px;font-weight: 800;color: #24D1F0;">保养统计</div>
          <div id="chart4"></div>
        </div>
        <div class="content-right-bottom">
          <div style="padding-bottom: 20px; font-size: 24px;font-weight: 800;color: #24D1F0;">保养通知</div>
          <div
            class="demo-infinite-container"
            style="height:80%"
          >
            <a-list :split="false" size="small" :data-source="information">
              <a-list-item style="color:#B9BFD6 " slot="renderItem" slot-scope="item">
                <a-list-item-meta>
                  <div slot="title" style="color:#B9BFD6 " :href="item.href">
                    <span style="display: inline-block; width: 10px;height: 10px;background: #AB1AE1;border-radius: 50%;"></span>
                    {{ item.name }}
                  </div>
                </a-list-item-meta>
                <div>
                  {{ item.time }}
                </div>
              </a-list-item>
            </a-list>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Chart, registerTheme } from '@antv/g2'
export default {
  data () {
    return {
      information: [
        {
          name: '项目管理通知',
          time: '2022-4-7'
        },
        {
          name: '项目管理通知',
          time: '2022-4-7'
        },
        {
          name: '项目管理通知',
          time: '2022-4-7'
        },
        {
          name: '项目管理通知',
          time: '2022-4-7'
        }, {
          name: '项目管理通知',
          time: '2022-4-7'
        },
        {
          name: '项目管理通知',
          time: '2022-4-7'
        },
        {
          name: '项目管理通知',
          time: '2022-4-7'
        }, {
          name: '项目管理通知',
          time: '2022-4-7'
        },
        {
          name: '项目管理通知',
          time: '2022-4-7'
        }
      ],
      columns: [
        {
          title: '故障类别',
          key: 'type'
        },
        {
          title: '维修单数',
          key: 'num'
        },
        {
          title: '设备',
          key: 'sb'
        },
        {
          title: '维修费用',
          key: 'fee'
        }

      ],
      data1: [
        {
          type: '发动机启动困难',
          num: 19,
          sb: 3,
          fee: 2222
        },
        {
          type: '发动机启动困难',
          num: 19,
          sb: 3,
          fee: 2222
        },
        {
          type: '发动机启动困难',
          num: 19,
          sb: 3,
          fee: 2222
        },
        {
          type: '发动机启动困难',
          num: 19,
          sb: 3,
          fee: 2222
        },
        {
          type: '发动机启动困难',
          num: 19,
          sb: 3,
          fee: 2222
        },
        {
          type: '发动机启动困难',
          num: 19,
          sb: 3,
          fee: 2222
        }
      ],
      chart1: [
        { day: 1, percent: 60 },
        { day: 2, percent: 40 },
        { day: 3, percent: 50 },
        { day: 4, percent: 60 },
        { day: 5, percent: 70 },
        { day: 6, percent: 60 }
      ],
      chart2: [
        { day: 1, percent: 60 },
        { day: 2, percent: 40 },
        { day: 3, percent: 50 },
        { day: 4, percent: 60 },
        { day: 5, percent: 70 },
        { day: 6, percent: 60 },
        { day: 7, percent: 60 },
        { day: 8, percent: 40 },
        { day: 9, percent: 50 },
        { day: 10, percent: 60 },
        { day: 11, percent: 70 },
        { day: 12, percent: 60 }
      ],
      chart3: [
        { day: '维修-配件', percent: 60 },
        { day: '维修-人工', percent: 40 },
        { day: '备件费用', percent: 50 },
        { day: '维护保养费用', percent: 60 },
        { day: '改造费用', percent: 70 },
        { day: '委外费用', percent: 60 }
      ],
      chart4: [
        { day: '一级', percent: 30, value: 300 },
        { day: '二级', percent: 20, value: 200 },
        { day: '三级', percent: 50, value: 500 }
      ]
    }
  },
  mounted () {
    this.getChart()
  },
  methods: {
    getChart () {
      this.getChart1('chart1', this.chart1)
      this.getChart2('chart2', this.chart2)
      this.getChart3('chart3', this.chart3)
      this.getChart4('chart4', this.chart4)
    },
    getChart1 (id, data) {
      const chart = new Chart({
        container: id,
        width: 470,
        height: 220,
        appendPadding: [0, 0, 0, 20]
      })
      chart.data(data)
      chart.scale({
        day: {
          min: 1
        },
        percent: {
          min: 0,
          range: [0, 1]
        }
      })
      chart.axis('percent', {
        tickLine: null,
        title: {
          style: {
            fill: '#01D4F9',
            fontSize: 14
          },
          grid: null,
          offset: -10,
          autoRotate: false,
          position: 'end',
          text: '单数（个）'
        }
      })
      chart.axis('day', {
        title: {
          style: {
            fill: '#01D4F9',
            fontSize: 14
          },
          grid: null,
          autoRotate: false,
          position: 'end',
          text: '日期(月)'
        }
      })
      chart.tooltip({
        showCrosshairs: true,
        shared: true
      })

      chart.line().position('day*percent').shape('smooth')
      chart.point().position('day*percent')
      chart.theme({ 'styleSheet': { 'brandColor': '#F5942B ' } })
      chart.render()
    },
    getChart2 (id, data) {
      const chart = new Chart({
        container: id,
        width: 730,
        height: 350,
        appendPadding: [0, 0, 0, 20]
      })
      chart.data(data)
      chart.scale({
        day: {
          min: 1,
          tickCount: 12
        },
        percent: {
          min: 0,
          range: [0, 1]
        }
      })
      chart.axis('percent', {
        tickLine: null,
        title: {
          style: {
            fill: '#01D4F9',
            fontSize: 14
          },
          grid: null,
          offset: -10,
          autoRotate: false,
          position: 'end',
          text: '金额（元）'
        }
      })

      chart.tooltip({
        showCrosshairs: true,
        shared: true
      })

      // chart.line().position('day*percent').shape('smooth')
      chart.area().position('day*percent').shape('smooth')
      // chart.theme({ 'styleSheet': { 'brandColor': '#031655 ' } })
      chart.render()
    },
    getChart3 (id, data) {
      registerTheme('myTheme', {
        columnWidthRatio: 0.1,
        colors10: ['#0091F1', '#FDB628', '#00E4EC', '#EB6F49', '#9C24F0 ', '#00FF00', '#9661BC', '#F6903D', '#008685', '#F08BB4']
      })
      const chart = new Chart({
        container: id,
        width: 700,
        height: 150
      })
      chart.data(data)
      chart.scale({
        percent: {
          nice: true,
          range: [0, 1]
        }
      })
      chart.legend(false)
      chart.tooltip({
        showCrosshairs: true,
        shared: true
      })
      chart.interaction('active-region')
        .interval()
        .position('day*percent')
        .color('day')
      chart.theme('myTheme')
      chart.render()
    },
    getChart4 (id, data) {
      registerTheme('myTheme', {
        columnWidthRatio: 0.1,
        colors10: ['#0091F1', '#FDB628', '#00E4EC', '#EB6F49', '#9C24F0 ', '#00FF00', '#9661BC', '#F6903D', '#008685', '#F08BB4']
      })
      const chart = new Chart({
        container: id,
        autoFit: true,
        height: 300
      })
      chart.data(data)
      chart.scale('percent', {
        formatter: (val) => {
          val = val * 100 + '%'
          return val
        }
      })
      chart.coordinate('theta', {
        radius: 0.75,
        innerRadius: 0.8
      })
      chart.tooltip({
        showTitle: false,
        showMarkers: false,
        itemTpl: '<li class="g2-tooltip-list-item"><span style="background-color:{color};" class="g2-tooltip-marker"></span>{name}: {value}</li>'
      })
      // 辅助文本
      chart
        .annotation()
        .text({
          position: ['50%', '50%'],
          content: '1000',
          style: {
            fontSize: 20,
            fill: '#8c8c8c',
            textAlign: 'center'
          }

        })
      chart
        .interval()
        .adjust('stack')
        .position('percent')
        .color('day')
        .label('percent', (percent) => {
          return {
            content: (data) => {
              return percent + '%\n' + data.value
            }
          }
        })
        .tooltip('day*percent', (item, percent) => {
          percent = percent + '%'
          return {
            name: item,
            value: percent
          }
        })

      chart.interaction('element-active')
      chart.theme('myTheme')
      chart.render()
    }
  }
}
</script>

<style lang="less" scoped>
.view-container {
width:1920px;
height:1080px;
background-color: RGBA(0, 7, 73, 0.8);
padding:30px 41px;
}
.view-container::after {
  content: "";
  width:1920px;
  height:1080px;
  background: url(../../assets/bgView.png);
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  position: absolute;
  z-index: -1;
}
.title{
  text-align: center;
font-size: 28px;
font-family: Microsoft YaHei;
font-weight: bold;
color: #BDE4FF;
padding-bottom: 38px;
  .text{
padding-top: 10px;
}
}
.content{
 width: 100%;
 height: 919px;
 display: flex;
 justify-content: space-between;
}
.content-left{
 font-size: 24px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #24D1F0;
 width: 522px;
height: 919px;
.content-left-top{
  background: #000D39;
border: 4px solid #02044B;
   width: 522px;
   height: 543px;
   margin-bottom:14px;
}
.content-left-bottom{
  background: #000D39;
border: 4px solid #02044B;
   width: 522px;
   height: 362px;
padding:20px;
overflow: hidden;
}
}
.content-middle{
   font-size: 24px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #24D1F0;
 width: 762px;
height: 919px;
.content-middle-top{
  background: #000D39;
border: 4px solid #02044B;
   width: 762px;
   height: 445px;
   margin-bottom:14px;
}
.content-middle-bottom{
  background: #000D39;
border: 4px solid #02044B;
   width: 762px;
   height: 458px;
padding:20px;
.middle-bottom-tag{
width: 695px;
height: 172px;
background: #030E44;
.middle-bottom-tag-list{
height: 51px;
margin:17px auto;
display:flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.border-right{
border-right: 2px solid #07164C;
}
.border-bottom{
border-bottom: 2px solid #07164C;
}
}
}
}
.content-right{

 width: 513px;
height: 919px;
.content-right-top{
  background: #000D39;
border: 4px solid #02044B;
   width: 513px;
   height: 445px;
   margin-bottom:14px;
padding:20px;

}
.content-right-bottom{
  background: #000D39;
 border: 4px solid #02044B;
   width: 513px;
   height: 457px;
padding:20px;
overflow: hidden;
}
}
.discolor{
  background: #04154D;
}
.list-header{
  width: 25%;
  text-align: center;
}
.card-num{
  padding: 0 5px;
  font-size: 24px;
  margin-right: 5px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #000D39;
  background:#24D1F0;
  }
.demo-infinite-container {
  overflow: auto;
  height: 240px;
}
::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
</style>
