<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: #e3f0ff !important;
  color: #333;
  font-weight: bold;
  font-size: 14px;
}
</style>
<style lang="scss" scoped>
.el-scrollbar {
  margin-top: 10px;
}
.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>
