ZhangXianQiang
2024-02-28 b8a72fe64c7dce111517e18f1b9c3b73ab49fb36
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
<script setup lang="ts">
import { currentGET } from "@/api";
import SeamlessScroll from "@/components/seamless-scroll";
import { computed, onMounted, reactive } from "vue";
import { useSettingStore } from "@/stores";
import { storeToRefs } from "pinia";
import EmptyCom from "@/components/empty-com";
const settingStore = useSettingStore();
const { defaultOption, indexConfig } = storeToRefs(settingStore);
const state = reactive<any>({
  list: [],
  defaultOption: {
    ...defaultOption.value,
    singleHeight: 252,
    limitScrollNum: 3,
    // step:3
  },
  scroll: true,
 
});
 
const getData = () => {
  currentGET("rightBottom", { limitNum: 20 }).then((res) => {
    console.log("右下", res);
    if (res.success) {
      state.list = res.data.list;
    } else {
      window.$message({
        text: res.msg,
        type: "warning",
      });
    }
  });
};
 
const comName = computed(() => {
  if (indexConfig.value.rightBottomSwiper) {
    return SeamlessScroll;
  } else {
    return EmptyCom;
  }
});
function montionFilter (val:any) {
    // console.log(val);
    return val ? Number(val).toFixed(2) : '--'
}
const handleAddress=(item:any)=>{
  return `${ item.provinceName }/${item.cityName }/${item.countyName}`
}
onMounted(() => {
  getData();
});
</script>
 
<template>
  <div
    class="right_bottom_wrap beautify-scroll-def"
    :class="{ 'overflow-y-auto': !indexConfig.rightBottomSwiper }"
  >
    <component
      :is="comName"
      :list="state.list"
      v-model="state.scroll"
      :singleHeight="state.defaultOption.singleHeight"
      :step="state.defaultOption.step"
      :limitScrollNum="state.defaultOption.limitScrollNum"
      :hover="state.defaultOption.hover"
      :singleWaitTime="state.defaultOption.singleWaitTime"
      :wheel="state.defaultOption.wheel"
    >
      <ul class="right_bottom">
        <li class="right_center_item" v-for="(item, i) in state.list" :key="i">
          <span class="orderNum">{{ i + 1 }}</span>
          <div class="inner_right">
            <div class="dibu"></div>
            <div class="flex">
              <div class="info">
                <span class="labels">设备ID:</span>
                <span class="text-content zhuyao"> {{ item.gatewayno }}</span>
              </div>
              <div class="info">
                <span class="labels">型号:</span>
                <span class="text-content"> {{ item.terminalno }}</span>
              </div>
              <div class="info">
                <span class="labels">告警值:</span>
                <span class="text-content warning">
                  {{  montionFilter(item.alertvalue) }}</span
                >
              </div>
            </div>
 
            <div class="flex">
              <div class="info">
                <span class="labels shrink-0"> 地址:</span>
                <span class=" ciyao truncate" style="font-size: 12px;width: 220px;" :title="handleAddress(item)">
                  {{ handleAddress(item)}}</span
                >
              </div>
              <div class="info time shrink-0">
                <span class="labels">时间:</span>
                <span class="text-content" style="font-size: 12px">
                  {{ item.createtime }}</span
                >
              </div>
            </div>
            <div class="flex">
              <div class="info">
                <span class="labels">报警内容:</span>
                <span
                  class="text-content ciyao"
                  :class="{ warning: item.alertdetail }"
                >
                  {{ item.alertdetail || "无" }}</span
                >
              </div>
            </div>
          </div>
        </li>
      </ul>
    </component>
  </div>
</template>
 
<style scoped lang="scss">
.right_bottom {
  width: 100%;
  height: 100%;
 
  .right_center_item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    padding: 10px;
    font-size: 14px;
    color: #fff;
 
    .orderNum {
      margin: 0 20px 0 -20px;
    }
 
    .inner_right {
      position: relative;
      height: 100%;
      width: 400px;
      flex-shrink: 0;
      line-height: 1.5;
 
      .dibu {
        position: absolute;
        height: 2px;
        width: 104%;
        background-image: url("@/assets/img/zuo_xuxian.png");
        bottom: -12px;
        left: -2%;
        background-size: cover;
      }
    }
 
    .info {
      margin-right: 10px;
      display: flex;
      align-items: center;
 
      .labels {
        flex-shrink: 0;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
      }
 
      .zhuyao {
        color: $primary-color;
        font-size: 15px;
      }
 
      .ciyao {
        color: rgba(255, 255, 255, 0.8);
      }
 
      .warning {
        color: #e6a23c;
        font-size: 15px;
      }
    }
  }
}
 
.right_bottom_wrap {
  overflow: hidden;
  width: 100%;
  height: 252px;
}
 
.overflow-y-auto {
  overflow-y: auto;
}
</style>