farmSteps.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="steps-container">
  3. <div
  4. v-for="(step, index) in steps"
  5. :key="index"
  6. class="step-item"
  7. :class="{ completed: index < currentStep, active: index === currentStep }"
  8. >
  9. <div class="step-circle">
  10. <el-icon v-if="index < currentStep"><Select /></el-icon>
  11. <span v-else class="step-number">{{ index + 1 }}</span>
  12. </div>
  13. <div class="step-label">{{ step.label }}</div>
  14. <div v-if="index < steps.length - 1" class="step-line" :class="{ completed: index < currentStep }"></div>
  15. </div>
  16. </div>
  17. </template>
  18. <script setup>
  19. import { ref, defineProps } from "vue";
  20. const props = defineProps({
  21. currentStep: {
  22. type: Number,
  23. default: 2,
  24. },
  25. });
  26. const steps = ref([
  27. { label: "触发农事" },
  28. { label: "农事确认" },
  29. { label: "农事执行" },
  30. { label: "农事复核" },
  31. ]);
  32. </script>
  33. <style lang="scss" scoped>
  34. .steps-container {
  35. display: flex;
  36. align-items: flex-start;
  37. justify-content: space-between;
  38. position: relative;
  39. .step-item {
  40. display: flex;
  41. flex-direction: column;
  42. align-items: center;
  43. position: relative;
  44. flex: 1;
  45. z-index: 2;
  46. .step-circle {
  47. width: 25px;
  48. height: 25px;
  49. border-radius: 50%;
  50. display: flex;
  51. align-items: center;
  52. justify-content: center;
  53. margin-bottom: 8px;
  54. transition: all 0.3s ease;
  55. .step-number {
  56. font-size: 14px;
  57. }
  58. }
  59. .step-label {
  60. font-size: 12px;
  61. text-align: center;
  62. line-height: 1.2;
  63. max-width: 60px;
  64. }
  65. .step-line {
  66. position: absolute;
  67. top: 13px;
  68. left: 74%;
  69. width: calc(100% - 38px);
  70. height: 2px;
  71. background-color: rgba(0, 0, 0, 0.22);
  72. z-index: 1;
  73. }
  74. &.completed {
  75. .step-circle {
  76. background-color: #1890ff;
  77. color: white;
  78. }
  79. .step-line {
  80. background-color: #1890ff;
  81. }
  82. }
  83. &.active {
  84. .step-circle {
  85. background-color: #1890ff;
  86. color: white;
  87. }
  88. }
  89. }
  90. }
  91. .step-item:not(.completed):not(.active) .step-circle {
  92. background-color: #FFFFFF;
  93. color: #999;
  94. }
  95. .step-item.completed .step-label,
  96. .step-item.active .step-label {
  97. color: #333;
  98. font-weight: 500;
  99. }
  100. .step-item:not(.completed):not(.active) .step-label {
  101. color: rgba(0, 0, 0, 0.5);
  102. }
  103. .step-line.completed {
  104. background-color: #1890ff;
  105. }
  106. .step-item:last-child .step-line {
  107. display: none;
  108. }
  109. </style>