<template>
  <div class="from-table font-line-space">
    <table class="tab-content" cellpadding="3" cellspacing="3" style="width: 98%;">
      <tr>
        <td colspan="20" class="bg-title">2020年度</td>
      </tr>
      <tr>
        <td class="bg-title">项目名称</td>
        <td colspan="19"></td>
      </tr>
      <tr>
        <td class="bg-title">主管处室</td>
        <td colspan="10"></td>
        <td colspan="2" class="bg-title">实施单位</td>
        <td colspan="7"></td>
      </tr>
      <tr>
        <td class="bg-title">项目属性</td>
        <td colspan="10"></td>
        <td colspan="2" class="bg-title">项目期</td>
        <td colspan="7"></td>
      </tr>
      <tr>
        <td rowspan="3" class="bg-title">项目资金(万元)</td>
        <td colspan="2" class="bg-title">总体资金总额：</td>
        <td colspan="8"></td>
        <td colspan="2" class="bg-title">年度资金总额：</td>
        <td colspan="7"></td>
      </tr>
      <tr>
        <td colspan="2" class="bg-title">其中：财政拨款</td>
        <td colspan="8"></td>
        <td colspan="2" class="bg-title">其中：财政拨款</td>
        <td colspan="7"></td>
      </tr>
      <tr>
        <td colspan="2" class="bg-title">其他资金</td>
        <td colspan="8"></td>
        <td colspan="2" class="bg-title">其他资金</td>
        <td colspan="7"></td>
      </tr>
      <tr>
        <td rowspan="3" class="bg-title">总体考核目标</td>
        <td colspan="10" class="bg-title">总体目标(2020年—2022年)</td>
        <td class="bg-title" colspan="9">分年度指标</td>
      </tr>
      <tr>
        <td colspan="10" rowspan="2"></td>
        <td class="target-value" colspan="3">2020年</td>
        <td class="target-value" colspan="3">2021年</td>
        <td class="target-value" colspan="3">2022年</td>
      </tr>
      <tr>
        <td colspan="3"></td>
        <td colspan="3"></td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td :rowspan="kpiData.totalRowSpan"></td>
        <td rowspan="2" class="bg-title">一级指标</td>
        <td rowspan="2" class="bg-title">二级指标</td>
        <td rowspan="2" colspan="6" class="bg-title">三级指标</td>
        <td rowspan="2" class="bg-title">指标值</td>
        <td rowspan="2" class="bg-title">绩效标准</td>
        <td rowspan="2" class="bg-title">二级指标</td>
        <td rowspan="2" colspan="5" class="bg-title">三级指标</td>
        <td colspan="3" class="bg-title">指标值</td>
      </tr>
      <tr>
        <td>2020</td>
        <td>2021</td>
        <td>2022</td>
      </tr>
      <tr v-for="(item, index) in kpiData.threeLevel" :key="index">
        <td class="bg-title" v-if="item.oneDisplay" :rowspan="item.oneRowSpan">{{ item.oneLevelName }}</td>
        <td class="bg-title" v-if="item.towDisplay" :rowspan="item.towRowSpan">{{ item.towLevelName }}</td>
        <td colspan="6">{{ item.kpitName }}</td>
        <td class="target-value">{{ item.targetValue }}</td>
        <td class="target-value">{{ item.performanceStandard }}</td>
        <td class="bg-title" v-if="item.towDisplay" :rowspan="item.towRowSpan">{{ item.towLevelName }}</td>
        <td colspan="5">{{ item.kpitName }}</td>
        <td class="target-value">{{ item.yearValue1 }}</td>
        <td class="target-value">{{ item.yearValue2 }}</td>
        <td class="target-value">{{ item.yearValue3 }}</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: "projectKPI",
  props: {
    projectKPI: {
      type: String,
      default: () => {
        return null
      }
    },
  },
  data() {
    return {
      kpiData: {},
    };
  },
  created () {
    //this.getProjectKpitStatistic()
  },
  methods: {
    getProjectKpitStatistic() {
      this.$api.statistical.getProjectKpitStatistic().then(({ data = {} }) => {
        if (data) {
          this.kpiData = data
        }
      })
    }
  }
};
</script>

<style scoped lang="less">
table,
tr,
td {
  border: 1px solid #080808;
  font-size: 9pt;
  text-align: left;
  line-height: 25px;
  height: 25px;
}
.bg-title {
  background-color: #f5f5f5;
  font-weight: bold;
  text-align: center;
}
.target-value {
  text-align: center;
}
</style>