王飞
2025-01-23 b108c63ceb09716fb04a62cc155a404b236b6794
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
  <div id="ProcessBar" class="pB_Container" @mouseenter="delayedOpen" @mouseleave="delayedClose">
    <div class="first" :style="error">
      <!-- {{ getProcessDesc(processValue[0]) }} -->
    </div>
    <div class="second" :style="cancel">
      <!-- {{ getProcessDesc(processValue[1]) }} -->
    </div>
    <div class="third" :style="success">
      <!-- {{ getProcessDesc(processValue[2]) }} -->
    </div>
    <!-- <div class="last" :style="notDone">
        {{ getProcessDesc(processValue[3]) }}
      </div> -->
    <!-- 弹窗元素 -->
    <div v-if="isPopupVisible" @mouseenter="clearCloseTimeout" @mouseleave="delayedClose" class="popup">
      <span>
        东位移: {{ processValueyuan[0] }}
      </span>
      <span style="margin-left: 5px;">
        北位移: {{ processValueyuan[1] }}
      </span>
      <span style="margin-left: 5px;">
        天位移: {{ processValueyuan[2] }}
      </span>
 
    </div>
 
  </div>
</template>
 
<script>
export default {
  name: "ProcessBar",
  props: {
    processValue: {
      type: Array,
      default: [0],
    },
    processValueyuan: {
      type: Array,
      default: [0],
    },
  },
  data() {
    return {
      isPopupVisible: false,
      closeTimeout: null,
      error: {
        width: this.processValue[0] + "%",
      },
      cancel: {
        width: this.processValue[1] + "%",
      },
      success: {
        width: this.processValue[2] + "%",
      },
      // notDone: {
      //   width: this.processValue[3] + "%",
      // },
    };
  },
  components: {},
  methods: {
    delayedOpen() {
      this.clearCloseTimeout();
      this.isPopupVisible = true;
    },
    delayedClose() {
      // 设置一个延时,给用户时间移动到弹窗上
      this.closeTimeout = setTimeout(() => {
        this.isPopupVisible = false;
      }, 300); // 延时300毫秒关闭
    },
    clearCloseTimeout() {
      // 清除已设定的延时关闭,防止弹窗意外关闭
      if (this.closeTimeout) {
        clearTimeout(this.closeTimeout);
        this.closeTimeout = null;
      }
    },
 
    getProcessDesc(data) {
      return data == 0 ? " " : data + "%";
    },
  },
};
</script>
<style lang="scss" scoped>
.popup {
  position: absolute;
  width: 70%;
  height: 26px;
  background-color: rgb(14, 27, 71);
}
 
.pB_Container {
 
  width: 70%;
  height: 13px;
  display: inline-flex;
  line-height: 13px;
 
 
 
  margin-left: 50px;
  margin-top: 25px;
}
 
.first {
  background-color: rgb(41, 122, 244);
 
}
 
.second {
  background-color: rgb(6, 75, 193);
 
}
 
.third {
  background-color: rgb(7, 190, 247);
 
}
</style>