qualityControlAnalysis.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div class="quality-control-container">
  3. <div class="section-title">质控分析</div>
  4. <div class="data-block">
  5. <div class="block-title-row">
  6. <div class="block-title">查获数据TOP3</div>
  7. </div>
  8. <div class="data-grid" v-if="prohibitedTop3 && prohibitedTop3.length > 0">
  9. <div v-for="(item, index) in prohibitedTop3" :key="index" class="data-item">
  10. <div class="item-label">{{ item.categoryName }}总数</div>
  11. <div class="item-value">{{ item.quantity }}</div>
  12. <div class="item-ratio">占比<span class="ratio-highlight">{{ item.percentage }}%</span></div>
  13. </div>
  14. </div>
  15. <div v-else class="no-data-text">暂无查获数据</div>
  16. <div class="note-text" v-if="prohibitedTop3Desc">注:{{ prohibitedTop3Desc }}</div>
  17. </div>
  18. <div class="data-block">
  19. <div class="block-title-row">
  20. <div class="block-title">质控发现问题</div>
  21. <div class="total-count">总数:<span class="count-highlight">{{ checkProblemDistributionTotal }}</span>
  22. </div>
  23. </div>
  24. <div class="data-grid" v-if="checkProblemDistribution && checkProblemDistribution.length > 0">
  25. <div v-for="(item, index) in checkProblemDistribution" :key="index" class="data-item">
  26. <div class="item-label">{{ item.name }}类总数</div>
  27. <div class="item-value">{{ item.total }}</div>
  28. <div class="item-ratio">占比<span class="ratio-highlight">{{ item.percentage }}%</span></div>
  29. </div>
  30. </div>
  31. <div v-else class="no-data-text">暂未发现问题</div>
  32. <div class="note-text" v-if="checkProblemDistributionDesc">注:{{ checkProblemDistributionDesc }}</div>
  33. </div>
  34. <div class="data-block">
  35. <div class="block-title-row">
  36. <div class="block-title">培训测试正确率分析</div>
  37. <div class="total-count">平均正确率:<span class="count-highlight">{{ avgCorrectRate }}%</span></div>
  38. </div>
  39. <div class="data-grid" v-if="accuracyAnalysis && accuracyAnalysis.length > 0">
  40. <div v-for="(item, index) in accuracyAnalysis" :key="index" class="data-item">
  41. <div class="item-label">{{ item.categoryName }}</div>
  42. <div class="item-value" :class="getValueClass(item.color)">{{ item.correctRate }}%</div>
  43. <div class="item-status" :class="getValueClass(item.color)">{{ item.label }}</div>
  44. </div>
  45. </div>
  46. <div v-else class="no-data-text">暂无培训测试数据</div>
  47. <div class="note-text" v-if="accuracyAnalysisDesc">注:{{ accuracyAnalysisDesc }}</div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. export default {
  53. name: 'QualityControlAnalysis',
  54. data() {
  55. return {
  56. checkProblemDistribution: [],
  57. checkProblemDistributionTotal: 0,
  58. checkProblemDistributionDesc: '',
  59. avgCorrectRate: 0,
  60. accuracyAnalysisDesc: '',
  61. accuracyAnalysis: [],
  62. prohibitedTop3: [],
  63. prohibitedTop3Desc: ''
  64. }
  65. },
  66. props: {
  67. checkProblemDistributionData: {
  68. type: Object,
  69. default: () => ({})
  70. },
  71. accuracyAnalysisData: {
  72. type: Object,
  73. default: () => ({})
  74. },
  75. prohibitedTop3Data: {
  76. type: Array,
  77. default: () => ([])
  78. },
  79. concealmentPositionTop1Data: {
  80. type: Array,
  81. default: () => ([])
  82. },
  83. },
  84. watch: {
  85. // 监听checkProblemDistributionData变化,重新计算数据
  86. checkProblemDistributionData: {
  87. handler(newVal) {
  88. this.calculateCheckProblemDistribution();
  89. },
  90. deep: true,
  91. immediate: true
  92. },
  93. accuracyAnalysisData: {
  94. handler(newVal) {
  95. this.calculateAccuracyAnalysis();
  96. },
  97. deep: true,
  98. immediate: true
  99. },
  100. prohibitedTop3Data: {
  101. handler(newVal) {
  102. this.calculateProhibitedTop3();
  103. },
  104. deep: true,
  105. immediate: true
  106. },
  107. concealmentPositionTop1Data: {
  108. handler(newVal) {
  109. this.calculateProhibitedTop1();
  110. },
  111. deep: true,
  112. immediate: true
  113. }
  114. },
  115. methods: {
  116. calculateProhibitedTop1() {
  117. let str = this.concealmentPositionTop1Data.map(item => `${item.checkPositionNameOne}/${item.checkPositionNameTwo}`).join('/');
  118. this.prohibitedTop3Desc = str ? `隐匿重点部位以[${str}]为主` : "";
  119. },
  120. calculateAccuracyAnalysis() {
  121. const { avgCorrectRate, note, categoryList } = this.accuracyAnalysisData || [];
  122. this.avgCorrectRate = avgCorrectRate;
  123. this.accuracyAnalysisDesc = note;
  124. this.accuracyAnalysis = categoryList
  125. },
  126. // 计算违禁品TOP3数据
  127. calculateProhibitedTop3() {
  128. this.prohibitedTop3 = this.prohibitedTop3Data || [];
  129. },
  130. // 根据颜色获取值对应的CSS类
  131. getValueClass(color) {
  132. if (color === 'green') return 'value-green';
  133. if (color === 'red') return 'value-red';
  134. return '';
  135. },
  136. // 计算检查问题分布数据
  137. calculateCheckProblemDistribution() {
  138. const { checkProblemDistributionItemDtoList, desc } = this.checkProblemDistributionData || [];
  139. this.checkProblemDistributionDesc = desc;
  140. // 计算总问题数
  141. this.checkProblemDistributionTotal = (checkProblemDistributionItemDtoList || []).reduce((sum, item) => sum + (item.total || 0), 0);
  142. // 计算每个项目的百分比
  143. this.checkProblemDistribution = (checkProblemDistributionItemDtoList || []).map(item => ({
  144. ...item,
  145. percentage: this.checkProblemDistributionTotal > 0 ?
  146. ((item.total / this.checkProblemDistributionTotal) * 100).toFixed(2) : '0.00'
  147. }));
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .quality-control-container {
  154. background: #FFFFFF;
  155. border-radius: 20rpx;
  156. padding: 30rpx;
  157. margin-bottom: 30rpx;
  158. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  159. }
  160. .section-title {
  161. font-size: 34rpx;
  162. font-weight: bold;
  163. color: #333333;
  164. margin-bottom: 30rpx;
  165. }
  166. .data-block {
  167. background: #EFF2FE;
  168. border-radius: 15rpx;
  169. padding: 25rpx;
  170. margin-bottom: 25rpx;
  171. &:last-child {
  172. margin-bottom: 0;
  173. }
  174. }
  175. .block-title-row {
  176. display: flex;
  177. justify-content: space-between;
  178. align-items: center;
  179. margin-bottom: 25rpx;
  180. }
  181. .block-title {
  182. font-size: 30rpx;
  183. font-weight: bold;
  184. color: #333333;
  185. }
  186. .total-count {
  187. font-size: 26rpx;
  188. color: #666666;
  189. }
  190. .count-highlight {
  191. color: #1890FF;
  192. font-weight: bold;
  193. }
  194. .data-grid {
  195. display: grid;
  196. grid-template-columns: repeat(3, 1fr);
  197. gap: 20rpx;
  198. margin-bottom: 20rpx;
  199. }
  200. .data-item {
  201. display: flex;
  202. flex-direction: column;
  203. align-items: center;
  204. text-align: center;
  205. }
  206. .item-label {
  207. font-size: 24rpx;
  208. color: #666666;
  209. margin-bottom: 8rpx;
  210. }
  211. .item-value {
  212. font-size: 34rpx;
  213. font-weight: bold;
  214. color: #333333;
  215. margin-bottom: 8rpx;
  216. }
  217. .value-green {
  218. color: #00AE41 !important;
  219. }
  220. .value-red {
  221. color: #F96060 !important;
  222. }
  223. .item-ratio {
  224. font-size: 24rpx;
  225. color: #666666;
  226. }
  227. .ratio-highlight {
  228. color: #F96060;
  229. font-weight: bold;
  230. }
  231. .item-status {
  232. font-size: 24rpx;
  233. color: #666666;
  234. }
  235. .note-text {
  236. font-size: 24rpx;
  237. color: #F96060;
  238. line-height: 1.6;
  239. }
  240. .no-data-text {
  241. font-size: 28rpx;
  242. color: #999999;
  243. text-align: center;
  244. padding: 40rpx 0;
  245. font-style: italic;
  246. }
  247. </style>