陶杰
2024-11-29 9d8b830b1bc0ff91d86b718e4cdef53367496cc3
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<template>
  <div
    class="itm-map-item"
    :class="[
      item.s ? '' : 'd',
      item.n == 'r' ? 'error r' : '',
      item.n == 'y' ? 'error y' : '',
      item.areacode ? 'areacode' : '',
    ]"
    :style="{
      left: evalA(item.x) + 'rem',
      top: evalA(item.y) + 'rem',
      width: item.w && item.w != '0' ? item.w + 'rem' : '',
      height: item.h && item.h != '0' ? item.h + 'rem' : '',
    }"
    @click="toAreaDetail"
  >
    <div
      v-if="item.t"
      class="t"
      v-html="item.t"
      :class="[item.t_c_1, item.stand, item.t_c, item.tl]"
    ></div>
    <div v-if="false">{{ no }}</div>
    <!-- <img v-if="item.s" :class="[item.s ? 'itm-svg-' + item.s : '']"></img> -->
    <div
      v-if="item.s"
      :class="[
        item.s ? 'itm-svg-' + item.s : '',
        item.n == 'r' ? 'r' : '',
        item.n == 'y' ? 'y' : '',
      ]"
      :style="{
        width: item.w && item.w != '0' ? item.w + 'rem' : '',
        height: item.h && item.h != '0' ? item.h + 'rem' : '',
      }"
    ></div>
    <div class="tip-msg">
      <div class="title flex">
        <div class="dot"></div>
        <div>{{ getMsg(item.t) }}</div>
      </div>
      <div class="title flex">
        <div class="dot"></div>
        <div>所属区域:{{ item.areacode }}区</div>
      </div>
      <!-- <div class="desc">所属区域:{{item.area}}</div> -->
      <!-- <div class="desc">详细信息:一小时后磁盘满</div> -->
    </div>
    <div v-if="item.n == 'r'" class="tip-msg">
      <div class="title flex">
        <div class="dot"></div>
        <div>{{ getMsg(item.t) }}</div>
      </div>
      <div class="desc">预警情况:红色预警</div>
      <div class="desc">详细信息:一小时后磁盘满</div>
    </div>
    <div v-if="item.n == 'y'" class="tip-msg">
      <div class="title flex">
        <div class="dot"></div>
        <div>{{ getMsg(item.t) }}</div>
      </div>
      <div class="desc">预警情况:黄色预警</div>
      <div class="desc">详细信息:一小时后磁盘满</div>
    </div>
  </div>
</template>
 
<script>
export default {
  props: {
    item: {
      type: Object,
      default() {
        return {};
      },
    },
    no: {
      type: Number,
      default() {
        return 0;
      },
    },
  },
  methods: {
    evalA(string) {
      return eval(string);
    },
    getMsg(t) {
      return t
        .replace("&nbsp;", " ")
        .replace("&nbsp;", " ")
        .replace("&nbsp;", " ")
        .replace("<br/>", " ")
        .replace("<br/>", " ");
    },
    toAreaDetail() {
      if (this.item.areacode) {
        this.$router.push({
          path: "/area",
          query: { code: this.item.areacode },
        });
      }
    },
  },
};
</script>
 
<style lang="scss" scoped>
@import "../../common/itm_svg3d.scss";
 
.itm-map-item {
  position: absolute;
  min-width: 20px;
  min-height: 20px;
  .itm-svg-A41 {
    background-size: 100% 100%;
  }
 
  .t {
    position: absolute;
    left: 50%; //起始是在body中,横向距左50%的位置
    top: 50%; //起始是在body中,纵向距上50%的位置,这个点相当于body的中心点,div的左上角的定位
    transform: translate(-50%, -50%); //水平、垂直都居中,也可以写成下面的方式
    font-size: 1.2rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #ffffff;
    color: rgba(1, 43, 94, 1);
    line-height: 1.4rem;
  }
  .t.w {
    color: #ffffff;
  }
  .t.l {
    /* left: unset; */
    /* right: 2rem; */
    left: 30%;
    transform: translate(-50%, 0%);
  }
  .t.t_c_1 {
    font-size: 2.33rem;
    /* font-weight: 400; */
  }
  .t.stand {
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
  .t.t_c_2 {
    font-size: 2.33rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #8ba7c7;
  }
  .tip-msg {
    display: none;
    position: absolute;
    left: calc(50% + 5rem); //起始是在body中,横向距左50%的位置
    top: 55%; //起始是在body中,纵向距上50%的位置,这个点相当于body的中心点,div的左上角的定位
    min-width: 21rem;
    height: 9.6rem;
    background: #f1f9ff;
    box-shadow: 0.6rem 0.4rem 2.4rem 0rem rgba(56, 92, 131, 0.77);
    border-radius: 0.6rem;
    z-index: 2;
    padding: 1.3rem;
    .title {
      font-size: 2.5rem;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #012b5e;
      line-height: 3.6rem;
      text-align: left;
      margin-bottom: 1rem;
      text-overflow: ellipsis;
      /* width: 10rem; */
      overflow: hidden;
      word-break: break-all;
      white-space: nowrap;
      .dot {
        width: 1.6rem;
        height: 1.6rem;
        min-width: 1.6rem;
        min-height: 1.6rem;
        /* background: #e20505; */
        border-radius: 50%;
        margin-top: 1rem;
        margin-right: 0.5rem;
      }
    }
    .desc {
      font-size: 1.4rem;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #666666;
      line-height: 2rem;
      text-align: left;
      margin-left: 2.1rem;
      margin-top: 0.5rem;
    }
  }
}
.itm-map-item.d {
  /* background-color: rgba(209, 227, 247, 1); */
}
.itm-map-item.error {
  cursor: pointer;
  .tip-msg {
    /* display: unset; */
  }
}
.itm-map-item.error.r::before {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
 
  content: "";
  background-color: #e2050593;
}
.itm-map-item.error.y::before {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
 
  content: "";
  background: rgba(236, 193, 93, 0.6);
}
.itm-map-item.error.r .tip-msg .title .dot {
  background: #e20505;
}
.itm-map-item.error.y .tip-msg .title .dot {
  background: rgba(236, 193, 93, 1);
}
 
.itm-map-item.error:hover {
  .tip-msg {
    display: unset;
  }
}
.itm-map-item:hover {
  .tip-msg {
    display: unset;
  }
}
.itm-map-item.areacode:hover::before {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
 
  content: "";
  background-color: #059ce293;
}
</style>