You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
3.2 KiB

6 months ago
  1. <template>
  2. <div class="pda-container">
  3. <div class="header-bar">
  4. <div class="header-left" @click="$router.back()">
  5. <i class="el-icon-arrow-left"></i>
  6. <span>生产领料</span>
  7. </div>
  8. <div class="header-right" @click="$router.push({ path: '/' })">
  9. 首页
  10. </div>
  11. </div>
  12. <!-- 功能菜单 -->
  13. <div class="menu-grid">
  14. <div
  15. class="menu-item"
  16. v-for="(btn, index) in buttons"
  17. :key="index"
  18. :class="{ 'disabled': btn.disabled }"
  19. @click="handleButtonClick(btn)"
  20. >
  21. <div class="menu-icon" :class="btn.iconClass">
  22. <van-icon :name="btn.icon" size="24" />
  23. </div>
  24. <div class="menu-text">{{ btn.label }}</div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. buttons: [
  34. { icon: 'scan', label: '直接领料', iconClass: 'purchase', to: 'productionPicking', disabled: true },
  35. { icon: 'records', label: '申请单领料', iconClass: 'qualified', to: 'productionPicking', disabled: false },
  36. ]
  37. }
  38. },
  39. methods: {
  40. handleButtonClick(btn) {
  41. if (btn.disabled) {
  42. this.$message.warning('正在开发中,敬请期待...');
  43. } else {
  44. this.$router.push(btn.to);
  45. }
  46. }
  47. }
  48. }
  49. </script>
  50. <style>
  51. :root {
  52. --columns: 3;
  53. --button-size: calc(100vw / var(--columns) - 20px);
  54. }
  55. /* 头部栏 */
  56. .header-bar {
  57. display: flex;
  58. justify-content: space-between;
  59. align-items: center;
  60. padding: 8px 16px;
  61. background: #17B3A3;
  62. color: white;
  63. height: 40px;
  64. min-height: 40px;
  65. max-height: 40px;
  66. }
  67. .header-left {
  68. display: flex;
  69. align-items: center;
  70. cursor: pointer;
  71. font-size: 16px;
  72. font-weight: 500;
  73. }
  74. .header-left i {
  75. margin-right: 8px;
  76. font-size: 18px;
  77. }
  78. .header-right {
  79. cursor: pointer;
  80. font-size: 16px;
  81. font-weight: 500;
  82. }
  83. .menu-grid {
  84. display: grid;
  85. grid-template-columns: repeat(3, 1fr);
  86. gap: 15px;
  87. padding: 20px;
  88. justify-content: center; /* 水平居中 */
  89. align-content: center; /* 垂直居中 */
  90. width: 100%; /* 确保占满容器宽度 */
  91. }
  92. .menu-item {
  93. background: white;
  94. border-radius: 12px;
  95. padding: 12px 6px;
  96. text-align: center;
  97. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  98. transition: transform 0.2s;
  99. cursor: pointer;
  100. }
  101. .menu-item:active {
  102. transform: scale(0.95);
  103. }
  104. .menu-item.disabled {
  105. opacity: 0.6;
  106. position: relative;
  107. }
  108. .menu-item.disabled::after {
  109. content: '开发中';
  110. position: absolute;
  111. top: 8px;
  112. right: 8px;
  113. background: #ff9500;
  114. color: white;
  115. font-size: 8px;
  116. padding: 2px 4px;
  117. border-radius: 8px;
  118. font-weight: bold;
  119. }
  120. .menu-icon {
  121. width: 38px;
  122. height: 38px;
  123. border-radius: 50%;
  124. display: flex;
  125. align-items: center;
  126. justify-content: center;
  127. margin: 0 auto 6px;
  128. color: white;
  129. }
  130. .menu-icon.purchase {
  131. background: linear-gradient(135deg, #17b3a3 0%, #1dc5ef 100%);
  132. }
  133. .menu-icon.inspection {
  134. background: linear-gradient(135deg, #17b3a3 0%, #1dc5ef 100%);
  135. }
  136. .menu-icon.qualified {
  137. background: linear-gradient(135deg, #17b3a3 0%, #1dc5ef 100%);
  138. }
  139. .menu-text {
  140. font-size: 10px;
  141. color: #333;
  142. font-weight: bold; /* 加粗字体 */
  143. white-space: nowrap; /* 防止文字换行 */
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. margin-top: 2px;
  147. }
  148. </style>