|
@@ -3,7 +3,7 @@
|
|
|
<div class="ment_equip">
|
|
|
<div class="card_ment_equip">
|
|
|
<div class="box_bj_equip center_in blue_bj_equip">
|
|
|
- <svg-icon icon-class="rke" color="#fff" className="arch_icon_rke" />
|
|
|
+ <svg-icon icon-class="amount" color="#fff" className="arch_icon_rke" />
|
|
|
</div>
|
|
|
<div class="equip_ment">
|
|
|
<div class="equip_ment_title">设备总数</div>
|
|
@@ -11,26 +11,43 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="card_ment_equip">
|
|
|
- <div class="box_bj_equip center_in yellow_bj_equip">
|
|
|
- <svg-icon icon-class="rke" color="#fff" className="arch_icon_rke" />
|
|
|
+ <div class="box_bj_equip center_in green_bj_equip">
|
|
|
+ <svg-icon icon-class="onlinelink" color="#fff" className="arch_icon_rke" />
|
|
|
</div>
|
|
|
<div class="equip_ment">
|
|
|
<div class="equip_ment_title">在线</div>
|
|
|
- <span class="num_ment yellow_title">{{ resultData.Online }}</span>
|
|
|
+ <span class="num_ment green_title">{{ resultData.Online }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="card_ment_equip">
|
|
|
- <div class="box_bj_equip center_in green_bj_equip">
|
|
|
- <svg-icon icon-class="rke" color="#fff" className="arch_icon_rke" />
|
|
|
+ <div class="box_bj_equip center_in yellow_bj_equip">
|
|
|
+ <svg-icon icon-class="abnormal" color="#fff" className="arch_icon_rke" />
|
|
|
</div>
|
|
|
<div class="equip_ment">
|
|
|
<div class="equip_ment_title">异常</div>
|
|
|
- <span class="num_ment green_title">{{ resultData.Abnormal }}</span>
|
|
|
+ <span class="num_ment yellow_title">{{ resultData.Abnormal }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="box_arch_ment">
|
|
|
- <dv-scroll-board :config="config" style="width:100%;height:calc(100% - 10px);margin-top: 10px;" />
|
|
|
+ <div class="page">
|
|
|
+ <div class="header-view">
|
|
|
+ <div class="view_item" v-for="item in headerList" :key="item">{{ item }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="warning-view">
|
|
|
+ <div class="scroll-view" ref="scrollViewRef" @mouseenter="onMouseenter" @mouseleave="onMouseleave">
|
|
|
+ <div ref="listRef" class="list" v-for="(p, n) in count" :key="n">
|
|
|
+ <div class="item" v-for="(item, index) in data" :key="index">
|
|
|
+ <div class="content view_item">{{ item.AlarmContent }}</div>
|
|
|
+ <div class="content view_item">{{ item.Location }}</div>
|
|
|
+ <div class="time view_item" :class="item.State == 0 ? 'green_titleil' : 'red_title'">{{
|
|
|
+ item.State == 0 ? '正常' : '异常' }}</div>
|
|
|
+ <div class="time view_item">{{ item.Date }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -42,48 +59,75 @@ const props = defineProps({
|
|
|
default: {}
|
|
|
}
|
|
|
})
|
|
|
-const config = ref({
|
|
|
- headerBGC: '#10285c',
|
|
|
- oddRowBGC: '#10285c7f',
|
|
|
- evenRowBGC: '#10285c00',
|
|
|
- header: ['设备名称', '位置', '状态'],
|
|
|
- data: [
|
|
|
- ['行1列1', '行1列2', '行1列3'],
|
|
|
- ['行2列1', '行2列2', '行2列3'],
|
|
|
- ['行3列1', '行3列2', '行3列3'],
|
|
|
- ['行4列1', '行4列2', '行4列3'],
|
|
|
- ['行5列1', '行5列2', '行5列3'],
|
|
|
- ['行6列1', '行6列2', '行6列3'],
|
|
|
- ['行7列1', '行7列2', '行7列3'],
|
|
|
- ['行8列1', '行8列2', '行8列3'],
|
|
|
- ['行9列1', '行9列2', '行9列3'],
|
|
|
- ['行10列1', '行10列2', '行10列3']
|
|
|
- ]
|
|
|
-})
|
|
|
+const headerList = ref(['设备名称', '位置', '状态', '时间'])
|
|
|
+const data = ref([]); //列表数据
|
|
|
+const listRef = ref(); //列表dom
|
|
|
+const scrollViewRef = ref(); //滚动区域dom
|
|
|
+const count = ref(1); //列表个数
|
|
|
+
|
|
|
+let intervalId = null;
|
|
|
+let isAutoScrolling = true; //是否自动滚动标识
|
|
|
+
|
|
|
+//获取列表数据
|
|
|
+const getData = () => {
|
|
|
+ //模拟接口请求列表数据
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ //生成10条数据
|
|
|
+ let list = new Array(30).fill().map((item, index) => index);
|
|
|
+ resolve(list);
|
|
|
+ }, 100);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
watch(() => props.resultData, (newVal) => {
|
|
|
if (newVal) {
|
|
|
- let arrData = []
|
|
|
- let arrData1 = newVal.AlarmList
|
|
|
- if (arrData1 && arrData1.length > 0) {
|
|
|
- arrData1.forEach(item => {
|
|
|
- let arrData2 = []
|
|
|
- arrData2.push(item.AlarmContent)
|
|
|
- arrData2.push(item.Location)
|
|
|
- let title = ''
|
|
|
- if (item.State == 0) {
|
|
|
- title = '正常'
|
|
|
- } else {
|
|
|
- title = '异常'
|
|
|
- }
|
|
|
- arrData2.push(title)
|
|
|
- arrData2.push(item.Date)
|
|
|
- arrData.push(arrData2)
|
|
|
- })
|
|
|
- }
|
|
|
- // config.value.data = arrData
|
|
|
+ // data.value = await getData();
|
|
|
+ data.value = newVal.AlarmList;
|
|
|
+ console.log(data.value, 333);
|
|
|
+
|
|
|
+ intervalId && clearInterval(intervalId);
|
|
|
+ nextTick(() => {
|
|
|
+ //判断列表是否生成滚动条
|
|
|
+ count.value = hasScrollBar() ? 2 : 1;
|
|
|
+ //有滚动条开始自动滚动
|
|
|
+ if (count.value == 2) {
|
|
|
+ autoScrolling();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}, { deep: true, immediate: true } // 开启深度监听
|
|
|
)
|
|
|
+onMounted(() => {
|
|
|
+})
|
|
|
+//判断列表是否有滚动条
|
|
|
+const hasScrollBar = () => {
|
|
|
+ return scrollViewRef.value.scrollHeight > scrollViewRef.value.clientHeight;
|
|
|
+};
|
|
|
+//设置自动滚动
|
|
|
+const autoScrolling = () => {
|
|
|
+ intervalId = setInterval(() => {
|
|
|
+ if (scrollViewRef.value.scrollTop < listRef.value[0].clientHeight) {
|
|
|
+ scrollViewRef.value.scrollTop += isAutoScrolling ? 1 : 0;
|
|
|
+ } else {
|
|
|
+ scrollViewRef.value.scrollTop = 0;
|
|
|
+ }
|
|
|
+ }, 20);
|
|
|
+};
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ //离开页面清理定时器
|
|
|
+ intervalId && clearInterval(intervalId);
|
|
|
+});
|
|
|
+
|
|
|
+//鼠标进入,停止滚动
|
|
|
+const onMouseenter = () => {
|
|
|
+ isAutoScrolling = false;
|
|
|
+};
|
|
|
+//鼠标移出,继续滚动
|
|
|
+const onMouseleave = () => {
|
|
|
+ isAutoScrolling = true;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
@@ -170,4 +214,93 @@ watch(() => props.resultData, (newVal) => {
|
|
|
.green_bj_equip {
|
|
|
background-image: linear-gradient(25deg, rgb(87, 172, 115) 0%, rgba(0, 0, 0, 0)66%, rgb(87, 172, 115) 100%);
|
|
|
}
|
|
|
+
|
|
|
+.page {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+
|
|
|
+.header-view {
|
|
|
+ margin-top: 10px;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 10px 10px 10px 20px;
|
|
|
+ background-color: rgba(16, 40, 92, 1);
|
|
|
+}
|
|
|
+
|
|
|
+.view_item {
|
|
|
+ flex: 1;
|
|
|
+ color: #fff;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ overflow: hidden;
|
|
|
+ max-width: 33%;
|
|
|
+}
|
|
|
+
|
|
|
+.warning-view {
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 51px);
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+
|
|
|
+.label {
|
|
|
+ color: #fff;
|
|
|
+ padding: 20px;
|
|
|
+ font-size: 22px;
|
|
|
+}
|
|
|
+
|
|
|
+.scroll-view {
|
|
|
+ flex: 1;
|
|
|
+ height: auto;
|
|
|
+ width: 100%;
|
|
|
+ overflow-y: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.list {
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.item {
|
|
|
+ padding: 0px 10px 0px 20px;
|
|
|
+ width: 100%;
|
|
|
+ height: 50px;
|
|
|
+ min-height: 50px;
|
|
|
+ font-size: 15px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ color: #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.item:nth-child(even) {
|
|
|
+ background: rgba(16, 40, 92, 0.4);
|
|
|
+}
|
|
|
+
|
|
|
+.item:hover {
|
|
|
+ cursor: pointer;
|
|
|
+ background-image: linear-gradient(to right, #168cdb, transparent);
|
|
|
+}
|
|
|
+
|
|
|
+/*隐藏滚动条
|
|
|
+ */
|
|
|
+::-webkit-scrollbar {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+
|
|
|
+.green_titleil {
|
|
|
+ color: #67C23A;
|
|
|
+}
|
|
|
+
|
|
|
+.red_title {
|
|
|
+ color: #F56C6C;
|
|
|
+}
|
|
|
</style>
|