From 425056ac132653a2aedfb9781db598b67c314fb4 Mon Sep 17 00:00:00 2001
From: churf <123456>
Date: Thu, 14 Sep 2023 04:02:11 +0000
Subject: [PATCH] 首页新增详细绩效图,任务日报新增日报提交输入检索
---
eladmin-web-master/src/views/dashboard/PanelGroup.vue | 93 +++++++++++++++++-
eladmin-web-master/src/views/home.vue | 2
eladmin-web-master/src/api/system/user.js | 9 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java | 6 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java | 128 ++++++++++++++++++-------
eladmin-web-master/src/views/task/taskDaliy/index.vue | 29 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java | 2
7 files changed, 222 insertions(+), 47 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
index 54b05c7..c04110f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
@@ -289,4 +289,10 @@
}
return new ResponseEntity<>(result,HttpStatus.OK);
}
+
+ @GetMapping("/getPerformanceDetail")
+ public ResponseEntity<Object> getPerformanceDetail(Long nextMonth) {
+ return new ResponseEntity<>(userService.getPerformanceDetail(nextMonth),HttpStatus.OK);
+
+ }
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
index f3a8db8..80532c3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
@@ -151,4 +151,6 @@
List<DeptAndUser> getUserDept();
Long[] getUserPidDept(Long id);
+
+ List<Map> getPerformanceDetail(Long nextMonth);
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
index 6de8d94..e57134f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -294,6 +294,62 @@
return list.toArray(new Long[list.size()]);
}
+ @Override
+ public List<Map> getPerformanceDetail(Long nextMonth) {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
+ //本月第一天
+ Calendar c = Calendar.getInstance();
+ c.add(Calendar.MONTH, 0);
+ c.set(Calendar.DAY_OF_MONTH, 1);
+ String todayMonth = df.format(c.getTime());
+ String nextMonth_ = df.format(new Date(nextMonth));
+ List<TaskDaliyMongo> daliyMongoList;
+ try {
+ daliyMongoList = mongoTemplate.find(Query.query(new Criteria("userId").is(SecurityUtils.getCurrentUserId()).and("fillDate").gte(new SimpleDateFormat("yyyy-MM-dd").parse(todayMonth)).lte(new SimpleDateFormat("yyyy-MM-dd").parse(nextMonth_))), TaskDaliyMongo.class);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ List<Map> resultList = new ArrayList<>();
+ for (TaskDaliyMongo taskDaliyMongo : daliyMongoList) {
+ String taskName = taskDaliyMongo.getTaskUserMongo().getTask().getName();
+ Double taskConsumeHours = taskDaliyMongo.getConsumedHours();
+ if (resultList.isEmpty()) {
+ Map map = new HashMap();
+ map.put("name", taskName);
+ map.put("value", taskConsumeHours);
+ resultList.add(map);
+ continue;
+ }
+ findList(resultList, taskName, taskConsumeHours);
+ }
+ return resultList;
+ }
+
+ /*
+ 方法作用:
+ 遍历resultList 集合将集合中的元素逐个遍历,如果有元素与当前任务的任务名称相等
+ 如果任务名称相等,取出当前元素并且将当前任务的消耗工时添加进元素中
+ */
+ private static void findList(List<Map> resultList, String taskName, Double taskConsumeHours) {
+ boolean flag = false;
+ for (Map map : resultList) {
+ if (map.get("name").equals(taskName)) {
+ // 有
+ Double value = (Double) map.get("value");
+ value += taskConsumeHours;
+ map.put("value", value);
+ flag = true;
+ }
+ }
+ // 无
+ if (!flag) {
+ Map newMap = new HashMap();
+ newMap.put("name", taskName);
+ newMap.put("value", taskConsumeHours);
+ resultList.add(newMap);
+ }
+ }
+
private ArrayList<Long> getPidNode(ArrayList<Long> list, Long deptId_leaf) {
Long pidId = deptRepository.findPidIdByDeptId(deptId_leaf);
if (pidId != null) {
@@ -478,15 +534,15 @@
//查询日志表
List<TaskDaliyMongo> taskDaliyList = mongoTemplate.find(Query.query(new Criteria("userId").is(userId).and("fillDate").gte(startDate).lte(endDate)), TaskDaliyMongo.class);
- Map<String,Double> map = new HashMap<>();
+ Map<String, Double> map = new HashMap<>();
for (TaskDaliyMongo taskDaliy : taskDaliyList) {
if (map.get(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate())) != null) {
// 如果已经有了
Double todayHours = map.get(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()));
todayHours += taskDaliy.getConsumedHours();
- map.put(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()),todayHours);
+ map.put(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()), todayHours);
} else {
- map.put(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()),taskDaliy.getConsumedHours());
+ map.put(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours());
}
}
for (Map.Entry<String, Double> entry : map.entrySet()) {
@@ -494,48 +550,48 @@
if (entry.getValue() >= 8) {
calendarVo.setDate(entry.getKey());
calendarVo.setIsOk(true);
- calendarVo.setTitle("工时:"+entry.getValue());
+ calendarVo.setTitle("工时:" + entry.getValue());
calendarVo.setType(2);
} else {
calendarVo.setDate(entry.getKey());
calendarVo.setIsOk(false);
- calendarVo.setTitle("已填工时:"+entry.getValue()+" 不足8小时,请补充日报");
+ calendarVo.setTitle("已填工时:" + entry.getValue() + " 不足8小时,请补充日报");
calendarVo.setType(2);
}
calendarInfo.add(calendarVo);
}
- for (String date : dateList) {
- String type1 = "";
- String type2 = "";
- System.out.println(date);
- CalendarVo dailyVo = new CalendarVo();
- if (map.get(date) != null) {
- // 如果在map中找到了它的值,说明用户填写过日报
- continue;
- }
- dailyVo.setDate(date);
- for (Attendance attendanceRecord : attendanceList) {
- type1 = attendanceRecord.getStartClockResults();
- type2 = attendanceRecord.getEndClockResults();
- date = date.substring(0, 10);
- if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_LEAVE) && type2.equals(Constant.ATTENDANCE_STATE_LEAVE)) {
- dailyVo.setTitle("请假");
- dailyVo.setIsOk(true);
- } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_BUSINESS) && type2.equals(Constant.ATTENDANCE_STATE_BUSINESS)) {
- dailyVo.setTitle("出差");
- dailyVo.setIsOk(true);
- } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_REST) && type2.equals(Constant.ATTENDANCE_STATE_REST)) {
- dailyVo.setTitle("休息");
- dailyVo.setIsOk(true);
- } else if (date.equals(df.format(attendanceRecord.getAttendanceDate()))) {
- dailyVo.setTitle("日报未填写,请补充日报");
- dailyVo.setIsOk(false);
- }
- }
- dailyVo.setType(2);
- calendarInfo.add(dailyVo);
+ for (String date : dateList) {
+ String type1 = "";
+ String type2 = "";
+ System.out.println(date);
+ CalendarVo dailyVo = new CalendarVo();
+ if (map.get(date) != null) {
+ // 如果在map中找到了它的值,说明用户填写过日报
+ continue;
}
+ dailyVo.setDate(date);
+ for (Attendance attendanceRecord : attendanceList) {
+ type1 = attendanceRecord.getStartClockResults();
+ type2 = attendanceRecord.getEndClockResults();
+ date = date.substring(0, 10);
+ if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_LEAVE) && type2.equals(Constant.ATTENDANCE_STATE_LEAVE)) {
+ dailyVo.setTitle("请假");
+ dailyVo.setIsOk(true);
+ } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_BUSINESS) && type2.equals(Constant.ATTENDANCE_STATE_BUSINESS)) {
+ dailyVo.setTitle("出差");
+ dailyVo.setIsOk(true);
+ } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_REST) && type2.equals(Constant.ATTENDANCE_STATE_REST)) {
+ dailyVo.setTitle("休息");
+ dailyVo.setIsOk(true);
+ } else if (date.equals(df.format(attendanceRecord.getAttendanceDate()))) {
+ dailyVo.setTitle("日报未填写,请补充日报");
+ dailyVo.setIsOk(false);
+ }
+ }
+ dailyVo.setType(2);
+ calendarInfo.add(dailyVo);
+ }
return calendarInfo;
}
@@ -724,7 +780,7 @@
Double completedWork = 0D;
List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find(Query.query(new Criteria("userId").is(SecurityUtils.getCurrentUserId()).and("fillDate").gte(new SimpleDateFormat("yyyy-MM-dd").parse(startTime)).lte(new SimpleDateFormat("yyyy-MM-dd").parse(endTime))), TaskDaliyMongo.class);
for (TaskDaliyMongo taskDaliyMongo : daliyMongoList) {
- if (taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")){
+ if (taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")) {
// 绩效任务
if (taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours()) {
// 如果当前的绩效任务中,用户填写的日报超出了绩效时长就以绩效任务中绩效时长为准
diff --git a/eladmin-web-master/src/api/system/user.js b/eladmin-web-master/src/api/system/user.js
index c3ca52c..ea38b07 100644
--- a/eladmin-web-master/src/api/system/user.js
+++ b/eladmin-web-master/src/api/system/user.js
@@ -123,4 +123,11 @@
})
}
-export default { getAll, add, edit, del, get, getApprovalUsers, getUserCalendarInfo, getUserBaseInfo, getByDept, getProjectUser, getUserDept, getUserPidDept }
+export function getPerformanceDetail(param) {
+ return request({
+ url: 'api/users/getPerformanceDetail?nextMonth=' + param,
+ method: 'get'
+ })
+}
+
+export default { getAll, add, edit, del, get, getApprovalUsers, getUserCalendarInfo, getUserBaseInfo, getByDept, getProjectUser, getUserDept, getUserPidDept, getPerformanceDetail }
diff --git a/eladmin-web-master/src/views/dashboard/PanelGroup.vue b/eladmin-web-master/src/views/dashboard/PanelGroup.vue
index d652698..f59f183 100644
--- a/eladmin-web-master/src/views/dashboard/PanelGroup.vue
+++ b/eladmin-web-master/src/views/dashboard/PanelGroup.vue
@@ -55,18 +55,32 @@
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
- <div class="card-panel">
- <div class="card-panel-icon-wrapper icon-timings">
- <svg-icon icon-class="timing" class-name="card-panel-icon" />
+ <el-tooltip class="item" effect="dark" placement="top" :open-delay="3000" style="cursor:pointer">
+ <div slot="content" class="slot-style">
+ <h4 style="cursor: pointer;" @click="showPerformanceDetail">详细绩效</h4>
</div>
- <div class="card-panel-description">
- <div class="card-panel-text">
- 当月绩效时长
+ <div class="card-panel">
+ <div class="card-panel-icon-wrapper icon-timings">
+ <svg-icon icon-class="timing" class-name="card-panel-icon" />
</div>
- <count-to :start-val="0" :end-val="userInfo.achievementsTime" :decimals="2" :duration="3600" class="card-panel-num" />
+ <div class="card-panel-description">
+ <div class="card-panel-text">
+ 当月绩效时长
+ </div>
+ <count-to :start-val="0" :end-val="userInfo.achievementsTime" :decimals="2" :duration="3600" class="card-panel-num" />
+ </div>
</div>
- </div>
+ </el-tooltip>
</el-col>
+ <el-dialog
+ title="详细绩效"
+ :visible.sync="centerDialogVisible"
+ width="50%"
+ center
+ @opened="showPerformanceDetail"
+ >
+ <div id="container" style="height: 400px;overflow: auto;" />
+ </el-dialog>
<el-col :xs="12" :sm="12" :lg="30" class="card-panel-col">
<div class="card-panel" style="display: flex;justify-content: right">
<div style="width: 100%;padding-top: 30px;">
@@ -83,6 +97,7 @@
</div>
<div style="width: 100%;padding-top: 30px;">
<el-statistic
+ v-if="meritWageList[2]"
format="DD天HH小时mm分钟"
:value="meritWageList[2]"
time-indices
@@ -96,6 +111,8 @@
<script>
import CountTo from 'vue-count-to'
+import crudUser from '@/api/system/user'
+import * as echarts from 'echarts'
export default {
components: {
CountTo
@@ -110,9 +127,69 @@
required: true
}
},
+ data() {
+ return {
+ centerDialogVisible: false
+ }
+ },
methods: {
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
+ },
+ showPerformanceDetail() {
+ // 查看当前用户这个月参与和完成了那些任务?并且其中那些任务的任务工时是在任务的绩效时间中的,那些超出
+ crudUser.getPerformanceDetail(this.meritWageList[2]).then(res => {
+ this.centerDialogVisible = true
+ var dom = document.getElementById('container')
+ var myChart = echarts.init(dom, null, {
+ renderer: 'canvas',
+ useDirtyRect: false
+ })
+ var option
+ option = {
+ tooltip: {
+ trigger: 'item'
+ },
+ legend: {
+ top: '5%',
+ left: 'center'
+ },
+ series: [
+ {
+ name: '当月完成工时',
+ type: 'pie',
+ radius: ['40%', '70%'],
+ avoidLabelOverlap: false,
+ itemStyle: {
+ borderRadius: 10,
+ borderColor: '#fff',
+ borderWidth: 2
+ },
+ label: {
+ show: false,
+ position: 'right'
+ },
+ emphasis: {
+ label: {
+ show: true,
+ fontSize: 15,
+ fontWeight: 'bold'
+ }
+ },
+ labelLine: {
+ show: false
+ },
+ data: []
+ }
+ ]
+ }
+ option.series[0].data = res
+ if (option && typeof option === 'object') {
+ myChart.setOption(option)
+ }
+
+ window.addEventListener('resize', myChart.resize)
+ })
}
}
}
diff --git a/eladmin-web-master/src/views/home.vue b/eladmin-web-master/src/views/home.vue
index 13aec7e..ea82592 100644
--- a/eladmin-web-master/src/views/home.vue
+++ b/eladmin-web-master/src/views/home.vue
@@ -204,13 +204,11 @@
this.meritWageList = []
crudMeritWage.getMeritWageDetail(this.userInfo.achievementsTime, new Date(this.yearMonth).getTime()).then(res => {
for (var key in res) {
- console.log(res)
this.meritWageList.push('距离' + key + '级业绩标准还有:')
this.meritWageList.push(Number(res[key]))
this.meritWageList.push(dateObject.getTime())
this.meritWageList.push(res.money + '元')
}
- console.log(this.meritWageList)
})
})
},
diff --git a/eladmin-web-master/src/views/task/taskDaliy/index.vue b/eladmin-web-master/src/views/task/taskDaliy/index.vue
index 9b0bbb2..bc4fdd5 100644
--- a/eladmin-web-master/src/views/task/taskDaliy/index.vue
+++ b/eladmin-web-master/src/views/task/taskDaliy/index.vue
@@ -619,6 +619,35 @@
}
},
checkForm(flag) {
+ if (this.form.taskUserMongo.id === undefined) {
+ this.$message({
+ showClose: true,
+ message: '任务进度不能为空',
+ type: 'error'
+ })
+ return
+ } else if (this.form.fillDate === undefined) {
+ this.$message({
+ showClose: true,
+ message: '分配任务不能为空',
+ type: 'error'
+ })
+ return
+ } else if (this.form.consumedHours === undefined || this.form.consumedHours === 0) {
+ this.$message({
+ showClose: true,
+ message: '请填写任务时长',
+ type: 'error'
+ })
+ return
+ } else if (this.form.taskProgress === undefined) {
+ this.$message({
+ showClose: true,
+ message: '填写日期不能为空',
+ type: 'error'
+ })
+ return
+ }
crudTaskDaliy.checkTaskHours({ 'taskProgress': this.form.taskProgress, 'taskUserId': this.form.taskUserMongo.id, 'fillDate': this.form.fillDate }).then(res => {
if (res === false && !this.confirmProgress) {
flag++
--
Gitblit v1.9.3