后台首页数据定时刷新
parent
db1048aa1f
commit
b668ef41c6
|
@ -1,5 +1,5 @@
|
|||
<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" />
|
||||
|
@ -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
|
||||
projectId: this.currentPrjId,
|
||||
};
|
||||
let ajax = [];
|
||||
ajax.push(groupByCraftTypeByAttendance({...data,createTime:this.$dt(new Date()).format("YYYY-MM-DD")}))
|
||||
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,27 +121,27 @@ export default {
|
|||
mgr: 0,
|
||||
worker: 0,
|
||||
},
|
||||
edu:0
|
||||
edu: 0,
|
||||
};
|
||||
tmps.forEach(d=>{
|
||||
let cnt=(d.id||0)*1
|
||||
obj.att.total+=cnt
|
||||
tmps.forEach((d) => {
|
||||
let cnt = (d.id || 0) * 1;
|
||||
obj.att.total += cnt;
|
||||
if (d.createBy == "管理人员") {
|
||||
obj.att.mgr+=cnt
|
||||
obj.att.mgr += cnt;
|
||||
} else {
|
||||
obj.att.worker+=cnt
|
||||
obj.att.worker += cnt;
|
||||
}
|
||||
});
|
||||
tmps = res[1].data || [];
|
||||
tmps.forEach(d=>{
|
||||
let cnt=(d.id||0)*1
|
||||
obj.job.total+=cnt
|
||||
tmps.forEach((d) => {
|
||||
let cnt = (d.id || 0) * 1;
|
||||
obj.job.total += cnt;
|
||||
if (d.createBy == "管理人员") {
|
||||
obj.job.mgr+=cnt
|
||||
obj.job.mgr += cnt;
|
||||
} else {
|
||||
obj.job.worker+=cnt
|
||||
obj.job.worker += cnt;
|
||||
}
|
||||
})
|
||||
});
|
||||
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() {
|
||||
|
|
|
@ -34,7 +34,7 @@ export default {
|
|||
this.currentComId = this.userStore.currentComId;
|
||||
this.vendorsCode = this.userStore.vendorsCode;
|
||||
if (this.vendorsCode == "jgw") {
|
||||
this.vendorsCode="uni"
|
||||
this.vendorsCode = "uni";
|
||||
}
|
||||
this.init();
|
||||
},
|
||||
|
|
|
@ -91,7 +91,7 @@ export default {
|
|||
setTimeout(() => {
|
||||
let total = this.attInfo ? this.attInfo.job.total : 0;
|
||||
let totalAtt = this.attInfo ? this.attInfo.att.total : 0;
|
||||
this.sum=total+totalAtt
|
||||
this.sum = total + totalAtt;
|
||||
this.chartData = [
|
||||
{
|
||||
name: "出勤人数",
|
||||
|
|
|
@ -17,13 +17,9 @@ export default {
|
|||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -17,13 +17,9 @@ export default {
|
|||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -17,9 +17,9 @@ export default {
|
|||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -17,9 +17,9 @@ export default {
|
|||
attInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -42,5 +42,3 @@ export default {
|
|||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
|
Loading…
Reference in New Issue