From 3bcf018be416359e13497637c82546845b08f292 Mon Sep 17 00:00:00 2001 From: haha Date: Sat, 6 Apr 2024 22:12:12 +0800 Subject: [PATCH] update code --- src/api/costOut/index.js | 2 +- src/pages/projectDetail.vue | 249 ++++++++++++++++++++++-------------- 2 files changed, 154 insertions(+), 97 deletions(-) diff --git a/src/api/costOut/index.js b/src/api/costOut/index.js index bd7b93a..c482481 100644 --- a/src/api/costOut/index.js +++ b/src/api/costOut/index.js @@ -7,7 +7,7 @@ const selectYearAndMonth=(data)=> { url: `/bgscreen/costOut/selectYearAndMonth`, method: 'post', data:data - }).then(d=>{ + }).then(d=>{ const getValue=(tmps,type)=>{ let objs=tmps.filter(d=>d.costType==type); return objs.length>0?objs[0]:{}; diff --git a/src/pages/projectDetail.vue b/src/pages/projectDetail.vue index 84d028b..117fb57 100644 --- a/src/pages/projectDetail.vue +++ b/src/pages/projectDetail.vue @@ -6,7 +6,8 @@
-
+
项目简介
@@ -29,7 +30,7 @@
项目等级
{{ - getProjectLevel() || ' ' }}
+ getProjectLevel() || ' ' }}
@@ -84,7 +85,8 @@
今日出勤
- @@ -147,8 +149,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="15828"> @@ -167,8 +169,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="15828"> @@ -187,8 +189,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="15828"> @@ -208,14 +210,15 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="15828"> + laborPersonnelData 开累完成

@@ -229,8 +232,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="16844"> @@ -275,8 +278,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="16844"> @@ -321,8 +324,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="16844"> @@ -366,8 +369,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="16844"> @@ -411,8 +414,8 @@

+ viewBox="0 0 1024 1024" version="1.1" + xmlns="http://www.w3.org/2000/svg" p-id="17500"> @@ -425,7 +428,7 @@ 建筑面积

-
244449 平方米
+
{{ floorArea }} 平方米
@@ -477,8 +480,8 @@
验收阶段
- + @@ -493,7 +496,8 @@ {{ it.original }}
- {{ row.files.length }} 个 + {{ row.files.length }} + 个 / @@ -650,11 +654,11 @@ export default { infoNav: 0, staffText: '在岗人员', surveyUrl: 'images/survey_icon_4.png', - laborPersonnelTotal: 149, + laborPersonnelTotal: 0, laborPersonnelData: [ - { text: "职工", value: 52 }, - { text: "劳务派遣", value: 45 }, - { text: "其他", value: 20 }, + { text: "职工", value: 0 }, + { text: "劳务派遣", value: 0 }, + { text: "其他", value: 0 }, ], //设备概况 overview: 0, @@ -736,6 +740,7 @@ export default { finishBuildNode: [], modleMap: [], elDeptWorks: 0, + floorArea:"-", } }, created() { @@ -764,34 +769,53 @@ export default { this.loadFilshNode(); })); this.$bus.$on("deptChange", debounce(dept => { - this.dept = dept; + this.dept = dept; })); if (this.$root.hasInitHeader) { this.initMe(); } }, methods: { + getFloorArea() { + this.getProjectId(id => { + if (id == 0) { + return "-"; + } + let tmps = this.prjs.filter(d => d.id == id); + let tmp=tmps.length > 0 ? tmps[0].floorArea : "-"; + this.floorArea=tmp||"-"; + }); + }, doShowAttendanceDetail() { this.getProjectId(id => { - let data = { - deptId: this.dept.id || 0, - projectId: id || 0, - attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD") - } - if (this.infoNav == 1) { - this.$refs.attDetailDlg.showDialog(data); - } else { - this.$refs.jobWorkerdlg.showDialog({ - ...data, - total:this.laborPersonnelTotal, - datas:this.laborPersonnelData.map(it=>{ - return { - text:it.text.replace("总包人员","101").replace("监理人员","102").replace("劳务人员","103"), - cnt:it.value - } - }) - }); - } + if (id == 0) { + this.laborPersonnelTotal = 0; + this.laborPersonnelData = [ + { text: "职工", value: 0 }, + { text: "劳务派遣", value: 0 }, + { text: "其他", value: 0 }, + ]; + return; + } + let data = { + deptId: this.dept.id || 0, + projectId: id || 0, + attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD") + } + if (this.infoNav == 1) { + this.$refs.attDetailDlg.showDialog(data); + } else { + this.$refs.jobWorkerdlg.showDialog({ + ...data, + total: this.laborPersonnelTotal, + datas: this.laborPersonnelData.map(it => { + return { + text: it.text.replace("总包人员", "101").replace("监理人员", "102").replace("劳务人员", "103"), + cnt: it.value + } + }) + }); + } }); }, initMe() { @@ -878,9 +902,9 @@ export default { if (!this.prjs || this.prjs.length == 0) { setTimeout(func, 100); } else { - if(this.prjs.length>1){ + if (this.prjs.length > 1) { cb && cb(this.prjs[1].id); - }else{ + } else { cb(0); } } @@ -892,22 +916,22 @@ export default { }, loadFilshNode() { this.getProjectId(id => { - this.$api.buildNode.queryFinishProject(id).then(d => { + this.$api.buildNode.queryFinishProject(id).then(d => { this.finishBuildNode = d || []; - let findLvl='030101,030102,030103,030104,030105,030101,0302,030201,030202'.split(","); - let tmps=(d||[]); - let obj=null; - for(let i=0;iit.lvl==findLvl[i]); - if(objs.length>0 && objs[0].files){ + let findLvl = '030101,030102,030103,030104,030105,030101,0302,030201,030202'.split(","); + let tmps = (d || []); + let obj = null; + for (let i = 0; i < findLvl.length; i++) { + let objs = tmps.filter(it => it.lvl == findLvl[i]); + if (objs.length > 0 && objs[0].files) { let files = (objs[0].files || '[]') - if(files.length>0){ - let fs=tryToJson(files,[]); - if(fs.length>0){ - obj=objs; + if (files.length > 0) { + let fs = tryToJson(files, []); + if (fs.length > 0) { + obj = objs; break; } - } + } } } if (obj && obj.length > 0) { @@ -925,34 +949,46 @@ export default { }); }, loadData() { - this.getProjectId(id => { - this.$api.schedule.projectConstructionProgress(id).then(d => { - let obj = d?.data || {}; - if (obj.image) { - obj.images = obj.image.split(",").filter(d => d).map(f => { - return this.$apiPath + f; - }); - } else { - obj.images = []; - } - this.scheduleInfo = obj; - if (this.$refs.mapModle) { - this.$refs.mapModle.initImgs(obj?.images || []); - } - }); - this.photographyList=[]; - this.$api.project.selectLastPhotography(id).then(d => { - this.photographyList = d.data || []; - }); + this.getProjectId(id => { + if (id > 0) { + this.$api.schedule.projectConstructionProgress(id).then(d => { + let obj = d?.data || {}; + if (obj.image) { + obj.images = obj.image.split(",").filter(d => d).map(f => { + return this.$apiPath + f; + }); + } else { + obj.images = []; + } + this.scheduleInfo = obj; + if (this.$refs.mapModle) { + this.$refs.mapModle.initImgs(obj?.images || []); + } + }); + this.photographyList = []; + this.$api.project.selectLastPhotography(id).then(d => { + this.photographyList = d.data || []; + }); + } + else { + this.photographyList = []; + this.scheduleInfo=null; + } this.projectBuildNode = []; this.getProjectBuildNode(); this.loadAttendanceData(); this.getProjectUser(); this.getCostOut(id); + this.getFloorArea(); }); }, getCostOut(id) { let dt = this.$dt(new Date()) + if (id == 0) { + this.costOut = {}; + this.elCostOut++; + return; + } this.$api.costOut.selectYearAndMonth({ projectId: id, year: dt.$y, @@ -966,6 +1002,11 @@ export default { }, getProjectUser() { this.getProjectId(id => { + if (id == 0) { + this.projectUsers = []; + this.elPrjUser++; + return; + } this.$api.project.getProjectUser(id).then(d => { this.projectUsers = d.data || []; this.elPrjUser++; @@ -974,6 +1015,10 @@ export default { }, getProjectBuildNode() { this.getProjectId(id => { + if (id == 0) { + this.projectBuildNode = []; + return; + } this.$api.project.getProjectBuildNode(id).then(d => { this.projectBuildNode = this.$api.buildNode.covertData(d.data || []).filter(it => it.lvl.length == 2); this.maxWidth = 200 * this.projectBuildNode.length; @@ -1003,17 +1048,27 @@ export default { //造价 定时器 this.costInterval = setInterval(this.manufacturingCostRoll, 5000); }, - //查询在岗人数 + //查询在岗人数 loadAttendanceData() { this.getProjectId(id => { + if (id == 0) { + this.laborPersonnelTotal = 0; + this.laborPersonnelData = [ + { text: "职工", value: 0 }, + { text: "劳务派遣", value: 0 }, + { text: "其他", value: 0 }, + ]; + this.elDeptWorks++; + return; + } let data = { subDeptId: this.dept.id || 0, projectId: id || 0, attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD") } - let ajax=this.$api.attendance.groupByComany; + let ajax = this.$api.attendance.groupByComany; if (this.infoNav == 0) { - ajax=this.$api.attendance.groupAllByComany; + ajax = this.$api.attendance.groupAllByComany; } ajax(data).then(d => { let tmps = d.data || []; @@ -1026,14 +1081,14 @@ export default { } this.laborPersonnelTotal = 0; - this.laborPersonnelData = [{ text: "劳务人员", value: func(["0","2","3","4","5"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1","6"]) }]; + this.laborPersonnelData = [{ text: "劳务人员", value: func(["0", "2", "3", "4", "5"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1", "6"]) }]; this.laborPersonnelData.forEach(it => { this.laborPersonnelTotal += it.value; }) this.elDeptWorks++; }); }); - }, + }, //项目介绍弹窗 projectIntroduction() { //this.popupShow = true @@ -1046,8 +1101,8 @@ export default { this.prjResNav = n; if (n == '06') { this.prjResultsData = this.finishBuildNode.filter(d => d.lvl.length == 4 && d.lvl.substring(0, 2) == '06').map(it => { - if (it.files && !Array.isArray(it.files)) { - it.files = tryToJson(it.files,[]); + if (it.files && !Array.isArray(it.files)) { + it.files = tryToJson(it.files, []); } else { it.files = []; } @@ -1055,8 +1110,8 @@ export default { }); } else { this.prjResultsData = this.finishBuildNode.filter(d => d.lvl.length == 6 && d.lvl.substring(0, 2) == n).map(it => { - if (it.files && !Array.isArray(it.files)) { - it.files = tryToJson(it.files,[]); + if (it.files && !Array.isArray(it.files)) { + it.files = tryToJson(it.files, []); } else { it.files = []; } @@ -1296,14 +1351,15 @@ export default { }; - \ No newline at end of file +} + \ No newline at end of file