update code

dev-login
haha 2023-08-26 12:46:38 +08:00
parent db074a8c34
commit 7915221e81
4 changed files with 212 additions and 105 deletions

View File

@ -2,7 +2,7 @@ import request from "@/utils/request";
import { tryToJson } from "../../utils/tools"; import { tryToJson } from "../../utils/tools";
import $dt from "dayjs"; import $dt from "dayjs";
const updateItemState=it=>{ const updateItemState = (it) => {
let dt0 = +$dt($dt(new Date()).format("YYYY-MM-DD")); //当时时间 let dt0 = +$dt($dt(new Date()).format("YYYY-MM-DD")); //当时时间
let dt1 = it.planStartDate ? +$dt(it.planStartDate) : 0; //计划开始 let dt1 = it.planStartDate ? +$dt(it.planStartDate) : 0; //计划开始
let dt2 = it.planEndDate ? +$dt(it.planEndDate) : 0; //计划结束 let dt2 = it.planEndDate ? +$dt(it.planEndDate) : 0; //计划结束
@ -42,25 +42,23 @@ const updateItemState=it=>{
return; return;
} }
if (!it.startDate) { if (!it.startDate) {
it.finish = "未开始"; it.finish = "未开始";
it.finishState = 4; it.finishState = 4;
} }
};
}
// 节点计划预警 // 节点计划预警
const selectScheduledAlerts = (data) => { const selectScheduledAlerts = (data) => {
return new Promise(resolve=>{ return new Promise((resolve) => {
request({ request({
url: "bgscreen/projectBuildNode/selectScheduledAlerts", url: "bgscreen/projectBuildNode/selectScheduledAlerts",
method: "post", method: "post",
data: data, data: data,
}).then(d=>{ }).then((d) => {
let tmps = (d.data || []).map(it => { let tmps = (d.data || []).map((it) => {
it.lvl = it.baseBuildNode.nodeLvl; it.lvl = it.baseBuildNode.nodeLvl;
it.projectName=it.project?.projectName||''; it.projectName = it.project?.projectName || "";
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2); it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
it.nodeText = it.baseBuildNode.nodeText; it.nodeText = it.baseBuildNode.nodeText;
it.file = tryToJson(it.files, []); it.file = tryToJson(it.files, []);
@ -81,14 +79,8 @@ const selectCurrent = (data) => {
}); });
}; };
const listByProject=(projectId)=>{ const toTree = (nodes) => {
return new Promise(resolve=>{ let tmps = nodes.map((it) => {
request({
url: `bgscreen/projectBuildNode/listByProject?projectId=${projectId}`,
method: "get",
}).then(d=>{
let tmps = (d.data || []).map(it => {
it.lvl = it.baseBuildNode.nodeLvl; it.lvl = it.baseBuildNode.nodeLvl;
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2); it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
it.nodeText = it.baseBuildNode.nodeText; it.nodeText = it.baseBuildNode.nodeText;
@ -97,18 +89,52 @@ const listByProject=(projectId)=>{
updateItemState(it); updateItemState(it);
return it; return it;
}); });
let objs = tmps.filter(d => d.parentLvl.length == 0); let objs = tmps.filter((d) => d.parentLvl.length == 0);
objs.forEach(it => { objs.forEach((it) => {
it.children = tmps.filter(item => item.parentLvl == it.lvl) it.children = tmps.filter((item) => item.parentLvl == it.lvl);
it.children.forEach(item => { it.children.forEach((item) => {
item.children = tmps.filter(item3 => item3.planStartDate && item3.parentLvl == item.lvl ); item.children = tmps.filter(
(item3) => item3.planStartDate && item3.parentLvl == item.lvl
);
});
it.children = it.children.filter(
(item) => item.children.length > 0 || item.planStartDate
);
});
return objs;
};
const listByProject = (projectId) => {
return new Promise((resolve) => {
request({
url: `bgscreen/projectBuildNode/listByProject?projectId=${projectId}`,
method: "get",
}).then((d) => {
let tmps = (d.data || []).map((it) => {
it.lvl = it.baseBuildNode.nodeLvl;
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
it.nodeText = it.baseBuildNode.nodeText;
it.file = tryToJson(it.files, []);
it.expend = true;
updateItemState(it);
return it;
});
let objs = tmps.filter((d) => d.parentLvl.length == 0);
objs.forEach((it) => {
it.children = tmps.filter((item) => item.parentLvl == it.lvl);
it.children.forEach((item) => {
item.children = tmps.filter(
(item3) => item3.planStartDate && item3.parentLvl == item.lvl
);
});
it.children = it.children.filter(
(item) => item.children.length > 0 || item.planStartDate
);
}); });
it.children=it.children.filter(item=>item.children.length>0||item.planStartDate);
})
resolve(objs); resolve(objs);
})
}); });
} });
};
const covertData = (objs) => { const covertData = (objs) => {
let tmps = objs.map((it) => { let tmps = objs.map((it) => {
@ -194,56 +220,67 @@ const covertData = (objs) => {
* @param {*} data * @param {*} data
* @returns * @returns
*/ */
const countCompletionRate=data=>{ const countCompletionRate = (data) => {
return new Promise(resolve=>{ return new Promise((resolve) => {
request({ request({
url: "bgscreen/projectBuildNode/countCompletionRate", url: "bgscreen/projectBuildNode/countCompletionRate",
method: "post", method: "post",
data: data, data: data,
}).then(d=>{ }).then((d) => {
let tmps=(d.data||[]).map(it=>{ let tmps = (d.data || []).map((it) => {
it.lvl = it.baseBuildNode.nodeLvl; it.lvl = it.baseBuildNode.nodeLvl;
it.projectName=it.project?.projectName||''; it.projectName = it.project?.projectName || "";
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2); it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
it.nodeText = it.baseBuildNode.nodeText; it.nodeText = it.baseBuildNode.nodeText;
it.file = tryToJson(it.files, []); it.file = tryToJson(it.files, []);
it.percent = 0; it.percent = 0;
if (+it.id > 0) { if (+it.id > 0) {
it.percent=(it.nodeId*100.0/it.id*1.0).toFixed(2); it.percent = (((it.nodeId * 100.0) / it.id) * 1.0).toFixed(2);
} }
return it; return it;
}) });
resolve(tmps); resolve(tmps);
}); });
}); });
} };
const queryByProjectType=type=>{ const queryByProjectType = (type) => {
return new Promise(resolve=>{ return new Promise((resolve) => {
request({ request({
url: "bgscreen/projectBuildNode/queryByProjectType?type=" + type, url: "bgscreen/projectBuildNode/queryByProjectType?type=" + type,
method: "get" method: "get",
}).then(d=>{ }).then((d) => {
let tmps = (d.data || []).map(it => { resolve(toTree(d.data || []));
});
});
};
const queryByProjectTypeNoTree = (type) => {
return new Promise((resolve) => {
request({
url: "bgscreen/projectBuildNode/queryByProjectType?type=" + type,
method: "get",
}).then((d) => {
let tmps = (d.data || []).map((it) => {
it.lvl = it.baseBuildNode.nodeLvl; it.lvl = it.baseBuildNode.nodeLvl;
it.projectName=it.project?.projectName||''; it.projectName = it.project?.projectName || "";
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2); it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
it.nodeText = it.baseBuildNode.nodeText; it.nodeText = it.baseBuildNode.nodeText;
it.file = tryToJson(it.files, []);
updateItemState(it); updateItemState(it);
return it; return it;
}); });
resolve(tmps); resolve(tmps);
}); });
}); });
} };
export default { export default {
selectScheduledAlerts, selectScheduledAlerts,
selectCurrent, selectCurrent,
covertData, covertData,
listByProject, listByProject,
countCompletionRate, countCompletionRate,
queryByProjectType queryByProjectType,
queryByProjectTypeNoTree,
toTree
}; };

View File

@ -47,7 +47,7 @@
</module-one-2-1> </module-one-2-1>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<module-one-1-1 label="人员统计"> <module-one-1-1 label="人员统计" :key="elDeptWorks">
<div class="warning-info-title" style="padding-left: 20px;"> <div class="warning-info-title" style="padding-left: 20px;">
<div :class="infoNav == 0 ? 'active' : ''" @click="onWarningInfoNav(0)"></div> <div :class="infoNav == 0 ? 'active' : ''" @click="onWarningInfoNav(0)"></div>
<div :class="infoNav == 1 ? 'active' : ''" @click="onWarningInfoNav(1)"></div> <div :class="infoNav == 1 ? 'active' : ''" @click="onWarningInfoNav(1)"></div>
@ -231,6 +231,7 @@ export default {
}, },
data() { data() {
return { return {
elDeptWorks:0,
prj:{}, prj:{},
prjs:[], prjs:[],
elSumKey:0, elSumKey:0,
@ -604,7 +605,7 @@ export default {
let deptId = this.deptInfo?.id||0; let deptId = this.deptInfo?.id||0;
if (this.infoNav == 0) { if (this.infoNav == 0) {
// //
this.$api.attendance.getDeptWorksList(deptId).then(d => { this.$api.attendance.getDeptWorksList(deptId,this.prj.id).then(d => {
this.laborPersonnelTotal=0; this.laborPersonnelTotal=0;
this.laborPersonnelData=[{text: "劳务人员", value: 0},{text: "监理人员", value: 0},{text: "总包人员", value: 0}]; this.laborPersonnelData=[{text: "劳务人员", value: 0},{text: "监理人员", value: 0},{text: "总包人员", value: 0}];
if(d.rows.length>0 && d.rows[0]!=null){ if(d.rows.length>0 && d.rows[0]!=null){
@ -616,6 +617,7 @@ export default {
this.laborPersonnelTotal += d.rows[0].contractorPersonnel; this.laborPersonnelTotal += d.rows[0].contractorPersonnel;
this.laborPersonnelData.push({text: "总包人员", value: d.rows[0].contractorPersonnel}); this.laborPersonnelData.push({text: "总包人员", value: d.rows[0].contractorPersonnel});
} }
this.elDeptWorks++;
}); });
} else { } else {
// //
@ -631,6 +633,7 @@ export default {
this.laborPersonnelTotal += d.rows[0].contractorPersonnel; this.laborPersonnelTotal += d.rows[0].contractorPersonnel;
this.laborPersonnelData.push({text: "总包人员", value: d.rows[0].contractorPersonnel}); this.laborPersonnelData.push({text: "总包人员", value: d.rows[0].contractorPersonnel});
} }
this.elDeptWorks++;
}); });
} }
}, },

View File

@ -64,13 +64,34 @@
{{ it.constructionProgress }} {{ it.constructionProgress }}
</div> </div>
</div> </div>
<div class="data-row" v-else> <div class="data-row data-node scroll" v-else style="display: block;overflow-y: auto;">
<img src="images/title_icon.png"><span class="sp-lbl">目前进展:</span> <div><img src="images/title_icon.png"><span class="sp-lbl">目前进展:</span></div>
<div class="div-text node-list"> <div class="div-text node-list" v-if="it.nodes && it.nodes.length>0" :style="fontSize==0?'display: flex;':''">
<span v-for="(d,idx) in it.nodes" :key="idx" v-if="it.nodes && it.nodes.length>0" class="node-item"> <template >
{{ d.nodeText}}:<span :class="'finish-'+d.finishState">{{d.finish }}</span> <table v-for="(d,idx) in it.nodes" :key="idx" class="table-lvl1">
</span> <tr>
<td class="td-lvl1">
<div><img src="images/title_icon.png">{{d.nodeText}}:<span :class="'finish-'+d.finishState">{{d.finish }}</span></div>
<table v-for="(dd,idxx) in d.children" :key="idxx" v-if="d.children && d.children.length>0" class="table-lvl2">
<tr>
<td class="td-lvl2">
<div><img src="images/title_icon.png" v-if="dd.children && dd.children.length>0">{{dd.nodeText}}:<span :class="'finish-'+dd.finishState">{{dd.finish }}</span></div>
<table v-for="(ddd,idxxx) in dd.children" :key="idxxx" v-if="dd.children && dd.children.length>0" class="table-lvl3">
<tr>
<td class="td-lvl3" >
<div>{{ddd.nodeText}}:<span :class="'finish-'+ddd.finishState">{{ddd.finish }}</span></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</template>
</div> </div>
<div v-if="!it.nodes || it.nodes.length==0"> <div v-if="!it.nodes || it.nodes.length==0">
暂无. 暂无.
</div> </div>
@ -181,13 +202,13 @@ export default {
quarterly:q quarterly:q
}), }),
this.$api.schedule.selectByProjectType(n), this.$api.schedule.selectByProjectType(n),
this.$api.buildNode.queryByProjectType(n) this.$api.buildNode.queryByProjectTypeNoTree(n)
]; ];
this.$api.http.all(ajaxs).then(res=>{ this.$api.http.all(ajaxs).then(res=>{
let prjs=res[0].data||[]; let prjs=res[0].data||[];
let tmps=res[1].data||[]; let tmps=res[1].data||[];
let nodes=res[2]||[]; let nodes=res[2]||[];
let findNodes=['01','02','03','04','05'] let findNodes=['01','02','03','04','05'];
this.tableData=prjs.map(it=>{ this.tableData=prjs.map(it=>{
it.projectName=it.project?.projectName||''; it.projectName=it.project?.projectName||'';
it.projectSchedule=it.project?.projectSchedule||'1'; it.projectSchedule=it.project?.projectSchedule||'1';
@ -195,7 +216,8 @@ export default {
if(objs.length>0){ if(objs.length>0){
it.existingProblem=objs[0].existingProblem||''; it.existingProblem=objs[0].existingProblem||'';
} }
it.nodes=nodes.filter(item=>item.finish && item.projectId==it.id && findNodes.includes(item.lvl.substring(0,2))); let nds=nodes.filter(item=>item.finish && item.projectId==it.id && findNodes.includes(item.lvl.substring(0,2)));
it.nodes=this.$api.buildNode.toTree(nds);
return it; return it;
}) })
}) })
@ -253,10 +275,9 @@ export default {
} }
.sp-lbl { .sp-lbl {
width: 140px; white-space: nowrap;
&.sp-lbl2 { &.sp-lbl2 {
width: 218px; white-space: nowrap;
} }
} }
@ -268,6 +289,12 @@ export default {
.data-row { .data-row {
line-height: 64px; line-height: 64px;
.td-lvl2{
padding-left: 36px;
}
.td-lvl3{
padding-left: 72px;
}
} }
} }
} }
@ -287,10 +314,10 @@ export default {
} }
.sp-lbl { .sp-lbl {
width: 140px; white-space: nowrap;
&.sp-lbl2 { &.sp-lbl2 {
width: 218px; white-space: nowrap;
} }
} }
@ -302,6 +329,12 @@ export default {
.data-row { .data-row {
line-height: 48px; line-height: 48px;
.td-lvl2{
padding-left: 24px;
}
.td-lvl3{
padding-left: 48px;
}
} }
} }
} }
@ -335,6 +368,14 @@ export default {
} }
} }
} }
.table-lvl1{
border-collapse: collapse;
border:solid 1px #fff;
td{
vertical-align: top;
white-space: nowrap;
}
}
} }
.data-item { .data-item {
border-bottom: solid 1px #fff; border-bottom: solid 1px #fff;
@ -344,6 +385,7 @@ export default {
.sp-lbl { .sp-lbl {
display: inline-block; display: inline-block;
color: aquamarine; color: aquamarine;
white-space: nowrap;
} }
.data-row { .data-row {
@ -364,6 +406,17 @@ export default {
border-bottom: solid 1px rgba(255, 255, 255, 0.1); border-bottom: solid 1px rgba(255, 255, 255, 0.1);
padding: 4px 0px; padding: 4px 0px;
&.data-node{
img{
top:4px;
}
}
.td-lvl2{
padding-left: 12px;
}
.td-lvl3{
padding-left: 24px;
}
} }
img { img {

View File

@ -138,11 +138,12 @@
<rank-chart :data="mechanicalData" :showval="true" :height="224"></rank-chart> <rank-chart :data="mechanicalData" :showval="true" :height="224"></rank-chart>
</module-one-1-1> </module-one-1-1>
<module-one-1-1 label="实测实量" :key="elCheck"> <module-one-1-1 label="实测实量" :key="elCheck">
<div class="warning-info-title" style="padding-left: 20px;"> <div class="warning-info-title measured-data-list" style="padding-left: 20px;">
<div :class="measuredNav==1?'active':''" @click="doMeasuredNav(1,'混泥土工程')"></div> <div :class="measuredNav==1?'active':''" @click="doMeasuredNav(1,'混泥土工程')"></div>
<div :class="measuredNav==2?'active':''" @click="doMeasuredNav(2,'二次构建工程')"></div> <div :class="measuredNav==2?'active':''" @click="doMeasuredNav(2,'二次构建工程')"></div>
<div :class="measuredNav==3?'active':''" @click="doMeasuredNav(3,'房间尺寸')"></div> <div :class="measuredNav==3?'active':''" @click="doMeasuredNav(3,'房间尺寸')"></div>
<div :class="measuredNav==4?'active':''" @click="doMeasuredNav(4,'抹灰工程')"></div> <div :class="measuredNav==4?'active':''" @click="doMeasuredNav(4,'抹灰工程')"></div>
<div :class="measuredNav==5?'active':''" @click="doMeasuredNav(5,'其它')"></div>
</div> </div>
<project-overview-chart :key="measuredNav" <project-overview-chart :key="measuredNav"
:legend-opt="legendOptCheck" :legend-opt="legendOptCheck"
@ -234,7 +235,7 @@ export default {
{value: 1,prop: '12.5', text: '小轿车'}, {value: 1,prop: '12.5', text: '小轿车'},
], ],
measuredNav:0, measuredNav:0,
measuredTotal:7, measuredTotal:0,
measuredText:" 全部", measuredText:" 全部",
measuredData:[], measuredData:[],
// //
@ -255,6 +256,10 @@ export default {
}, },
legendOptCheck: { legendOptCheck: {
icon: "rect", icon: "rect",
orient:'vertical',
itemWidth:'40%',
right:'15%',
itemWidth:50,
textStyle: { textStyle: {
fontSize: 14, fontSize: 14,
rich: { rich: {
@ -264,7 +269,7 @@ export default {
}, },
percent: { percent: {
color: "#4676FD", color: "#4676FD",
padding: [5, 5, 20, 5], padding: [0, 5, 0, 5],
}, },
}, },
}, },
@ -394,6 +399,10 @@ export default {
value:it.id value:it.id
} }
}); });
this.measuredTotal=0;
this.measuredData.forEach(it=>{
this.measuredTotal+=it.value;
})
this.elCheck++; this.elCheck++;
}) })
}, },
@ -615,5 +624,10 @@ export default {
.hide-scroll>.screen-one-3-1{ .hide-scroll>.screen-one-3-1{
overflow: hidden; overflow: hidden;
} }
.measured-data-list{
&>div{
padding:0px 8px;
}
}
} }
</style> </style>