|
|
<template> <div class="pda-container"> <div class="header-bar"> <div class="header-left" @click="$router.back()"> <i class="el-icon-arrow-left"></i> <span>其他出入库</span> </div> <div class="header-right" @click="$router.push({ path: '/' })">首页</div> </div>
<!-- 功能菜单 --> <div class="menu-grid"> <div class="menu-item" v-for="(btn, index) in buttons" :key="index" :class="{ disabled: btn.disabled }" @click="handleButtonClick(btn)" > <div class="menu-icon" :class="btn.iconClass"> <van-icon :name="btn.icon" size="24" /> </div> <div class="menu-text">{{ btn.label }}</div> </div> </div> </div></template>
<script>export default { data() { return { buttons: [ { icon: "add-o", label: "其它入库", iconClass: "other-inbound", to: "other-inbound", disabled: false, }, { icon: "minus", label: "其它出库", iconClass: "other-outbound", to: "other-outbound", disabled: false, }, { icon: "delete-o", label: "报废", iconClass: "scrap", to: "scrap", disabled: false, }, { icon: "records", label: "Receive from Transit", iconClass: "qualified", to: "receiveFromTransit", disabled: false, }, { icon: "exchange", label: "移库", iconClass: "inventory-move", to: "inventory-move", disabled: false, }, /* { icon: "records", label: "单独CALL料", iconClass: "qualified", to: "productionPicking", disabled: false, },*/ ], }; }, methods: { handleButtonClick(btn) { if (btn.disabled) { this.$message.warning("正在开发中,敬请期待..."); } else { if (btn.to) { this.$router.push(btn.to); } else { this.$message.warning("正在开发中,敬请期待..."); } } }, },};</script>
<style>:root { --columns: 3; --button-size: calc(100vw / var(--columns) - 20px);}
/* 头部栏 */.header-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: #17b3a3; color: white; height: 40px; min-height: 40px; max-height: 40px;}
.header-left { display: flex; align-items: center; cursor: pointer; font-size: 16px; font-weight: 500;}
.header-left i { margin-right: 8px; font-size: 18px;}
.header-right { cursor: pointer; font-size: 16px; font-weight: 500;}
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 20px; justify-content: center; /* 水平居中 */ align-content: center; /* 垂直居中 */ width: 100%; /* 确保占满容器宽度 */}
.menu-item { background: white; border-radius: 12px; padding: 12px 6px; text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); transition: transform 0.2s; cursor: pointer;}
.menu-item:active { transform: scale(0.95);}
.menu-item.disabled { opacity: 0.6; position: relative;}
.menu-item.disabled::after { content: "开发中"; position: absolute; top: 8px; right: 8px; background: #ff9500; color: white; font-size: 8px; padding: 2px 4px; border-radius: 8px; font-weight: bold;}
.menu-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; color: white;}
.menu-icon.purchase { background: linear-gradient(135deg, #17b3a3 0%, #1dc5ef 100%);}
.menu-icon.inspection { background: linear-gradient(135deg, #17b3a3 0%, #1dc5ef 100%);}
.menu-icon.qualified { background: linear-gradient(135deg, #17b3a3 0%, #1dc5ef 100%);}
.menu-icon.other-inbound { background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%); box-shadow: 0 4px 8px rgba(82, 196, 26, 0.3);}
.menu-icon.other-outbound { background: linear-gradient(135deg, #fa8c16 0%, #ffa940 100%); box-shadow: 0 4px 8px rgba(250, 140, 22, 0.3);}
.menu-icon.scrap { background: linear-gradient(135deg, #f5222d 0%, #ff4d4f 100%); box-shadow: 0 4px 8px rgba(245, 34, 45, 0.3);}
.menu-icon.inventory-move { background: linear-gradient(135deg, #722ed1 0%, #9254de 100%); box-shadow: 0 4px 8px rgba(114, 46, 209, 0.3);}
.menu-text { font-size: 10px; color: #333; font-weight: bold; /* 加粗字体 */ white-space: nowrap; /* 防止文字换行 */ overflow: hidden; text-overflow: ellipsis; margin-top: 2px;}</style>
|