helongyang
2 天以前 cb25acc46bf41863e068b6f968f1592b7a14d1c9
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Client/src/views/Home.vue
@@ -1,24 +1,145 @@
<template>
  <div class="title"></div>
  <div class="warehouse-dashboard">
    <!-- å¯¼èˆªæ  -->
    <nav class="navbar">
      <div class="nav-container">
        <h1 class="logo">仓库调度系统</h1>
        <ul class="nav-links">
          <li
            v-for="(warehouse, index) in warehouses"
            :key="index"
            :class="{ active: activeWarehouse === index }"
            @click="switchWarehouse(index)"
          >
            {{ warehouse.name }}
          </li>
        </ul>
      </div>
    </nav>
    <!-- ä¸»å†…容区 - åŠ¨æ€æ¸²æŸ“é€‰ä¸­çš„ä»“åº“é¡µé¢ -->
    <main class="content-area">
      <component :is="currentComponent" class="warehouse-content"></component>
    </main>
  </div>
</template>
<script>
import { ref, reactive } from 'vue'
import { ref, computed } from 'vue';
// å¯¼å…¥å„个仓库的组件
import BoardWarehouse from './deviceMonitoring/BoardWarehouse.vue';
import TestFrameWarehouse from './deviceMonitoring/TestFrameWarehouse.vue';
import SolderMaskWarehouse from './deviceMonitoring/SolderMaskWarehouse.vue';
import PpWarehouse from './deviceMonitoring/PpWarehouse.vue';
import InkWarehouse from './deviceMonitoring/InkWarehouse.vue';
import AuxiliaryWarehouse from './deviceMonitoring/AuxiliaryWarehouse.vue';
import DryFilmWarehouse from './deviceMonitoring/DryFilmWarehouse.vue';
export default {
  setup() {
    return {
    // å®šä¹‰ä»“库列表
    const warehouses = [
      { name: '板材仓', component: BoardWarehouse },
      { name: '测试架仓', component: TestFrameWarehouse },
      { name: '阻焊仓', component: SolderMaskWarehouse },
      { name: 'PP仓', component: PpWarehouse },
      { name: '油墨仓', component: InkWarehouse },
      { name: '辅料仓', component: AuxiliaryWarehouse },
      { name: '成品仓', component: BoardWarehouse },
      { name: '干膜仓', component: DryFilmWarehouse},
    ];
    // å½“前选中的仓库索引
    const activeWarehouse = ref(0);
    // åˆ‡æ¢ä»“库
    const switchWarehouse = (index) => {
      activeWarehouse.value = index;
    };
    // æ ¹æ®é€‰ä¸­çš„仓库获取当前要渲染的组件
    const currentComponent = computed(() => {
      return warehouses[activeWarehouse.value].component;
    });
    return {
      warehouses,
      activeWarehouse,
      switchWarehouse,
      currentComponent
    };
    }
  }
}
};
</script>
<style scoped>
.title {
  line-height: 70vh;
  text-align: center;
  font-size: 28px;
  color: orange;
.warehouse-dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.navbar {
  background-color: #2c3e50;
  color: white;
  padding: 0 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}
.logo {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}
.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1px;
}
.nav-links li {
  padding: 0 15px;
  height: 60px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #34495e;
}
.nav-links li:hover {
  background-color: #3d5a7c;
}
.nav-links li.active {
  background-color: #3498db;
  font-weight: 500;
  box-shadow: inset 0 -3px 0 #2980b9;
}
.content-area {
  flex: 1;
  padding: 20px;
  background-color: #f5f7fa;
}
.warehouse-content {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  min-height: calc(100vh - 100px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
</style>