11wqe1 8 月之前
父節點
當前提交
3b37044ab1
共有 2 個文件被更改,包括 78 次插入4 次删除
  1. 39 2
      src/components/pages/components/exportWorksDialog.vue
  2. 39 2
      src/components/pages/components/lookWork.vue

+ 39 - 2
src/components/pages/components/exportWorksDialog.vue

@@ -529,7 +529,7 @@
                     }}</span>
                   </div>
-                  <div>提交时间:{{ l.time }}</div>
+                  <div>作业提交时间:{{ workTime(k.toolEList) }}</div>
                 </div>
 
                 <!-- 作业评分 -->
@@ -623,7 +623,7 @@
                     }}</span>
                   </div>
-                  <div>提交时间:{{ l.time }}</div>
+                  <div>作业提交时间:{{ workTime(k.toolEList) }}</div>
                 </div>
 
                 <!-- 作业评分 -->
@@ -827,10 +827,47 @@ export default {
 
         return (new1 / data.length).toFixed(1);
       };
+    },
+    workTime(){
+      return function(val) {
+        if (!val.length) return ''
+        let TimeList = []
+        val.forEach(e=>{
+          if (e.time) {
+            const timestamp = new Date(e.time).getTime();
+            TimeList.push(timestamp)
+          }
+        })
+
+        console.log('TimeList',TimeList);
+        TimeList.sort(function(a,b){
+          return a-b;//从小到大排序
+        })
+
+
+        return this.convertToTimestamp(TimeList[0]);
+      };
     }
   },
 
   methods: {
+      // 时间戳转时间
+      convertToTimestamp(val) {
+      const date = new Date(val);
+
+      // 使用Date对象的方法获取年、月、日、时、分、秒
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1
+      const day = String(date.getDate()).padStart(2, '0');
+      const hours = String(date.getHours()).padStart(2, '0');
+      const minutes = String(date.getMinutes()).padStart(2, '0');
+      const seconds = String(date.getSeconds()).padStart(2, '0');
+
+      // 格式化后的日期时间字符串
+      const formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+      
+      return formattedDateTime
+    },
     // 下载pdf文件
     getPdf() {
       const content = this.$refs.reportPdf;

+ 39 - 2
src/components/pages/components/lookWork.vue

@@ -596,7 +596,7 @@
                       }}</span>
                     </div>
-                    <div>作业提交时间:{{ l.time }}</div>
+                    <div>作业提交时间:{{ workTime(k.toolEList) }}</div>
                   </div>
 
                   <!-- 作业评分 -->
@@ -672,7 +672,7 @@
                       }}</span>
                     </div>
-                    <div>作业提交时间:{{ l.time }}</div>
+                    <div>作业提交时间:{{ workTime(k.toolEList) }}</div>
                   </div>
 
                   <!-- 作业评分 -->
@@ -848,6 +848,26 @@ export default {
 
         return (new1 / data.length).toFixed(1);
       };
+    },
+    workTime(){
+      return function(val) {
+        if (!val.length) return ''
+        let TimeList = []
+        val.forEach(e=>{
+          if (e.time) {
+            const timestamp = new Date(e.time).getTime();
+            TimeList.push(timestamp)
+          }
+        })
+
+        console.log('TimeList',TimeList);
+        TimeList.sort(function(a,b){
+          return a-b;//从小到大排序
+        })
+
+
+        return this.convertToTimestamp(TimeList[0]);
+      };
     }
   },
   mounted() {
@@ -875,6 +895,23 @@ export default {
     }
   },
   methods: {
+     // 时间戳转时间
+     convertToTimestamp(val) {
+      const date = new Date(val);
+
+      // 使用Date对象的方法获取年、月、日、时、分、秒
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1
+      const day = String(date.getDate()).padStart(2, '0');
+      const hours = String(date.getHours()).padStart(2, '0');
+      const minutes = String(date.getMinutes()).padStart(2, '0');
+      const seconds = String(date.getSeconds()).padStart(2, '0');
+
+      // 格式化后的日期时间字符串
+      const formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+      
+      return formattedDateTime
+    },
     expPdf() {
       this.$emit("childExportPdfSetBtn", { uid: this.uid, con: this.resData });
     },