后台首页数据定时刷新
parent
db1048aa1f
commit
b668ef41c6
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="app-container home">
|
||||
<div class="app-container home" :key="mainKey">
|
||||
<el-card class="nav-top">
|
||||
<nav-top-unit />
|
||||
<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" />
|
||||
<nav-top-att-real-count v-if="vendorsCode == 'uni'" :attInfo="attInfo" :key="elKey" />
|
||||
</el-card>
|
||||
|
||||
<el-card class="nav-body" style="margin-top: 20px">
|
||||
|
@ -14,16 +14,16 @@
|
|||
<nav-attendance-rate :attInfo="attInfo" :key="elKey" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<nav-att-laborer-rate :attInfo="attInfo" :key="elKey"/>
|
||||
<nav-att-laborer-rate :attInfo="attInfo" :key="elKey" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<nav-att-manager-rate :attInfo="attInfo" :key="elKey"/>
|
||||
<nav-att-manager-rate :attInfo="attInfo" :key="elKey" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<nav-att-laborer-trend />
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="vendorsCode == 'uni'">
|
||||
<nav-att-woker-prop :attInfo="attInfo" :key="elKey"/>
|
||||
<nav-att-woker-prop :attInfo="attInfo" :key="elKey" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<nav-att-job-type-group />
|
||||
|
@ -49,7 +49,7 @@ import navAttWokerProp from "./indexCompents/navAttWokerProp.vue";
|
|||
import navAttJobTypeGroup from "./indexCompents/navAttJobTypeGroup.vue";
|
||||
import NavTopAttOnlineCount from "./indexCompents/navTopAttOnlineCount.vue";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
import { groupByComany, groupAllByComany,groupByCraftType,groupByCraftTypeByAttendance ,getEduCompletedCount} from "@/api/manage/labor.js";
|
||||
import { groupByComany, groupAllByComany, groupByCraftType, groupByCraftTypeByAttendance, getEduCompletedCount } from "@/api/manage/labor.js";
|
||||
export default {
|
||||
components: {
|
||||
navTopAttMgrCount,
|
||||
|
@ -72,6 +72,7 @@ export default {
|
|||
vendorsCode: "",
|
||||
attInfo: null,
|
||||
elKey: 0,
|
||||
mainKey: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -91,17 +92,21 @@ export default {
|
|||
} else {
|
||||
this.loadUniAttendanceData();
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.loadAttInfo();
|
||||
this.mainKey++;
|
||||
}, 1000 * 60 * 5);
|
||||
},
|
||||
loadUniAttendanceData(){
|
||||
let data={
|
||||
comId:this.currentComId,
|
||||
projectId:this.currentPrjId
|
||||
loadUniAttendanceData() {
|
||||
let data = {
|
||||
comId: this.currentComId,
|
||||
projectId: this.currentPrjId,
|
||||
};
|
||||
let ajax=[];
|
||||
ajax.push(groupByCraftTypeByAttendance({...data,createTime:this.$dt(new Date()).format("YYYY-MM-DD")}))
|
||||
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=>{
|
||||
ajax.push(getEduCompletedCount(this.vendorsCode, this.currentPrjId));
|
||||
Promise.all(ajax).then((res) => {
|
||||
let tmps = res[0].data || [];
|
||||
let obj = {
|
||||
job: {
|
||||
|
@ -116,28 +121,28 @@ export default {
|
|||
mgr: 0,
|
||||
worker: 0,
|
||||
},
|
||||
edu: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.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
|
||||
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;
|
||||
});
|
||||
obj.edu = res[2].data || 0;
|
||||
this.attInfo = obj;
|
||||
this.elKey++;
|
||||
});
|
||||
|
|
|
@ -28,7 +28,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
chartData: [],
|
||||
sum:0
|
||||
sum: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -92,7 +92,7 @@ export default {
|
|||
setTimeout(() => {
|
||||
let total = this.attInfo ? this.attInfo.job.worker : 0;
|
||||
let totalAtt = this.attInfo ? this.attInfo.att.worker : 0;
|
||||
this.sum=totalAtt+total;
|
||||
this.sum = totalAtt + total;
|
||||
this.chartData = [
|
||||
{
|
||||
name: "出勤人数",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="index-nav-body">
|
||||
<div class="index-nav-body-title">劳务人员出勤趋势图</div>
|
||||
<div class="chart-content" v-if="sum>0">
|
||||
<div class="chart-content" v-if="sum > 0">
|
||||
<my-chart ref="chart" id="navAttLaborerTrendChart" width="100%" height="100%" :render="renderChart" />
|
||||
</div>
|
||||
<div class="no-data" v-if="sum==0">
|
||||
<svg-icon icon-class="nodata"/>
|
||||
<div class="no-data" v-if="sum == 0">
|
||||
<svg-icon icon-class="nodata" />
|
||||
<div>暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@ export default {
|
|||
currentPrjId: null,
|
||||
currentComId: null,
|
||||
vendorsCode: "",
|
||||
sum:0,
|
||||
sum: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -33,8 +33,8 @@ export default {
|
|||
this.currentPrjId = this.userStore.currentPrjId;
|
||||
this.currentComId = this.userStore.currentComId;
|
||||
this.vendorsCode = this.userStore.vendorsCode;
|
||||
if(this.vendorsCode=="jgw"){
|
||||
this.vendorsCode="uni"
|
||||
if (this.vendorsCode == "jgw") {
|
||||
this.vendorsCode = "uni";
|
||||
}
|
||||
this.init();
|
||||
},
|
||||
|
@ -104,9 +104,9 @@ export default {
|
|||
},
|
||||
init() {
|
||||
groupAttendanceLastWeek(this.vendorsCode, this.currentPrjId).then((d) => {
|
||||
this.sum=0;
|
||||
this.sum = 0;
|
||||
this.weekData = (d.data || []).map((it) => {
|
||||
this.sum+=it.cnt;
|
||||
this.sum += it.cnt;
|
||||
return {
|
||||
name: it.dt.substring(5).replace("-", "."),
|
||||
value: it.cnt,
|
||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
|||
components: {
|
||||
MyChart,
|
||||
},
|
||||
props: {
|
||||
props: {
|
||||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
@ -27,7 +27,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
chartData: [],
|
||||
sum:0,
|
||||
sum: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -89,9 +89,9 @@ export default {
|
|||
},
|
||||
init() {
|
||||
setTimeout(() => {
|
||||
let total=this.attInfo?this.attInfo.job.mgr:0;
|
||||
let totalAtt=this.attInfo?this.attInfo.att.mgr:0;
|
||||
this.sum=totalAtt+total;
|
||||
let total = this.attInfo ? this.attInfo.job.mgr : 0;
|
||||
let totalAtt = this.attInfo ? this.attInfo.att.mgr : 0;
|
||||
this.sum = totalAtt + total;
|
||||
this.chartData = [
|
||||
{
|
||||
name: "出勤人数",
|
||||
|
@ -99,7 +99,7 @@ export default {
|
|||
},
|
||||
{
|
||||
name: "未出勤人数",
|
||||
value: total-totalAtt,
|
||||
value: total - totalAtt,
|
||||
},
|
||||
];
|
||||
if (this.$refs.chart) {
|
||||
|
|
|
@ -28,7 +28,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
chartData: [],
|
||||
sum:0,
|
||||
sum: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -92,7 +92,7 @@ export default {
|
|||
setTimeout(() => {
|
||||
let total = this.attInfo ? this.attInfo.job.total : 0;
|
||||
let edu = this.attInfo ? this.attInfo.edu : 0;
|
||||
this.sum=total+edu;
|
||||
this.sum = total + edu;
|
||||
this.chartData = [
|
||||
{
|
||||
name: "参与人数",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="index-nav-body">
|
||||
<div class="index-nav-body-title">今日出勤率</div>
|
||||
<div class="chart-content" v-if="sum> 0">
|
||||
<div class="chart-content" v-if="sum > 0">
|
||||
<my-chart ref="chart" id="navAttendanceRateChart" width="100%" height="100%" :render="renderChart" />
|
||||
</div>
|
||||
<div class="no-data" v-if="sum == 0">
|
||||
|
@ -28,7 +28,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
chartData: [],
|
||||
sum:0,
|
||||
sum: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -89,9 +89,9 @@ export default {
|
|||
},
|
||||
init() {
|
||||
setTimeout(() => {
|
||||
let total=this.attInfo?this.attInfo.job.total:0;
|
||||
let totalAtt=this.attInfo?this.attInfo.att.total:0;
|
||||
this.sum=total+totalAtt
|
||||
let total = this.attInfo ? this.attInfo.job.total : 0;
|
||||
let totalAtt = this.attInfo ? this.attInfo.att.total : 0;
|
||||
this.sum = total + totalAtt;
|
||||
this.chartData = [
|
||||
{
|
||||
name: "出勤人数",
|
||||
|
@ -99,7 +99,7 @@ export default {
|
|||
},
|
||||
{
|
||||
name: "未出勤人数",
|
||||
value: total-totalAtt,
|
||||
value: total - totalAtt,
|
||||
},
|
||||
];
|
||||
if (this.$refs.chart) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
<div class="top-data">
|
||||
<div class="data-title">在岗管理人员数</div>
|
||||
<div class="data-number">{{attInfo?attInfo.job.mgr:0}}</div>
|
||||
<div class="data-number">{{ attInfo ? attInfo.job.mgr : 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -13,17 +13,13 @@
|
|||
<script>
|
||||
//考勤人员在职管理人员数
|
||||
export default {
|
||||
props:{
|
||||
attInfo:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
props: {
|
||||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="index-nav-top">
|
||||
<div class="top-icon">
|
||||
<div class="top-icon">
|
||||
<svg-icon icon-class="onlineworker" />
|
||||
</div>
|
||||
<div class="top-data">
|
||||
<div class="data-title">在岗工人数</div>
|
||||
<div class="data-number">{{attInfo?attInfo.job.worker:0}}</div>
|
||||
<div class="data-number">{{ attInfo ? attInfo.job.worker : 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -13,17 +13,13 @@
|
|||
<script>
|
||||
//考勤人员数在职工人数
|
||||
export default {
|
||||
props:{
|
||||
attInfo:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
props: {
|
||||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
<div class="top-data">
|
||||
<div class="data-title">完成三级安全教育人数</div>
|
||||
<div class="data-number">{{attInfo?attInfo.edu:0}}</div>
|
||||
<div class="data-number">{{ attInfo ? attInfo.edu : 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -13,13 +13,13 @@
|
|||
<script>
|
||||
//考勤人员数
|
||||
export default {
|
||||
props:{
|
||||
attInfo:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
props: {
|
||||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="index-nav-top">
|
||||
<div class="top-icon">
|
||||
<div class="top-icon">
|
||||
<svg-icon icon-class="group" />
|
||||
</div>
|
||||
<div class="top-data">
|
||||
<div class="data-title">总人数</div>
|
||||
<div class="data-number">{{attInfo?attInfo.job.total:0}}</div>
|
||||
<div class="data-number">{{ attInfo ? attInfo.job.total : 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -13,13 +13,13 @@
|
|||
<script>
|
||||
//考勤人员数
|
||||
export default {
|
||||
props:{
|
||||
attInfo:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
props: {
|
||||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -42,5 +42,3 @@ export default {
|
|||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
|
Loading…
Reference in New Issue