diff --git a/src/api/attendance/index.js b/src/api/attendance/index.js index 5821c4c..769eed7 100644 --- a/src/api/attendance/index.js +++ b/src/api/attendance/index.js @@ -15,7 +15,16 @@ const getWorkAttendanceList=(deptId,projectId)=> { }) } + +const groupByComany=(data)=> { + return request({ + url: `bgscreen/attendance/groupByComany`, + data:data, + method: 'post' + }) +} export default{ getDeptWorksList, - getWorkAttendanceList + getWorkAttendanceList, + groupByComany } \ No newline at end of file diff --git a/src/pages/index.vue b/src/pages/index.vue index b803ef9..9f5a628 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -491,6 +491,7 @@ export default { this.elKey++; this.onWarningInfoNav(0); this.sumCostOutByDeptId(); + })); this.$bus.$on("deptChange", debounce(dept => { this.deptInfo = dept; @@ -502,6 +503,31 @@ export default { })); }, methods: { + loadAttendanceData(){ + let data={ + subDeptId:this.deptInfo.id||0, + projectId:this.prj.id||0, + attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD") + } + this.$api.attendance.groupByComany(data).then(d=>{ + + let tmps=d.data||[]; + const func=(ids)=>{ + let sum=0; + tmps.filter(it=>ids.includes(it.companyTypeId)).map(it=>it.id).forEach(it=>{ + sum+=it*1; + }) + return sum; + } + + this.laborPersonnelTotal = 0; + this.laborPersonnelData = [{ text: "劳务人员", value: func(["2","3"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1"]) }]; + this.laborPersonnelData.forEach(it=>{ + this.laborPersonnelTotal += it.value; + }) + this.elDeptWorks++; + }); + }, planSummaryChartClick(p){ let idx=0; if(p.event.target.parent.style && p.event.target.parent.style.text){ @@ -633,7 +659,6 @@ export default { }, init() { - this.localStorage = JSON.parse(localStorage.getItem("data1")) //地图数据 @@ -666,7 +691,7 @@ export default { this.surveyUrl = 'images/survey_icon_4.png' } else { this.surveyUrl = 'images/survey_icon_5.png' - } + } this.getDeptWorksList(); }, //查询在岗人数 @@ -690,20 +715,7 @@ export default { }); } else { //查询出勤人数 - this.$api.attendance.getWorkAttendanceList(deptId).then(d => { - this.laborPersonnelTotal = 0; - this.laborPersonnelData = [{ text: "劳务人员", value: 0 }, { text: "监理人员", value: 0 }, { text: "总包人员", value: 0 }]; - if (d.rows.length > 0 && d.rows[0] != null) { - this.laborPersonnelData = []; - this.laborPersonnelTotal += d.rows[0].servicePersonnel; - this.laborPersonnelData.push({ text: "劳务人员", value: d.rows[0].servicePersonnel }); - this.laborPersonnelTotal += d.rows[0].supervisorPersonnel; - this.laborPersonnelData.push({ text: "监理人员", value: d.rows[0].supervisorPersonnel }); - this.laborPersonnelTotal += d.rows[0].contractorPersonnel; - this.laborPersonnelData.push({ text: "总包人员", value: d.rows[0].contractorPersonnel }); - } - this.elDeptWorks++; - }); + this.loadAttendanceData(); } }, //集团新闻列表 diff --git a/src/pages/projectDetail.vue b/src/pages/projectDetail.vue index 0488f30..71ea9e1 100644 --- a/src/pages/projectDetail.vue +++ b/src/pages/projectDetail.vue @@ -88,7 +88,7 @@