17 changed files with 251 additions and 32 deletions
@ -0,0 +1,9 @@ |
|||
import request from "@/utils/request"; |
|||
|
|||
// 查询项目人员名单信息列表
|
|||
export function personnelAttendanceStatistics(proNo) { |
|||
return request({ |
|||
url: `/site/personDetails/personnelAttendanceStatistics/${proNo}`, |
|||
method: "get", |
|||
}); |
|||
} |
@ -0,0 +1,98 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div |
|||
ref="personnelAttendanceStatistics" |
|||
style="width: 100%; height: 500px" |
|||
></div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import * as echarts from "echarts"; |
|||
import { personnelAttendanceStatistics } from "@/api/site/personnelAttendanceStatistics"; |
|||
export default { |
|||
name: "personnelAttendanceStatistics", |
|||
props: ["proNo", "proCode"], |
|||
data() { |
|||
return { |
|||
labelOptions: { |
|||
noWorkCount: "缺勤人员数", |
|||
totle: "总参建人员数", |
|||
workCount: "实时在场人员数", |
|||
}, |
|||
}; |
|||
}, |
|||
created() {}, |
|||
mounted() { |
|||
this.getPersonnelAttendanceStatistics(); |
|||
}, |
|||
methods: { |
|||
getPersonnelAttendanceStatistics() { |
|||
personnelAttendanceStatistics(this.proNo).then((res) => { |
|||
console.log("personnelAttendanceStatistics", res); |
|||
this.chartInit(res.data); |
|||
}); |
|||
}, |
|||
chartInit(dataList) { |
|||
let xAxisData = []; |
|||
let seriesData = [ |
|||
{ |
|||
name: "实时在场人员数", |
|||
type: "bar", |
|||
data: [], |
|||
}, |
|||
{ |
|||
name: "总参建人员数", |
|||
type: "bar", |
|||
data: [], |
|||
}, |
|||
{ |
|||
name: "缺勤人员数", |
|||
type: "bar", |
|||
data: [], |
|||
}, |
|||
]; |
|||
|
|||
dataList.forEach((item) => { |
|||
xAxisData.push(item.dte); |
|||
seriesData[0].data.push(item.workCount); |
|||
seriesData[1].data.push(item.totle); |
|||
seriesData[2].data.push(item.noWorkCount); |
|||
}); |
|||
|
|||
let myChart = echarts.init(this.$refs.personnelAttendanceStatistics); |
|||
let option = { |
|||
tooltip: { |
|||
trigger: "axis", |
|||
axisPointer: { |
|||
type: "shadow", |
|||
}, |
|||
}, |
|||
legend: {}, |
|||
grid: { |
|||
left: "3%", |
|||
right: "4%", |
|||
bottom: "3%", |
|||
containLabel: true, |
|||
}, |
|||
xAxis: { |
|||
type: "category", |
|||
data: xAxisData, |
|||
}, |
|||
yAxis: { |
|||
type: "value", |
|||
boundaryGap: [0, 1], |
|||
minInterval: 1, |
|||
}, |
|||
series: seriesData, |
|||
}; |
|||
|
|||
option && myChart.setOption(option); |
|||
window.addEventListener("resize", function () { |
|||
myChart.resize(); |
|||
}); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped></style> |
Loading…
Reference in new issue