<template>
  <div class="from-table font-line-space">
    <a-row>
        <a-col :span="24">
          <div class="tb-title">
            <span>项目绩效目标表</span>
          </div>
        </a-col>
      </a-row>
    <table class="tab-content" cellpadding="3" cellspacing="3" style="width: 98%;">
      <tr>
        <td colspan="20" class="bg-title">{{ projectKPI.reportYear }}年度</td>
      </tr>
      <tr>
        <td class="bg-title">项目名称</td>
        <td colspan="19">{{ projectKPI.projName }}</td>
      </tr>
      <tr>
        <td class="bg-title">主管处室</td>
        <td colspan="10"></td>
        <td colspan="2" class="bg-title">实施单位</td>
        <td colspan="7">{{ projectKPI.appUnitName }}</td>
      </tr>
      <tr>
        <td class="bg-title">项目属性</td>
        <td colspan="10">
          <a-radio-group v-model="projectKPI.projAttribute">
            <a-radio :value="newProject">新增项目</a-radio>
            <a-radio :value="delayProject">延期项目</a-radio>
          </a-radio-group>
        </td>
        <td colspan="2" class="bg-title">项目期</td>
        <td colspan="7">{{ projectKPI.projDeadline }}</td>
      </tr>
      <tr>
        <td rowspan="3" class="bg-title">项目资金(万元)</td>
        <td colspan="2" class="bg-title">总体资金总额：</td>
        <td colspan="8">{{ parseFloat(projectKPI.totalBudget).toFixed(2) }}</td>
        <td colspan="2" class="bg-title">年度资金总额：</td>
        <td colspan="7">{{ parseFloat(projectKPI.yearTotal).toFixed(2) }}</td>
      </tr>
      <tr>
        <td colspan="2" class="bg-title">其中：财政拨款</td>
        <td colspan="8">{{ parseFloat(projectKPI.applyFunds).toFixed(2) }}</td>
        <td colspan="2" class="bg-title">其中：财政拨款</td>
        <td colspan="7">{{ parseFloat(projectKPI.yearApply).toFixed(2) }}</td>
      </tr>
      <tr>
        <td colspan="2" class="bg-title">其他资金</td>
        <td colspan="8">{{ parseFloat(projectKPI.selfFunds).toFixed(2) }}</td>
        <td colspan="2" class="bg-title">其他资金</td>
        <td colspan="7">{{ parseFloat(projectKPI.yearSelf).toFixed(2) }}</td>
      </tr>
      <tr>
        <td rowspan="3" class="bg-title">总体考核目标</td>
        <td colspan="10" class="bg-title">总体目标({{ projectKPI.reportYear }}年—{{ projectKPI.reportYear + 2 }}年)</td>
        <td class="bg-title" colspan="9">分年度指标</td>
      </tr>
      <tr>
        <td colspan="10" rowspan="2"></td>
        <td class="target-value" colspan="3">{{ projectKPI.reportYear }}年</td>
        <td class="target-value" colspan="3">{{ projectKPI.reportYear + 1 }}年</td>
        <td class="target-value" colspan="3">{{ projectKPI.reportYear + 2 }}年</td>
      </tr>
      <tr>
        <td colspan="3"></td>
        <td colspan="3"></td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td :rowspan="projectKPI.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 projectKPI.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: Object,
      default: () => {
        return null
      }
    },
  },
  data() {
    return {
      newProject: "5b9d6509-aece-11ef-b6cb-0c42a1380f01",
      delayProject: "5b9d6509-aece-11ef-b6cb-0c42a1380f02",
    };
  },
  created () {
    //this.getProjectKpitStatistic()
  },
  methods: {
    getProjectKpitStatistic() {
      this.$api.statistical.getProjectKpitStatistic().then(({ data = {} }) => {
        if (data) {
        }
      })
    }
  }
};
</script>

<style scoped lang="less">
table,
tr,
td {
  border: 1px solid #080808;
  font-size: 10pt;
  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>