diff --git a/src/api/attendance/index.js b/src/api/attendance/index.js index 1c7c7eb..bbe927d 100644 --- a/src/api/attendance/index.js +++ b/src/api/attendance/index.js @@ -23,6 +23,13 @@ const groupByComany=(data)=> { method: 'post' }) } +const groupAllByComany=(data)=> { + return request({ + url: `bgscreen/attendance/groupByComany`, + data:data, + method: 'post' + }) +} const todayAttendance=(data)=>{ return request({ url: `bgscreen/attendance/todayAttendance`, @@ -43,5 +50,6 @@ export default{ getWorkAttendanceList, groupByComany, todayAttendance, - selectList + selectList, + groupAllByComany } \ No newline at end of file diff --git a/src/pages/index.vue b/src/pages/index.vue index 4e0e458..4e6a9eb 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -535,14 +535,18 @@ export default { this.$refs.jobWorkerdlg.showDialog(data); } }, + //查询在岗人数 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 ajax=this.$api.attendance.groupByComany + if (this.infoNav == 0) { + ajax=this.$api.attendance.groupAllByComany + } + ajax(data).then(d=>{ let tmps=d.data||[]; const func=(ids)=>{ let sum=0; @@ -550,8 +554,7 @@ export default { sum+=it*1; }) return sum; - } - + } this.laborPersonnelTotal = 0; this.laborPersonnelData = [{ text: "劳务人员", value: func(["2","3","4","5"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1","6"]) }]; this.laborPersonnelData.forEach(it=>{ @@ -706,7 +709,7 @@ export default { //正在发生 定时器 this.warningInterval = setInterval(this.automaticRoll, 5000); this.getJournalismList(); - setInterval(this.getDeptWorksList, 600000); + setInterval(this.loadAttendanceData, 600000); setInterval(this.getJournalismList, 600000); }, doPrjProcess(n, text) { @@ -728,32 +731,8 @@ export default { } else { this.surveyUrl = 'images/survey_icon_5.png' } - this.getDeptWorksList(); - }, - //查询在岗人数 - getDeptWorksList() { - let deptId = this.deptInfo?.id || 0; - if (this.infoNav == 0) { - //查询在岗人数 - this.$api.attendance.getDeptWorksList(deptId, this.prj.id).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++; - }); - } else { - //查询出勤人数 - this.loadAttendanceData(); - } - }, + this.loadAttendanceData(); + }, //集团新闻列表 getJournalismList() { //查询出勤人数 diff --git a/src/pages/projectDetail.vue b/src/pages/projectDetail.vue index ede37d3..3786ee6 100644 --- a/src/pages/projectDetail.vue +++ b/src/pages/projectDetail.vue @@ -771,9 +771,10 @@ export default { }, methods: { doShowAttendanceDetail() { + this.getProjectId(id => { let data = { deptId: this.dept.id || 0, - projectId: this.project.id || 0, + projectId: id || 0, attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD") } if (this.infoNav == 1) { @@ -781,6 +782,7 @@ export default { } else { this.$refs.jobWorkerdlg.showDialog(data); } + }); }, initMe() { this.project = this.$root.project || {}; @@ -914,7 +916,7 @@ export default { }); this.projectBuildNode = []; this.getProjectBuildNode(); - this.getDeptWorksList(); + this.loadAttendanceData(); this.getProjectUser(); this.getCostOut(id); }); @@ -953,7 +955,7 @@ export default { } this.minWidth = n * 200 + 100; }); - this.getDeptWorksList(); + this.loadAttendanceData(); }); }, init() { @@ -971,6 +973,7 @@ export default { //造价 定时器 this.costInterval = setInterval(this.manufacturingCostRoll, 5000); }, + //查询在岗人数 loadAttendanceData() { this.getProjectId(id => { let data = { @@ -978,7 +981,11 @@ export default { projectId: id || 0, attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD") } - this.$api.attendance.groupByComany(data).then(d => { + let ajax=this.$api.attendance.groupByComany; + if (this.infoNav == 0) { + ajax=this.$api.attendance.groupAllByComany; + } + ajax(data).then(d => { let tmps = d.data || []; const func = (ids) => { let sum = 0; @@ -989,36 +996,14 @@ export default { } this.laborPersonnelTotal = 0; - this.laborPersonnelData = [{ text: "劳务人员", value: func(["2", "3"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1"]) }]; + this.laborPersonnelData = [{ text: "劳务人员", value: func(["2","3","4","5"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1","6"]) }]; this.laborPersonnelData.forEach(it => { this.laborPersonnelTotal += it.value; }) this.elDeptWorks++; }); }); - }, - //查询在岗人数 - getDeptWorksList() { - if (this.infoNav == 0) { - //查询在岗人数 - this.$api.attendance.getDeptWorksList(this.dept?.id || 0, this.project?.id || 0).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 }); - } - }); - - } else { - this.loadAttendanceData(); - } - }, + }, //项目介绍弹窗 projectIntroduction() { //this.popupShow = true @@ -1140,7 +1125,7 @@ export default { onWarningInfoNav(n, text) { this.infoNav = n this.staffText = text - this.getDeptWorksList(); + this.loadAttendanceData(); if (n == 0) { this.surveyUrl = 'images/survey_icon_4.png' } else {