From b76d7b030093416fa10e30945122445f5aace36f Mon Sep 17 00:00:00 2001
From: jxj_yjl <1490736767@qq.com>
Date: Fri, 30 Jun 2023 09:11:15 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=98=E7=89=B9=E5=9B=BE=E9=9D=99?=
=?UTF-8?q?=E6=80=81=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=802?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../progressManagement/ganttChart/index.vue | 454 ++++--------------
1 file changed, 90 insertions(+), 364 deletions(-)
diff --git a/src/views/hz-project/progressManagement/ganttChart/index.vue b/src/views/hz-project/progressManagement/ganttChart/index.vue
index aa46c2f..2c41d8a 100644
--- a/src/views/hz-project/progressManagement/ganttChart/index.vue
+++ b/src/views/hz-project/progressManagement/ganttChart/index.vue
@@ -22,7 +22,7 @@
{{ date }}
@@ -62,7 +62,12 @@
{{ child.endTime }}
{
+ if (el) {
+ const b = va.split("@|@");
+
+ const dataItem = {
+ refData: va,
+ item: el
+ };
+
+ if (itemRefs.length == 0) {
+ const itemList = [];
+ itemList.push(dataItem);
+ const data = {
+ name: b[0],
+ itemS: itemList
+ };
+ itemRefs.push(data);
+ } else {
+ const isCheck = true;
+ for (let index = 0; index < itemRefs.length; index++) {
+ const element = itemRefs[index];
+ if (element.name === b) {
+ isCheck = false;
+ element.itemS.push(dataItem);
+ break;
+ }
+ }
+ if (isCheck) {
+ const itemList = [];
+ itemList.push(dataItem);
+ const data = {
+ name: b[0],
+ itemS: itemList
+ };
+ itemRefs.push(data);
+ }
+ }
+ }
+};
const scrollLeft = ref(0);
const scrollTimer = ref(0);
const openedIndex = ref(9999);
-const refList = ref(""); // 存放dom节点的数组的 获取到的dom节点都在这里
let tooltipsStyle = reactive({
display: "none",
left: 0,
@@ -497,7 +209,6 @@ let tooltipsStyle = reactive({
onMounted(() => {
setGantts();
console.log(getDays("2022/09"), "月日期分布");
- console.log("refList:", refList.value);
});
const getGanttStyle = (project: any) => {
console.log("进入 getGanttStyle --- ", project);
@@ -507,34 +218,49 @@ const getGanttStyle = (project: any) => {
const endArr = endTime.split("/");
let startRef = null;
let endRef = null;
+ // 抹灰工程1-1-2022/09/03
- if (!(startArr[2] % 2)) {
+ const a = !(startArr[2] % 2);
+ console.log(a, ":!(startArr[2] % 2:");
+ if (a) {
const day = startArr[2] - 1;
startArr[2] = day < 10 ? "0" + day : day;
startTime = startArr.join("/");
- console.log(startTime, "startTime----------");
}
+ const b = !(endArr[2] % 2);
+ console.log(a, ":!(endArr[2] % 2):");
if (!(endArr[2] % 2)) {
const day = endArr[2] - 1;
endArr[2] = day < 10 ? "0" + day : day;
endTime = endArr.join("/");
- console.log(endTime, "endTime ------------", pName);
}
- startRef = [`${pName}-${startTime}`][0]; //此项需看下是否生效
+
+ console.log(dateList, "endTime ------------", itemRefs.length);
+ for (let index = 0; index < itemRefs.length; index++) {
+ const data = itemRefs[index];
+
+ if (data.name === pName) {
+ for (let index = 0; index < data.itemS.length; index++) {
+ const element = data.itemS[index];
+ if (element.refData === pName + "@|@" + startTime) {
+ startRef = data.itemS[index].item;
+ }
+
+ if (element.refData === pName + "@|@" + endTime) {
+ endRef = data.itemS[index].item;
+ }
+ }
+ }
+ }
const startLeft = startRef.offsetLeft;
- endRef = [`${pName}-${endTime}`][0]; //此项需看下是否生效
+ const endWidth = endRef.offsetWidth;
- const endWidth = endRef.offsetWidth; //此项需看下是否生效
- console.log("endWidth--------", endWidth);
+ const endLeft = endRef.offsetLeft;
+ const ganttWidth = endLeft - startLeft + endWidth;
- const endLeft = endRef.offsetLeft; //此项需看下是否生效
- console.log("endLeft--------", endLeft);
- const ganttWidth = endLeft - startLeft + endWidth; //此项需看下是否生效
- console.log("ganttWidth--------", ganttWidth);
-
- return { left: startLeft + "px", width: ganttWidth + "px" }; //此项需看下是否生效
+ return { left: startLeft + "px", width: ganttWidth + "px" };
};
const setGantts = () => {
const configGantts = (projects: any) => {