YZProjectCloud/yanzhu-ui-vue3/src/views/index.vue

279 lines
7.3 KiB
Vue
Raw Normal View History

2024-08-17 12:11:19 +08:00
<template>
2025-07-09 18:09:23 +08:00
<div class="app-container home">
<el-card class="nav-top">
<nav-top-unit />
2025-07-10 14:54:38 +08:00
<nav-top-att-worker-count :attInfo="attInfo" :key="elKey" />
<nav-top-att-online-count :attInfo="attInfo" :key="elKey" />
<nav-top-att-mgr-count :attInfo="attInfo" :key="elKey" />
<nav-top-att-real-count v-if="vendorsCode == 'uni'" :attInfo="attInfo" :key="elKey" />
2025-07-09 18:09:23 +08:00
</el-card>
<el-card class="nav-body" style="margin-top: 20px">
<el-row>
<el-col :span="8">
2025-07-10 14:54:38 +08:00
<nav-attendance-rate :attInfo="attInfo" :key="elKey" />
2025-07-09 18:09:23 +08:00
</el-col>
<el-col :span="8">
2025-07-10 14:54:38 +08:00
<nav-att-laborer-rate :attInfo="attInfo" :key="elKey"/>
2025-07-09 18:09:23 +08:00
</el-col>
<el-col :span="8">
2025-07-10 14:54:38 +08:00
<nav-att-manager-rate :attInfo="attInfo" :key="elKey"/>
2025-07-09 18:09:23 +08:00
</el-col>
<el-col :span="8">
<nav-att-laborer-trend />
</el-col>
2025-07-10 14:54:38 +08:00
<el-col :span="8" v-if="vendorsCode == 'uni'">
<nav-att-woker-prop :attInfo="attInfo" :key="elKey"/>
2025-07-09 18:09:23 +08:00
</el-col>
<el-col :span="8">
<nav-att-job-type-group />
</el-col>
</el-row>
</el-card>
</div>
2024-08-17 12:11:19 +08:00
</template>
2025-07-09 18:09:23 +08:00
<script>
import navTopAttMgrCount from "./indexCompents/navTopAttMgrCount.vue";
import navTopAttWokerProp from "./indexCompents/navAttWokerProp.vue";
import navTopAttRealCount from "./indexCompents/navTopAttRealCount.vue";
import navTopAttWorkerCount from "./indexCompents/navTopAttWorkerCount.vue";
import navTopUnit from "./indexCompents/navTopUnit.vue";
2025-05-13 01:06:27 +08:00
2025-07-09 18:09:23 +08:00
import navAttendanceRate from "./indexCompents/navAttendanceRate.vue";
import navAttLaborerRate from "./indexCompents/navAttLaborerRate.vue";
import navAttManagerRate from "./indexCompents/navAttManagerRate.vue";
2024-08-17 12:11:19 +08:00
2025-07-09 18:09:23 +08:00
import navAttLaborerTrend from "./indexCompents/navAttLaborerTrend.vue";
import navAttWokerProp from "./indexCompents/navAttWokerProp.vue";
import navAttJobTypeGroup from "./indexCompents/navAttJobTypeGroup.vue";
import NavTopAttOnlineCount from "./indexCompents/navTopAttOnlineCount.vue";
2025-07-10 14:54:38 +08:00
import useUserStore from "@/store/modules/user";
import { groupByComany, groupAllByComany,groupByCraftType,groupByCraftTypeByAttendance ,getEduCompletedCount} from "@/api/manage/labor.js";
2025-07-09 18:09:23 +08:00
export default {
components: {
navTopAttMgrCount,
navTopAttWokerProp,
navTopAttRealCount,
navTopAttWorkerCount,
navTopUnit,
navAttendanceRate,
navAttLaborerRate,
navAttManagerRate,
navAttLaborerTrend,
navAttWokerProp,
navAttJobTypeGroup,
NavTopAttOnlineCount,
},
2025-07-10 14:54:38 +08:00
data() {
return {
currentPrjId: null,
currentComId: null,
vendorsCode: "",
attInfo: null,
elKey: 0,
};
},
mounted() {
this.userStore = useUserStore();
this.currentPrjId = this.userStore.currentPrjId;
this.currentComId = this.userStore.currentComId;
this.vendorsCode = this.userStore.vendorsCode;
if (this.vendorsCode == "jgw") {
this.vendorsCode = "uni";
}
this.loadAttInfo(); //加载考勤人员信息
},
methods: {
loadAttInfo() {
if (this.vendorsCode != "uni") {
this.loadJhAttendanceData();
} else {
this.loadUniAttendanceData();
}
},
loadUniAttendanceData(){
let data={
comId:this.currentComId,
projectId:this.currentPrjId
};
let ajax=[];
ajax.push(groupByCraftTypeByAttendance({...data,createTime:this.$dt(new Date()).format("YYYY-MM-DD")}))
ajax.push(groupByCraftType(data));
ajax.push(getEduCompletedCount(this.vendorsCode,this.currentPrjId))
Promise.all(ajax).then(res=>{
let tmps = res[0].data || [];
let obj = {
job: {
//在岗
total: 0,
mgr: 0,
worker: 0,
},
att: {
//今日出勤
total: 0,
mgr: 0,
worker: 0,
},
edu:0
};
tmps.forEach(d=>{
let cnt=(d.id||0)*1
obj.att.total+=cnt
if(d.createBy=="管理人员"){
obj.att.mgr+=cnt
}else{
obj.att.worker+=cnt
}
});
tmps = res[1].data || [];
tmps.forEach(d=>{
let cnt=(d.id||0)*1
obj.job.total+=cnt
if(d.createBy=="管理人员"){
obj.job.mgr+=cnt
}else{
obj.job.worker+=cnt
}
})
obj.edu=res[2].data||0;
this.attInfo = obj;
this.elKey++;
});
},
loadJhAttendanceData() {
let ajax = [];
let data = {
projectId: this.currentPrjId,
attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD"),
};
ajax.push(groupByComany({ ...data, id: 1 }));
ajax.push(groupAllByComany({ ...data, id: 0 }));
Promise.all(ajax).then((res) => {
let tmps = res[0].data || [];
let obj = {
job: {
//在岗
total: 0,
mgr: 0,
worker: 0,
},
att: {
//今日出勤
total: 0,
mgr: 0,
worker: 0,
},
};
tmps.forEach((d) => {
let cnt = d.id * 1;
obj.att.total += cnt;
if (["1"].includes(d.companyTypeId)) {
obj.att.mgr += cnt;
} else {
obj.att.worker += cnt;
}
});
tmps = res[1].data || [];
tmps.forEach((d) => {
let cnt = d.id * 1;
obj.job.total += cnt;
if (["1"].includes(d.companyTypeId)) {
obj.job.mgr += cnt;
} else {
obj.job.worker += cnt;
}
});
this.attInfo = obj;
this.elKey++;
});
},
},
2025-07-09 18:09:23 +08:00
};
2024-08-17 12:11:19 +08:00
</script>
2025-07-09 18:09:23 +08:00
<style lang="scss">
2024-08-17 12:11:19 +08:00
.home {
2025-07-09 18:09:23 +08:00
.el-card__body {
padding: 10px !important;
}
.nav-top {
.index-nav-top {
display: inline-flex;
width: calc(20% - 20px);
margin: 10px;
height: 100px;
background-color: #f0f3f8;
align-items: center;
border-radius: 5px;
max-width: 300px;
min-width: 220px;
.top-icon {
margin-left: 30px;
.svg-icon {
width: 40px;
height: 40px;
fill: #6bc1da;
}
}
.top-data {
margin-left: 10px;
width: calc(100% - 60px);
.data-title {
text-align: center;
color: #999;
2025-05-13 01:06:27 +08:00
}
2025-07-09 18:09:23 +08:00
.data-number {
line-height: 40px;
height: 40px;
text-align: center;
font-size: 20px;
}
}
2024-08-17 12:11:19 +08:00
}
2025-07-09 18:09:23 +08:00
}
.nav-body {
.index-nav-body {
height: 400px;
background-color: #f0f3f8;
margin: 10px;
border-radius: 5px;
.index-nav-body-title {
line-height: 30px;
font-weight: bold;
padding: 6px 0px 0px 10px;
}
.chart-content {
height: calc(100% - 50px);
display: flex;
align-items: center;
justify-content: center;
.my-chart {
display: flex;
align-items: center;
justify-content: center;
2025-05-13 01:06:27 +08:00
}
2025-07-09 18:09:23 +08:00
}
2025-07-10 14:54:38 +08:00
.no-data {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.svg-icon {
width: 100px;
height: 100px;
fill: #999;
}
div {
color: #999;
font-size: 14px;
}
}
2024-08-17 12:11:19 +08:00
}
2025-07-09 18:09:23 +08:00
}
2024-08-17 12:11:19 +08:00
}
</style>