diff --git a/yanzhu-bigscreen/src/api/detail.js b/yanzhu-bigscreen/src/api/detail.js index 03ef4224..fa5d7d9a 100644 --- a/yanzhu-bigscreen/src/api/detail.js +++ b/yanzhu-bigscreen/src/api/detail.js @@ -1,39 +1,108 @@ import request from "@/utils/request"; +import { tryToJson } from "../utils/tools"; +import $dt from "dayjs"; const groupByCraftType = (data) => { - return request({ - url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftType", - method: "get", - params:data - }); - }; + return request({ + url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftType", + method: "get", + params: data, + }); +}; - const groupByCraftTypeByAttendance = (data) => { - return request({ - url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftTypeByAttendance", - method: "get", - params:data - }); - }; +const groupByCraftTypeByAttendance = (data) => { + return request({ + url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftTypeByAttendance", + method: "get", + params: data, + }); +}; - const subdeptsUsersList=(data)=>{ +const subdeptsUsersList = (data) => { + return request({ + url: "/manage/proProjectInfoSubdeptsUsers/list", + method: "get", + params: data, + }); +}; + +const attendanceUbiDataList = (data) => { + return request({ + url: "/manage/attendanceUbiData/list", + method: "get", + params: data, + }); +}; +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.planStartDate) { + return; + } + if (it.endDate) { + if (!it.planEndDate) { + it.finish = "正常完成"; + it.finishState = 3; + return; + } + if (dt4 > dt2) { + it.finish = "逾期完成"; + it.finishState = 1; + } else { + it.finish = "正常完成"; + it.finishState = 3; + } + return; + } + if (it.startDate) { + if (!it.planEndDate) { + it.finish = "进行中"; + it.finishState = 2; + return; + } + 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 = 4; + } +}; + +const milestoneList = (data) => { + return new Promise((resolve) => { return request({ - url: "/manage/proProjectInfoSubdeptsUsers/list", - method: "get", - params:data + url: "/manage/milestone/list", + method: "get", + params: data, + }).then((d) => { + let tmps = (d.rows || []).map((it) => { + it.nodeText = it.nodeName||''; + it.planStartDate=it.scheduledStart; + it.planEndDate=it.scheduledEnd; + it.startDate=it.actualStart; + it.endDate=it.actualEnd; + updateItemState(it); + return it; }); - } - - const attendanceUbiDataList=(data)=>{ - return request({ - url: "/manage/attendanceUbiData/list", - method: "get", - params:data + resolve(tmps); }); - } -export default{ - groupByCraftType, - groupByCraftTypeByAttendance, - subdeptsUsersList, - attendanceUbiDataList -} \ No newline at end of file + }); +}; +export default { + groupByCraftType, + groupByCraftTypeByAttendance, + subdeptsUsersList, + attendanceUbiDataList, + milestoneList, +}; diff --git a/yanzhu-bigscreen/src/views/projectDetail.vue b/yanzhu-bigscreen/src/views/projectDetail.vue index 1604f6db..b66aceb1 100644 --- a/yanzhu-bigscreen/src/views/projectDetail.vue +++ b/yanzhu-bigscreen/src/views/projectDetail.vue @@ -363,7 +363,8 @@