<template>
  <div class="main">
    <div class="middle">
      <display-board class="trade_left" title="营业情况">
        <div
          style="height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;">
          <contrast-card :mouseHand="true" v-for="data in yyqk" style="height: 28%;"
                         @click.native="routerTo('/turnover-detail',paths[data.title])">
            <title-content-mark style="width: 40%;color: #369afa;float: left;" :title="data.title"
                                :content="data.amount" :mark="data.unit"/>
            <div
              style="width: 60%; height: 100%; float:left; padding: 4% 4% 0 12%; line-height: 26px;; display: flex; align-items: center;">
              <table-column style="float: left;width: 25%;" :data="data.hb" name="title"/>
              <table-column style="float: left;width: 40%;" :data="data.hb" name="amount"/>
              <table-column style="float: left;width: 35%;" :data="data.hb" name="rate"
                            :cell-style-function="cellStyleFunction"/>
              <!--              <table-column style="float: left;width: 35%;" :data="data.hb" name="rate" cell-style-js="var res = {color: '#5eeef4'};  if(data.indexOf('+') !== -1){res.color = '#fee064'} res; "/>-->
            </div>
          </contrast-card>
        </div>
      </display-board>
      <display-board class="trade_middle" title="应收款情况" corner_size="large">
        <div style="height: 36%;display: flex;justify-content: space-evenly;padding-top: 1.5rem">
          <simple-card v-for="data in arSummary" style="width: 30%;height: 100%">
            <title-content-mark style="color: #5eeef4;" :title="data.title" :content="data.value" :mark="'万元'"
                                isCenter isBold/>
          </simple-card>
        </div>
        <ar-summary-bar ref="arSummaryBar" style="width: 100%; height: 64%;"></ar-summary-bar>
      </display-board>
      <display-board class="trade_right" title="账款情况">
        <div
          style="height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;">
          <contrast-card v-for="data in mockData.zkqk" style="height: 28%;">
            <title-content-mark style="width: 40%;color: #369afa;float: left;" :title="data.title"
                                :content="data.amount" :mark="data.unit"/>
            <div
              style="width: 60%; height: 100%; float:left; padding: 4% 4% 0 12%; line-height: 26px;; display: flex; align-items: center;">
              <table-column style="float: left;width: 25%;" :data="data.hb" name="title"/>
              <table-column style="float: left;width: 40%;" :data="data.hb" name="amount"/>
              <table-column style="float: left;width: 35%;" :data="data.hb" name="rate"
                            :cell-style-function="cellStyleFunction"/>
            </div>
          </contrast-card>
        </div>
      </display-board>
    </div>
    <div class="middle">
      <display-board class="trade_left" title="已开票未收款">
        <winners-list style="height: 96%;overflow: auto;" :mouseHand="true" @click.native="goArBar" id="ar_company_list" :rows="arCompanyList"/>
      </display-board>
      <div class="trade_middle" style="border: none;box-shadow: none;">
        <div style="display: flex; justify-content: space-between; height: 50%;">
          <display-board style="width: 32%;" title="每日目标情况" :mouseHand="true" @click.native="routerTo('/target-achievement','day')">
            <div
              style="width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;">
              <table-column style="float: left;width: 35%;" :data="targetAchievement.day" name="title" show-head/>
              <table-column
                style="float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
                :data="targetAchievement.day" name="actualValue" title="实时值" show-head/>
              <table-column style="float: left;width: 20%;" :data="targetAchievement.day" name="targetValue" title="目标值"
                            show-head/>
            </div>
          </display-board>
          <display-board style="width: 32%;" title="月度目标情况" :mouseHand="true" @click.native="routerTo('/target-achievement','month')">
            <div
              style="width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;">
              <table-column style="float: left;width: 35%;" :data="targetAchievement.month" name="title" show-head/>
              <table-column
                style="float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
                :data="targetAchievement.month" name="actualValue" title="实时值" show-head/>
              <table-column style="float: left;width: 20%;" :data="targetAchievement.month" name="targetValue" title="目标值"
                            show-head/>
            </div>
          </display-board>
          <display-board style="width: 32%;" title="年度目标情况" :mouseHand="true" @click.native="routerTo('/target-achievement','year')">
            <div
              style="width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;">
              <table-column style="float: left;width: 35%;" :data="targetAchievement.year" name="title" show-head/>
              <table-column
                style="float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
                :data="targetAchievement.year" name="actualValue" title="实时值" show-head/>
              <table-column style="float: left;width: 20%;" :data="targetAchievement.year" name="targetValue" title="目标值"
                            show-head/>
            </div>
          </display-board>
        </div>
        <div style="display: flex; justify-content: space-between; height: 50%; padding-top: 2rem;">
          <showcase style="width: 18%;" title="当日订单量">
            <title-content-mark
              style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
              content-style="font-size: 16px;" mark-style="font-size: 10px;" :content="drddl.weight"
              mark="万吨"/>
            <title-content-mark style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
                                content-style="font-size: 16px;" mark-style="font-size: 10px;"
                                :content="drddl.amount" mark="万元"/>
          </showcase>
          <showcase style="width: 18%;" title="当日完成量">
            <title-content-mark
              style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
              content-style="font-size: 16px;" mark-style="font-size: 10px;" :content="drwcl.weight"
              mark="万吨"/>
            <title-content-mark style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
                                content-style="font-size: 16px;" mark-style="font-size: 10px;"
                                :content="drwcl.amount" mark="万元"/>
          </showcase>
          <showcase style="width: 18%;" title="余量">
            <title-content-mark
              style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
              content-style="font-size: 16px;" mark-style="font-size: 10px;" :content="yl.weight" mark="万吨"/>
            <title-content-mark style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
                                content-style="font-size: 16px;" mark-style="font-size: 10px;"
                                :content="yl.amount" mark="万元"/>
          </showcase>
          <showcase style="width: 18%;" title="流失客户" :mouseHand="true" @click.native="routerTo('/lost-add-customer',2)">
            <title-content-mark
              style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
              content-style="font-size: 16px;" mark-style="font-size: 10px;" :content="lskh.weight"
              mark="万吨"/>
            <title-content-mark style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
                                content-style="font-size: 16px;" mark-style="font-size: 10px;"
                                :content="lskh.amount" mark="万元"/>
          </showcase>
          <showcase style="width: 18%;" title="新增客户" :mouseHand="true" @click.native="routerTo('/lost-add-customer',1)">
            <title-content-mark
              style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
              content-style="font-size: 16px;" mark-style="font-size: 10px;" :content="xzkh.weight"
              mark="万吨"/>
            <title-content-mark style="float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
                                content-style="font-size: 16px;" mark-style="font-size: 10px;"
                                :content="xzkh.amount" mark="万元"/>
          </showcase>
        </div>
      </div>
      <display-board class="trade_right" title="当日订单量占比">
        <div
          style="height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;">
          <ring-pie-chart ref="transportTypeChart" style="width: 100%;height: 50%;z-index: 999" name="运输类型占比"
                          :data="transportTypeOrderFinishPie" @click.native="routerTo('/order-proportion')"
                          :value-formatter="pieDataValueFormatter" :formatter="pieDataFormatter"/>
          <ring-pie-chart ref="customerChart" style="width: 100%;height: 50%;" name="公司占比"
                          :data="customerOrderFinishPie" @click.native="routerTo('/order-proportion')"
                          :value-formatter="pieDataValueFormatter" :formatter="pieDataFormatter"/>
        </div>
      </display-board>
    </div>
  </div>
</template>
<script>
import DisplayBoard from "./components/container/display-board.vue";
import Showcase from "./components/container/showcase.vue";
import ContrastCard from "./components/card/contrast-card.vue";
import SimpleCard from "./components/card/simple-card.vue";
import ArSummaryBar from "./components/chart/ar-summary-bar.vue";
import WinnersList from "./components/card/winners-list.vue";
import TitleContentMark from "./components/layout/title-content-mark.vue";
import TableColumn from "./components/table/table-column.vue";
import RingPieChart from "./components/chart/ring-pie-chart.vue";
import {
  arSummaryBar,
  arCompanyList,
  getBusinessConditionDatas,
  getOrderLoseAddCustomer,
  getOrderBusinessConditionData
} from "../api/apiList"
import {calc_hb_str, calc_tb_str, conver_amont, conver_num_retain} from "../utils/numUtil";
import {getTransportTypeOrderFinishPie, getCustomerOrderFinishPie} from "./databoard/js/indexPieData";
import moment from 'moment'
import {getTargetOrderDataByConditionCount} from "./databoard/js/targetAchievementData";
import mockData from "./databoard/mockData/target-achievement.json";
export default {
  components: {
    RingPieChart,
    TableColumn,
    TitleContentMark,
    Showcase,
    DisplayBoard,
    ContrastCard,
    SimpleCard,
    ArSummaryBar,
    WinnersList
  },
  data() {
    return {
      today: moment().format("yyyy-MM-DD"),
      yyqk: {
        yye: {
          title: "营业额",
          amount: "20,303",
          unit: "万元",
          hb: [
            {
              title: "昨天",
              amount: "21,000",
              rate: "-3.32%",
            },
            {
              title: "上月",
              amount: "20,000",
              rate: "+4.92%",
            },
          ],
        },
        cb: {
          title: "成本",
          amount: "10,303",
          unit: "万元",
          hb: [
            {
              title: "昨日",
              amount: "11,000",
              rate: "-2.68%",
            },
            {
              title: "上月",
              amount: "10,000",
              rate: "+5.71%",
            },
          ],
        },
        ml: {
          title: "毛利",
          amount: "10,000",
          unit: "万元",
          hb: [
            {
              title: "昨日",
              amount: "10,000",
              rate: "0.00%",
            },
            {
              title: "上月",
              amount: "10,000",
              rate: "0.00%",
            },
          ],
        },
      },
      arSummary: [
        {title: '累计营业收入（当年）', value: '20,303'},
        {title: '应收款（财务）', value: '20,303'},
        {title: '应收款（营销）', value: '20,303',},
      ],
      lskh: {
        weight: "2,000",
        amount: "20,000",
      },
      xzkh: {
        weight: "2,000",
        amount: "20,000",
      },
      drddl: {
        weight: "2,000",
        amount: "20,000",
      },
      drwcl: {
        weight: "2,000",
        amount: "20,000",
      },
      yl: {
        weight: "2,000",
        amount: "20,000",
      },
      mockData: {
        zqk: {
          yszk: {
            title: "应收账款",
            amount: "20,303",
            unit: "万元",
            hb: [
              {
                title: "昨天",
                amount: "21,000",
                rate: "-3.32%",
              },
              {
                title: "上月",
                amount: "20，000",
                rate: "+4.92%",
              },
            ],
          },
          yfzk: {
            title: "应付账款",
            amount: "10,303",
            unit: "万元",
            hb: [
              {
                title: "昨日",
                amount: "11,000",
                rate: "-2.68%",
              },
              {
                title: "上月",
                amount: "10,000",
                rate: "+5.71%",
              },
            ],
          },
          zsye: {
            title: "账上余额",
            amount: "10,000",
            unit: "万元",
            hb: [
              {
                title: "昨日",
                amount: "10,000",
                rate: "0.00%",
              },
              {
                title: "上月",
                amount: "10,000",
                rate: "0.00%",
              },
            ],
          },
        },
        sr: [
          {
            title: '累计营业收入（当年）',
            value: '20,303',
          },
          {
            title: '应收款（财务）',
            value: '20,303',
          },
          {
            title: '应收款（营销）',
            value: '20,303',
          },
        ],
        drddl: {
          weight: "2,000",
          amount: "20,000",
        },
        drwcl: {
          weight: "2,000",
          amount: "20,000",
        },
        yl: {
          weight: "2,000",
          amount: "20,000",
        },
        lskh: {
          weight: "2,000",
          amount: "20,000",
        },
        xzkh: {
          weight: "2,000",
          amount: "20,000",
        },
        ndmbqk: [
          {
            title: "吨位(万吨)",
            actualValue: "20,303",
            currentValue: "21,000",
          },
          {
            title: "营业额(万元)",
            actualValue: "32,342",
            currentValue: "21,000",
          },
          {
            title: "净利润(万元)",
            actualValue: "32,342",
            currentValue: "21,000",
          },
        ],
        zkqk: {
          yszk: {
            title: "应收账款",
            amount: "20,303",
            unit: "万元",
            hb: [
              {
                title: "昨天",
                amount: "21,000",
                rate: "-3.32%",
              },
              {
                title: "上月",
                amount: "20，000",
                rate: "+4.92%",
              },
            ],
          },
          yfzk: {
            title: "应付账款",
            amount: "10,303",
            unit: "万元",
            hb: [
              {
                title: "昨日",
                amount: "11,000",
                rate: "-2.68%",
              },
              {
                title: "上月",
                amount: "10,000",
                rate: "+5.71%",
              },
            ],
          },
          zsye: {
            title: "账上余额",
            amount: "10,000",
            unit: "万元",
            hb: [
              {
                title: "昨日",
                amount: "10,000",
                rate: "0.00%",
              },
              {
                title: "上月",
                amount: "10,000",
                rate: "0.00%",
              },
            ],
          },
        },
        barChart: {
          textStyle: {color: "#fff"},
          tooltip: {},
          xAxis: {
            data: ['未结算未开票', '已结算未开票', '已开票未收款', '应收款', '已开票已收款']
          },
          yAxis: {},
          series: [
            {
              name: '开票详情',
              type: 'bar',
              data: [500, 300, 500, 1001, 319],
              color: "#7f83f7",
              label: {
                show: true,
                position: 'top',
                color: "#fff",
              },
            }
          ]
        },
        drddlzb: {
          transportType: [
            {value: 2500, name: '汽运'},
            {value: 100, name: '码头/仓库'},
            {value: 500, name: '铁运'},
            {value: 484, name: '水运'},
          ],
          customer: [
            {value: 500, name: '上海欧冶物流股份有限公司'},
            {value: 2500, name: '宝钢运输部'},
            {value: 1100, name: '宝山钢铁股份有限公司'},
          ]
        },
      },
      paths: {
        "营业额": "yye",
        "成本": "cb",
        "毛利": "ml",
      },
      dataset: {},
      transportTypeOrderFinishPie: [],
      customerOrderFinishPie: [],
      arCompanyList: [],
      charts: {},
      targetAchievement:{
        day: null,
        month: null,
        year: null,
      }
    }
  },
  methods: {
    generateData(count, res) {
      res.push({
        title: "吨位(万吨)",
        actualValue: conver_amont(count.unit_weight),
        targetValue: conver_amont(count.target_unit_weight),
      })
      res.push({
        title: "营业额(万元)",
        actualValue: conver_amont(count.sell_settle_amount),
        targetValue: conver_amont(count.target_sell_settle_amount),
      })
      res.push({
        title: "净利润(万元)",
        actualValue: conver_amont(count.gross_profit_amount),
        targetValue: conver_amont(count.target_gross_profit_amount),
      })
    },
    dataFormatter(data){
      let res = [];
      for (let i = 0; i < data.length; i++) {
        if (data[i].group_name === "总计"){
          this.generateData(data[i], res);
          break;
        }
      }
      //mock数据，接口没好的时候用的
      if (res.length === 0){
        let count = mockData.count;
        this.generateData(count, res);
      }
      return res;
    },
    cellStyleFunction(data) {
      let res = {color: '#33ff66'};
      if (data.indexOf('-') !== -1) {
        res.color = '#ff3300'
      }
      return res;
    },
    resizeChart() {
      for (let chartsKey in this.charts) {
        this.charts[chartsKey].resize();
      }
    },
    routerTo(path, code) {
      this.$router.push({path: path, query: {code: code}});
    },
    //营业情况
    showBusinessConditionDatas() {
      let res = getBusinessConditionDatas(this.today)
      res.then(data => {
        data = data.data;
        //营业额
        this.yyqk.yye.amount = conver_amont(data.cur_sell_settle_amount);
        this.yyqk.yye.hb[0].amount = conver_amont(data.pre_sell_settle_amount);
        this.yyqk.yye.hb[0].rate = calc_hb_str(data.cur_sell_settle_amount, data.pre_sell_settle_amount);
        this.yyqk.yye.hb[1].amount = conver_amont(data.pre_month_sell_settle_amount);
        this.yyqk.yye.hb[1].rate = calc_tb_str(data.cur_sell_settle_amount, data.pre_month_sell_settle_amount);
        //成本
        this.yyqk.cb.amount = conver_amont(data.cur_buy_settle_amount);
        this.yyqk.cb.hb[0].amount = conver_amont(data.pre_buy_settle_amount);
        this.yyqk.cb.hb[0].rate = calc_hb_str(data.cur_buy_settle_amount, data.pre_buy_settle_amount);
        this.yyqk.cb.hb[1].amount = conver_amont(data.pre_month_buy_settle_amount);
        this.yyqk.cb.hb[1].rate = calc_tb_str(data.cur_buy_settle_amount, data.pre_month_buy_settle_amount);
        //毛利
        this.yyqk.ml.amount = conver_amont(data.cur_gross_profit_amount);
        this.yyqk.ml.hb[0].amount = conver_amont(data.pre_gross_profit_amount);
        this.yyqk.ml.hb[0].rate = calc_hb_str(data.cur_gross_profit_amount, data.pre_gross_profit_amount);
        this.yyqk.ml.hb[1].amount = conver_amont(data.pre_month_gross_profit_amount);
        this.yyqk.ml.hb[1].rate = calc_tb_str(data.cur_gross_profit_amount, data.pre_month_gross_profit_amount);
      })
    },
    // 跳转已开票未收款页面
    goArBar() {
      this.$router.push('/ar_bar')
    },
    // 获取应收账款数据
    getArSummaryBar() {
      let seriesData = []
      seriesData.push(1984.84)
      seriesData.push(526.88)
      seriesData.push(3865.13)
      seriesData.push(6376.85)
      seriesData.push(21985.16)
      this.arSummary[0].value = conver_num_retain(28362.01)
      this.arSummary[1].value = conver_num_retain(3865.13)
      this.arSummary[2].value = conver_num_retain(6376.85)
      setTimeout(() => {
        this.$refs.arSummaryBar.drawArSummaryBar(seriesData)
      }, 200)
    },
    // 获取已开票未收款排行
    getArCompanyList() {
      this.arCompanyList = [{"unregister_amount":26945716.13871128,"column":[{"value":2694.57,"key":"未收款（万元）"}],"settle_company":"上海******有限公司","title":"上海******有限公司"},{"unregister_amount":1484200.33999975,"column":[{"value":148.42,"key":"未收款（万元）"}],"settle_company":"南京******有限公司","title":"南京******有限公司"},{"unregister_amount":1282384.1125039729,"column":[{"value":128.24,"key":"未收款（万元）"}],"settle_company":"北京******有限公司","title":"北京******有限公司"},{"unregister_amount":1222847.829203282,"column":[{"value":122.28,"key":"未收款（万元）"}],"settle_company":"******有限公司","title":"上海******有限公司"},{"unregister_amount":669150.4900020813,"column":[{"value":66.92,"key":"未收款（万元）"}],"settle_company":"上海******有限公司","title":"上海******有限公司"},{"unregister_amount":582699.659999399,"column":[{"value":58.27,"key":"未收款（万元）"}],"settle_company":"上海******有限公司","title":"上海******有限公司"},{"unregister_amount":485170.73599994266,"column":[{"value":48.52,"key":"未收款（万元）"}],"settle_company":"上海******有限公司","title":"上海******有限公司"},{"unregister_amount":482944.5004,"column":[{"value":48.29,"key":"未收款（万元）"}],"settle_company":"上海******有限公司","title":"上海******有限公司"},{"unregister_amount":476673.075,"column":[{"value":47.67,"key":"未收款（万元）"}],"settle_company":"天津******有限公司","title":"天津******有限公司"},{"unregister_amount":472057.86699967426,"column":[{"value":47.21,"key":"未收款（万元）"}],"settle_company":"上海******有限公司","title":"上海******有限公司"}]
    },
    refreshData() {
        getTransportTypeOrderFinishPie(res => this.transportTypeOrderFinishPie = res, this.today);
        getCustomerOrderFinishPie(res => this.customerOrderFinishPie = res, this.today);
        // this.showBusinessConditionDatas();
        this.getArSummaryBar();
        this.getArCompanyList();
        this.getLoseAndAdd();
        this.getOrderBusinessCondition();
        this.getTargetOrderDataByConditionCount();
    },
    pieDataValueFormatter(param) {
      return conver_amont(param) + "万吨";
    },
    pieDataFormatter(param) {
      return param.name + '\r\n' + this.pieDataValueFormatter(param.value);
    },
    getLoseAndAdd() {
      this.lskh.amount = conver_amont(6618584.99529);
      this.lskh.weight = conver_amont(64185.005);
      this.xzkh.amount = conver_amont(5084225.684932);
      this.xzkh.weight = conver_amont(46417.2155);
    },
    getOrderBusinessCondition() {
      this.drddl.amount = conver_amont(11114.321);
      this.drddl.weight = conver_amont(18255.342);
      this.drwcl.amount = conver_amont(14522.34334);
      this.drwcl.weight = conver_amont(22473.342);
      this.yl.amount = conver_amont(2741768.178166);
      this.yl.weight = conver_amont(48897.813);
    },
    getTargetOrderDataByConditionCount() {
      let day = {"data":[{"sell_settle_amount":0,"group_name":"总计","gross_profit_amount":0,"target_gross_profit_amount":0,"sort_num":1,"target_unit_weight":0,"target_sell_settle_amount":0,"unit_weight":0,"key":"总计"}]};
      this.targetAchievement.day = this.dataFormatter(day);
      let month = [{"sell_settle_amount":0,"group_name":"总计","gross_profit_amount":0,"target_gross_profit_amount":0,"sort_num":1,"target_unit_weight":0,"target_sell_settle_amount":0,"unit_weight":0,"key":"总计"}];
      this.targetAchievement.month = this.dataFormatter(month);
      let year = [{"sell_settle_amount":77091201.836384,"group_name":"上海事业部-汽运-外发","gross_profit_amount":8174523.653191,"target_gross_profit_amount":2500000,"sort_num":0,"target_unit_weight":880000,"target_sell_settle_amount":100000000,"unit_weight":3139892.174471,"key":"上海事业部"},{"sell_settle_amount":63496115.426714,"group_name":"上海事业部-水运-外发","gross_profit_amount":13120983.73225,"target_gross_profit_amount":4800000,"sort_num":0,"target_unit_weight":2340000,"target_sell_settle_amount":117000000,"unit_weight":1443545.391646,"key":"上海事业部"},{"sell_settle_amount":140587317.263098,"group_name":"上海事业部-小计","gross_profit_amount":21295507.385441,"target_gross_profit_amount":7300000,"sort_num":0,"target_unit_weight":3220000,"target_sell_settle_amount":217000000,"unit_weight":4583437.566117,"key":"上海事业部"},{"sell_settle_amount":8390189.93402,"group_name":"天津事业部-汽运-外发","gross_profit_amount":3853758.221518,"target_gross_profit_amount":0,"sort_num":0,"target_unit_weight":0,"target_sell_settle_amount":0,"unit_weight":156598.709,"key":"天津事业部"},{"sell_settle_amount":8390189.93402,"group_name":"天津事业部-小计","gross_profit_amount":3853758.221518,"target_gross_profit_amount":0,"sort_num":0,"target_unit_weight":0,"target_sell_settle_amount":0,"unit_weight":156598.709,"key":"天津事业部"},{"sell_settle_amount":9235964.928734,"group_name":"广东事业部-汽运-外发","gross_profit_amount":262070.641631,"target_gross_profit_amount":200000,"sort_num":0,"target_unit_weight":120000,"target_sell_settle_amount":8200000,"unit_weight":131398.972,"key":"广东事业部"},{"sell_settle_amount":62148344.910186,"group_name":"广东事业部-水运-外发","gross_profit_amount":9399318.568367,"target_gross_profit_amount":2700000,"sort_num":0,"target_unit_weight":2280000,"target_sell_settle_amount":110000000,"unit_weight":1388034.805,"key":"广东事业部"},{"sell_settle_amount":71384309.83892,"group_name":"广东事业部-小计","gross_profit_amount":9661389.209998,"target_gross_profit_amount":2900000,"sort_num":0,"target_unit_weight":2400000,"target_sell_settle_amount":118200000,"unit_weight":1519433.777,"key":"广东事业部"},{"sell_settle_amount":2975268.55467,"group_name":"江苏事业部-汽运-外发","gross_profit_amount":52651.383704,"target_gross_profit_amount":200000,"sort_num":0,"target_unit_weight":100000,"target_sell_settle_amount":5000000,"unit_weight":31696.566,"key":"江苏事业部"},{"sell_settle_amount":13840981.666537,"group_name":"江苏事业部-水运-外发","gross_profit_amount":3358843.742655,"target_gross_profit_amount":800000,"sort_num":0,"target_unit_weight":850000,"target_sell_settle_amount":25000000,"unit_weight":533022.425,"key":"江苏事业部"},{"sell_settle_amount":16816250.221207,"group_name":"江苏事业部-小计","gross_profit_amount":3411495.126359,"target_gross_profit_amount":1000000,"sort_num":0,"target_unit_weight":950000,"target_sell_settle_amount":30000000,"unit_weight":564718.991,"key":"江苏事业部"},{"sell_settle_amount":6997776.6353,"group_name":"河南事业部-汽运-外发","gross_profit_amount":1681780.49656,"target_gross_profit_amount":0,"sort_num":0,"target_unit_weight":0,"target_sell_settle_amount":0,"unit_weight":29560.2265,"key":"河南事业部"},{"sell_settle_amount":6997776.6353,"group_name":"河南事业部-小计","gross_profit_amount":1681780.49656,"target_gross_profit_amount":0,"sort_num":0,"target_unit_weight":0,"target_sell_settle_amount":0,"unit_weight":29560.2265,"key":"河南事业部"},{"sell_settle_amount":244175843.892545,"group_name":"总计","gross_profit_amount":39903930.439876,"target_gross_profit_amount":11200000,"sort_num":1,"target_unit_weight":6570000,"target_sell_settle_amount":365200000,"unit_weight":6853749.269617,"key":"总计"}];
      this.targetAchievement.year = this.dataFormatter(year);
    }
  },
  mounted() {
    this.refreshData();
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.resizeChart);
  },
  watch:{
    countDown(n,o){
      if (n === 1){
        this.refreshData();
      }
    },
  },
  props:{
    countDown:{
      type: Number
    }
  }
};
</script>

<style scoped>
#ar_company_list:hover {
  background-color: #19EBFF10;
  transform: scale(101%);
}
</style>
