Ver Fonte

close #637 已调整知识点分布图

OnePsycho há 3 anos atrás
pai
commit
445ebe4278

+ 25 - 17
TEAMModelOS/ClientApp/src/view/evaluation/components/BasePointPie.vue

@@ -81,28 +81,36 @@
 		},
 		mounted() {
 			let arr = []
-			let tempArr = []
+			let pointList = []
 			this.echartsData.item.forEach(i => {
 				if (i.type === 'compose' && i.children.length) {
-					tempArr.push(...i.children)
+					i.children.forEach(j => {
+						pointList.push(...j.knowledge)
+					})
 				} else {
-					tempArr.push(i)
+					pointList.push(...i.knowledge)
 				}
 			})
-			let typeList = this._.groupBy(tempArr, 'knowledge')
-			for (let key in typeList) {
-				let newKey = key === 'undefined' || !key ? this.$t('evaluation.noPoints') : key
-				let isExistIndex = arr.map(i => i.name).indexOf(newKey)
-				if (arr.length && isExistIndex > -1) {
-					arr[isExistIndex].value = arr[isExistIndex].value + typeList[key].length
-				} else {
-					arr.push({
-						value: typeList[key].length,
-						name: newKey
-					})
-				}
-
-			}
+			let pointArr = [...new Set(pointList)]
+			pointArr.forEach((i,index) => {
+				arr.push({
+					value: 0,
+					name: i
+				})
+				this.echartsData.item.forEach(k => {
+					if (k.type === 'compose' && k.children.length) {
+						k.children.forEach(j => {
+							if(j.knowledge && Array.isArray(j.knowledge) && j.knowledge.includes(i)){
+								arr[index].value++
+							}
+						})
+					} else {
+						if(k.knowledge && Array.isArray(k.knowledge) && k.knowledge.includes(i)){
+							arr[index].value++
+						}
+					}
+				})
+			})
 			this.drawLine(arr)
 		},
 		computed: {