From 11c29edfd46650de4eafb697ab55b1588ca5135a Mon Sep 17 00:00:00 2001 From: haha Date: Wed, 11 Oct 2023 23:24:11 +0800 Subject: [PATCH] update code --- src/components/header.vue | 1 + src/pages/projectSafety.vue | 56 ++++++++++++++++++------- src/pages/quality/checkDetectionDlg.vue | 6 +-- src/pages/quality/measuredDlg.vue | 6 +-- src/pages/style/index.less | 3 ++ 5 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/components/header.vue b/src/components/header.vue index 8510070..04da826 100644 --- a/src/components/header.vue +++ b/src/components/header.vue @@ -157,6 +157,7 @@ export default { this.data = [{ id: 0, text: '所有项目' }, ...objs]; let dept={id:0,text:''}; this.$root.dept=dept; + this.$root.hasInitHeader=true; this.$bus.$emit("deptChange", dept) this.$root._prjIds=objs.map(it=>it.id); Cookies.set("__ids__",objs.map(it=>it.id).join(",")); diff --git a/src/pages/projectSafety.vue b/src/pages/projectSafety.vue index 935e68f..65b0c33 100644 --- a/src/pages/projectSafety.vue +++ b/src/pages/projectSafety.vue @@ -485,22 +485,50 @@ export default { } }); } else { - //查询出勤人数 - this.$api.attendance.getWorkAttendanceList(this.dept?.id||0,this.projectInfo?.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}); - } - }); + this.loadAttendanceData(); } }, + getProjectId(cb) { + let func = () => { + let prjId = this.projectInfo?.id||0; + if (prjId == 0) { + if (!this.projects||this.projects.length == 0) { + setTimeout(func, 100); + } else { + cb && cb(this.projects[1].id); + } + } else { + cb && cb(prjId); + } + } + func(); + }, + loadAttendanceData(){ + this.getProjectId(id => { + let data={ + subDeptId:this.dept.id||0, + projectId: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++; + }); + }); + }, getProjectInsuranceList(){ this.$api.insurance.getProjectInsuranceList(this.dept?.id||0,this.projectInfo?.id||0).then(d => { this.insuranceDataList=[]; diff --git a/src/pages/quality/checkDetectionDlg.vue b/src/pages/quality/checkDetectionDlg.vue index 41affe3..d6c442b 100644 --- a/src/pages/quality/checkDetectionDlg.vue +++ b/src/pages/quality/checkDetectionDlg.vue @@ -89,7 +89,7 @@ 送检时间: -
{{ it.checkTime|dateFormat }}
+
{{ it.checkTime|formatDate }}
检测结果: @@ -107,7 +107,7 @@ 提交时间: -
{{ it.createTime|dateFormat }}
+
{{ it.createTime|formatDate }}
登记结果用户: @@ -115,7 +115,7 @@ 登记结果时间: -
{{ it.updateTime|dateFormat }}
+
{{ it.updateTime|formatDate }}
diff --git a/src/pages/quality/measuredDlg.vue b/src/pages/quality/measuredDlg.vue index 3fbb7c9..39d25a2 100644 --- a/src/pages/quality/measuredDlg.vue +++ b/src/pages/quality/measuredDlg.vue @@ -70,7 +70,7 @@ 测量时间: -
{{ it.measureTime|dateFormat }}
+
{{ it.measureTime|formatDate }}
测量点位: @@ -97,7 +97,7 @@ 提交时间: -
{{ it.createTime|dateFormat }}
+
{{ it.createTime|formatDate }}
登记结果用户: @@ -105,7 +105,7 @@ 登记结果时间: -
{{ it.updateTime|dateFormat }}
+
{{ it.updateTime|formatDate }}
diff --git a/src/pages/style/index.less b/src/pages/style/index.less index d2042b4..9ca4b79 100644 --- a/src/pages/style/index.less +++ b/src/pages/style/index.less @@ -144,4 +144,7 @@ } .el-message-box__content{ color: #fff; +} +.head-title-tab{ + white-space: nowrap; } \ No newline at end of file