<template>
  <div class="data-module">
    <div class="module-header">
      <h3>系统资源监控</h3>
      <span class="system-time">{{ currentTime }}</span>
    </div>
    <div class="module-body">
      <div class="system-resources">
        <div
          v-for="(resource, index) in resourceList"
          :key="index"
          class="resource-item"
        >
          <span class="resource-label">{{ resource.label }}</span>
          <div class="resource-bar-container">
            <div
              class="resource-bar"
              :class="resource.barClass"
              :style="{ width: resource.value + '%' }"
            ></div>
          </div>
          <span class="resource-value">{{ resource.value + "%" }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "SystemLoad",
  props: {
    currentTime: {
      type: String,
      default: "",
    },
    resourceList: {
      type: Array,
      default: () => [
        {
          label: "CPU使用率",
          value: 42,
          barClass: "cpu-bar",
        },
        {
          label: "内存使用率",
          value: 68,
          barClass: "mem-bar",
        },
        {
          label: "磁盘使用率",
          value: 35,
          barClass: "disk-bar",
        },
      ],
    },
  },
};
</script>

<style scoped>
/* 组件样式将从主页面继承 */
</style>