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.

113 lines
2.4 KiB

2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="excel_container">
  3. <div class="common_grid" v-for="item in 14 * 14" :key="item">
  4. <div v-if="isTableHeader(item)" class="table_header_box">
  5. {{ getHeaderText(item) }}
  6. </div>
  7. <div class="box" v-else>
  8. <p class="line1">{{ getLine(item, 1) }}</p>
  9. <p class="line2">{{ getLine(item, 2) }}</p>
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script setup>
  15. const props = defineProps({
  16. excelData: {
  17. type: Array,
  18. },
  19. })
  20. const getLine = (index, position) => {
  21. const arr = props.excelData.filter(item => item.num == index)
  22. if (arr?.length > 0) {
  23. const obj = arr[0]
  24. if (obj.secondSign && obj.firstSign) {
  25. if (position == 1) {
  26. // 截取后4位
  27. return obj.firstSign.substr(-4)
  28. } else {
  29. // 截取后4位
  30. return obj.secondSign.substr(-4)
  31. }
  32. }
  33. }
  34. return ''
  35. }
  36. const isTableHeader = index => {
  37. return index <= 14 || index % 14 == 1
  38. }
  39. const getHeaderText = index => {
  40. if (index <= 14 && index > 1) {
  41. return index - 1
  42. }
  43. const arr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N']
  44. if (index % 14 == 1) {
  45. return arr[parseInt(index / 14) - 1]
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .excel_container {
  51. width: 1000px;
  52. height: 800px;
  53. display: grid;
  54. grid-template-columns: repeat(14, 1fr);
  55. grid-template-rows: repeat(14, 1fr);
  56. border: 1px solid #ebebeb;
  57. box-sizing: border-box;
  58. border-radius: 6px;
  59. overflow: hidden;
  60. .common_grid {
  61. border: 1px solid #ebebeb;
  62. margin-left: -1px;
  63. margin-top: -1px;
  64. .box {
  65. width: 100%;
  66. height: 100%;
  67. padding: 7px;
  68. background: #ffffff;
  69. font-size: 18px;
  70. font-weight: 500;
  71. color: #b3b3b3;
  72. box-sizing: border-box;
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. justify-content: space-between;
  77. }
  78. .success {
  79. cursor: pointer;
  80. background: #e1fff1;
  81. color: #01ff82;
  82. }
  83. .fail {
  84. cursor: pointer;
  85. background: #fee2e2;
  86. color: #fe0c0c;
  87. }
  88. .process {
  89. cursor: pointer;
  90. background: #4350dc;
  91. color: #ffffff;
  92. }
  93. .cur {
  94. cursor: pointer;
  95. }
  96. .table_header_box {
  97. background: #f1f1f1;
  98. box-sizing: border-box;
  99. font-size: 26px;
  100. font-weight: bold;
  101. color: #3d3d3d;
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. height: 100%;
  106. }
  107. }
  108. }
  109. </style>