Przeglądaj źródła

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

zhouj1203@hotmail.com 2 lat temu
rodzic
commit
e18ee63d74

+ 13 - 11
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -1529,13 +1529,13 @@ namespace TEAMModelBI.Controllers.BISchool
             //    cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
             List<YearCnt> yearCnts = new();  //当前的课例,活动,互动统计
-
+            List<string> schoolIds = new();
             string strSql = "SELECT value(count(c.id)) FROM c where c.pk='LessonRecord'";
             string scSql = null;
             if (!string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}"))
             {
                 //List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
-                List<string> schoolIds = new();
+
                 if (!string.IsNullOrEmpty($"{tmdId}"))
                 {
                     switch ($"{role}")
@@ -1548,19 +1548,21 @@ namespace TEAMModelBI.Controllers.BISchool
                             break;
                     }
                 }
-                else
-                    schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
-
-                if (schoolIds.Count == 0) return Ok(new { state = RespondCode.Ok, yearCnts, });
-                scSql = BICommonWay.ManyScSql("c.school", schoolIds);
             }
-
-            if (!string.IsNullOrEmpty($"{schooId}") && string.IsNullOrEmpty($"{tmdId}"))
+            else if (!string.IsNullOrEmpty($"{schooId}") && string.IsNullOrEmpty($"{tmdId}"))
                 scSql = $"c.school = '{schooId}'";
+            else 
+            {
+                schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
 
-            if ((string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}")) || (!string.IsNullOrEmpty($"{tmdId}") && !string.IsNullOrEmpty($"{schooId}")))
-                return Ok(new { state = RespondCode.ParamsError, msg = "参数错误" });
+                if (schoolIds.Count == 0)
+                    return Ok(new { state = RespondCode.Ok, yearCnts, });
+                else
+                    scSql = BICommonWay.ManyScSql("c.school", schoolIds);
+            }
 
+            //if ((string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}")) || (!string.IsNullOrEmpty($"{tmdId}") && !string.IsNullOrEmpty($"{schooId}")))
+                
             List<MonthStartEnd> mthStartEnds = await TimeHelper.GetYearSataMthCtMth(DateTimeOffset.UtcNow);
             if (mthStartEnds.Count > 0)
             {

+ 30 - 7
TEAMModelOS/ClientApp/src/components/dashboard/art/BaseArtScatter.vue

@@ -48,9 +48,7 @@ export default {
               width: 1
             }
           },
-          textStyle: {
-            height: '160px'
-          },
+
           formatter: function (params) {
             const item = params
             return `${_this.$t('totalAnalysis.base_name')}:${item.name}
@@ -62,7 +60,7 @@ export default {
         grid: {
           left: 20,
           right: 20,
-          bottom: '4%',
+          bottom: '10%',
           top: '6%',
           containLabel: true,
         },
@@ -114,6 +112,31 @@ export default {
             },
           },
         },
+        dataZoom: [{
+          show: true,
+          height: 10,
+          start: 0,
+          end: 100,
+          xAxisIndex: [0],
+          bottom: 10,
+          handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
+          handleSize: '110%',
+          handleStyle: {
+            color: "#5B3AAE",
+          },
+          textStyle: {
+            color: "rgba(204,187,225,0.5)",
+          },
+          fillerColor: "rgba(67,55,160,0.4)",
+          borderColor: "rgba(204,187,225,0.5)",
+
+        }, {
+          type: "inside",
+          show: true,
+          height: 15,
+          start: 1,
+          end: 35
+        }],
         series: [
           {
             type: 'scatter',
@@ -271,14 +294,14 @@ export default {
     }
   },
   watch: {
-    '$store.state.artDashboard.artAnalysisJson': {
+    '$store.state.artDashboard.scatterStuArr': {
       deep: true,
       immediate: true,
       handler(n, o) {
         if (n) {
           this.$nextTick(() => {
-            let analysisJson = n
-            let scatterArr = analysisJson.students.map(student => [student.sta, student.pass])
+            let analysisJson = this.$store.state.artDashboard.artAnalysisJson
+            let scatterArr = n.map(student => [student.sta, (student.pass * 100).toFixed(2)])
             this.doRender(scatterArr, analysisJson.students)
           })
         }

+ 15 - 6
TEAMModelOS/ClientApp/src/components/dashboard/art/BaseClassLineBar.vue

@@ -134,7 +134,7 @@ export default {
             name: '班级平均分',
             type: 'bar',
             yAxis: 0,
-            barWidth: '10%',
+            barWidth: 20,
             itemStyle: {
               normal: {
                 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
@@ -153,7 +153,7 @@ export default {
             name: '班级最高分',
             type: 'bar',
             yAxis: 0,
-            barWidth: '10%',
+            barWidth: 20,
             itemStyle: {
               normal: {
                 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
@@ -236,14 +236,23 @@ export default {
     }
   },
   watch: {
-    '$store.state.dashboard.artDashboard': {
-      deep: true,
+    '$store.state.artDashboard.curGradeId': {
       immediate: true,
       handler(n, o) {
         if (n) {
+          let artAnalysisJson = this.$store.state.artDashboard.artAnalysisJson
           this.$nextTick(() => {
-            console.log('*********',n.classData)
-            this.doRender(n.classData)
+            let analysisJson = n
+            let classDatas = artAnalysisJson.cInfo.map(classInfo => {
+              return {
+                className: classInfo.name,
+                average: classInfo.score,
+                hScore: classInfo.max,
+                goodRate: classInfo.excellent,
+                normalRate: classInfo.pass
+              }
+            })
+            this.doRender(classDatas)
           })
         }
       }

+ 14 - 3
TEAMModelOS/ClientApp/src/components/dashboard/art/BaseGradeLineBar.vue

@@ -63,7 +63,7 @@ export default {
         },
         xAxis: {
           type: 'category',
-          data: data.map(i => i.className),
+          data: data.map(i => i.gradeName),
           axisLine: {
             lineStyle: {
               color: '#eee'
@@ -236,13 +236,24 @@ export default {
     }
   },
   watch: {
-    '$store.state.dashboard.artDashboard': {
+    '$store.state.artDashboard.artAnalysisJson': {
       deep: true,
       immediate: true,
       handler(n, o) {
         if (n) {
           this.$nextTick(() => {
-            this.doRender(n.classData)
+            let analysisJson = n
+            let curPeriod = JSON.parse(localStorage.getItem('curPeriod'))
+            let gradeDatas = analysisJson.gscore.map(grade => {
+              return {
+                gradeName: curPeriod.grades[+grade.id],
+                average: grade.score,
+                hScore: grade.max,
+                goodRate: grade.excellent,
+                normalRate: grade.pass
+              }
+            })
+            this.doRender(gradeDatas)
           })
         }
       }

+ 21 - 11
TEAMModelOS/ClientApp/src/components/dashboard/art/BaseKnowPie.vue

@@ -8,7 +8,8 @@ export default {
       option: null,
       level1RenderArr: [],
       myChart: null,
-      curActiveIndex: 0
+      curActiveIndex: 0,
+      level1PieData: []
     }
   },
   methods: {
@@ -36,7 +37,7 @@ export default {
       this.option = {
         tooltip: {
           trigger: 'item',
-          formatter: '{a} <br/>{b}: {c} ({d}%)'
+          formatter: '{a} <br/>{b} 配分: {c} ({d}%)'
         },
         series: [
           {
@@ -52,7 +53,7 @@ export default {
               show: true,
               smooth: 0.2,
             },
-            data: this.level1RenderArr
+            data: that.level1PieData
           },
           {
             name: '二级知识点',
@@ -72,7 +73,7 @@ export default {
       };
       myChart.setOption(this.option)
       myChart.off('click')
-      myChart.on('click',{seriesIndex: 0}, function (param) {
+      myChart.on('click', { seriesIndex: 0 }, function (param) {
         if (that.curActiveIndex !== param.dataIndex) {
           param.data.selected = true
           that.curActiveIndex = param.dataIndex
@@ -88,31 +89,32 @@ export default {
       that.myChart = myChart
     },
     onLevel1Click(name, index, isAll) {
-      let allPoints = this.$store.state.dashboard.artDashboard.knowledges
+      let allPoints = this.$store.state.artDashboard.knowledges
       let level2NameArr = isAll ? [...new Set(allPoints.map(j => j.level2))] : [...new Set(allPoints.filter(i => i.level1 === name).map(j => j.level2))]
       let level2RenderArr = level2NameArr.map(level2Name => {
         return {
           name: level2Name,
-          value: allPoints.filter(j => j.level2 === level2Name).length
+          value: this.$store.state.artDashboard.artAnalysisJson.blk.find(i => i.name === level2Name).score
         }
       })
       this.level1RenderArr.forEach(i => i.selected = false)
       !isAll && (this.level1RenderArr[index].selected = true)
       this.$EventBus.$emit('onLevel1Click', [...arguments])
-      this.doRender(this.level1RenderArr, level2RenderArr)
+      this.doRender(this.level1PieData, level2RenderArr)
     }
   },
   watch: {
-    '$store.state.dashboard.artDashboard': {
+    '$store.state.artDashboard.knowledges': {
       deep: true,
       immediate: true,
       handler(n, o) {
         if (n) {
+          console.error(n)
           this.$nextTick(() => {
-            let level1Arr = [...new Set(n.knowledges.map(i => i.level1))]
-            let level2Arr = [...new Set(n.knowledges.map(i => i.level2))]
+            let level1Arr = [...new Set(n.map(i => i.level1))]
+            let level2Arr = [...new Set(n.map(i => i.level2))]
             let level1RenderArr = level1Arr.map((i, index) => {
-              let matchLevel3 = n.knowledges.filter(j => j.level1 === i)
+              let matchLevel3 = n.filter(j => j.level1 === i)
               return {
                 name: i,
                 value: ((matchLevel3.reduce((a, b) => a + b.val, 0)) / matchLevel3.length).toFixed(2),
@@ -120,6 +122,14 @@ export default {
               }
             })
             this.level1RenderArr = level1RenderArr
+            let blks = this.$store.state.artDashboard.artAnalysisJson.blk
+            this.level1PieData = level1Arr.map((i, index) => {
+              return {
+                name: i,
+                value: Number(blks.filter(j => j.dimension.includes(i)).reduce((a, b) => a + b.score, 0).toFixed(2)),
+                selected: index === 0
+              }
+            })
             this.onLevel1Click(level1RenderArr[0].name, 0)
           })
         }

+ 3 - 4
TEAMModelOS/ClientApp/src/components/dashboard/art/BasePointLineBar.vue

@@ -78,8 +78,8 @@ export default {
         dataZoom: [{
           show: true,
           height: 10,
-          start:data.length > 10 ? 20 : 0,
-          end:data.length > 10 ? 80 : 100,
+          start: data.length > 10 ? 20 : 0,
+          end: data.length > 10 ? 80 : 100,
           xAxisIndex: [0],
           bottom: 10,
           handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
@@ -128,8 +128,7 @@ export default {
   mounted() {
     this.$EventBus.$off('onLevel1Click')
     this.$EventBus.$on('onLevel1Click', val => {
-      let allPoints = this.$store.state.dashboard.artDashboard.knowledges
-      console.log('***',allPoints)
+      let allPoints = this.$store.state.artDashboard.knowledges
       this.doRender(val[2] ? allPoints : allPoints.filter(i => i.level1 === val[0]))
     })
   }

+ 55 - 25
TEAMModelOS/ClientApp/src/components/dashboard/art/BaseStuLineBar.vue

@@ -7,7 +7,8 @@ export default {
     return {
       option: null,
       isFromBarClick: false,
-      activeIndex: 3
+      activeIndex: 3,
+      classAverage: 0
     }
   },
   methods: {
@@ -56,8 +57,8 @@ export default {
         dataZoom: [{
           show: true,
           height: 10,
-          start: data.length > 10 ? 40 : 0,
-          end: data.length > 10 ? 60 : 100,
+          start: 0,
+          end: 100,
           xAxisIndex: [0],
           bottom: 10,
           handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
@@ -80,7 +81,7 @@ export default {
         }],
         xAxis: {
           type: 'category',
-          data: data.map(i => i.className),
+          data: data.map(i => i.stuName),
           axisLine: {
             lineStyle: {
               color: '#eee'
@@ -151,7 +152,7 @@ export default {
             name: '得分',
             type: 'bar',
             yAxis: 0,
-            barWidth: '10%',
+            barWidth: 20,
             itemStyle: {
               normal: {
                 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
@@ -187,26 +188,36 @@ export default {
               }
               ]
             },
-            data: data.map(i => i.hScore),
+            data: data.map(i => i.score),
           },
           {
             name: '班级平均分',
-            type: 'bar',
-            yAxis: 0,
-            barWidth: '10%',
+            type: 'line',
+            symbol: 'none',
+            lineStyle: {
+              type: 'dashed',
+              width: 0
+            },
+            yAxisIndex: 1,
+            zlevel: 3,
+            markLine: {
+              data: [
+                { type: 'average' }
+              ],
+              lineStyle: {
+                color: '#66ff99',
+                type: 'dashed',
+                width: 2
+              }
+            },
             itemStyle: {
               normal: {
-                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
-                  offset: 0,
-                  color: '#8bd46e'
-                }, {
-                  offset: 1,
-                  color: '#09bcb7'
-                }]),
-                barBorderRadius: 11,
+                color: 'rgb(255,188,10)',
+                borderColor: 'rgba(255,188,10,0.17)',
+                borderWidth: 12
               }
             },
-            data: data.map(i => i.average)
+            data: data.map(i => that.classAverage),
           }]
       };
       myChart.clear()
@@ -233,17 +244,36 @@ export default {
     }
   },
   watch: {
-    '$store.state.dashboard.artDashboard': {
-      deep: true,
+    // '$store.state.dashboard.artDashboard': {
+    //   deep: true,
+    //   immediate: true,
+    //   handler(n, o) {
+    //     if (n) {
+    //       this.$nextTick(() => {
+    //         if (this.isFromBarClick) {
+    //           this.isFromBarClick = false
+    //         } else {
+    //           this.doRender(n.classData)
+    //         }
+    //       })
+    //     }
+    //   }
+    // }
+    '$store.state.artDashboard.curClassId': {
       immediate: true,
       handler(n, o) {
         if (n) {
+          console.error(n)
+          let artAnalysisJson = this.$store.state.artDashboard.artAnalysisJson
           this.$nextTick(() => {
-            if (this.isFromBarClick) {
-              this.isFromBarClick = false
-            } else {
-              this.doRender(n.classData)
-            }
+            this.classAverage = artAnalysisJson.cInfo.find(i => i.id === n).score
+            let stuDatas = artAnalysisJson.students.filter(i => i.classId === n).map(stu => {
+              return {
+                stuName: stu.name,
+                score: stu.score,
+              }
+            })
+            this.doRender(stuDatas)
           })
         }
       }

+ 16 - 0
TEAMModelOS/ClientApp/src/components/dashboard/art/LeftCenter.vue

@@ -73,6 +73,22 @@ export default {
     isMusic() {
       return this.$store.state.dashboard.subject === 'music'
     }
+  },
+  watch: {
+    '$store.state.artDashboard.knowledges': {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        if (n) {
+          console.error(n)
+          // this.$nextTick(() => {
+          //   let analysisJson = n
+          //   let scatterArr = analysisJson.students.map(student => [student.sta, student.pass])
+          //   this.doRender(scatterArr, analysisJson.students)
+          // })
+        }
+      }
+    }
   }
 }
 </script>

+ 0 - 1
TEAMModelOS/ClientApp/src/components/dashboard/art/RightBotR.vue

@@ -9,7 +9,6 @@
       <!-- <BaseAwardPie></BaseAwardPie> -->
       <dv-capsule-chart :config="config2" style="width:300px;height:300px" />
       <dv-active-ring-chart :config="config" style="width:300px;height:300px" />
-
     </div>
   </div>
 </template>

+ 72 - 17
TEAMModelOS/ClientApp/src/components/dashboard/art/RightTop.vue

@@ -6,7 +6,7 @@
       <dv-decoration-1 class="dv-dec-3" />
     </p>
     <div class="select-wrap">
-      <Cascader v-model="cascaderVal" :data="classData" change-on-select @on-change="onSelect" :clearable="false"></Cascader>
+      <Cascader v-model="cascaderVal" :data="cascaderConfig" change-on-select @on-change="onSelect" :clearable="false"></Cascader>
     </div>
     <div class="bg-color-black">
       <BaseGradeLineBar v-if="classType === 'all'" />
@@ -39,7 +39,9 @@ export default {
   },
   data() {
     return {
-      cascaderVal: ['all']
+      cascaderConfig: [],
+      cascaderVal: ['all'],
+      classType: 'all'
     }
   },
   created() {
@@ -49,20 +51,32 @@ export default {
     onSelect(val) {
       console.log(val);
       if (val.length === 1) {
-        this.$store.commit('setRandomArtData', this.isYdzt ? 'grade' : 'all')
-
+        this.classType = 'all'
+        this.$store.commit('artDashboard/setAllStus')
       } else if (val.length === 2) {
-        // this.$store.commit('setRandomArtData', this.isYdzt ? 'single' : 'grade')
-        if (!this.isYdzt) {
-          this.$store.commit('setRandomArtData', 'grade')
-        } else {
-          this.$store.commit('setYdztStuData', val)
-        }
+        this.classType = 'grade'
+        console.error('年级切换', val[1])
+        this.$store.commit('artDashboard/setGradeId', val[1])
       } else {
-        if (!this.isYdzt) {
-          this.$store.commit('setRandomArtData', 'single')
-        }
+        this.classType = 'single'
+        console.error('班级切换', val[2])
+        this.$store.commit('artDashboard/setClassId', val[2])
       }
+      // if (val.length === 1) {
+      //   this.$store.commit('setRandomArtData', this.isYdzt ? 'grade' : 'all')
+
+      // } else if (val.length === 2) {
+      //   // this.$store.commit('setRandomArtData', this.isYdzt ? 'single' : 'grade')
+      //   if (!this.isYdzt) {
+      //     this.$store.commit('setRandomArtData', 'grade')
+      //   } else {
+      //     this.$store.commit('setYdztStuData', val)
+      //   }
+      // } else {
+      //   if (!this.isYdzt) {
+      //     this.$store.commit('setRandomArtData', 'single')
+      //   }
+      // }
     }
   },
   mounted() {
@@ -72,10 +86,10 @@ export default {
     }
   },
   computed: {
-    classType() {
-      console.log(this.$store.state.dashboard.classType);
-      return this.$store.state.dashboard.classType
-    },
+    // classType() {
+    //   console.log(this.$store.state.dashboard.classType);
+    //   return this.$store.state.dashboard.classType
+    // },
     isYdzt() {
       return localStorage.getItem('login_schoolCode') === 'ydzt'
     },
@@ -285,6 +299,47 @@ export default {
       }
     }
   },
+  watch: {
+    '$store.state.artDashboard.artAnalysisJson': {
+      deep: true,
+      immediate: true,
+      handler(n, o) {
+        if (n) {
+          this.$nextTick(() => {
+            let analysisJson = n
+            let curPeriod = JSON.parse(localStorage.getItem('curPeriod'))
+
+            // 全校
+            let cascaderConfig = [
+              {
+                value: 'all',
+                label: '全校',
+                children: []
+              }
+            ]
+            // 放入年级
+            analysisJson.gscore.forEach(grade => {
+              cascaderConfig[0].children.push({
+                value: grade.id,
+                label: curPeriod.grades[+grade.id],
+                children: []
+              })
+            })
+            // 放入班级
+            analysisJson.cInfo.forEach(classInfo => {
+              cascaderConfig[0].children.find(grade => grade.value === classInfo.gradeId).children.push({
+                value: classInfo.id,
+                label: classInfo.name,
+                children: []
+              })
+            })
+
+            this.cascaderConfig = cascaderConfig
+          })
+        }
+      }
+    }
+  }
 }
 </script>
 

+ 31 - 15
TEAMModelOS/ClientApp/src/store/module/artDashboard.js

@@ -2,26 +2,42 @@
 export default {
     namespaced: true,
     state: {
-        artAnalysisJson: null
+        artAnalysisJson: null,
+        curGradeId: 0,
+        curClassId: 0,
+        knowledges: null,
+        scatterStuArr: []
     },
-    getters: {
-        getOpenClassroomInfo: (state) => {
-            return state.data.openClassroomInfo;
+
+    mutations: {
+        setAnalysisJson: (state, value) => {
+            state.artAnalysisJson = value
+            let result = []
+            value.kno.forEach(point => {
+                point.block.forEach(block => {
+                    result.push({
+                        level1: value.blk.find(i => i.name === block).dimension[0],
+                        level2: block,
+                        name: point.name,
+                        val: +((point.score * 100).toFixed(2))
+                    })
+                })
+            })
+            console.error(result)
+            state.knowledges = result
+            state.scatterStuArr = value.students
         },
-        getMapInfo: (state) => {
-            return state.data.openMapInfo;
+        setGradeId: (state, value) => {
+            state.curGradeId = value
+            state.scatterStuArr = state.artAnalysisJson.students.filter(i => i.gradeId === value)
         },
-        getClassroomInfo: (state) => {
-            return state.data.classroomInfo;
+        setClassId: (state, value) => {
+            state.curClassId = value
+            state.scatterStuArr = state.artAnalysisJson.students.filter(i => i.classId === value)
         },
-        getMorefilterCondition: (state) => {
-            return state.data.morefilterCondition;
+        setAllStus: (state, value) => {
+            state.scatterStuArr = state.artAnalysisJson.students
         },
     },
-    mutations: {
-        setAnalysisJson: (state, value) => {
-            state.artAnalysisJson = value
-        }
-    },
     actions: {},
 };

+ 1 - 1
TEAMModelOS/ClientApp/src/view/dashboard/Art.less

@@ -56,7 +56,7 @@
     border-radius: 5px;
     height: 30px;
     margin-right: 10px;
-    font-size: 16px;
+    font-size: 14px;
   }
 
   .ivu-input {

+ 2 - 1
TEAMModelOS/ClientApp/src/view/dashboard/Art.vue

@@ -137,7 +137,7 @@ export default {
         (res) => {
           this.acList = res.arts.filter(i => i.progress === 'finish')
           if (this.acList.length) {
-            this.onAcChange(1)
+            this.onAcChange(0)
           }
         },
         (err) => { }
@@ -172,6 +172,7 @@ export default {
     /* 科目切换 */
     onSubjectChange() {
       let curSubjectId = this.subjectList[this.curSubjectIndex].id
+      this.loading = true
       // 获取看板数据
       this.$api.areaArt.findArtDashAnalysis({
         "code": this.$store.state.userInfo.schoolCode,