劳务管理大屏
parent
d37d9e4966
commit
5f48623204
|
@ -174,6 +174,7 @@ export default {
|
|||
legend: [
|
||||
{
|
||||
right: 10,
|
||||
|
||||
data: legendData,
|
||||
align: 'left',
|
||||
...opt,
|
||||
|
|
|
@ -44,14 +44,57 @@
|
|||
<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>
|
||||
</module-one-2-2>
|
||||
<module-one-1-2 label="实时进出" class="prj-plan"></module-one-1-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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</module-one-1-2>
|
||||
</el-col>
|
||||
<el-col :span="6" class="h100">
|
||||
<module-one-1-1 label="工种占比分布"></module-one-1-1>
|
||||
<module-one-1-1 label="工种占比分布" class="chart-module4">
|
||||
<project-overview-chart
|
||||
:htmlShow="true"
|
||||
:key="'ai4' + overview+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>
|
||||
</module-one-1-1>
|
||||
<module-one-1-1 label="人员预期"></module-one-1-1>
|
||||
<module-one-1-1 label="人员预警" class="prj-labor-alert">
|
||||
<div class="alert-list scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>姓名</th>
|
||||
<th>单位</th>
|
||||
<th>缺勤天数</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in alertList" :key="index">
|
||||
<td>{{ item.name }}</td>
|
||||
<td>{{ item.companyName }}</td>
|
||||
<td>{{ item.id }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</module-one-1-1>
|
||||
</el-col>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -65,6 +108,8 @@ export default {
|
|||
return {
|
||||
dpi: '',
|
||||
chartKey: 0,
|
||||
chart4Height: 230,
|
||||
chart2Height: 230,
|
||||
selProject: null,
|
||||
attendanceNav: 0,
|
||||
attendanceTotal: 0,
|
||||
|
@ -73,12 +118,74 @@ export default {
|
|||
{ text: '特殊工种', value: 0, id: 0 },
|
||||
{ text: '管理人员', value: 0, id: 0 },
|
||||
],
|
||||
legendOpt: {},
|
||||
overviewDatas: [],
|
||||
nativeList: [],
|
||||
ageList: [],
|
||||
weekData: [],
|
||||
workerTotal: 0,
|
||||
workerGroupList: [],
|
||||
realList: [],
|
||||
alertList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeChart4(opt) {
|
||||
if (this.$dpi() == '1K') {
|
||||
opt.legend[0].left = 200
|
||||
return opt
|
||||
} else if (this.$dpi() == '2K') {
|
||||
opt.legend[0].left = 360
|
||||
return opt
|
||||
} else {
|
||||
opt.legend[0].left = 500
|
||||
return opt
|
||||
}
|
||||
},
|
||||
setOpts() {
|
||||
let is1K = this.$dpi() == '1K'
|
||||
let is2K = this.$dpi() == '2K'
|
||||
this.legendOpt = {
|
||||
icon: 'rect',
|
||||
orient: 'vertical',
|
||||
itemWidth: '50%',
|
||||
left: 240,
|
||||
right: '10%',
|
||||
itemWidth: 20,
|
||||
itemGap: 20,
|
||||
itemHeight: 20,
|
||||
type: 'scroll',
|
||||
pageTextStyle: {
|
||||
color: '#c3dbfd',
|
||||
},
|
||||
scroll: {
|
||||
y: is1K ? 300 : is2K ? 500 : 600,
|
||||
bar: {
|
||||
show: true,
|
||||
width: 5,
|
||||
height: 10,
|
||||
},
|
||||
},
|
||||
textStyle: {
|
||||
padding: [0, 0, 0, 0],
|
||||
fontSize: is1K ? 10 : is2K ? 14 : 16,
|
||||
color: '#c3dbfd',
|
||||
align: 'center',
|
||||
rich: {
|
||||
name: {
|
||||
fontSize: is1K ? 10 : is2K ? 14 : 16,
|
||||
color: '#c3dbfd',
|
||||
padding: [5, 2, 5, 2],
|
||||
},
|
||||
percent: {
|
||||
fontSize: is1K ? 10 : is2K ? 14 : 16,
|
||||
color: '#4676FD',
|
||||
padding: [0, 2, 0, 2],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
init() {
|
||||
if (!this.selProject) {
|
||||
return
|
||||
|
@ -86,6 +193,55 @@ export default {
|
|||
this.loadAttendanceData()
|
||||
this.getGroupByWorker()
|
||||
this.groupAttendanceLastWeek()
|
||||
this.getWorkerCountGroupByType()
|
||||
this.getRealAttendance()
|
||||
this.getAttendanceAlert()
|
||||
},
|
||||
resize() {
|
||||
let is1K = this.$dpi() == '1K'
|
||||
let is2K = this.$dpi() == '2K'
|
||||
this.chart4Height = is1K ? 230 : is2K ? 360 : 595
|
||||
this.chart2Height = is1K ? 567 : is2K ? 800 : 1250
|
||||
this.chartKey++
|
||||
},
|
||||
getAttendanceAlert() {
|
||||
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.workType = it.workTypeName
|
||||
it.img = it.scanPhoto
|
||||
if (it.attendanceOutTime) {
|
||||
it.inOutType = 'out'
|
||||
it.inoutDate = it.attendanceInTime
|
||||
} 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) => {
|
||||
sum += item.id ? item.id : 0
|
||||
})
|
||||
this.workerTotal = sum
|
||||
this.workerGroupList = d.data.map((item) => {
|
||||
return {
|
||||
name: item.workTypeName,
|
||||
value: item.id ? item.id : 0,
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
groupAttendanceLastWeek() {
|
||||
this.$api.labor.groupAttendanceLastWeek(this.selProject.vendorsCode, this.selProject.id).then((d) => {
|
||||
|
@ -506,12 +662,93 @@ export default {
|
|||
window.addEventListener('resize', () => {
|
||||
if (this.dpi != this.$dpi()) {
|
||||
this.dpi = this.$dpi()
|
||||
this.chartKey++
|
||||
this.resize()
|
||||
}
|
||||
})
|
||||
this.setOpts()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="less">
|
||||
.project-labor {
|
||||
.chart-module4 {
|
||||
.chart-gif {
|
||||
left: 50px;
|
||||
}
|
||||
.chart-text {
|
||||
top: 63px;
|
||||
left: 50px;
|
||||
}
|
||||
}
|
||||
.prj-labor-real {
|
||||
.module-ctx {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
font-size: 12px;
|
||||
.real-item {
|
||||
height: 100%;
|
||||
width: 25%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
.real-item-type {
|
||||
position: absolute;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
z-index: 10;
|
||||
&.is-in {
|
||||
color: #00ffd0;
|
||||
}
|
||||
&.is-out {
|
||||
color: #cc6933;
|
||||
}
|
||||
}
|
||||
.real-item-img {
|
||||
height: calc(100% - 60px);
|
||||
padding: 0px 40px;
|
||||
.el-image__inner {
|
||||
width: unset;
|
||||
}
|
||||
}
|
||||
.real-item-name {
|
||||
text-align: center;
|
||||
}
|
||||
.real-item-work-type {
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
span {
|
||||
color: #33b7bd;
|
||||
border: solid 1px #33b7bd;
|
||||
border-radius: 5px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
.real-item-time {
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
color: #33b7bd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.prj-labor-alert {
|
||||
.module-ctx {
|
||||
height: calc(100% - 40px);
|
||||
line-height: 30px;
|
||||
.alert-list {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
th {
|
||||
color: #00ffd0;
|
||||
}
|
||||
td {
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -664,10 +664,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getRealAttendance" resultMap="SurProjectAttendanceDataResult">
|
||||
<!--
|
||||
select * from sur_project_attendance_data_${year}
|
||||
where date(attendance_time)=date(now()) or date(attendance_out_time)=date(now())
|
||||
and is_del!=1
|
||||
and projectid=#{prjId} and state=0
|
||||
and projectid=#{prjId}
|
||||
order by ifnull(attendance_time,attendance_out_time) DESC
|
||||
LIMIT 4-->
|
||||
select * from yanzhu_jh.sur_project_attendance_data_2024
|
||||
where (date(attendance_time)='2024-03-22' or date(attendance_out_time)='2024-03-22')
|
||||
order by ifnull(attendance_time,attendance_out_time) DESC
|
||||
LIMIT 4
|
||||
</select>
|
||||
|
|
|
@ -817,7 +817,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getWorkerCountGroupByType" resultMap="SurProjectAttendanceUserResult">
|
||||
select workTypeName,count(1) id from sur_project_attendance_user
|
||||
where cfgid in (select id from attendance_cfg where project_id= #{projectId}) and is_del!=1 and state=0
|
||||
where cfgid in (select id from attendance_cfg where project_id= #{projectId})
|
||||
and is_del!=1 and state=0
|
||||
group by workTypeName
|
||||
order by count(1) DESC
|
||||
|
||||
|
@ -826,6 +827,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getAttendanceAlert" resultMap="SurProjectAttendanceUserResult">
|
||||
|
||||
<!--
|
||||
select u.*,TIMESTAMPDIFF(Day, att.dt,now()) id
|
||||
from (
|
||||
select su.workerId,su.name,pi.project_name companyName, pdept.sub_dept_name teamName
|
||||
|
@ -846,5 +848,28 @@ and cfg.project_id=#{projectId} ) u
|
|||
GROUP BY workerId
|
||||
order by max(ifnull(attendance_time,attendance_out_time))
|
||||
) att on u.workerId=att.workerId
|
||||
-->
|
||||
select u.*,TIMESTAMPDIFF(Day, att.dt,now()) id
|
||||
from (
|
||||
select su.workerId,su.name,pi.project_name companyName, pdept.sub_dept_name teamName
|
||||
from ( select 11 cfgid, name,workerId
|
||||
from yanzhu_jh.sur_project_attendance_user where cfgId=1) su
|
||||
left join attendance_cfg cfg on su.cfgId=cfg.ID
|
||||
left join pro_project_info pi on pi.id = cfg.project_id
|
||||
join pro_project_info_subdepts pdept on cfg.dept_id=pdept.id
|
||||
|
||||
) u
|
||||
join
|
||||
|
||||
(
|
||||
|
||||
select workerId,max(ifnull(attendance_time,attendance_out_time)) dt
|
||||
from yanzhu_jh.sur_project_attendance_data_2024
|
||||
where projectid=644 and is_del!=1
|
||||
GROUP BY workerId
|
||||
order by max(ifnull(attendance_time,attendance_out_time))
|
||||
) att on u.workerId=att.workerId
|
||||
|
||||
LIMIT 10
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue