修改数字建考勤相关BUG

dev_xd
lj7788@126.com 2025-06-26 14:49:00 +08:00
parent 51f31be16f
commit 0b9853268b
6 changed files with 196 additions and 176 deletions

View File

@ -2,32 +2,17 @@
<div class="project-labor main-page">
<el-col :span="6" class="h100">
<module-one-1-1 label="劳务人员概况" class="labor-base">
<img src="images/icon2001.png" class="img-openwin" v-if="attendanceTotal > 0" @click="doShowAttendanceDetail" />
<div class="attendance-info warning-info">
<div class="attendance-info-title warning-info-title">
<div
:class="attendanceNav == 0 ? 'active' : ''"
@click="doAttendanceNav(0, '在岗人员')"
>
在岗人员
</div>
<div
:class="attendanceNav == 1 ? 'active' : ''"
@click="doAttendanceNav(1, '今日出勤')"
>
今日出勤
</div>
<div :class="attendanceNav == 0 ? 'active' : ''" @click="doAttendanceNav(0, '在岗人员')">在岗人员</div>
<div :class="attendanceNav == 1 ? 'active' : ''" @click="doAttendanceNav(1, '今日出勤')">今日出勤</div>
</div>
<el-row>
<el-col :span="8" class="attendance-tag">
<div class="survey_content">
<div class="survey_content_img">
<img
:src="
attendanceNav == 0
? 'images/survey_icon_4.png'
: 'images/survey_icon_5.png'
"
/>
<img :src="attendanceNav == 0 ? 'images/survey_icon_4.png' : 'images/survey_icon_5.png'" />
</div>
</div>
<div class="survey_content_number labour-survey_content_number">
@ -38,97 +23,44 @@
</div>
</el-col>
<el-col :span="16">
<staffSurveyChart
:key="chartKey"
:height="
$dpi() == '1K' ? '220px' : $dpi() == '2K' ? '330px' : '550px'
"
:data="attendanceData"
:width="140"
></staffSurveyChart>
<staffSurveyChart :key="chartKey" :height="$dpi() == '1K' ? '220px' : $dpi() == '2K' ? '330px' : '550px'" :data="attendanceData" :width="140"></staffSurveyChart>
</el-col>
</el-row>
</div>
</module-one-1-1>
<module-one-1-1 label="劳务人员七天出勤趋势" class="labor-week-att">
<my-chart
:key="chartKey"
id="prj_labor_chart2"
width="100%"
height="calc(100% - 40px)"
:render="renderChart2"
></my-chart>
<my-chart :key="chartKey" id="prj_labor_chart2" width="100%" height="calc(100% - 40px)" :render="renderChart2"></my-chart>
</module-one-1-1>
<module-one-1-1 label="劳务人员年龄分布">
<my-chart
:key="chartKey"
id="prj_labor_chart3"
width="100%"
height="calc(100% - 0px)"
:render="renderChart3"
></my-chart>
<my-chart :key="chartKey" id="prj_labor_chart3" width="100%" height="calc(100% - 0px)" :render="renderChart3"></my-chart>
</module-one-1-1>
</el-col>
<el-col :span="12" class="h100">
<module-one-2-2 label class="no-title no-border">
<my-chart
:key="chartKey"
id="prj-labor-map"
width="100%"
height="100%"
:render="renderMap"
></my-chart>
<my-chart :key="chartKey" id="prj-labor-map" width="100%" height="100%" :render="renderMap"></my-chart>
</module-one-2-2>
<module-one-1-2 label="实时进出" class="prj-labor-real">
<div class="real-item" v-for="(item, index) in realList" :key="index">
<div class="real-item-type" :class="'is-' + item.inOutType">
{{ item.inOutType === "out" ? "出" : "进" }}
</div>
<el-image
class="real-item-img"
fit="cover"
:src="item.img"
:preview-src-list="[item.img]"
></el-image>
<el-image class="real-item-img" fit="cover" :src="item.img" :preview-src-list="[item.img]"></el-image>
<div class="real-item-name">{{ item.name }}</div>
<div class="real-item-work-type">
<span>{{ item.workType }}</span>
</div>
<div class="real-item-time">
<span
>{{ item.inOutType === "in" ? "进场时间:" : "出场时间:" }}
{{ item.inoutDate }}</span
>
<span>{{ item.inOutType === "in" ? "进场时间:" : "出场时间:" }} {{ item.inoutDate }}</span>
</div>
</div>
</module-one-1-2>
</el-col>
<el-col :span="6" class="h100">
<module-one-1-1
label="工种占比分布"
class="chart-module4"
:key="chartKey"
>
<project-overview-chart
:htmlShow="true"
:key="'ai4' + chartKey"
:sp="''"
:fn="changeChart4"
:maintitle="workerTotal"
:legend-opt="legendOpt"
:typedata="workerGroupList"
:text="'总人数'"
:height="chart4Height"
></project-overview-chart>
<module-one-1-1 label="工种占比分布" class="chart-module4" :key="chartKey">
<project-overview-chart :htmlShow="true" :key="'ai4' + chartKey" :sp="''" :fn="changeChart4" :maintitle="workerTotal" :legend-opt="legendOpt" :typedata="workerGroupList" :text="'总人数'" :height="chart4Height"></project-overview-chart>
</module-one-1-1>
<module-one-1-1 label="人员地区分布">
<my-chart
:key="chartKey"
id="prj_labor_chart5"
width="100%"
height="100%"
:render="renderChart5"
></my-chart>
<my-chart :key="chartKey" id="prj_labor_chart5" width="100%" height="100%" :render="renderChart5"></my-chart>
</module-one-1-1>
<module-one-1-1 label="人员预警" class="prj-labor-alert">
<div class="alert-list scroll">
@ -151,14 +83,20 @@
</div>
</module-one-1-1>
</el-col>
<attendanceInfoDlg ref="attDlg"></attendanceInfoDlg>
<jh-attendance-detail-dialog ref="jhAttDlg"></jh-attendance-detail-dialog>
<jh-job-worker-dialog ref="jhJobWorkerDlg"></jh-job-worker-dialog>
</div>
</template>
<script>
import attendanceInfoDlg from './detail/attendanceInfoDlg.vue'
import jhAttendanceDetailDialog from './detail/AttendanceDetailDialog.vue'
import jhJobWorkerDialog from './detail/JobWorkerDialog.vue'
import debounce from "lodash.debounce";
import staffSurveyChart from "@/components/staffSurveyChart.vue";
export default {
components: { staffSurveyChart },
components: { staffSurveyChart,attendanceInfoDlg,jhAttendanceDetailDialog,jhJobWorkerDialog },
data() {
return {
dpi: "",
@ -185,6 +123,36 @@ export default {
};
},
methods: {
doShowAttendanceDetail() {
if (this.prjInfo.vendorsCode == "uni") {
this.$refs.attDlg.showDialog({
prjInfo: this.prjInfo,
attendanceData: this.attendanceData,
type: this.attendanceNav,
});
} else {
let data = {
deptId: this.prjInfo.deptId || 0,
projectId: this.prjInfo.id || 0,
attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD"),
};
if (this.attendanceNav === 1) {
this.$refs.jhAttDlg.showDialog(data);
} else {
this.$refs.jhJobWorkerDlg.showDialog({
...data,
type: this.attendanceNav,
total: this.attendanceTotal,
datas: this.attendanceData.map((it) => {
return {
text: it.text.replace("总包人员", "101").replace("监理人员", "102").replace("劳务人员", "103"),
cnt: it.value,
};
}),
});
}
}
},
changeChart4(opt) {
if (this.$dpi() == "1K") {
opt.legend[0].left = 200;
@ -246,13 +214,22 @@ export default {
if (!this.selProject) {
return;
}
this.$api.project.getProjectInfo(this.selProject.id).then((d) => {
this.prjInfo = d.data || {};
if (this.prjInfo.vendorsCode == "jgw") {
this.prjInfo.vendorsCode = "uni";
}
this.doInit();
});
},
doInit() {
this.loadAttendanceData();
this.getGroupByWorker();
this.groupAttendanceLastWeek();
this.getWorkerCountGroupByType();
this.getRealAttendance();
this.getAttendanceAlert();
setTimeout(this.init, 3 * 60 * 1000);
setTimeout(this.doInit, 3 * 60 * 1000);
},
resize() {
let is1K = this.$dpi() == "1K";
@ -262,93 +239,77 @@ export default {
this.chartKey++;
},
getAttendanceAlert() {
this.$api.labor
.getAttendanceAlert(this.selProject.vendorsCode, this.selProject.id)
.then((d) => {
this.alertList = d.data.map((it) => {
return it;
});
this.$api.labor.getAttendanceAlert(this.selProject.vendorsCode, this.selProject.id).then((d) => {
this.alertList = d.data.map((it) => {
return it;
});
});
},
getRealAttendance() {
this.$api.labor
.getRealAttendance(this.selProject.vendorsCode, this.selProject.id)
.then((d) => {
this.realList = d.data.map((it) => {
it.name = it.workerName || it.userName;
it.workType = it.workTypeName || it.subDeptGroupName;
it.img = it.scanPhoto || it.inPhoto || it.outPhoto;
if (it.outTime) {
it.inOutType = "out";
it.inoutDate = it.outTime;
} else if (it.inTime) {
it.inOutType = "in";
it.inoutDate = it.inTime;
} else if (it.attendanceOutTime) {
it.inOutType = "out";
it.inoutDate = it.attendanceOutTime;
} else {
it.inOutType = "in";
it.inoutDate = it.attendanceTime;
}
return it;
});
this.$api.labor.getRealAttendance(this.selProject.vendorsCode, this.selProject.id).then((d) => {
this.realList = d.data.map((it) => {
it.name = it.workerName || it.userName;
it.workType = it.workTypeName || it.subDeptGroupName;
it.img = it.scanPhoto || it.inPhoto || it.outPhoto;
if (it.outTime) {
it.inOutType = "out";
it.inoutDate = it.outTime;
} else if (it.inTime) {
it.inOutType = "in";
it.inoutDate = it.inTime;
} else if (it.attendanceOutTime) {
it.inOutType = "out";
it.inoutDate = it.attendanceOutTime;
} else {
it.inOutType = "in";
it.inoutDate = it.attendanceTime;
}
return it;
});
});
},
getWorkerCountGroupByType() {
this.$api.labor
.getWorkerCountGroupByType(
this.selProject.vendorsCode,
this.selProject.id
)
.then((d) => {
let sum = 0;
d.data.forEach((item) => {
item.id = item.id || item.comId;
sum += item.id ? item.id : 0;
});
this.workerTotal = sum;
this.workerGroupList = d.data.map((item) => {
return {
name: item.workTypeName || item.craftPostName,
value: item.id ? item.id : 0,
};
});
this.chartKey++;
this.$api.labor.getWorkerCountGroupByType(this.selProject.vendorsCode, this.selProject.id).then((d) => {
let sum = 0;
d.data.forEach((item) => {
item.id = item.id || item.comId;
sum += item.id ? item.id : 0;
});
this.workerTotal = sum;
this.workerGroupList = d.data.map((item) => {
return {
name: item.workTypeName || item.craftPostName,
value: item.id ? item.id : 0,
};
});
this.chartKey++;
});
},
groupAttendanceLastWeek() {
this.$api.labor
.groupAttendanceLastWeek(
this.selProject.vendorsCode,
this.selProject.id
)
.then((d) => {
this.weekData = d.data.map((it) => {
return {
name: it.dt.substring(5).replace("-", "."),
value: it.cnt,
};
});
this.chartKey++;
this.$api.labor.groupAttendanceLastWeek(this.selProject.vendorsCode, this.selProject.id).then((d) => {
this.weekData = d.data.map((it) => {
return {
name: it.dt.substring(5).replace("-", "."),
value: it.cnt,
};
});
this.chartKey++;
});
},
getGroupByWorker() {
this.$api.labor
.groupByWorker(this.selProject.vendorsCode, this.selProject.id)
.then((d) => {
this.nativeList = (d.data.native || []).map((it) => {
it.name = it.nativePlace;
it.value = it.count;
return it;
});
this.ageList = (d.data.age || []).map((it) => {
it.name = ["", "18~30", "30~40", "40~55", "55岁以上"][it.age];
it.value = it.count;
return it;
});
this.chartKey++;
this.$api.labor.groupByWorker(this.selProject.vendorsCode, this.selProject.id).then((d) => {
this.nativeList = (d.data.native || []).map((it) => {
it.name = it.nativePlace;
it.value = it.count;
return it;
});
this.ageList = (d.data.age || []).map((it) => {
it.name = ["", "18~30", "30~40", "40~55", "55岁以上"][it.age];
it.value = it.count;
return it;
});
this.chartKey++;
});
},
renderChart2(opt) {
let is1K = this.$dpi() == "1K";
@ -812,7 +773,7 @@ export default {
}
}
.real-item-img {
height: calc(100% - 60px);
height: calc(100% - 80px);
padding: 0px 40px;
.el-image__inner {
width: unset;

View File

@ -399,15 +399,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="groupAllByComany" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select ct.sub_type companyTypeId,count(1) id
from sur_project_attendance_user u, attendance_cfg c,
view_sur_project_attendance_group g,
pro_project_info sp,
sur_project_attendance_company_type ct
where u.cfgid=c.id and u.companyId=g.companyId and u.state=0 and c.project_id = sp.id
and u.vendors_code=ct.vendors_code and g.companyTypeId=ct.type_id
select g.companyTypeId,count(1) id
from sur_project_attendance_user u, attendance_cfg c,view_sur_project_attendance_group g,
pro_project_info sp
where u.cfgid=c.id and u.groupId=g.teamId and u.state=#{id} and c.project_id = sp.id
and sp.is_Del=0
and ct.sub_type in (0,1,2,3,4,5,6,8)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
<if test="projectId!=null and projectId>0">
and c.project_id=#{projectId}
</if>
@ -421,7 +418,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
group by ct.sub_type
group by g.companyTypeId
</select>
<select id="getHuazhuPage" parameterType="SurProjectAttendanceData" resultType="Long">

View File

@ -65,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.teamId,u.teamName,u.enterType,u.is_del,u.create_by,u.create_time,u.update_by,u.update_time,
c.project_id,c.dept_id,u.companyName,u.workTypeName,g.teamname groupName,g.companyName remark
FROM sur_project_attendance_user u,attendance_cfg c,sur_project_attendance_group g
WHERE u.cfgid=c.id AND g.companyid=u.companyid AND u.vendors_code='jgw'
WHERE u.cfgid=c.id AND u.groupId=g.teamId AND u.vendors_code='jgw'
<if test="companyTypeId!=null">
<if test="companyTypeId>100">
<if test="companyTypeId==101">
@ -289,7 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select u.companyId,u.companyName,u.`name`,u.recentPhoto,u.gender,u.birthDate,u.ethnic,u.nativePlace,u.phone,
u.workTypeName,u.specWorkType,u.groupName,g.companyTypeId,u.workTypeCode
from sur_project_attendance_user u
left join sur_project_attendance_group g on u.companyId = g.companyId and g.cfgid = u.cfgid
left join sur_project_attendance_group g on u.groupId=g.teamId and g.cfgid = u.cfgid
where u.cfgid=#{cfgid} and u.workerId=#{workerId}
</select>
@ -297,7 +297,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select u.companyId,g.companyName,u.`name`,u.recentPhoto,u.gender,u.birthDate,u.ethnic,u.nativePlace,u.phone,
u.workTypeName,u.specWorkType,u.groupName,g.companyTypeId,u.workTypeCode
from sur_project_attendance_user u
left join sur_project_attendance_group g on u.groupId = g.serverid and g.cfgid = u.cfgid
left join sur_project_attendance_group g on u.groupId=g.teamId and g.cfgid = u.cfgid
where u.cfgid=#{cfgid} and u.workerId=#{workerId} ORDER BY u.id desc LIMIT 1
</select>
@ -654,7 +654,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.project_id,b.dept_id,u.companyName,u.workTypeName,u.groupName,
b.project_id,b.dept_id, g.teamname remark,g.companyName degreeName
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info sp
WHERE u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and sp.is_Del=0 and b.project_id = sp.id
WHERE u.cfgid=b.id and u.state=0 and u.groupId=g.teamId and sp.is_Del=0 and b.project_id = sp.id
<if test="id==101">
and g.companyTypeId in (1,6)
</if>
@ -688,7 +688,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.project_id,b.dept_id,u.companyName,u.workTypeName,u.groupName,
b.project_id,b.dept_id, g.teamname remark,g.companyName degreeName,g.companyTypeId
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info sp
WHERE u.cfgid=b.id and u.companyId=g.companyId and sp.is_Del=0 and b.project_id = sp.id
WHERE u.cfgid=b.id and u.groupId=g.teamId and sp.is_Del=0 and b.project_id = sp.id
<if test="companyTypeId==101">
and g.companyTypeId in (1,6)
</if>
@ -710,7 +710,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="groupByWorkerOnDutyByDept" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT p.id, p.project_Name NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info p,sys_dept c
where u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.dept_id
where u.cfgid=b.id and u.state=0 and u.groupId=g.teamId and b.project_id=p.id and c.dept_id=b.dept_id
and p.is_Del=0
and g.companyTypeId in (1,6,0,2,3,4,5,8)
<if test="deptId!=null and deptId>0">
@ -760,7 +760,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="groupByWorkerByDept" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT p.id, p.project_Name NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info p,sys_dept c
where u.cfgid=b.id and u.state= #{state} and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.dept_id
where u.cfgid=b.id and u.state= #{state} and u.groupId=g.teamId and b.project_id=p.id and c.dept_id=b.dept_id
and p.is_Del=0
and g.companyTypeId in (1,6,0,2,3,4,5,8)
<if test="deptId!=null and deptId>0">
@ -786,7 +786,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.project_id,b.dept_id,u.companyName,u.workTypeName,u.groupName,
g.teamname remark,g.companyName degreeName
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info sp
WHERE u.cfgid=b.id and u.state=#{state} and u.companyId=g.companyId and sp.is_Del=0 and b.project_id = sp.id
WHERE u.cfgid=b.id and u.state=#{state} and u.groupId=g.teamId and sp.is_Del=0 and b.project_id = sp.id
<if test="id==101">
and g.companyTypeId in (1,6)
</if>

View File

@ -205,7 +205,7 @@ public class AttendanceSzjTask {
user.setExitDate(StringUtils.isEmpty(tmp)?null:DateUtil.formatDateTime( DateUtil.parse(tmp)));
user.setCompanyId(jo.getString("enterpriseId"));
user.setCompanyName(jo.getString("enterpriseName"));
user.setTeamId(jo.getInteger("roleType"));
user.setTeamId(jo.getInteger("id"));
user.setIdCardNo(jo.getString("idCardNo"));
user.setIdTypeName(jo.getString("idTypeName"));
user.setTeamName(jo.getString("role"));

View File

@ -0,0 +1,25 @@
package com.yanzhu.manage.controller;
import com.alibaba.fastjson2.JSONObject;
import com.yanzhu.common.core.web.controller.BaseController;
import com.yanzhu.common.core.web.domain.AjaxResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
*
*/
@RestController
@RequestMapping("/attendancePost")
public class AttendancePostController extends BaseController {
@PostMapping("/add")
public AjaxResult doAddAttendance(@RequestBody JSONObject json){
System.out.println(json.toString());
return AjaxResult.success();
}
}

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="/cdn/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
haha
<script>
window.addEventListener(
"message",
(data) => {
console.log("iframe->", data);
let postData={data:data.data};
let url = "http://localhost/dev-api/manage/attendancePost/add";
$.post({
url: url,
contentType: "application/json", // 设置内容类型为 JSON
data: JSON.stringify(postData), // 将数据转换为 JSON 字符串
success: function (response) {
// 处理成功响应
console.log("成功响应:", response);
},
error: function (xhr, status, error) {
// 处理错误响应
console.error("错误响应:", error);
},
});
},
false
);
</script>
</body>
</html>