项目信息管理头部优化

yfy
项洋 7 days ago
parent 5b5a72f378
commit 5674ab25f2

@ -289,6 +289,7 @@ export default {
},
projectRemarks: [],
loading: false,
scrollTimeout: null,
};
},
created() {
@ -473,28 +474,34 @@ export default {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
handleScroll() {
//
const container = document.querySelector(".containerbody");
if (!container) return;
//
const scrollPosition = container.scrollTop; //
//
for (let i = this.sections.length - 1; i >= 0; i--) {
const element = document.getElementById(this.sections[i].id);
if (element) {
//
const elementPosition = element.offsetTop - container.offsetTop;
if (elementPosition <= scrollPosition) {
if (this.activeSection !== this.sections[i].id) {
this.activeSection = this.sections[i].id;
if (this.scrollTimeout) {
clearTimeout(this.scrollTimeout);
}
this.scrollTimeout = setTimeout(() => {
const scrollPosition = container.scrollTop;
if (scrollPosition > this.lastScrollTop) {
this.scrollDirection = 'down';
} else {
this.scrollDirection = 'up';
}
this.lastScrollTop = scrollPosition;
const offset = this.scrollDirection === 'down' ? 500 : 200;
const adjustedScrollPosition = scrollPosition + offset;
for (let i = this.sections.length - 1; i >= 0; i--) {
const element = document.getElementById(this.sections[i].id);
if (element) {
const elementPosition = element.offsetTop - container.offsetTop;
if (elementPosition <= adjustedScrollPosition) {
if (this.activeSection !== this.sections[i].id) {
this.activeSection = this.sections[i].id;
}
break;
}
break;
}
}
}
}, 50);
},
handleMenuClick() {
if (this.$refs.menuRef) {

@ -200,7 +200,7 @@ export default {
{ id: "basic", label: "基本信息" },
{ id: "programme", label: "规划信息" },
{ id: "buildings", label: "建筑信息" },
{ id: "models", label: "要素模型信息" },
{ id: "models", label: "要素模型信息" },
{ id: "months", label: "月度进展信息" },
{ id: "companyenter", label: "企业入驻信息" },
{ id: "projectpicture", label: "项目画像" },
@ -213,6 +213,9 @@ export default {
projectId: null,
isContainerVisible: true,
isSubmitted: false,
lastScrollTop: 0,
scrollDirection: 'down',
scrollTimeout: null,
basicInformation: {
acceptanceTime: "",
begainTime: "",
@ -282,10 +285,10 @@ export default {
},
projectRemarks: [],
loading: false,
scrollTimeout: null,
};
},
created() {
// projectId
this.projectId = Number(this.$route.params.id);
this.loadData();
this.action = this.$route.query.action;
@ -296,8 +299,6 @@ export default {
if (container) {
container.addEventListener("scroll", this.handleScroll);
}
//
// document.addEventListener('click', this.handleGlobalClick);
},
beforeDestroy() {
window.removeEventListener("scroll", this.handleScroll);
@ -305,8 +306,6 @@ export default {
if (container) {
container.removeEventListener("scroll", this.handleScroll);
}
//
// document.removeEventListener('click', this.handleGlobalClick);
},
methods: {
checkPermi,
@ -348,30 +347,37 @@ export default {
this.$router.go(-1);
},
handleScroll() {
//
const container = document.querySelector(".containerbody");
if (!container) return;
//
const scrollPosition = container.scrollTop; //
//
for (let i = this.sections.length - 1; i >= 0; i--) {
const element = document.getElementById(this.sections[i].id);
if (element) {
//
const elementPosition = element.offsetTop - container.offsetTop;
if (elementPosition <= scrollPosition) {
if (this.activeSection !== this.sections[i].id) {
this.activeSection = this.sections[i].id;
if (this.scrollTimeout) {
clearTimeout(this.scrollTimeout);
}
this.scrollTimeout = setTimeout(() => {
const scrollPosition = container.scrollTop;
if (scrollPosition > this.lastScrollTop) {
this.scrollDirection = 'down';
} else {
this.scrollDirection = 'up';
}
this.lastScrollTop = scrollPosition;
const offset = this.scrollDirection === 'down' ? 500 : 200;
const adjustedScrollPosition = scrollPosition + offset;
for (let i = this.sections.length - 1; i >= 0; i--) {
const element = document.getElementById(this.sections[i].id);
if (element) {
const elementPosition = element.offsetTop - container.offsetTop;
if (elementPosition <= adjustedScrollPosition) {
if (this.activeSection !== this.sections[i].id) {
console.log(`切换到 ${this.sections[i].label},位置: ${elementPosition},偏移: ${offset}`);
this.activeSection = this.sections[i].id;
}
break;
}
break;
}
}
}
}, 50);
},
//
//
handleDataUpdate(dataKey, updatedData) {
if (dataKey === "projectOtherInfos" || dataKey === "wysmxInformations") {
if (Array.isArray(updatedData)) {

Loading…
Cancel
Save