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.

170 lines
3.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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="getClass(item)" v-else @click="showCoreDetail(item)">
  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. import { useImageStore, useTaskStore, useCheckStore } from '@/store'
  16. const imageStore = useImageStore()
  17. const taskStore = useTaskStore()
  18. const checkStore = useCheckStore()
  19. const showCoreDetail = index => {
  20. const arr = taskStore.excelData.filter(item => item.num == index)
  21. const item = arr[0]
  22. if (item.firstSign == '' && item.secondSign == '') {
  23. return
  24. }
  25. if (checkStore.manualCheck) {
  26. if (arr?.length > 0) {
  27. checkStore.updateCheckNumber(item.serialNumber)
  28. }
  29. }
  30. // 只有正确或者错误的才可以点击出详情
  31. if (arr?.length > 0) {
  32. imageStore.updateShowImage(true)
  33. imageStore.updateCoreInfo(item)
  34. }
  35. }
  36. const getClass = index => {
  37. // 需要用item 获取真正实体
  38. const arr = taskStore.excelData.filter(item => item.num == index)
  39. if (arr?.length > 0) {
  40. const item = arr[0]
  41. if (checkStore.manualCheck && checkStore.checkNumber == item.serialNumber) {
  42. return 'box process'
  43. }
  44. if (item.result == 1) {
  45. // 检测正确
  46. return 'box success'
  47. } else if (
  48. item.result == 2 &&
  49. item.firstSign != '' &&
  50. item.secondSign != ''
  51. ) {
  52. // 检测错误
  53. return 'box fail'
  54. } else if (
  55. taskStore.currentCoord == item.serialNumber &&
  56. taskStore.taskStatus == 1
  57. ) {
  58. // 正在检测
  59. return 'box process'
  60. } else {
  61. // 待检测
  62. if (canClick(index)) {
  63. return 'box cur'
  64. } else {
  65. return 'box'
  66. }
  67. }
  68. }
  69. }
  70. const canClick = item => {
  71. if (getLine(item, 1) && getLine(item, 2)) {
  72. return true
  73. }
  74. return false
  75. }
  76. const getLine = (index, position) => {
  77. const arr = taskStore.excelData.filter(item => item.num == index)
  78. if (arr?.length > 0) {
  79. const obj = arr[0]
  80. if (obj.secondSign && obj.firstSign) {
  81. if (position == 1) {
  82. // 截取后4位
  83. return obj.firstSign.substr(-4)
  84. } else {
  85. // 截取后4位
  86. return obj.secondSign.substr(-4)
  87. }
  88. }
  89. }
  90. return ''
  91. }
  92. const isTableHeader = index => {
  93. return index <= 14 || index % 14 == 1
  94. }
  95. const getHeaderText = index => {
  96. if (index <= 14 && index > 1) {
  97. return index - 1
  98. }
  99. const arr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N']
  100. if (index % 14 == 1) {
  101. return arr[parseInt(index / 14) - 1]
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .excel_container {
  107. display: grid;
  108. grid-template-columns: repeat(14, 1fr);
  109. grid-template-rows: repeat(14, 1fr);
  110. border: 1px solid #ebebeb;
  111. box-sizing: border-box;
  112. border-radius: 6px;
  113. overflow: hidden;
  114. .common_grid {
  115. border: 1px solid #ebebeb;
  116. margin-left: -1px;
  117. margin-top: -1px;
  118. .box {
  119. width: 100%;
  120. height: 100%;
  121. padding: 7px;
  122. background: #ffffff;
  123. font-size: 18px;
  124. font-weight: 500;
  125. color: #b3b3b3;
  126. box-sizing: border-box;
  127. display: flex;
  128. flex-direction: column;
  129. align-items: center;
  130. justify-content: space-between;
  131. }
  132. .success {
  133. cursor: pointer;
  134. background: #e1fff1;
  135. color: #01ff82;
  136. }
  137. .fail {
  138. cursor: pointer;
  139. background: #fee2e2;
  140. color: #fe0c0c;
  141. }
  142. .process {
  143. cursor: pointer;
  144. background: #4350dc;
  145. color: #ffffff;
  146. }
  147. .cur {
  148. cursor: pointer;
  149. }
  150. .table_header_box {
  151. background: #f1f1f1;
  152. box-sizing: border-box;
  153. font-size: 26px;
  154. font-weight: bold;
  155. color: #3d3d3d;
  156. display: flex;
  157. align-items: center;
  158. justify-content: center;
  159. height: 100%;
  160. }
  161. }
  162. }
  163. </style>