Reiskuchen 5 years ago
parent
commit
2500810503
18 changed files with 1015 additions and 636 deletions
  1. 7 4
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ScreenshotController.java
  2. 35 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeCalculationController.java
  3. 8 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java
  4. 18 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TimeCalculationMapper.java
  5. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ScreenshotService.java
  6. 6 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TimeCalculationService.java
  7. 2 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java
  8. 20 11
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
  9. 84 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java
  10. 18 9
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  11. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ScreenshotMapper.xml
  12. 72 7
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeCalculationMapper.xml
  13. 10 1
      fhKeeper/formulahousekeeper/timesheet/src/port.js
  14. 258 191
      fhKeeper/formulahousekeeper/timesheet/src/views/desktop/detail.vue
  15. 168 152
      fhKeeper/formulahousekeeper/timesheet/src/views/desktop/index.vue
  16. 104 78
      fhKeeper/formulahousekeeper/timesheet/src/views/desktop/unusual.vue
  17. 44 4
      fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue
  18. 159 172
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/statistics.vue

+ 7 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ScreenshotController.java

@@ -31,10 +31,13 @@ public class ScreenshotController {
         return screenshotService.getLatestScreenshotList();
     }
 
-    @RequestMapping("/getTodayScreenshotListByUser")
-    public HttpRespMsg getTodayScreenshotListByUser(
-            @RequestParam Integer userId, @RequestParam Integer pageIndex, @RequestParam Integer pageSize) {
-        return screenshotService.getTodayScreenshotListByUser(userId, pageIndex, pageSize);
+    /**
+     * 获取某人今日截图列表
+     * userId 用户id
+     */
+    @RequestMapping("/getTodayScreenshotList")
+    public HttpRespMsg getTodayScreenshotList(@RequestParam String userId) {
+        return screenshotService.getTodayScreenshotList(userId);
     }
 
 }

+ 35 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeCalculationController.java

@@ -1,13 +1,17 @@
 package com.management.platform.controller;
 
 
+import com.management.platform.service.TimeCalculationService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author 吴涛涛
@@ -17,5 +21,35 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/time-calculation")
 public class TimeCalculationController {
 
+    @Autowired
+    private TimeCalculationService timeCalculationService;
+
+    /**
+     * 获取某人今日工作时间和其他信息
+     * userId 用户id
+     */
+    @RequestMapping("/getTodayWorkingTime")
+    public HttpRespMsg getTodayWorkingTime(@RequestParam String userId) {
+        return timeCalculationService.getTodayWorkingTime(userId);
+    }
+
+    /**
+     * 分页获取异常列表
+     * pageIndex 分页页码
+     * pageSize 分页大小
+     * userId 筛选用户id 可传
+     * actionCode 筛选行为种类 可传 不传时排除0
+     * date 筛选日期 可传
+     */
+    @RequestMapping("/getDevianceList")
+    public HttpRespMsg getDevianceList(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,
+                                       String userId, Integer actionCode, String date) {
+        return timeCalculationService.getDevianceList(pageIndex, pageSize, userId, actionCode, date);
+    }
+
+    @RequestMapping("/getTimeStatistics")
+    public HttpRespMsg getTimeStatistics(@RequestParam String date) {
+        return timeCalculationService.getTimeStatistics(date);
+    }
 }
 

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -49,5 +49,13 @@ public class UserController {
     public HttpRespMsg getEmployeeList() {
         return userService.getEmployeeList();
     }
+
+    /**
+     * 删除用户
+     */
+    @RequestMapping("/deleteUser")
+    public HttpRespMsg deleteUser(@RequestParam String userId){
+        return userService.deleteUser(userId);
+    }
 }
 

+ 18 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TimeCalculationMapper.java

@@ -1,16 +1,33 @@
 package com.management.platform.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.TimeCalculation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
- *  Mapper 接口
+ * Mapper 接口
  * </p>
  *
  * @author 吴涛涛
  * @since 2020-01-09
  */
 public interface TimeCalculationMapper extends BaseMapper<TimeCalculation> {
+    List<Map<String, Object>> getDevianceList(Page page,
+                                              @Param("userId") String userId,
+                                              @Param("actionCode") Integer actionCode,
+                                              @Param("date") String date);
+
+    Integer countDeviance(@Param("userId") String userId,
+                          @Param("actionCode") Integer actionCode,
+                          @Param("date") String date);
+
+    List<Map<String, Object>> getTodayStatisticsUser(@Param("date") String date);
 
+    List<Map<String, Object>> getTodayStatistics(@Param("userId") String userId,
+                                                 @Param("date") String date);
 }

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ScreenshotService.java

@@ -16,7 +16,7 @@ import com.management.platform.util.HttpRespMsg;
 public interface ScreenshotService extends IService<Screenshot> {
     HttpRespMsg getLatestScreenshotList();
 
-    HttpRespMsg getTodayScreenshotListByUser(Integer userId, Integer pageIndex, Integer pageSize);
+    HttpRespMsg getTodayScreenshotList(String userId);
 
     HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo);
 }

+ 6 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TimeCalculationService.java

@@ -2,15 +2,20 @@ package com.management.platform.service;
 
 import com.management.platform.entity.TimeCalculation;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.util.HttpRespMsg;
 
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author 吴涛涛
  * @since 2020-01-09
  */
 public interface TimeCalculationService extends IService<TimeCalculation> {
+    HttpRespMsg getTodayWorkingTime(String userId);
 
+    HttpRespMsg getDevianceList(Integer pageIndex, Integer pageSize, String userId, Integer actionCode, String date);
+
+    HttpRespMsg getTimeStatistics(String date);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -18,4 +18,6 @@ public interface UserService extends IService<User> {
     HttpRespMsg loginEmployee(String username, String password);
 
     HttpRespMsg getEmployeeList();
+
+    HttpRespMsg deleteUser(String userId);
 }

+ 20 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java

@@ -28,11 +28,9 @@ import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalTime;
+import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * <p>
@@ -81,15 +79,26 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
         return httpRespMsg;
     }
 
-    //根据用户id分页获取当天的截图
+    //获取当天的截图
     @Override
-    public HttpRespMsg getTodayScreenshotListByUser(Integer userId, Integer pageIndex, Integer pageSize) {
+    public HttpRespMsg getTodayScreenshotList(String userId) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg.data = screenshotMapper.selectPage(new Page<>(pageIndex, pageSize),
-                new QueryWrapper<Screenshot>()
-                        .eq("date_str", LocalDate.now())
-                        .eq("uid", userId)
-                        .orderByDesc("indate"));
+        Map<String, Object> resultMap = new HashMap<>();
+        List<String> srcList = new ArrayList<>();
+        List<Object> dataList = new ArrayList<>();
+        for (Screenshot screenshot : screenshotMapper.selectList(new QueryWrapper<Screenshot>()
+                .eq("date_str", LocalDate.now(ZoneOffset.of("+8")))
+                .eq("uid", userId)
+                .orderByDesc("indate"))) {
+            srcList.add(screenshot.getPicUrl());
+            Map<String, Object> map = new HashMap<>();
+            map.put("time", screenshot.getIndate().toLocalTime());
+            map.put("type", screenshot.getPicType() == null ? 0 : screenshot.getPicType());
+            dataList.add(map);
+        }
+        resultMap.put("srcList", srcList);
+        resultMap.put("data", dataList);
+        httpRespMsg.data = resultMap;
         return httpRespMsg;
     }
 

+ 84 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java

@@ -1,14 +1,24 @@
 package com.management.platform.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.TimeCalculation;
 import com.management.platform.mapper.TimeCalculationMapper;
+import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.TimeCalculationService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.util.HttpRespMsg;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author 吴涛涛
@@ -17,4 +27,76 @@ import org.springframework.stereotype.Service;
 @Service
 public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMapper, TimeCalculation> implements TimeCalculationService {
 
-}
+    @Resource
+    private UserMapper userMapper;
+
+    @Resource
+    private TimeCalculationMapper timeCalculationMapper;
+
+    //根据id获取用户名 日期 时间分布
+    @Override
+    public HttpRespMsg getTodayWorkingTime(String userId) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        Map<String, Object> resultMap = new HashMap<>();
+        //用户名
+        resultMap.put("username", userMapper.selectById(userId).getName());
+        //日期
+        LocalDate todayDate = LocalDate.now(ZoneOffset.of("+8"));
+        resultMap.put("date", todayDate);
+        //时间占比 预先定义好长度为9的数组再向里面添加
+        Double[] doubleArray = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+        for (TimeCalculation timeCalculation : timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
+                .eq("user_id", userId)
+                .eq("date", todayDate))) {
+            doubleArray[timeCalculation.getActionType()] += timeCalculation.getDuration();
+        }
+        resultMap.put("timeDistribution", doubleArray);
+        httpRespMsg.data = resultMap;
+        return httpRespMsg;
+    }
+
+    //分页获取今日全部异常信息
+    @Override
+    public HttpRespMsg getDevianceList(Integer pageIndex, Integer pageSize,
+                                       String userId, Integer actionCode, String date) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        Map<String, Object> resultMap = new HashMap<>();
+        //注意这里目前把代码为0以外的行为全部计作异常 后续可能需要修改
+        resultMap.put("records", timeCalculationMapper
+                .getDevianceList(new Page<>(pageIndex, pageSize), userId, actionCode, date));
+        //返回总数
+        resultMap.put("total", timeCalculationMapper.countDeviance(userId, actionCode, date));
+        httpRespMsg.data = resultMap;
+        return httpRespMsg;
+    }
+
+    //获取每日时间统计
+    @Override
+    public HttpRespMsg getTimeStatistics(String date) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        List<Map<String, Object>> resultList = new ArrayList<>();
+        //首先获取某日期有截图的人
+        for (Map<String, Object> userMap : timeCalculationMapper.getTodayStatisticsUser(date)) {
+            //对于每一个人 首先记录下姓名和电话号码
+            Map<String, Object> map = new HashMap<>();
+            map.put("name", userMap.get("name"));
+            map.put("phone", userMap.get("phone"));
+            //然后根据日期和用户id获取到所有的记录 然后手动累加在一起
+            Double[] doubleArray = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+            for (Map<String, Object> dataMap : timeCalculationMapper
+                    .getTodayStatistics((String) userMap.get("id"), date)) {
+                doubleArray[(int) dataMap.get("type")] += (Double) dataMap.get("duration");
+            }
+            map.put("statistics", doubleArray);
+            //最后是数组的和
+            Double sum = 0.0;
+            for (Double singleNumber : doubleArray) {
+                sum += singleNumber;
+            }
+            map.put("sum", sum);
+            resultList.add(map);
+        }
+        httpRespMsg.data = resultList;
+        return httpRespMsg;
+    }
+}

+ 18 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -27,9 +27,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Resource
     private UserMapper userMapper;
 
-    /**
-     * 管理员登录网页端
-     */
+    //管理员登录网页端
     @Override
     public HttpRespMsg loginAdmin(String username, String password) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
@@ -53,9 +51,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         return httpRespMsg;
     }
 
-    /**
-     * 员工登录网页端
-     */
+    //员工登录网页端
     @Override
     public HttpRespMsg loginEmployee(String username, String password) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
@@ -79,13 +75,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         return httpRespMsg;
     }
 
-    /**
-     * 获取员工的列表
-     */
+    //获取员工的列表
     @Override
     public HttpRespMsg getEmployeeList() {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         httpRespMsg.data = userMapper.selectList(new QueryWrapper<User>().eq("role", 0));
         return httpRespMsg;
     }
+
+    //删除普通用户
+    @Override
+    public HttpRespMsg deleteUser(String userId) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        User user = userMapper.selectById(userId);
+        if (user == null) {
+            httpRespMsg.setError("未找到用户");
+        } else if (user.getRole() != 0) {
+            httpRespMsg.setError("只能删除普通用户");
+        } else {
+            userMapper.deleteById(userId);
+        }
+        return httpRespMsg;
+    }
 }

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

@@ -22,7 +22,7 @@
 
     <!--获取每个人最新的桌面截图-->
     <select id="getLatestScreenshotList" resultType="java.util.Map">
-        SELECT c.name, a.pic_url, a.indate, a.pic_type
+        SELECT c.id, c.name, a.pic_url, a.indate, a.pic_type
         FROM screenshot AS a
         JOIN(
         SELECT uid, MAX(indate) AS max_indate

+ 72 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeCalculationMapper.xml

@@ -4,13 +4,13 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.management.platform.entity.TimeCalculation">
-        <id column="id" property="id" />
-        <result column="user_id" property="userId" />
-        <result column="action_type" property="actionType" />
-        <result column="date" property="date" />
-        <result column="start_time" property="startTime" />
-        <result column="end_time" property="endTime" />
-        <result column="duration" property="duration" />
+        <id column="id" property="id"/>
+        <result column="user_id" property="userId"/>
+        <result column="action_type" property="actionType"/>
+        <result column="date" property="date"/>
+        <result column="start_time" property="startTime"/>
+        <result column="end_time" property="endTime"/>
+        <result column="duration" property="duration"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
@@ -18,4 +18,69 @@
         id, user_id, action_type, date, start_time, end_time, duration
     </sql>
 
+    <!--分页获取异常记录-->
+    <select id="getDevianceList" resultType="java.util.Map">
+        SELECT a.start_time AS time, b.name, a.action_type AS type, a.date
+        FROM time_calculation AS a
+        LEFT JOIN user AS b ON a.user_id = b.id
+        WHERE 1=1
+        <if test="userId != null and userId != ''">
+            AND a.user_id = #{userId}
+        </if>
+        <if test="actionCode != null and actionCode != ''">
+            AND a.action_type = #{actionCode}
+        </if>
+        <if test="actionCode == null">
+            AND a.action_type != 0
+        </if>
+        <if test="date != null and date != ''">
+            AND a.date = #{date}
+        </if>
+    </select>
+
+    <!--分页获取异常记录的总数量-->
+    <select id="countDeviance" resultType="java.lang.Integer">
+        SELECT COUNT(a.id) AS count
+        FROM time_calculation AS a
+        LEFT JOIN user AS b ON a.user_id = b.id
+        WHERE 1=1
+        <if test="userId != null and userId != ''">
+            AND a.user_id = #{userId}
+        </if>
+        <if test="actionCode != null and actionCode != ''">
+            AND a.action_type = #{actionCode}
+        </if>
+        <if test="actionCode == null">
+            AND a.action_type != 0
+        </if>
+        <if test="date != null and date != ''">
+            AND a.date = #{date}
+        </if>
+    </select>
+
+    <!--获取某日所有有记录的用户id-->
+    <select id="getTodayStatisticsUser" resultType="java.util.Map">
+        SELECT DISTINCT b.id, b.name, b.phone
+        FROM time_calculation AS a
+        LEFT JOIN user AS b
+        ON a.user_id = b.id
+        WHERE 1=1
+        <if test="date != null and date != ''">
+            AND a.date = #{date}
+        </if>
+    </select>
+
+    <!--根据日期和id获取所有统计信息-->
+    <select id="getTodayStatistics" resultType="java.util.Map">
+        SELECT action_type AS type, duration
+        FROM time_calculation
+        WHERE 1=1
+        <if test="date != null and date != ''">
+            AND date = #{date}
+        </if>
+        <if test="userId != null and userId != ''">
+            AND user_id = #{userId}
+        </if>
+    </select>
+
 </mapper>

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

@@ -2,11 +2,20 @@ export default {
     manage: {
         login: '/user/loginAdmin', // 登录
         list: '/user/getEmployeeList', //获取员工列表
+        delete: '/user/deleteUser', //删除用户
     },
 
-    //桌面
+    //时间
+    time: {
+        getToday: '/time-calculation/getTodayWorkingTime', //获取某人今日时间信息
+        listDeviance: '/time-calculation/getDevianceList', //获取异常行为列表
+        listStatistics: '/time-calculation/getTimeStatistics', //获取当天的统计
+    },
+
+    //截图
     desktop: {
         list: '/screenshot/getLatestScreenshotList', //获取当前每个人最新的桌面截图
+        listToday: '/screenshot/getTodayScreenshotList', //获取今日截图
     },
 
     //项目

+ 258 - 191
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/detail.vue

@@ -1,214 +1,281 @@
 <template>
-    <section>
-        <!--工具条-->
-        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-            <el-form :inline="true">
-                <el-form-item>
-                    <el-button type="text" @click="backToList" icon="el-icon-back" class="back">返回</el-button>
-                </el-form-item>
-                <el-form-item class="divLine"></el-form-item>
-                <el-form-item>
-                    <span class="workName">{{uName}} / {{uTime}}</span>
-                </el-form-item>
-                <el-form-item style="float:right;">
-                    今日工作时长:<span class="workHours">{{uHours}}h</span>
-                </el-form-item>
-            </el-form>
-        </el-col>
+  <section>
+    <!--工具条-->
+    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+      <el-form :inline="true">
+        <el-form-item>
+          <el-button type="text" @click="backToList" icon="el-icon-back" class="back">返回</el-button>
+        </el-form-item>
+        <el-form-item class="divLine"></el-form-item>
+        <el-form-item>
+          <span class="workName">{{uName}} / {{uTime}}</span>
+        </el-form-item>
+        <el-form-item style="float:right;">
+          今日工作时长:
+          <span class="workHours">{{uHours}}h</span>
+        </el-form-item>
+      </el-form>
+    </el-col>
 
-        <!-- 卡片列表 -->
-        <div>
-            <el-col :span="24" class="one_div">
-                <div id="pie_echarts"></div>
-            </el-col>
-            <el-col :span="6" v-for="(item, index) in 12" :key="item" class="one_div">
-                <el-card :body-style="{ padding: '0px' }" shadow="hover" class="one_card">
-                    <div class="one_card_img">
-                        <el-image :src="index==0?require('../../assets/image/047_S.jpg'):require('../../assets/image/noPic.png')" :preview-src-list="getSrcList(index)" class="image" lazy></el-image>
-                    </div>
-                    <div class="one_card_txt">
-                        <span>在玩游戏呢!!!!!</span>
-                        <div class="bottom clearfix">
-                            <time class="time">9点59分59秒</time>
-                        </div>
-                    </div>
-                </el-card>
-            </el-col>
-        </div>
-    </section>
+    <!-- 卡片列表 -->
+    <div>
+      <el-col :span="24" class="one_div">
+        <div id="pie_echarts"></div>
+      </el-col>
+      <el-col :span="6" v-for="(item, index) in infoList" :key="index" class="one_div">
+        <el-card :body-style="{ padding: '0px' }" shadow="hover" class="one_card">
+          <div class="one_card_img">
+            <el-image
+              :src="srcList[index]"
+              :preview-src-list="getSrcList(index)"
+              class="image"
+              lazy
+            >
+              <div slot="error" class="image-slot">
+                <el-image :src="require('../../assets/image/noPic.png')" class="image" lazy></el-image>
+              </div>
+            </el-image>
+          </div>
+          <div class="one_card_txt">
+            <span>{{item.type}}</span>
+            <div class="bottom clearfix">
+              <time class="time">{{item.time}}</time>
+            </div>
+          </div>
+        </el-card>
+      </el-col>
+    </div>
+  </section>
 </template>
 
 <script>
-    import util from "../../common/js/util";
-    export default {
-        data() {
-            return {
-                detailId: this.$route.params.id,
-                user: JSON.parse(sessionStorage.getItem('user')),
-                uName: '周瑞霆',
-                uTime: '2020-01-03',
-                uHours: 20,
-                srcList: [
-                    require('../../assets/image/047_S.jpg'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                    require('../../assets/image/noPic.png'),
-                ],
-                myChart: null,
-            };
+import util from "../../common/js/util";
+export default {
+  data() {
+    return {
+      detailId: this.$route.params.id,
+      user: JSON.parse(sessionStorage.getItem("user")),
+      uName: "周瑞霆",
+      uTime: "2020-01-03",
+      uHours: 20,
+      timeList: [],
+      srcList: [],
+      infoList: [],
+      myChart: null
+    };
+  },
+  methods: {
+    //获取个人当天的工作时间数据
+    getInfo() {
+      this.listLoading = true;
+      this.http.post(
+        this.port.time.getToday,
+        { userId: this.detailId },
+        res => {
+          this.listLoading = false;
+          if (res.code == "ok") {
+            //设置数据并绘制echarts
+            this.uName = res.data.username;
+            this.uTime = res.data.date;
+            this.timeList = res.data.timeDistribution;
+            //注意目前仅第0项即行为代码为0被计入正常工作 后续可能需要修改
+            this.uHours = this.timeList[0];
+            this.setEcharts();
+            //之后顺便再获取一下截图
+            this.getScreenshot();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
         },
-        methods: {
-            //返回
-            backToList() {
-                this.$router.go(-1);
-            },
+        error => {
+          this.listLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
 
-            setEcharts() {
-                var myChart = this.echarts.init(document.getElementById('pie_echarts'));
-                this.myChart = myChart;
-                var option = {
-                    title: {
-                        text: '工作时长分配',
-                        left: 'left'
-                    },
-                    tooltip: {
-                        trigger: 'item',
-                        formatter: '{a} <br/>{b} : {c} ({d}%)'
-                    },
-                    legend: {
-                        type: 'scroll',
-                        orient: 'vertical',
-                        right: 0,
-                        top: 30,
-                        bottom: 20,
-                        data: ['rose1', 'rose2', 'rose3', 'rose4', 'rose5', 'rose6', 'rose7', 'rose8']
-                    },
-                    toolbox: {
-                        show: true,
-                        feature: {
-                            mark: {show: true},
-                            dataView: {show: true, readOnly: false},
-                            magicType: {
-                                show: true,
-                                type: ['pie', 'funnel']
-                            },
-                            restore: {show: true},
-                            saveAsImage: {show: true}
-                        }
-                    },
-                    series: [
-                        {
-                            name: '面积模式',
-                            type: 'pie',
-                            radius: [30, 110],
-                            roseType: 'area',
-                            data: [
-                                {value: 10, name: 'rose1'},
-                                {value: 5, name: 'rose2'},
-                                {value: 15, name: 'rose3'},
-                                {value: 25, name: 'rose4'},
-                                {value: 20, name: 'rose5'},
-                                {value: 35, name: 'rose6'},
-                                {value: 30, name: 'rose7'},
-                                {value: 40, name: 'rose8'}
-                            ]
-                        }
-                    ]
-                };
-                myChart.setOption(option);
-            },
+    //获取个人当天的截图数据
+    getScreenshot() {
+      this.listLoading = true;
+      this.http.post(
+        this.port.desktop.listToday,
+        { userId: this.detailId },
+        res => {
+          this.listLoading = false;
+          if (res.code == "ok") {
+            this.srcList = res.data.srcList;
+            this.infoList = res.data.data;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.listLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
 
-            getSrcList(index){
-                return this.srcList.slice(index).concat(this.srcList.slice(0,index))
-            },
+    //返回
+    backToList() {
+      this.$router.go(-1);
+    },
 
-            getSrcList1(index) {
-                return this.srcList1.slice(index).concat(this.srcList1.slice(0,index))
-            }
+    setEcharts() {
+      var myChart = this.echarts.init(document.getElementById("pie_echarts"));
+      this.myChart = myChart;
+      var option = {
+        title: {
+          text: "工作时长分配",
+          left: "left"
         },
-
-        created() {
+        tooltip: {
+          trigger: "item",
+          formatter: "{a} <br/>{b} : {c} ({d}%)"
+        },
+        legend: {
+          type: "scroll",
+          orient: "vertical",
+          right: 0,
+          top: 30,
+          bottom: 20,
+          data: [
+            "编程",
+            "查资料",
+            "看文档",
+            "做设计",
+            "美工",
+            "运营",
+            "看小说",
+            "打游戏",
+            "听音乐"
+          ]
         },
+        toolbox: {
+          show: true,
+          feature: {
+            mark: { show: true },
+            dataView: { show: true, readOnly: false },
+            magicType: {
+              show: true,
+              type: ["pie", "funnel"]
+            },
+            restore: { show: true },
+            saveAsImage: { show: true }
+          }
+        },
+        series: [
+          {
+            name: "面积模式",
+            type: "pie",
+            radius: [30, 110],
+            roseType: "area",
+            data: [
+              { value: this.timeList[0], name: "编程" },
+              { value: this.timeList[1], name: "查资料" },
+              { value: this.timeList[2], name: "看文档" },
+              { value: this.timeList[3], name: "做设计" },
+              { value: this.timeList[4], name: "美工" },
+              { value: this.timeList[5], name: "运营" },
+              { value: this.timeList[6], name: "看小说" },
+              { value: this.timeList[7], name: "打游戏" },
+              { value: this.timeList[8], name: "听音乐" }
+            ]
+          }
+        ]
+      };
+      myChart.setOption(option);
+    },
 
-        mounted() {
-            this.setEcharts();
-            var _this = this;
-            window.addEventListener("resize", function () {
-                _this.myChart.resize();
-            });
-        }
-    };
+    getSrcList(index) {
+      return this.srcList.slice(index).concat(this.srcList.slice(0, index));
+    }
+  },
+
+  created() {},
+
+  mounted() {
+    this.getInfo();
+    var _this = this;
+    window.addEventListener("resize", function() {
+      _this.myChart.resize();
+    });
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-    .toolbar {
-        .el-form-item {
-            font-size: 14px;
-            vertical-align: middle;
-        }
-        .back {
-            font-size:16px; 
-            cursor: pointer;
-        }
-        .divLine {
-            width: 2px;
-            background: #c3c3c3;
-            height: 100%;
-        }
-        .workName {
-            color: #333;
-            font-size: 18px;
-        }
-        .workHours {
-            color: #20a0ff;
-            font-size: 18px;
-        }
-    }
+.toolbar {
+  .el-form-item {
+    font-size: 14px;
+    vertical-align: middle;
+  }
+  .back {
+    font-size: 16px;
+    cursor: pointer;
+  }
+  .divLine {
+    width: 2px;
+    background: #c3c3c3;
+    height: 100%;
+  }
+  .workName {
+    color: #333;
+    font-size: 18px;
+  }
+  .workHours {
+    color: #20a0ff;
+    font-size: 18px;
+  }
+}
 
-    .one_div {
-        padding: 15px;
-        .one_card {
-            .image {
-                width: 100%;
-            }
-            .one_card_txt {
-                padding: 13px;
-                .bottom {
-                    margin-top: 13px;
-                    line-height: 12px;
-                    i {
-                        color: #9ED0FF;
-                        margin-right: 5px;
-                    }
-                    .time {
-                        margin-top: 2px;
-                        color: #999;
-                    }
-                }
-            } 
+.one_div {
+  padding: 15px;
+  .one_card {
+    .image {
+      width: 100%;
+    }
+    .one_card_txt {
+      padding: 13px;
+      .bottom {
+        margin-top: 13px;
+        line-height: 12px;
+        i {
+          color: #9ed0ff;
+          margin-right: 5px;
         }
-        #pie_echarts {
-            display: inline-block;
-            width: 100%;
-            height: 100%;
-            min-height: 350px;
+        .time {
+          margin-top: 2px;
+          color: #999;
         }
+      }
     }
+  }
+  #pie_echarts {
+    display: inline-block;
+    width: 100%;
+    height: 100%;
+    min-height: 350px;
+  }
+}
 </style>
 
 <style lang="scss">
-    .image {
-        .el-image__inner {
-            height: 11.6vw!important;
-        }
-    }
+.image {
+  .el-image__inner {
+    height: 11.6vw !important;
+  }
+}
 </style>

+ 168 - 152
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/index.vue

@@ -1,171 +1,187 @@
 <template>
-	<section>
-        <!--工具条-->
-		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-			<div class="nowTime">
-                <i class="fa fa-clock-o"></i>
-                {{currentTime}}
-            </div>
-		</el-col>
+  <section>
+    <!--工具条-->
+    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+      <div class="nowTime">
+        <i class="fa fa-clock-o"></i>
+        {{currentTime}}
+      </div>
+    </el-col>
 
-        <!-- 卡片列表 -->
-        <div>
-            <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">
-                        <el-image :src="this.pic_url" class="image" lazy>
-                            <div slot="error" class="image-slot">
-                                <el-image :src="require('../../assets/image/noPic.png')" class="image" lazy></el-image>
-                            </div>
-                        </el-image>
-                        <div :id="'over'+index" class="over">
-                            <el-button type="primary" plain @click.native="jumpTo(item)"><i class="fa fa-link"></i> 所有截图</el-button>
-                        </div>
-                    </div>
-                    <div class="one_card_txt">
-                        <!-- pic_type 这里需要一个巨长的三目运算符 -->
-                        <!-- 0-编程,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐 -->
-                        <!-- 现在基本都是null -->
-                        <span>{{item.pic_type}}</span>
-                        <div class="bottom clearfix">
-                            <el-link><i class="fa fa-circle"></i> {{item.name}}</el-link>
-                            <time class="time">{{item.time}}</time>
-                        </div>
-                    </div>
-                </el-card>
-            </el-col>
-        </div>
-	</section>
+    <!-- 卡片列表 -->
+    <div>
+      <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">
+            <el-image :src="this.pic_url" class="image" lazy>
+              <div slot="error" class="image-slot">
+                <el-image :src="require('../../assets/image/noPic.png')" class="image" lazy></el-image>
+              </div>
+            </el-image>
+            <div :id="'over'+index" class="over">
+              <el-button type="primary" plain @click.native="jumpTo(item.id)">
+                <i class="fa fa-link"></i> 所有截图
+              </el-button>
+            </div>
+          </div>
+          <div class="one_card_txt">
+            <!-- pic_type 这里需要一个巨长的三目运算符 -->
+            <!-- 0-编程,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐 -->
+            <!-- 现在基本都是null -->
+            <span>{{item.pic_type == null ? 0 : item.pic_type}}</span>
+            <div class="bottom clearfix">
+              <el-link>
+                <i class="fa fa-circle"></i>
+                {{item.name}}
+              </el-link>
+              <time class="time">{{item.time}}</time>
+            </div>
+          </div>
+        </el-card>
+      </el-col>
+    </div>
+  </section>
 </template>
 
 <script>
-    import util from '../../common/js/util'
-	export default {
-		data() {
-			return {
-				filters: {
-					keyName: ''
-                },
-                user: JSON.parse(sessionStorage.getItem('user')),
-                timer: "",
-                currentTime: util.formatDate.format(new Date(new Date()), 'yyyy-MM-dd hh:mm:ss'),
-                desktopList: [],
-			}
-		},
-		methods: {
-            getTime() {
-                var _this = this; //声明一个变量指向Vue实例this,保证作用域一致
-                this.timer = setInterval(function() {
-                    _this.currentTime = util.formatDate.format(new Date(new Date()), 'yyyy-MM-dd hh:mm:ss');
-                }, 1000);
-            },
-            //获取项目列表
-			      getDesktopList() {
-				        this.listLoading = true;
-				        this.http.post(this.port.desktop.list, {}, res => {
-                    this.listLoading = false;
-                    if (res.code == "ok") {
-                        this.desktopList = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
-            jumpTo(id) {
-                this.$router.push('/desktop/' + id);
-            }
-        },
-        created() {
-            this.getTime();
-        },
-		    mounted() {
-            this.getDesktopList();
+import util from "../../common/js/util";
+export default {
+  data() {
+    return {
+      filters: {
+        keyName: ""
+      },
+      user: JSON.parse(sessionStorage.getItem("user")),
+      timer: "",
+      currentTime: util.formatDate.format(
+        new Date(new Date()),
+        "yyyy-MM-dd hh:mm:ss"
+      ),
+      desktopList: []
+    };
+  },
+  methods: {
+    getTime() {
+      var _this = this; //声明一个变量指向Vue实例this,保证作用域一致
+      this.timer = setInterval(function() {
+        _this.currentTime = util.formatDate.format(
+          new Date(new Date()),
+          "yyyy-MM-dd hh:mm:ss"
+        );
+      }, 1000);
+    },
+    //获取项目列表
+    getDesktopList() {
+      this.listLoading = true;
+      this.http.post(
+        this.port.desktop.list,
+        {},
+        res => {
+          this.listLoading = false;
+          if (res.code == "ok") {
+            this.desktopList = res.data;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
         },
-        beforeDestroy() {
-            if (this.timer) {
-                clearInterval(this.timer);
-            }
+        error => {
+          this.listLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
         }
-	}
+      );
+    },
+    jumpTo(id) {
+      this.$router.push("/desktop/" + id);
+    }
+  },
+  created() {
+    this.getTime();
+  },
+  mounted() {
+    this.getDesktopList();
+  },
+  beforeDestroy() {
+    if (this.timer) {
+      clearInterval(this.timer);
+    }
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-    .nowTime {
-        height: 35px;
-        line-height: 28px;
-        font-size: 18px;
-        color: #20a0ff;
-        margin-left: 10px;
-        i {
-            margin-right: 10px;
-        }
-    }
+.nowTime {
+  height: 35px;
+  line-height: 28px;
+  font-size: 18px;
+  color: #20a0ff;
+  margin-left: 10px;
+  i {
+    margin-right: 10px;
+  }
+}
 
-    .one_div {
-        padding: 15px;
-        .one_card {
-            .one_card_img {
-                position: relative;
-                .image {
-                    width: 100%;
-                }
-                .over {
-                    display: none;
-                    width: 100%;
-                    height: 98%;
-                    background: rgba(0,0,0,0.2);
-                    position: absolute;
-                    top: 0;
-                    text-align: center;
-                }
-            }
-            .one_card_txt {
-                padding: 13px;
-                .bottom {
-                    margin-top: 13px;
-                    line-height: 12px;
-                    i {
-                        color: #9ED0FF;
-                        margin-right: 5px;
-                    }
-                    .time {
-                        float: right;
-                        margin-top: 2px;
-                        color: #999;
-                    }
-                }
-            } 
+.one_div {
+  padding: 15px;
+  .one_card {
+    .one_card_img {
+      position: relative;
+      .image {
+        width: 100%;
+      }
+      .over {
+        display: none;
+        width: 100%;
+        height: 98%;
+        background: rgba(0, 0, 0, 0.2);
+        position: absolute;
+        top: 0;
+        text-align: center;
+      }
+    }
+    .one_card_txt {
+      padding: 13px;
+      .bottom {
+        margin-top: 13px;
+        line-height: 12px;
+        i {
+          color: #9ed0ff;
+          margin-right: 5px;
         }
-        .one_card:hover {
-            .one_card_img {
-                .over {
-                    display: block!important;
-                }
-            }
+        .time {
+          float: right;
+          margin-top: 2px;
+          color: #999;
         }
+      }
+    }
+  }
+  .one_card:hover {
+    .one_card_img {
+      .over {
+        display: block !important;
+      }
     }
+  }
+}
 </style>
 <style lang="scss">
-    .image {
-        .el-image__inner {
-            height: 11.6vw!important;
-        }
-    }
+.image {
+  .el-image__inner {
+    height: 11.6vw !important;
+  }
+}
 
-    .one_card_img {
-        .over {
-            .el-button {
-                margin-top: 25%;
-            }
-        }
+.one_card_img {
+  .over {
+    .el-button {
+      margin-top: 25%;
     }
+  }
+}
 </style>

+ 104 - 78
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/unusual.vue

@@ -1,91 +1,117 @@
 <template>
-	<section>
-        <!--工具条-->
-		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-			<div class="nowTime">
-                非工作情况统计
-            </div>
-		</el-col>
+  <section>
+    <!--工具条-->
+    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+      <div class="nowTime">非工作情况统计</div>
+    </el-col>
 
-        <!--列表-->
-		<el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
-			<el-table-column type="index" width="60"></el-table-column>
-            <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
-            <el-table-column prop="behavior" label="行为"></el-table-column>
-			<el-table-column prop="indate" label="创建时间" width="180" sortable></el-table-column>
-		</el-table>
+    <!--列表-->
+    <el-table
+      :data="list"
+      highlight-current-row
+      v-loading="listLoading"
+      :height="tableHeight"
+      style="width: 100%;"
+    >
+      <el-table-column type="index" width="60"></el-table-column>
+      <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
+      <el-table-column prop="type" label="行为"></el-table-column>
+      <el-table-column prop="time" label="时间" width="180" sortable></el-table-column>
+      <el-table-column prop="date" label="日期" width="180" sortable></el-table-column>
+    </el-table>
 
-		<!--工具条-->
-		<el-col :span="24" class="toolbar">
-			<el-pagination
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :page-sizes="[20 , 50 , 80 , 100]"
-                :page-size="20"
-                layout="total, sizes, prev, pager, next"
-                :total="total"
-                style="float:right;">
-            </el-pagination>
-		</el-col>
-    </section> 
+    <!--工具条-->
+    <el-col :span="24" class="toolbar">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :page-sizes="[20 , 50 , 80 , 100]"
+        :page-size="20"
+        layout="total, sizes, prev, pager, next"
+        :total="total"
+        style="float:right;"
+      ></el-pagination>
+    </el-col>
+  </section>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-                user: JSON.parse(sessionStorage.getItem('user')),
+export default {
+  data() {
+    return {
+      user: JSON.parse(sessionStorage.getItem("user")),
 
-                tableHeight: 0,
-                listLoading: false,
-                total: 0,
-                page: 1,
-                size: 20,
-                list:[
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                    {name:'张三',behavior:'上班打游戏',indate:'2019-12-14'},
-                ]
-			}
-		},
-		methods: {
-            //分页
-			handleCurrentChange(val) {
-				this.page = val;
-				this.getProject();
-            },
-
-            handleSizeChange(val) {
-                this.size = val;
-				this.getProject();
-            },
-        },
-        created() {
-            let height = window.innerHeight;
-            this.tableHeight = height - 195;
-            const that = this;
-            window.onresize = function temp() {
-                that.tableHeight = window.innerHeight - 195;    
-            };
+      tableHeight: 0,
+      listLoading: false,
+      total: 0,
+      page: 1,
+      size: 20,
+      list: []
+    };
+  },
+  methods: {
+    //获取异常信息
+    getDevianceList() {
+      this.listLoading = true;
+      this.http.post(
+        this.port.time.listDeviance,
+        { pageIndex: this.page, pageSize: this.size },
+        res => {
+          this.listLoading = false;
+          if (res.code == "ok") {
+            this.list = res.data.records;
+            this.total = res.data.total;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
         },
-        mounted() {
+        error => {
+          this.listLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
         }
-	}
+      );
+    },
+
+    //分页
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getDevianceList();
+    },
+
+    handleSizeChange(val) {
+      this.size = val;
+      this.getDevianceList();
+    }
+  },
+  created() {
+    let height = window.innerHeight;
+    this.tableHeight = height - 195;
+    const that = this;
+    window.onresize = function temp() {
+      that.tableHeight = window.innerHeight - 195;
+    };
+  },
+  mounted() {
+    this.getDevianceList();
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-    .nowTime {
-        height: 35px;
-        line-height: 28px;
-        font-size: 18px;
-        color: #333;
-        margin-left: 10px;
-        i {
-            margin-right: 10px;
-        }
-    }
+.nowTime {
+  height: 35px;
+  line-height: 28px;
+  font-size: 18px;
+  color: #333;
+  margin-left: 10px;
+  i {
+    margin-right: 10px;
+  }
+}
 </style>

+ 44 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -63,12 +63,12 @@ export default {
     //分页
     handleCurrentChange(val) {
       this.page = val;
-      // this.getUser();
+      this.getUser();
     },
 
     handleSizeChange(val) {
       this.size = val;
-      // this.getUser();
+      this.getUser();
     },
 
     //获取所有员工的列表
@@ -98,11 +98,51 @@ export default {
       );
     },
 
-    //删除员工
+    //三天之内删了你 数据库都给你清了
     deleteUser(index) {
-      alert("这个功能还没做呢");
+      this.$confirm(
+        "确定要删除用户" + this.list[index].name + "吗?",
+        "删除用户",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }
+      )
+        .then(() => {
+          this.listLoading = true;
+          this.http.post(
+            this.port.manage.delete,
+            { userId: this.list[index].id },
+            res => {
+              this.listLoading = false;
+              if (res.code == "ok") {
+                this.$message({
+                  message: "删除成功",
+                  type: "success"
+                });
+                //重新读取列表
+                this.getUser();
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error"
+                });
+              }
+            },
+            error => {
+              this.listLoading = false;
+              this.$message({
+                message: error,
+                type: "error"
+              });
+            }
+          );
+        })
+        .catch(() => {});
     }
   },
+
   created() {
     let height = window.innerHeight;
     this.tableHeight = height - 195;

+ 159 - 172
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/statistics.vue

@@ -1,192 +1,179 @@
 <template>
-	<section>
-		<!--工具条-->
-		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-			<el-form :inline="true">
-				<el-form-item>
-					<el-date-picker v-model="date" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change='getList' :clearable="false" type="date" placeholder="选择日期"></el-date-picker>
-				</el-form-item>
-				<el-form-item style="float:right;">
-                    <el-link type="primary" :underline="false" @click="handleAdd">异常申请</el-link>
-				</el-form-item>
-			</el-form>
-		</el-col>
+  <section>
+    <!--工具条-->
+    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+      <el-form :inline="true">
+        <el-form-item>
+          <el-date-picker
+            v-model="date"
+            :editable="false"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            @change="getList"
+            :clearable="false"
+            type="date"
+            placeholder="选择日期"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item style="float:right;">
+          <el-link type="primary" :underline="false" @click="handleAdd">异常申请</el-link>
+        </el-form-item>
+      </el-form>
+    </el-col>
 
-		<!--列表-->
-		<el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
-			<el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="projectName" label="姓名" width="140" sortable></el-table-column>
-            <el-table-column prop="ownerCompanyName" label="手机" width="180"></el-table-column>
-            <el-table-column prop="customCompaniesStr" label="编程"></el-table-column>
-            <el-table-column prop="manager" label="设计" sortable></el-table-column>
-            <el-table-column prop="manager" label="办公" sortable></el-table-column>
-            <el-table-column prop="manager" label="娱乐" sortable></el-table-column>
-            <el-table-column prop="manager" label="浏览" sortable></el-table-column>
-			<el-table-column prop="indate" label="总时长" width="180" sortable></el-table-column>
-		</el-table>
+    <!--列表-->
+    <el-table
+      :data="list"
+      highlight-current-row
+      v-loading="listLoading"
+      :height="tableHeight"
+      style="width: 100%;"
+    >
+      <el-table-column type="index" width="60"></el-table-column>
+      <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
+      <el-table-column prop="phone" label="手机" width="180"></el-table-column>
+      <!-- 这里数胡乱写进去的 后续需要重新约定数字代表的意义 -->
+      <el-table-column prop="statistics[0]" label="编程"></el-table-column>
+      <el-table-column prop="statistics[1]" label="设计" sortable></el-table-column>
+      <el-table-column prop="statistics[2]" label="办公" sortable></el-table-column>
+      <el-table-column prop="statistics[3]" label="娱乐" sortable></el-table-column>
+      <el-table-column prop="statistics[4]" label="浏览" sortable></el-table-column>
+      <el-table-column prop="sum" label="总时长" width="180" sortable></el-table-column>
+    </el-table>
 
-		<!--工具条-->
-		<el-col :span="24" class="toolbar">
-			<el-pagination
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :page-sizes="[20 , 50 , 80 , 100]"
-                :page-size="20"
-                layout="total, sizes, prev, pager, next"
-                :total="total"
-                style="float:right;">
-            </el-pagination>
-		</el-col>
+    <!--工具条-->
+    <el-col :span="24" class="toolbar">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :page-sizes="[20 , 50 , 80 , 100]"
+        :page-size="20"
+        layout="total, sizes, prev, pager, next"
+        :total="total"
+        style="float:right;"
+      ></el-pagination>
+    </el-col>
 
-        <!--新增界面-->
-		<el-dialog title="异常申请列表" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-table :data="list" highlight-current-row v-loading="listLoading" height="400" style="width: 100%;">
-                <el-table-column type="index" width="60"></el-table-column>
-                <el-table-column prop="projectName" label="姓名" width="140" sortable></el-table-column>
-                <el-table-column prop="indate" label="工作时长" width="100" sortable></el-table-column>
-                <el-table-column prop="indate" label="异常原因" width="180" sortable></el-table-column>
-                <el-table-column prop="indate" label="时间" sortable></el-table-column>
-            </el-table>
-			<div slot="footer" class="dialog-footer">
-				<el-button @click.native="addFormVisible = false">取消</el-button>
-			</div>
-		</el-dialog>
-	</section>
+    <!--新增界面-->
+    <el-dialog
+      title="异常申请列表"
+      v-if="addFormVisible"
+      :visible.sync="addFormVisible"
+      :close-on-click-modal="false"
+      customClass="customWidth"
+    >
+      <el-table
+        :data="list"
+        highlight-current-row
+        v-loading="listLoading"
+        height="400"
+        style="width: 100%;"
+      >
+        <el-table-column type="index" width="60"></el-table-column>
+        <el-table-column prop="projectName" label="姓名" width="140" sortable></el-table-column>
+        <el-table-column prop="indate" label="工作时长" width="100" sortable></el-table-column>
+        <el-table-column prop="indate" label="异常原因" width="180" sortable></el-table-column>
+        <el-table-column prop="indate" label="时间" sortable></el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click.native="addFormVisible = false">取消</el-button>
+      </div>
+    </el-dialog>
+  </section>
 </template>
 
 <script>
-	import util from '../../common/js/util'
+import util from "../../common/js/util";
 
-	export default {
-		data() {
-			return {
-                user: JSON.parse(sessionStorage.getItem('user')),
+export default {
+  data() {
+    return {
+      user: JSON.parse(sessionStorage.getItem("user")),
 
-                date: new Date(),
+      date: null,
 
-                tableHeight: 0,
-                listLoading: false,
-				total: 0,
-                page: 1,
-                size: 20,
-                list: [],
-                
-                addFormVisible: false,
-				addLoading: false,
-			}
-		},
-		methods: {
-			//分页
-			handleCurrentChange(val) {
-				this.page = val;
-				this.getList();
-            },
+      tableHeight: 0,
+      listLoading: false,
+      total: 0,
+      page: 1,
+      size: 20,
+      list: [],
 
-            handleSizeChange(val) {
-                this.size = val;
-				this.getList();
-            },
-            
-			//获取项目列表
-			getList() {
-				this.listLoading = true;
-				this.http.post(this.port.project.projectList, {
-                    keyName: '',
-                    pageNum: this.page,
-                    pageSize: this.size,
-                }, res => {
-                    this.listLoading = false;
-                    if (res.code == "ok") {
-                        var list = res.data.list;
-                        for(var i in list){
-                            var customCompaniesStr = "";
-                            for(var j in list[i].customCompanies){
-                                if(j == list[i].customCompanies.length -1){
-                                    customCompaniesStr += list[i].customCompanies[j].companyName;
-                                } else {
-                                    customCompaniesStr += list[i].customCompanies[j].companyName + "、";
-                                }
-                            }
-                            list[i].customCompaniesStr = customCompaniesStr;
-                        }
-                        this.list = list;
-                        this.total = res.data.total;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
+      addFormVisible: false,
+      addLoading: false
+    };
+  },
+  methods: {
+    //分页
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getList();
+    },
 
-            //显示新增界面
-			handleAdd() {
-                this.getUnusual();
-				this.addFormVisible = true;
-            },
-
-            // 获取异常列表
-            getUnusual() {
-                this.listLoading = true;
-				this.http.post(this.port.project.projectList, {
-                    keyName: '',
-                    pageNum: this.page,
-                    pageSize: this.size,
-                }, res => {
-                    this.listLoading = false;
-                    if (res.code == "ok") {
-                        var list = res.data.list;
-                        for(var i in list){
-                            var customCompaniesStr = "";
-                            for(var j in list[i].customCompanies){
-                                if(j == list[i].customCompanies.length -1){
-                                    customCompaniesStr += list[i].customCompanies[j].companyName;
-                                } else {
-                                    customCompaniesStr += list[i].customCompanies[j].companyName + "、";
-                                }
-                            }
-                            list[i].customCompaniesStr = customCompaniesStr;
-                        }
-                        this.list = list;
-                        this.total = res.data.total;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
+    handleSizeChange(val) {
+      this.size = val;
+      this.getList();
+    },
 
+    //获取统计列表
+    getList() {
+      this.listLoading = true;
+      this.http.post(
+        this.port.time.listStatistics,
+        {
+          date: this.date
         },
-        created() {
-            let height = window.innerHeight;
-            this.tableHeight = height - 195;
-            const that = this;
-            window.onresize = function temp() {
-                that.tableHeight = window.innerHeight - 195;    
-            };
+        res => {
+          this.listLoading = false;
+          if (res.code == "ok") {
+            this.list = res.data;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
         },
-		mounted() {
-            // this.getList();
-		}
-	}
+        error => {
+          this.listLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
+
+    //显示新增界面
+    handleAdd() {
+      this.getUnusual();
+      this.addFormVisible = true;
+    },
 
+    //获取异常列表
+    getUnusual() {}
+  },
+  created() {
+    let height = window.innerHeight;
+    this.tableHeight = height - 195;
+    const that = this;
+    window.onresize = function temp() {
+      that.tableHeight = window.innerHeight - 195;
+    };
+  },
+  mounted() {
+    //第一次处理时间
+    let tempDate = new Date();
+    this.date =
+      tempDate.getFullYear() +
+      "-" +
+      (tempDate.getMonth() + 1) +
+      "-" +
+      tempDate.getDate();
+    this.getList();
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-
 </style>