Reiskuchen пре 5 година
родитељ
комит
b3b5793aec

+ 9 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -82,10 +83,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             HSSFRow headRow = sheet.createRow(0);
             //设置列宽 setColumnWidth的第二个参数要乘以256,这个参数的单位是1/256个字符宽度
             sheet.setColumnWidth(0, 5 * 256);
-            sheet.setColumnWidth(1, 18 * 256);
-            sheet.setColumnWidth(2, 18 * 256);
-            sheet.setColumnWidth(3, 18 * 256);
-            sheet.setColumnWidth(4, 30 * 256);
+            sheet.setColumnWidth(1, 10 * 256);
+            sheet.setColumnWidth(2, 20 * 256);
+            sheet.setColumnWidth(3, 10 * 256);
+            sheet.setColumnWidth(4, 50 * 256);
             sheet.setColumnWidth(5, 18 * 256);
             //设置为居中加粗
             HSSFCellStyle headStyle = workbook.createCellStyle();
@@ -123,10 +124,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 row.createCell(0).setCellValue(rowNum);
                 row.createCell(1).setCellValue((String) map.get("name"));
                 row.createCell(2).setCellValue((String) map.get("project"));
-                row.createCell(3).setCellValue((String) map.get("duration"));
+                row.createCell(3).setCellValue(map.get("duration").toString());
                 row.createCell(4).setCellValue((String) map.get("content"));
                 HSSFCell cell = row.createCell(5);
-                cell.setCellValue((String) map.get("time"));
+                cell.setCellValue(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
+                        .format((Timestamp) map.get("time")));
                 cell.setCellStyle(style);
                 rowNum++;
             }
@@ -139,7 +141,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             fos.close();
             httpRespMsg.data = "/upload/" + fileUrlSuffix;
         } catch (NullPointerException e) {
-            httpRespMsg.setError("验证失败");
+            httpRespMsg.setError("验证失败或缺少数据");
             return httpRespMsg;
         } catch (IOException e) {
             httpRespMsg.setError("文件生成错误");

+ 0 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -28,7 +28,6 @@
         <if test="date != null and date != ''">
             AND a.create_date=#{date}
         </if>
-        AND a.creator_id=#{id}
         ORDER BY a.creator_id ASC
     </select>
 

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/port.js

@@ -30,6 +30,7 @@ export default {
 
     //日报
     report: {
-        list: '/report/getReportList',  //获取报告列表
+        list: '/report/getReportList', //获取报告列表
+        export: '/report/exportReport', //导出报告
     }
 }

+ 2 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/index.vue

@@ -10,6 +10,7 @@
 
     <!-- 卡片列表 -->
     <div>
+      <el-col :span="24" v-if="desktopList.length == 0" style="padding: 20px">今日暂无截图</el-col>
       <el-col :span="6" v-for="(item, index) in desktopList" :key="index" class="one_div">
         <el-card :body-style="{ padding: '0px' }" shadow="hover" class="one_card">
           <div class="one_card_img">
@@ -25,9 +26,7 @@
             </div>
           </div>
           <div class="one_card_txt">
-            <!-- pic_type 这里需要一个巨长的三目运算符 -->
-            <!-- 0-编程,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐 -->
-            <!-- 现在基本都是null -->
+            <!-- null 0-编程,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐 后续需要重新约定 -->
             <span>{{converType(item.pic_type == null ? 0 : item.pic_type)}}</span>
             <div class="bottom clearfix">
               <el-link>

+ 42 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -16,7 +16,7 @@
           ></el-date-picker>
         </el-form-item>
         <el-form-item style="float:right;">
-          <el-link type="primary" :underline="false">导出日报</el-link>
+          <el-link type="primary" :underline="false" @click="exportReport">导出日报</el-link>
         </el-form-item>
         <el-form-item style="float:right;">
           <el-link type="primary" :underline="false" @click="projectDialogVisible=true">项目管理</el-link>
@@ -314,6 +314,47 @@ export default {
       );
     },
 
+    //导出日报
+    exportReport() {
+      if (this.reportList.length > 0) {
+        this.listLoading = true;
+        //首先处理日期
+        let day =
+          this.choseDay > 9
+            ? "-" + (this.choseDay + 1)
+            : "-0" + (this.choseDay + 1);
+        this.http.post(
+          this.port.report.export,
+          {
+            date: this.date + day
+          },
+          res => {
+            this.listLoading = false;
+            if (res.code == "ok") {
+              location.href = res.data;
+            } else {
+              this.$message({
+                message: res.msg,
+                type: "error"
+              });
+            }
+          },
+          error => {
+            this.listLoading = false;
+            this.$message({
+              message: error,
+              type: "error"
+            });
+          }
+        );
+      } else {
+        this.$message({
+          message: "当天没有报告 无法导出",
+          type: "info"
+        });
+      }
+    },
+
     // 获取异常列表
     getUnusual() {
       this.listLoading = true;