<template>
  <div class="basic-target" v-loading="loading">
    <search :type="1" />
    <el-table
      :data="dataList"
      border
      highlight-current-row
      :height="tableHeight"
      ref="table"
    >
      <el-table-column type="index" label="序号" align="center" width="50">
      </el-table-column>
      <el-table-column
        label="一级指标"
        min-width="80"
        align="center"
        prop="quota1"
      ></el-table-column>

      <el-table-column
        label="二级指标"
        min-width="80"
        align="center"
        prop="quota2"
      ></el-table-column>

      <el-table-column
        label="考核内容和计分细则"
        align="center"
        min-width="400"
        prop="content"
      ></el-table-column>
      <el-table-column
        label="小条内容"
        align="center"
        min-width="150"
        prop="content"
      ></el-table-column>
      <el-table-column
        label="分值"
        min-width="60"
        align="center"
        prop="points"
      ></el-table-column>
      <el-table-column
        label="分数规则"
        min-width="95"
        align="center"
        prop=""
      ></el-table-column>
      <el-table-column
        label="区牵头单位"
        min-width="95 "
        align="center"
        prop="leaderUnit"
      >
        <template slot-scope="{ row }">
          <pre>{{ row.leaderUnit }}</pre>
        </template>
      </el-table-column>
      <el-table-column label="第一牵头部门" width="120" align="center">
        <template slot-scope="{ row }">
          <pre>{{ row.leaderDeptList | formatList }}</pre>
        </template>
      </el-table-column>
      <el-table-column label="责任领导" width="80" align="center">
        <template slot-scope="{ row }">
          <pre>{{ row.leaderPrincipalList | formatList }}</pre>
        </template>
      </el-table-column>
      <el-table-column label="牵头部门" min-width="80" align="center">
        <template slot-scope="{ row }">
          <span>
            <pre>{{ row.leaderDeptList | formatList }}</pre>
          </span>
        </template>
      </el-table-column>

      <el-table-column label="责任领导" min-width="80" align="center">
        <template slot-scope="{ row }">
          <pre>{{ row.leaderPrincipalList | formatList }}</pre>
        </template>
      </el-table-column>
      <el-table-column label="配合部门" min-width="80" align="center">
        <template slot-scope="{ row }">
          <span>
            <pre>{{ row.leaderDeptList | formatList }}</pre>
          </span>
        </template>
      </el-table-column>

      <el-table-column label="责任领导" min-width="80" align="center">
        <template slot-scope="{ row }">
          <pre>{{ row.leaderPrincipalList | formatList }}</pre>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="125" align="center">
        <template slot-scope="{ row }">
          <el-link
            @click="edit(row)"
            icon="el-icon-edit"
            type="primary"
            :underline="false"
            >编辑</el-link
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      :current-page.sync="page.page"
      :page-size="page.limit"
      :total="count"
      :background="true"
      layout="total, prev, pager, next, jumper"
      :pager-count="5"
      class="ele-pagination-circle"
      :flat="true"
      @current-change="getDataList()"
    />
    <el-dialog
      title="自定义考核得分规则"
      :visible.sync="showEdit"
      width="400px"
      custom-class="ele-dialog-form"
      :lock-scroll="true"
      :destroy-on-close="true"
      @closed="form = {}"
    >
      <el-row :gutter="20">
        <el-col :span="6"
          ><div class="grid-content bg-purple">序号</div></el-col
        >
        <el-col :span="8"
          ><div class="grid-content bg-purple">牵头部门名称</div></el-col
        >
        <el-col :span="10"
          ><div class="grid-content bg-purple">考核得分</div></el-col
        >
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6"><div class="grid-content bg-purple">1</div></el-col>
        <el-col :span="8"
          ><div class="grid-content bg-purple">党政办公室</div></el-col
        >
        <el-col :span="10">
          <div class="grid-content bg-purple">
            <el-input size="mini" v-model="form.leaderPoints"></el-input>
          </div>
        </el-col>
      </el-row>
      <el-divider></el-divider>
      <el-row :gutter="20">
        <el-col :span="6"
          ><div class="grid-content bg-purple">序号</div></el-col
        >
        <el-col :span="8"
          ><div class="grid-content bg-purple">配合部门名称</div></el-col
        >
        <el-col :span="10"
          ><div class="grid-content bg-purple">考核得分</div></el-col
        >
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6"><div class="grid-content bg-purple">1</div></el-col>
        <el-col :span="8"
          ><div class="grid-content bg-purple">党群办公室</div></el-col
        >
        <el-col :span="10">
          <div class="grid-content bg-purple">
            <el-input size="mini" v-model="form.coorPoints"></el-input>
          </div>
        </el-col>
      </el-row>

      <div slot="footer">
        <el-button @click="showEdit = false">取消</el-button>&nbsp;
        <el-button type="primary" @click="save">保存</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import search from "./search";
export default {
  components: {
    search,
  },
  data() {
    return {
      dataList: [[]],
      tableHeight: document.documentElement.clientHeight - 350,
      page: {
        page: 1,
        limit: Math.floor(
          (document.documentElement.clientHeight - 350 - 45) / 45
        ),
      },
      count: 0,
      showEdit: false,
      loading: false,
      form: {},
    };
  },
  methods: {
    getDataList() {},
    edit(row) {
      this.showEdit = true;
    },
    save() {
      this.showEdit = false;
    },
  },
  filters: {
    formatList(val) {
      if (val) {
        return val.join("\n");
      }
    },
  },
};
</script>

<style scoped>
/deep/.el-dialog__body {
  padding: 10px 20px;
}
.el-row {
  height: 45px;
  line-height: 45px;
}
.el-divider {
  margin: 10px 0px;
}
</style>