|
@@ -1,18 +1,18 @@
|
|
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 基准的画廊模块,通过不同的 type 展示不同的样式 -->
|
|
<!-- 基准的画廊模块,通过不同的 type 展示不同的样式 -->
|
|
|
- <a-space ref="container" class="syswind__container w-full h-full" wrap :size="30">
|
|
|
|
|
|
|
+ <div ref="container" class="syswind__container w-full h-full">
|
|
|
<div v-for="item in data" :key="item.deviceID" class="syswind__card">
|
|
<div v-for="item in data" :key="item.deviceID" class="syswind__card">
|
|
|
<!-- 画廊项的具体内容填充剩余宽度 -->
|
|
<!-- 画廊项的具体内容填充剩余宽度 -->
|
|
|
<div class="syswind__card__title font-bold" :title="getFormattedText(item, config.title)">{{ getFormattedText(item, config.title) }}</div>
|
|
<div class="syswind__card__title font-bold" :title="getFormattedText(item, config.title)">{{ getFormattedText(item, config.title) }}</div>
|
|
|
<div class="flex items-center justify-between syswind__card__vol_wrapper">
|
|
<div class="flex items-center justify-between syswind__card__vol_wrapper">
|
|
|
- <div class="syswind__card__vol_image"></div>
|
|
|
|
|
|
|
+ <div class="syswind__card__vol_image" :class="{ overlimit: isVolumnOverLimit(item) }"></div>
|
|
|
<div>
|
|
<div>
|
|
|
<div
|
|
<div
|
|
|
v-for="(ctx, idx) in config.volumns"
|
|
v-for="(ctx, idx) in config.volumns"
|
|
|
:key="`v${idx}`"
|
|
:key="`v${idx}`"
|
|
|
class="flex justify-between pl-20px pr-10px syswind__card__vol_space"
|
|
class="flex justify-between pl-20px pr-10px syswind__card__vol_space"
|
|
|
- :class="{ overlimit: isOverLimit(getFormattedText(item, ctx.value), getFormattedText(item, ctx.lowerLimit)) }"
|
|
|
|
|
|
|
+ :class="{ overlimit_space: isVolumnOverLimit(item) }"
|
|
|
>
|
|
>
|
|
|
<span>{{ getFormattedText(item, ctx.label) }}</span>
|
|
<span>{{ getFormattedText(item, ctx.label) }}</span>
|
|
|
<span class="font-bold">{{ getFormattedText(item, ctx.value) }}</span>
|
|
<span class="font-bold">{{ getFormattedText(item, ctx.value) }}</span>
|
|
@@ -20,18 +20,14 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="flex items-center justify-between syswind__card__spd_wrapper">
|
|
<div class="flex items-center justify-between syswind__card__spd_wrapper">
|
|
|
- <div class="syswind__card__spd_image"></div>
|
|
|
|
|
|
|
+ <div class="syswind__card__spd_image" :class="{ overlimit: isSpeedOverLimit(item) }"></div>
|
|
|
<div>
|
|
<div>
|
|
|
<div
|
|
<div
|
|
|
v-for="(ctx, idx) in config.speeds"
|
|
v-for="(ctx, idx) in config.speeds"
|
|
|
:key="`s${idx}`"
|
|
:key="`s${idx}`"
|
|
|
class="flex justify-between pl-20px pr-10px syswind__card__spd_space"
|
|
class="flex justify-between pl-20px pr-10px syswind__card__spd_space"
|
|
|
:class="{
|
|
:class="{
|
|
|
- overlimit: isOverLimit(
|
|
|
|
|
- getFormattedText(item, ctx.value),
|
|
|
|
|
- getFormattedText(item, ctx.lowerLimit),
|
|
|
|
|
- getFormattedText(item, ctx.upperLimit)
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ overlimit_space: isSpeedOverLimit(item),
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
|
<span>{{ getFormattedText(item, ctx.label) }}</span>
|
|
<span>{{ getFormattedText(item, ctx.label) }}</span>
|
|
@@ -40,18 +36,18 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </a-space>
|
|
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
- import { defaultTo, inRange } from 'lodash-es';
|
|
|
|
|
|
|
+ import { defaultTo, inRange, first } from 'lodash-es';
|
|
|
import { getFormattedText } from '../../hooks/helper';
|
|
import { getFormattedText } from '../../hooks/helper';
|
|
|
|
|
+ // import { onMounted, ref } from 'vue';
|
|
|
// import { useEventListener, useScroll } from '@vueuse/core';
|
|
// import { useEventListener, useScroll } from '@vueuse/core';
|
|
|
- // import { ref } from 'vue';
|
|
|
|
|
|
|
|
|
|
// import { get } from 'lodash-es';
|
|
// import { get } from 'lodash-es';
|
|
|
// import { computed } from 'vue';
|
|
// import { computed } from 'vue';
|
|
|
|
|
|
|
|
- defineProps<{
|
|
|
|
|
|
|
+ const props = defineProps<{
|
|
|
config: {
|
|
config: {
|
|
|
title: string;
|
|
title: string;
|
|
|
volumns: { value: string; label: string; lowerLimit: string }[];
|
|
volumns: { value: string; label: string; lowerLimit: string }[];
|
|
@@ -68,10 +64,20 @@
|
|
|
const h = parseFloat(high);
|
|
const h = parseFloat(high);
|
|
|
const v = parseFloat(val);
|
|
const v = parseFloat(val);
|
|
|
|
|
|
|
|
- console.log('debug rrr', defaultTo(v, 0), defaultTo(l, -Infinity), defaultTo(h, Infinity));
|
|
|
|
|
return !inRange(defaultTo(v, 0), defaultTo(l, -Infinity), defaultTo(h, Infinity));
|
|
return !inRange(defaultTo(v, 0), defaultTo(l, -Infinity), defaultTo(h, Infinity));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function isVolumnOverLimit(item) {
|
|
|
|
|
+ const ctx = first(props.config.volumns);
|
|
|
|
|
+ if (!ctx) return false;
|
|
|
|
|
+ return isOverLimit(getFormattedText(item, ctx.value), getFormattedText(item, ctx.lowerLimit));
|
|
|
|
|
+ }
|
|
|
|
|
+ function isSpeedOverLimit(item) {
|
|
|
|
|
+ const ctx = first(props.config.speeds);
|
|
|
|
|
+ if (!ctx) return false;
|
|
|
|
|
+ return isOverLimit(getFormattedText(item, ctx.value), getFormattedText(item, ctx.lowerLimit), getFormattedText(item, ctx.upperLimit));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// const container = ref<HTMLElement>();
|
|
// const container = ref<HTMLElement>();
|
|
|
// const { y, directions } = useScroll(container); // 当前滚动位置(响应式)
|
|
// const { y, directions } = useScroll(container); // 当前滚动位置(响应式)
|
|
|
|
|
|
|
@@ -79,7 +85,7 @@
|
|
|
|
|
|
|
|
// useEventListener(
|
|
// useEventListener(
|
|
|
// container,
|
|
// container,
|
|
|
- // 'click',
|
|
|
|
|
|
|
+ // 'scrollend',
|
|
|
// (event) => {
|
|
// (event) => {
|
|
|
// console.log('debug rr', event);
|
|
// console.log('debug rr', event);
|
|
|
// event.preventDefault();
|
|
// event.preventDefault();
|
|
@@ -107,8 +113,12 @@
|
|
|
}
|
|
}
|
|
|
.syswind__container {
|
|
.syswind__container {
|
|
|
padding: 10px 30px;
|
|
padding: 10px 30px;
|
|
|
- // display: flex;
|
|
|
|
|
- // flex-wrap: wrap;
|
|
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ overflow: auto;
|
|
|
|
|
+ scroll-padding-top: 10px;
|
|
|
|
|
+ scroll-snap-type: y mandatory;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.syswind__card {
|
|
.syswind__card {
|
|
@@ -121,14 +131,20 @@
|
|
|
--image-syswind-module: url(/@/assets/images/home-container/configurable/preset/syswind-module.png);
|
|
--image-syswind-module: url(/@/assets/images/home-container/configurable/preset/syswind-module.png);
|
|
|
--image-syswind-icon-blue: url(/@/assets/images/home-container/configurable/preset/syswind-icon-blue.png);
|
|
--image-syswind-icon-blue: url(/@/assets/images/home-container/configurable/preset/syswind-icon-blue.png);
|
|
|
--image-syswind-icon-green: url(/@/assets/images/home-container/configurable/preset/syswind-icon-green.png);
|
|
--image-syswind-icon-green: url(/@/assets/images/home-container/configurable/preset/syswind-icon-green.png);
|
|
|
|
|
+ --image-syswind-icon-red: url(/@/assets/images/home-container/configurable/preset/syswind-icon-red.png);
|
|
|
--image-syswind-icon-vol: url(/@/assets/images/home-container/configurable/preset/syswind-icon-vol.svg);
|
|
--image-syswind-icon-vol: url(/@/assets/images/home-container/configurable/preset/syswind-icon-vol.svg);
|
|
|
|
|
+ --image-syswind-icon-vol-red: url(/@/assets/images/home-container/configurable/preset/syswind-icon-vol-red.svg);
|
|
|
--image-syswind-icon-spd: url(/@/assets/images/home-container/configurable/preset/syswind-icon-spd.svg);
|
|
--image-syswind-icon-spd: url(/@/assets/images/home-container/configurable/preset/syswind-icon-spd.svg);
|
|
|
|
|
+ --image-syswind-icon-spd-red: url(/@/assets/images/home-container/configurable/preset/syswind-icon-spd-red.svg);
|
|
|
|
|
|
|
|
background-image: var(--image-syswind-module);
|
|
background-image: var(--image-syswind-module);
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
|
width: 320px;
|
|
width: 320px;
|
|
|
// width: 320px;
|
|
// width: 320px;
|
|
|
height: 234px;
|
|
height: 234px;
|
|
|
|
|
+ margin: 0 0 10px 0;
|
|
|
|
|
+ scroll-padding-top: 10px;
|
|
|
|
|
+ scroll-snap-align: start;
|
|
|
|
|
|
|
|
.syswind__card__title {
|
|
.syswind__card__title {
|
|
|
background-image: var(--image-syswind-module-title);
|
|
background-image: var(--image-syswind-module-title);
|
|
@@ -150,6 +166,7 @@
|
|
|
width: 76px;
|
|
width: 76px;
|
|
|
height: 70px;
|
|
height: 70px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.syswind__card__spd_image {
|
|
.syswind__card__spd_image {
|
|
|
background-image: var(--image-syswind-icon-blue), var(--image-syswind-icon-spd);
|
|
background-image: var(--image-syswind-icon-blue), var(--image-syswind-icon-spd);
|
|
|
background-position: center, center;
|
|
background-position: center, center;
|
|
@@ -157,6 +174,7 @@
|
|
|
width: 76px;
|
|
width: 76px;
|
|
|
height: 70px;
|
|
height: 70px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.syswind__card__vol_space {
|
|
.syswind__card__vol_space {
|
|
|
background-image: var(--image-syswind-space-green);
|
|
background-image: var(--image-syswind-space-green);
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
@@ -165,6 +183,7 @@
|
|
|
height: 28px;
|
|
height: 28px;
|
|
|
line-height: 28px;
|
|
line-height: 28px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.syswind__card__spd_space {
|
|
.syswind__card__spd_space {
|
|
|
background-image: var(--image-syswind-space-blue);
|
|
background-image: var(--image-syswind-space-blue);
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
@@ -173,6 +192,7 @@
|
|
|
height: 28px;
|
|
height: 28px;
|
|
|
line-height: 28px;
|
|
line-height: 28px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.syswind__card__vol_wrapper {
|
|
.syswind__card__vol_wrapper {
|
|
|
background-image: var(--image-syswind-border-green);
|
|
background-image: var(--image-syswind-border-green);
|
|
|
height: 72px;
|
|
height: 72px;
|
|
@@ -180,6 +200,9 @@
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
|
margin: 10px;
|
|
margin: 10px;
|
|
|
padding-right: 10px;
|
|
padding-right: 10px;
|
|
|
|
|
+ .overlimit {
|
|
|
|
|
+ background-image: var(--image-syswind-icon-red), var(--image-syswind-icon-vol-red);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
.syswind__card__spd_wrapper {
|
|
.syswind__card__spd_wrapper {
|
|
|
background-image: var(--image-syswind-border-blue);
|
|
background-image: var(--image-syswind-border-blue);
|
|
@@ -188,8 +211,12 @@
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
|
margin: 10px;
|
|
margin: 10px;
|
|
|
padding-right: 10px;
|
|
padding-right: 10px;
|
|
|
|
|
+ .overlimit {
|
|
|
|
|
+ background-image: var(--image-syswind-icon-red), var(--image-syswind-icon-spd-red);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- .overlimit {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ .overlimit_space {
|
|
|
background-image: var(--image-syswind-space-red);
|
|
background-image: var(--image-syswind-space-red);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|