update code
parent
608575c530
commit
2631112a89
|
@ -4,11 +4,51 @@ import $dt from "dayjs";
|
|||
|
||||
// 节点计划预警
|
||||
const selectScheduledAlerts = (data) => {
|
||||
return request({
|
||||
return new Promise(resolve=>{
|
||||
request({
|
||||
url: "bgscreen/projectBuildNode/selectScheduledAlerts",
|
||||
method: "post",
|
||||
data: data,
|
||||
}).then(d=>{
|
||||
const updateItemState=it=>{
|
||||
let dt0 = +$dt($dt(new Date()).format("YYYY-MM-DD")); //当时时间
|
||||
let dt1 = it.planStartDate ? +$dt(it.planStartDate) : 0; //计划开始
|
||||
let dt2 = it.planEndDate ? +$dt(it.planEndDate) : 0; //计划结束
|
||||
let dt3 = it.startDate ? +$dt(it.startDate) : 0; //实际开始
|
||||
let dt4 = it.endDate ? +$dt(it.endDate) : 0; //实际结束
|
||||
if(!it.startDate && it.endDate){
|
||||
it.finish="未开工";
|
||||
it.finishState = 4;
|
||||
return;
|
||||
}
|
||||
if(it.planEndDate){
|
||||
if(dt2<dt0){
|
||||
it.finish = "逾期" + (dt0 - dt2) / 3600 / 1000 / 24 + "天";
|
||||
it.finishState = 1;
|
||||
}else{
|
||||
it.finish = "进行中";
|
||||
it.finishState = 2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(it.startDate){
|
||||
it.finish = "进行中";
|
||||
it.finishState = 2;
|
||||
}
|
||||
|
||||
};
|
||||
let tmps = (d.data || []).map(it => {
|
||||
it.lvl = it.baseBuildNode.nodeLvl;
|
||||
it.projectName=it.project?.projectName||'';
|
||||
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
|
||||
it.nodeText = it.baseBuildNode.nodeText;
|
||||
it.file = tryToJson(it.files, []);
|
||||
updateItemState(it);
|
||||
return it;
|
||||
});
|
||||
resolve(tmps);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 获取当前节点及叶子节点
|
||||
|
@ -123,9 +163,40 @@ const covertData = (objs) => {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 节点完成率统计
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
const countCompletionRate=data=>{
|
||||
return new Promise(resolve=>{
|
||||
request({
|
||||
url: "bgscreen/projectBuildNode/countCompletionRate",
|
||||
method: "post",
|
||||
data: data,
|
||||
}).then(d=>{
|
||||
let tmps=(d.data||[]).map(it=>{
|
||||
it.lvl = it.baseBuildNode.nodeLvl;
|
||||
it.projectName=it.project?.projectName||'';
|
||||
it.parentLvl = it.lvl.substring(0, it.lvl.length - 2);
|
||||
it.nodeText = it.baseBuildNode.nodeText;
|
||||
it.file = tryToJson(it.files, []);
|
||||
it.percent=0;
|
||||
if(+it.id>0){
|
||||
it.percent=(it.nodeId*100.0/it.id*1.0).toFixed(2);
|
||||
}
|
||||
return it;
|
||||
})
|
||||
resolve(tmps);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
selectScheduledAlerts,
|
||||
selectCurrent,
|
||||
covertData,
|
||||
listByProject
|
||||
listByProject,
|
||||
countCompletionRate
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue