<template>
  <CommonTotal :numberList="initiationList" />
  <Map />
</template>

<script setup>
import CommonTotal from "@/components/CommonTotal.vue";
import Map from "@/components/CommonMap.vue";
import { onMounted, reactive, watch, ref } from "vue";

const props = defineProps({
  currentName: {
    type: String,
    default: "立项",
  },
});
const initiationList = ref([]);
// 根据currentName设置不同的数据
const setNumberList = (name) => {
  if (name === "立项") {
    initiationList.value = [
      { title: "总个数（个）", value: "59" },
      { title: "总投资（亿元）", value: "2733.35" },
      { title: "总规模（公里）", value: "5116.72" },
    ];
  } else {
    initiationList.value = [
      { title: "总个数（个）", value: "59" },
      { title: "总投资（亿元）", value: "2733.35" },
      { title: "总规模（公里）", value: "5116.72" },
      { title: "累计完成投资（亿元）", value: "3116.44" },
    ];
  }
};

watch(
  () => props.currentName,
  (newVal) => {
    setNumberList(newVal);
  },
  {
    immediate: true,
    deep: true,
  }
);

onMounted(() => {
  setNumberList(props.currentName);
});
</script>

<style scoped lang="less">
.stat-cards-container {
  display: flex;
  justify-content: center;
  align-items: center;
  .stat-card {
    .vw(width, 180);
    .vh(height, 80);
    .vw(border-radius, 5);
    .vw(padding, 10);
    .vw(padding, 10);
    .vw(margin,10);
    background-image: url("@/assets/images/total.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    .stat-card-title {
      .font(14);
    }
    .stat-card-value {
      .vh(margin-top, 20);
      .font(20);
    }
  }
}
</style>
