|
@@ -82,6 +82,11 @@
|
|
|
<div class="top">
|
|
|
<div class="titleBox">
|
|
|
<div class="title">课程分析</div>
|
|
|
+ <el-select v-model="cType" @change="typeChange" class="selectBox">
|
|
|
+ <el-option label="年级" value="grade"></el-option>
|
|
|
+ <el-option label="主题" value="theme"></el-option>
|
|
|
+ <el-option label="学科" value="subject"></el-option>
|
|
|
+ </el-select>
|
|
|
</div>
|
|
|
<div class="dataBox">
|
|
|
<CourseAna style="height: calc(100% - 40px)"></CourseAna>
|
|
@@ -90,9 +95,14 @@
|
|
|
<div class="bottom">
|
|
|
<div class="titleBox">
|
|
|
<div class="title">授课时长</div>
|
|
|
+ <el-select v-model="lType" @change="typeChange1" class="selectBox">
|
|
|
+ <el-option label="年级" value="grade"></el-option>
|
|
|
+ <el-option label="主题" value="theme"></el-option>
|
|
|
+ <el-option label="学科" value="subject"></el-option>
|
|
|
+ </el-select>
|
|
|
</div>
|
|
|
<div class="dataBox">
|
|
|
- <div class="teafre">
|
|
|
+ <div class="teafre" style="margin: 10px 0 0 0">
|
|
|
<div class="teaLeft">
|
|
|
<div>累计时长</div>
|
|
|
<div>15624小时</div>
|
|
@@ -102,7 +112,10 @@
|
|
|
<div>268小时</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <WorkTime style="height: calc(100% - 62px)"></WorkTime>
|
|
|
+ <WorkTime
|
|
|
+ style="height: calc(100% - 72px)"
|
|
|
+ :workList="tedurArray"
|
|
|
+ ></WorkTime>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -143,12 +156,28 @@ export default {
|
|
|
groupedArrayByMonth: [],
|
|
|
toolList: [],
|
|
|
reInc: 0,
|
|
|
+ cType: "grade",
|
|
|
+ lType: "grade",
|
|
|
+ tedurArray: [],
|
|
|
+ classList: [],
|
|
|
+ subjectList: [],
|
|
|
+ themeList: [],
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ typeChange(){},
|
|
|
+ typeChange1() {
|
|
|
+ if (this.lType == "grade") {
|
|
|
+ this.tedurArray = this.classList;
|
|
|
+ } else if (this.lType == "subject") {
|
|
|
+ this.tedurArray = this.subjectList;
|
|
|
+ } else {
|
|
|
+ this.tedurArray = this.themeList;
|
|
|
+ }
|
|
|
+ },
|
|
|
getData() {
|
|
|
this.isLoading = true;
|
|
|
let params = [
|
|
@@ -165,6 +194,10 @@ export default {
|
|
|
this.cCount = res.data[1].length;
|
|
|
var workArray = res.data[0];
|
|
|
var courseList = res.data[1];
|
|
|
+ var tList = res.data[2];
|
|
|
+ var classList = res.data[3]; //年级数组
|
|
|
+ var subjectList = res.data[4]; //学科数组
|
|
|
+ var themeList = res.data[5]; //主题数组
|
|
|
var cList = [];
|
|
|
//将数据根据time里面的月份分成多个数组
|
|
|
var groupedArrayByMonth = [];
|
|
@@ -264,6 +297,65 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.toolList = toolAllArray;
|
|
|
+ var courseJson = Object.values(
|
|
|
+ tList.reduce(function (acc, obj) {
|
|
|
+ if (!acc[obj.courseid]) {
|
|
|
+ acc[obj.courseid] = { ...obj };
|
|
|
+ acc[obj.courseid].typeid = [acc[obj.courseid].typeid];
|
|
|
+ } else {
|
|
|
+ if (!acc[obj.courseid].typeid.includes(obj.typeid)) {
|
|
|
+ acc[obj.courseid].typeid.push(obj.typeid);
|
|
|
+ }
|
|
|
+ acc[obj.courseid].text =
|
|
|
+ parseInt(acc[obj.courseid].text) + parseInt(obj.text);
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, {})
|
|
|
+ ).map(function (obj) {
|
|
|
+ var totalTime = parseInt(obj.text);
|
|
|
+ obj.text = (totalTime / (60 * 60)).toFixed(2);
|
|
|
+ return obj;
|
|
|
+ });
|
|
|
+
|
|
|
+ for (var i = 0; i < courseJson.length; i++) {
|
|
|
+ for (var j = 0; j < classList.length; j++) {
|
|
|
+ if (courseJson[i].typeid.indexOf(classList[j].id) != -1) {
|
|
|
+ if(classList[j].time && courseJson[i].text){
|
|
|
+ classList[j].time += parseInt(courseJson[i].text);
|
|
|
+ }else if(courseJson[i].text){
|
|
|
+ classList[j].time = parseInt(courseJson[i].text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var k = 0; k < subjectList.length; k++) {
|
|
|
+ if (courseJson[i].typeid.indexOf(subjectList[k].id) != -1) {
|
|
|
+ if(subjectList[k].time && courseJson[i].text){
|
|
|
+ subjectList[k].time += parseInt(courseJson[i].text);
|
|
|
+ }else if(courseJson[i].text){
|
|
|
+ subjectList[k].time = parseInt(courseJson[i].text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var l = 0; l < themeList.length; l++) {
|
|
|
+ if (courseJson[i].typeid.indexOf(themeList[l].id) != -1) {
|
|
|
+ if(themeList[l].time && courseJson[i].text){
|
|
|
+ themeList[l].time += parseInt(courseJson[i].text);
|
|
|
+ }else if(courseJson[i].text){
|
|
|
+ themeList[l].time = parseInt(courseJson[i].text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.classList = classList;
|
|
|
+ this.subjectList = subjectList;
|
|
|
+ this.themeList = themeList;
|
|
|
+ if (this.lType == "grade") {
|
|
|
+ this.tedurArray = classList;
|
|
|
+ } else if (this.lType == "subject") {
|
|
|
+ this.tedurArray = subjectList;
|
|
|
+ } else {
|
|
|
+ this.tedurArray = themeList;
|
|
|
+ }
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
this.isLoading = false;
|
|
@@ -457,4 +549,17 @@ export default {
|
|
|
width: 50%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+.selectBox {
|
|
|
+ width: 80px;
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.selectBox >>> .el-input__inner {
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+}
|
|
|
+
|
|
|
+.selectBox >>> .el-input__icon {
|
|
|
+ line-height: 30px;
|
|
|
+}
|
|
|
</style>
|