From 5f00696dfb25bc90034448ceb634ed1ef256681a Mon Sep 17 00:00:00 2001
From: qiyunfeng-create <1940665526@qq.com>
Date: 星期四, 21 八月 2025 21:13:35 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/xiehe_website

---
 src/views/classManage/jobAnalysis.vue |  331 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 331 insertions(+), 0 deletions(-)

diff --git a/src/views/classManage/jobAnalysis.vue b/src/views/classManage/jobAnalysis.vue
new file mode 100644
index 0000000..06d8e89
--- /dev/null
+++ b/src/views/classManage/jobAnalysis.vue
@@ -0,0 +1,331 @@
+<template>
+  <div class="classManagePage-box">
+    <el-breadcrumb :separator-icon="ArrowRight">
+      <el-breadcrumb-item>鎴戠殑鐝骇</el-breadcrumb-item>
+      <el-breadcrumb-item>{{ classInfo?.name }}</el-breadcrumb-item>
+      <el-breadcrumb-item>浣滀笟鍒嗘瀽</el-breadcrumb-item>
+    </el-breadcrumb>
+    <div class="classManagePage-content" v-loading="pageLoading">
+      <div class="staticBox">
+        <div class="pub_staticItem">
+          <img src="@/assets/images/class/zuoyecishu@2x.png" alt="" />
+          <div class="staticText">
+            <el-statistic title="浣滀笟娆℃暟" :value="outputValue" />
+          </div>
+        </div>
+        <!-- <div class="pub_staticItem">
+          <img src="@/assets/images/class/jinxing@2x.png" alt="" />
+          <div class="staticText">
+            <el-statistic title="杩涜涓�" :value="8" />
+          </div>
+        </div>
+        <div class="pub_staticItem">
+          <img src="@/assets/images/class/jieshu@2x.png" alt="" />
+          <div class="staticText">
+            <el-statistic title="宸茬粨鏉�" :value="8" />
+          </div>
+        </div> -->
+      </div>
+      <div class="chartsBox">
+        <div id="chartsContent" v-show="charstData.length > 0"></div>
+      </div>
+      <div v-if="charstData.length == 0 && !pageLoading">
+        <el-empty />
+      </div>
+      <div class="listContent" v-if="tabHeader.length > 0">
+        <div class="tableTitle">鐝骇鎴愮哗璇︽儏</div>
+        <div class="tableContent">
+          <el-table
+            v-loading="pages.loading"
+            :data="tableData"
+            border
+            style="width: 100%"
+            :cell-style="{ textAlign: 'center' }"
+            :header-cell-style="{ textAlign: 'center' }"
+            size="small"
+          >
+            <el-table-column prop="index" label="搴忓彿" width="70" />
+            <el-table-column label="濮撳悕" #default="scope">
+              <span>{{ scope.row.appUser?.userInfo?.name }}</span>
+            </el-table-column>
+            <el-table-column label="瀛﹀彿" #default="scope">
+              <span>{{ scope.row.appUser?.appUserId }}</span>
+            </el-table-column>
+            <el-table-column label="鐝骇浣滀笟寰楀垎" v-if="tabHeader.length > 0">
+              <el-table-column v-for="(item, index) in tabHeader" :key="index" :label="item">
+                <template #default="scope">
+                  <span v-if="scope.row.results[index]?.result >= 0">
+                    {{ scope.row.results[index]?.result }}
+                  </span>
+                  <span v-else> -- </span>
+                </template>
+              </el-table-column>
+            </el-table-column>
+          </el-table>
+          <el-pagination
+            style="float: right"
+            v-model:current-page="pages.page"
+            :page-size="pages.pageSize"
+            layout="total, prev, pager, next"
+            :total="pages.count"
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+          />
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import * as echarts from 'echarts'
+import { ArrowRight } from '@element-plus/icons-vue'
+import { useRoute } from 'vue-router'
+import { useTransition } from '@vueuse/core'
+import { inject, onMounted, onUnmounted, reactive, ref } from 'vue'
+const route: any = useRoute()
+const MG: any = inject('MG')
+const classInfo: any = JSON.parse(route.query.classInfo)
+var chartDom = null
+var myChart: any = {}
+var option = null
+
+const nameList: any = ref([])
+const charstData: any = ref([])
+const count = ref(0)
+const pageLoading = ref(true)
+const outputValue = useTransition(count, {
+  duration: 1000
+})
+const tabHeader: any = ref([])
+const tableData: any = ref([])
+
+let pages = reactive({
+  page: 1,
+  pageSize: 5,
+  count: 0,
+  loading: false
+})
+
+// 鍥捐〃鍒濆鍖�
+const initCharts = () => {
+  option = {
+    legend: {
+      bottom: 0
+    },
+    tooltip: {
+      trigger: 'axis',
+      showContent: true
+    },
+    toolbox: {
+      feature: {
+        saveAsImage: {},
+        magicType: {
+          type: ['bar']
+        },
+        restore: {}
+      }
+    },
+    title: {
+      text: '鐝骇鎴愮哗姒傝',
+      textStyle: {
+        fontFamily: 'PingFang SC',
+        color: '#000000',
+        fontWeight: 'bold',
+        fontSize: '16px'
+      }
+    },
+    dataset: {
+      source: charstData.value
+    },
+    xAxis: { type: 'category' },
+    yAxis: { gridIndex: 0 },
+    grid: {
+      left: '3%',
+      right: '4%',
+      containLabel: true
+    },
+    series: [
+      {
+        type: 'line',
+        smooth: true,
+        seriesLayoutBy: 'row',
+        emphasis: { focus: 'series' }
+      },
+      {
+        type: 'line',
+        smooth: true,
+        seriesLayoutBy: 'row',
+        emphasis: { focus: 'series' }
+      },
+      {
+        type: 'line',
+        smooth: true,
+        seriesLayoutBy: 'row',
+        emphasis: { focus: 'series' }
+      }
+    ]
+  }
+  option && myChart.setOption(option)
+}
+
+onMounted(() => {
+  getData()
+  getUserTaskList()
+})
+
+// 鑾峰彇缁熻鏁版嵁
+const getData = () => {
+  const data = {
+    classId: classInfo?.id
+  }
+  MG.edu
+    .getTaskStatistics(data)
+    .then((res: any) => {
+      count.value = res.length
+      if (res.length > 0) {
+        let dataX = res.map((item: any) => item.task.name)
+        dataX.unshift('homeWork')
+        nameList.value = dataX
+        let avg = ['鐝骇骞冲潎鍒�']
+        let max = ['鏈�楂樺垎']
+        let min = ['鏈�浣庡垎']
+        res.forEach((item: any) => {
+          avg.push(item.avgScore)
+          max.push(item.maxScore)
+          min.push(item.minScore)
+        })
+        charstData.value = [dataX, avg, max, min]
+      } else {
+        charstData.value = []
+        nameList.value = []
+      }
+      setTimeout(() => {
+        pageLoading.value = false
+        chartDom = document.getElementById('chartsContent')
+        myChart = echarts.init(chartDom)
+        initCharts()
+      }, 1000)
+    })
+    .catch((err: any) => {
+      pageLoading.value = false
+      console.log(err)
+    })
+}
+
+// 鑾峰彇鐝骇浣滀笟鎴愮哗璇︽儏
+const getUserTaskList = () => {
+  pages.loading = true
+  const data = {
+    start: (pages.page - 1) * pages.pageSize,
+    size: pages.pageSize,
+    classId: classInfo?.id
+  }
+  MG.edu
+    .getUserTaskList(data)
+    .then((res: any) => {
+      let headerList: any = []
+      pages.count = res.totalSize
+      if (res.datas.length > 0) {
+        res.datas.forEach((item: any, index: number) => {
+          item.index = index + 1
+          const hitem = item.results.map((citem: any) => citem.name)
+          headerList.push(...hitem)
+        })
+        tableData.value = res.datas
+        tabHeader.value = Array.from(new Set(headerList))
+      } else {
+        tableData.value = []
+        tabHeader.value = []
+      }
+      pages.loading = false
+    })
+    .catch((err: any) => {
+      pages.loading = false
+      console.log(err)
+    })
+}
+
+const handleSizeChange = (val: number) => {
+  pages.pageSize = val
+  getUserTaskList()
+}
+
+const handleCurrentChange = (val: number) => {
+  pages.page = val
+  getUserTaskList()
+}
+</script>
+
+<style lang="less" scoped>
+.classManagePage-box {
+  width: 100%;
+  padding: 20px;
+  .classManagePage-nav {
+    padding-bottom: 20px;
+    border-bottom: 1px solid #e6e8ed;
+  }
+  .classManagePage-content {
+    width: 100%;
+    padding: 30px 0;
+
+    .staticBox {
+      width: 100%;
+      height: 60px;
+      display: flex;
+      justify-content: flex-start;
+      align-items: center;
+      margin-bottom: 40px;
+
+      .pub_staticItem {
+        display: flex;
+
+        img {
+          width: 60px;
+          height: 60px;
+          background: #ebf4ff;
+          border-radius: 8px 8px 8px 8px;
+          margin-right: 15px;
+        }
+        .staticText {
+          display: flex;
+          flex-direction: column;
+          justify-content: space-between;
+
+          span:nth-child(1) {
+            font-family: PingFang SC;
+            font-weight: bold;
+            font-size: 14px;
+            color: #a5a7ab;
+          }
+
+          span:nth-child(2) {
+            font-family: DIN;
+            font-weight: 500;
+            font-size: 20px;
+            color: #000000;
+          }
+        }
+      }
+    }
+
+    .chartsBox {
+      margin-bottom: 40px;
+      #chartsContent {
+        height: 600px;
+      }
+    }
+
+    .listContent {
+      width: 100%;
+      .tableTitle {
+        font-family: PingFang SC;
+        font-weight: bold;
+        font-size: 16px;
+        color: #000000;
+        margin-bottom: 22px;
+      }
+    }
+  }
+}
+</style>

--
Gitblit v1.9.1