flx:修改进度小数点问题

This commit is contained in:
Rain_ 2025-05-14 09:13:44 +08:00
parent d486f0fde9
commit 336af6abd3
5 changed files with 2279 additions and 164 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

View File

@ -667,7 +667,7 @@ onMounted(() => {
width: 100%; width: 100%;
height: 500px; height: 500px;
// margin: 20px 0; // margin: 20px 0;
background-image: url("@/assets/images/bthgIcon/bgIndex_1.png"); background-image: url("@/assets/images/bthgIcon/bgIndex_2.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
position: relative; position: relative;

View File

@ -21,30 +21,51 @@
</div> </div>
</th> </th>
<!-- <th rowspan="2">装置名称</th> --> <!-- <th rowspan="2">装置名称</th> -->
<th :colspan="monthListUp(item).length" v-for="(item, index) in props.yearList" :key="index">{{ item }}</th> <th
v-for="(item, index) in props.yearList"
:key="`year-${index}`"
:colspan="monthListUp(item).length"
>
{{ item }}
</th>
</tr> </tr>
<tr> <tr>
<!-- <th>前期阶段</th> --> <!-- <th>前期阶段</th> -->
<template v-for="item in props.yearList"> <template v-for="item in props.yearList" :key="`month-${item}`">
<th v-for="ele in monthListUp(item)" :key="item + '-' + ele"> <th
v-for="ele in monthListUp(item)"
:key="`${item}-${ele}`"
>
{{ ele }} {{ ele }}
</th> </th>
</template> </template>
</tr> </tr>
<tr class="td_header_boxs" v-for="(item, index) in props.milestoneList" :key="item.id"> <tr
class="td_header_boxs"
v-for="(item, index) in props.milestoneList"
:key="`milestone-${item.id}`"
>
<td class="th_sticky" colspan="3">里程碑</td> <td class="th_sticky" colspan="3">里程碑</td>
<template v-for="(time, tIndex) in props.yearList"> <template v-for="(time, tIndex) in props.yearList" :key="`time-${time}`">
<td v-for="month in monthListUp(time)" :key="time + '-' + month"> <td
v-for="month in monthListUp(time)"
:key="`${time}-${month}`"
>
<div> <div>
<template v-for="(ele, eindex) in getQuarterTime(`${time}-${month}-01`, 'month')"> <template v-for="(ele, eindex) in getQuarterTime(`${time}-${month}-01`, 'month')" :key="`quarter-${ele}`">
<div> <div>
<template v-for="option in item.firstQuarterList"> <template v-for="option in item.firstQuarterList" :key="`option-${option.id}`">
<div <div
class="triangle_box" class="triangle_box"
v-if="ele - 1 == getCurrentQuarterTime(option.beginDate, `${time}-${month}`, 'month')" v-if="Number(ele) - 1 === getCurrentQuarterTime(option.beginDate, `${time}-${month}`, 'month')"
> >
<div></div> <div></div>
<el-tooltip class="item" effect="dark" :content="option.name" placement="top"> <el-tooltip
class="item"
effect="dark"
:content="option.name"
placement="top"
>
<div>{{ formatTime(option) }}{{ option.name }}</div> <div>{{ formatTime(option) }}{{ option.name }}</div>
</el-tooltip> </el-tooltip>
</div> </div>
@ -67,18 +88,31 @@
:infinite-scroll-distance="1" :infinite-scroll-distance="1"
:infinite-scroll-immediate="false" :infinite-scroll-immediate="false"
> >
<template v-for="(cur, index) in splitData"> <template v-for="(cur, index) in splitData" :key="`cur-${cur.id}`">
<!-- <template v-for="(planItem, index) in cur.children"> --> <!-- <template v-for="(planItem, index) in cur.children"> -->
<tr class="td_start_boxs" v-for="(item, planIndex) in cur.children" :key="item.id"> <tr
class="td_start_boxs"
v-for="(item, planIndex) in cur.children"
:key="`item-${item.id}`"
>
<!-- <td class="td_sticky" v-show="planIndex == 0" :rowspan="cur.children.length"> <!-- <td class="td_sticky" v-show="planIndex == 0" :rowspan="cur.children.length">
{{ cur.name }} {{ cur.name }}
</td> --> </td> -->
<td class="td_sticky" v-show="planIndex == 0" :rowspan="cur.children.length">{{ cur.name }}</td> <td
class="td_sticky"
v-show="planIndex == 0"
:rowspan="cur.children.length"
>
{{ cur.name }}
</td>
<td class="td_sticky td_sticky1">{{ item.name }}</td> <td class="td_sticky td_sticky1">{{ item.name }}</td>
<template v-for="(time, tIndex) in yearList"> <template v-for="(time, tIndex) in yearList" :key="`time-${time}`">
<td v-for="month in monthListUp(time)" :key="time + '-' + month"> <td
v-for="month in monthListUp(time)"
:key="`${time}-${month}`"
>
<div> <div>
<template v-for="(ele, eindex) in getQuarterTime(`${time}-${month}-01`, 'month')"> <template v-for="(ele, eindex) in getQuarterTime(`${time}-${month}-01`, 'month')" :key="`quarter-${ele}`">
<div <div
:class="{ :class="{
schedule_ff00: schedule_ff00:
@ -89,11 +123,11 @@
getQuarterTime(`${time}-${month}-${ele}`, 'month', item.minStartTime, item.maxEndTime) getQuarterTime(`${time}-${month}-${ele}`, 'month', item.minStartTime, item.maxEndTime)
}" }"
> >
<template v-for="option in item.firstQuarterList"> <template v-for="option in item.firstQuarterList" :key="`option-${option.id}`">
<!-- <el-tooltip :value="true" v-if="ele - 1 == getCurrentQuarterTime(option.yearTime, `${time}-${month}`, 'month')" class="item" effect="light" :content="option.name" placement="top"> --> <!-- <el-tooltip :value="true" v-if="ele - 1 == getCurrentQuarterTime(option.yearTime, `${time}-${month}`, 'month')" class="item" effect="light" :content="option.name" placement="top"> -->
<div <div
class="circle_box" class="circle_box"
v-if="ele - 1 == getCurrentQuarterTime(option.beginDate, `${time}-${month}`, 'month')" v-if="Number(ele) - 1 === getCurrentQuarterTime(option.beginDate, `${time}-${month}`, 'month')"
> >
<div <div
:class="{ :class="{
@ -103,10 +137,19 @@
}" }"
@click="option.isShowHidden = !option.isShowHidden" @click="option.isShowHidden = !option.isShowHidden"
></div> ></div>
<div class="shape" v-show="option.isShowHidden"> <div
class="shape"
v-show="option.isShowHidden"
ref="shapeRefs"
>
<!-- option.milestoneType == 2 --> <!-- option.milestoneType == 2 -->
<div :class="{ plan_flag: option.completeType == 1 }"></div> <div :class="{ plan_flag: option.completeType == 1 }"></div>
<el-tooltip class="item" effect="dark" :content="option.name" placement="top"> <el-tooltip
class="item"
effect="dark"
:content="option.name"
placement="top"
>
<div class="text_space" :class="{ indent: option.completeType == 1 }"> <div class="text_space" :class="{ indent: option.completeType == 1 }">
{{ formatTime(option) }}{{ option.name }} {{ formatTime(option) }}{{ option.name }}
</div> </div>
@ -130,7 +173,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, onMounted, watch, onUpdated, nextTick, computed, onUnmounted } from "vue"; import { reactive, ref, onMounted, watch, onUpdated, nextTick, computed, onUnmounted, onBeforeUpdate } from "vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import quarterOfYear from "dayjs/plugin/quarterOfYear"; import quarterOfYear from "dayjs/plugin/quarterOfYear";
import isBetween from "dayjs/plugin/isBetween"; import isBetween from "dayjs/plugin/isBetween";
@ -411,6 +454,59 @@ const setIntervalTimeFn2 = () => {
gasanalysisInfo.setIntervalTime2 = requestAnimationFrame(setIntervalTimeFn2); gasanalysisInfo.setIntervalTime2 = requestAnimationFrame(setIntervalTimeFn2);
} }
// 使refsshape
const shapeRefs = ref<HTMLElement[]>([]);
// 使
const debounce = (fn: Function, delay: number) => {
let timer: ReturnType<typeof setTimeout> | null = null;
return (...args: any[]) => {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(this, args);
}, delay);
};
};
// IntersectionObserver
const setupIntersectionObserver = () => {
const io = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const shape = entry.target as HTMLElement;
const rhombus = shape.previousElementSibling as HTMLElement;
if (rhombus) {
const shapeRect = shape.getBoundingClientRect();
const rhombusRect = rhombus.getBoundingClientRect();
//
const overlap = Math.min(shapeRect.right, rhombusRect.right) - Math.max(shapeRect.left, rhombusRect.left);
if (overlap > 0) {
//
const moveDistance = overlap + 10; // 10px
shape.style.transform = `translateX(${moveDistance}px)`;
//
const arrow = shape.querySelector('.popper__arrow') as HTMLElement;
if (arrow) {
const offset = rhombusRect.left - shapeRect.left;
arrow.style.left = `${offset}px`;
}
}
}
}
});
}, {
threshold: 0.1,
rootMargin: '0px'
});
return io;
};
//
onMounted(() => { onMounted(() => {
console.log("挂载了"); console.log("挂载了");
console.log(props.showDwon); console.log(props.showDwon);
@ -421,28 +517,34 @@ onMounted(() => {
setIntervalTimeFn(); setIntervalTimeFn();
}; };
// io IntersectionObserver - IntersectionObserver() // const io = setupIntersectionObserver();
// var io = new IntersectionObserver((entries) => { // shapeRefs.value.forEach(shape => {
// //entries IntersectionObserverEntry // io.observe(shape);
// entries.forEach((item: any) => { // });
// //item IntersectionObserverEntry });
// // isIntersectingBoolean });
// if (item.isIntersecting) {
// //div //
// console.log(1122333, item, item.target.__vnode, item.target.__vnode.el); onBeforeUpdate(() => {
// // console.log(document.getElementsByClassName(item.target.className) as any); shapeRefs.value = [];
// console.log(item.target.__vnode.el.previousElementSibling); });
// // console.log(item.currentTarget.previousElementSibling);
// // console.log(item.currentTarget.previousElementSibling.getBoundingClientRect()); //
// console.log(item.target.__vnode.el.nextElementSibling); onUpdated(() => {
// io.unobserve(item.target); //div DOM console.log("更新");
// } cancelAnimationFrame(gasanalysisInfo.setIntervalTime2);
// }); cancelAnimationFrame(gasanalysisInfo.setIntervalTime);
// }); //options if(store.schedulePlanFlag) {
// const divArr = [...document.querySelectorAll(".shape") as any]; gasanalysisInfo.setIntervalScrollLeft = 0;
// divArr.forEach((div) => io.observe(div)); // div DOM setIntervalTimeFn();
}) }
})
nextTick(() => {
setTimeout(() => {
userInfo.isLoading = false;
}, 1000);
});
});
watch(() => store.schedulePlanFlag, (newVal) => { watch(() => store.schedulePlanFlag, (newVal) => {
cancelAnimationFrame(gasanalysisInfo.setIntervalTime); cancelAnimationFrame(gasanalysisInfo.setIntervalTime);
@ -452,12 +554,11 @@ watch(() => store.schedulePlanFlag, (newVal) => {
} }
}, { deep: true }); }, { deep: true });
//
onUnmounted(()=>{ onUnmounted(() => {
// cancelAnimationFrame(gasanalysisInfo.setIntervalTime);
cancelAnimationFrame(gasanalysisInfo.setIntervalTime); cancelAnimationFrame(gasanalysisInfo.setIntervalTime2);
cancelAnimationFrame(gasanalysisInfo.setIntervalTime2); });
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>