<template>
  <div>
    <div class="mb75" v-if="ddlx && ddlx!=1 && ddlx!=3">
      <div class="font-size-14">任务指标</div>
      <el-table :data="tableData" tooltip-effect="dark" style="width: 100%">
        <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
        <el-table-column v-for="(item, index) in columnData" :key="index" :label="item.name" show-overflow-tooltip :prop="item.key" width="auto"></el-table-column>
      </el-table>
    </div>

    <div class="font-size-14">下发对象</div>
    <el-table :data="tableData1" tooltip-effect="dark">
      <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
      <el-table-column label="下发对象" align="center" prop="jddx_uo_name"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { rwzbList, xfdxList } from "../api";
export default {
  data() {
    return {
      parentId: "",
      columnData: [
        {
          name: "指标名称",
          key: "jddr_name"
        },
        {
          name: "指标内容",
          key: "jddr_content"
        },
        {
          name: "指标说明",
          key: "jddr_brief"
        },
        {
          name: "指标分值",
          key: "jddr_score"
        },
        {
          name: "附件数量",
          key: "jddr_fjsl"
        },
        {
          name: "计划开始时间",
          key: "jddr_start_date"
        },
        {
          name: "计划结束时间",
          key: "jddr_end_date"
        },
        {
          name: "责任部门",
          key: "jddr_uo_name"
        }
      ],
      tableData: [],
      limit: 9999,
      total: 0,
      cur_page: 1,
      tableData1: [],
    }
  },
  props: ["ddlx"],
  methods: {
    async getListData() {
      let obj = {
        page: this.cur_page,
        limit: this.limit,
        jdd_id: this.parentId,
      }
      let data = await rwzbList(obj);
      if (data) {
        this.tableData = data.page_data;
      }
    },
    handleCurrentChange(val) {
      this.cur_page = val;
      this.getListData();
    },
    async getSendData() {
      let obj = {
        page: this.cur_page,
        limit: this.limit,
        jdd_id: this.parentId,
        ptype: "1",
      }
      let data = await xfdxList(obj);
      if (data) {
        this.tableData1 = data.page_data;
      }
    }
  },
  created() {
    this.parentId = this.$route.params.id;
    this.getListData();
    this.getSendData();
  }
}
</script>