<template>
  <MapTitle text="创新示范区县(市、区）排名" />

  <el-scrollbar height="240px">
    <el-table
      :data="tableData"
      size="small"
      style="width: 100%"
      empty-text="暂无数据"
      header-row-class-name="tabs-header"
    >
      <el-table-column label="序号" width="120" align="center">
        <template #default="scope">
          <div>
            <div v-if="scope.$index > 2">{{ scope.$index + 1 }}</div>
            <div
              v-else
              class="tab-index"
              :style="{ background: `${colors[scope.$index + 1]}` }"
            >{{ scope.$index + 1 }}</div>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="地区" align="center" />
      <el-table-column prop="score" label="分数" width="120" align="center">
        <template #default="scope">
          <div>{{ scope.row.score }}</div>
        </template>
      </el-table-column>
    </el-table>
  </el-scrollbar>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import MapTitle from "@/components/mapTitle/index.vue";
import { Bottom, Top } from "@element-plus/icons";
import Mock from "./mock";
import { mapState } from "vuex";

export default defineComponent({
  components: {
    MapTitle,
    Bottom,
    Top,
  },
  setup() {},
  computed: {
    ...mapState({
      curDataType: (state) => state.curDataType,
    }),
    tableData() {
      return Mock[this.curDataType];
    },
  },
  data() {
    return {
      colors: {
        1: "#e45c5c",
        2: "#ea8234",
        3: "#fac858",
      },
    };
  },
  methods: {
    detailsHandle() {},
  },
});
</script>
<style>
.tabs-header {
}
.tabs-header .el-table__cell {
  background-color: #0e4781 !important;
  color: #d4f7ff;
  font-weight: bold;
  font-size: 14px;
}
/* .el-scrollbar__wrap {
  background: #0e4780 !important;
} */
.el-table__body tr:hover > td {
  background-color: #134087 !important;
}
.el-table tr {
  background: #0c3a65 !important;
}
.el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  border-bottom: 1px dashed #197ded;
}
.el-scrollbar {
  height: 86%;
  border-bottom: 1px dashed #197ded;
}
.el-table .cell {
  color: #d4f7ff;
}
</style>
<style lang="scss" scoped>
.el-scrollbar {
  margin-top: 10px;
  // background: red;
}
.tab-other-index {
  text-align: center;
}
.tab-index {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  // border: 1px solid;
  color: #fff;
  font-size: 16px;
  font-family: tabTypeFace;
  margin: 0 auto;
}
</style>
