From c3bb35b20d6e076f73a1cad50fd6b9b94ca399a7 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期一, 06 一月 2025 16:15:05 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/onlineEducation/learnRecord/components/detailDialog.vue | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/views/onlineEducation/learnRecord/components/detailDialog.vue b/src/views/onlineEducation/learnRecord/components/detailDialog.vue index 77dbbd1..6584be3 100644 --- a/src/views/onlineEducation/learnRecord/components/detailDialog.vue +++ b/src/views/onlineEducation/learnRecord/components/detailDialog.vue @@ -37,7 +37,8 @@ </div> <el-table :data="tableData" - style="width: 80%;margin-left: 50px"> + style="width: 80%;margin-left: 50px" + :cell-style="tableAddClass"> <el-table-column prop="durationDesc" label="学习时长" align="center"> @@ -58,6 +59,11 @@ label="结束位置" prop="finishPositionDesc" align="center"> </el-table-column> + <el-table-column + label="自然时间差" + prop="differenceDesc" align="center"> + </el-table-column> + </el-table> <div style="margin: 30px 20px "> <span style="font-size: 20px;font-weight: 550">认证纪录集合</span> @@ -157,17 +163,54 @@ startTime: data.startTime, finishTime: data.finishTime, finishPositionDesc: data.finishPositionDesc, - startPositionDesc: data.startPositionDesc + startPositionDesc: data.startPositionDesc, + differenceDesc: data.differenceDesc, + duration: data.duration, + difference: data.difference }) + // this.tableData.forEach(item => { + // item.timeDiff = this.getTimeDifferenceInSeconds(item.startTime,item.finishTime) + // }) this.trackList = data.trackList this.authList = data.authList }, + getTimeDifferenceInSeconds(dateStr1, dateStr2) { + const date1 = new Date(dateStr1); + const date2 = new Date(dateStr2); + const timeDiff = Math.abs(date2 - date1); // 计算时间差 + + const seconds = Math.floor(timeDiff / 1000) + const hour = Math.floor(seconds / 3600) + const hours = hour ==0 ? '' : hour>=10 ? hour: '0' + hour + const minute = Math.floor((seconds % 3600) / 60); + const minutes = minute == 0 ? '' : minute>= 10 ? minute: '0' + minute + const sec = seconds % 60; + const secs = sec == 0 ? '' : sec >= 10 ? sec: '0' + sec + + return [ + hours ? hours + '时' : '', + minutes ? minutes + '分' : '', + secs + '秒' + ].filter(Boolean); + + }, handleClose() { + this.tableData = []; + this.dataForm = {} + this.trackList = [] + this.authList =[] this.dialogVisible = false; this.$emit("getList"); }, + tableAddClass({ row, column,rowIndex, columnIndex }) { + console.log('1',columnIndex) + if (row.difference < row.duration && columnIndex === 5) { + return { color:' red' } + } + return ""; + }, } } -- Gitblit v1.9.2