feat(cockpit): 整合应急资源后端数据,优化UI布局
- 将EmergencyResources组件切换为从/district/statistics API获取动态数据 - 更新属性名(例如,name改为qxmc,stations改为yhzCount)并为表格主体添加滚动条 - 重构BlockEvent统计显示,加入值容器并调整布局 - 更新WeatherWarning徽章样式,使用背景图并注释掉未使用的元素 - 添加/修改公共面板头和天气徽章背景的图片资源
This commit is contained in:
parent
eda01c8043
commit
a4e94c4fb7
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@ -14,9 +14,12 @@
|
|||||||
<img src="../assets/img/block-stat-icon.png" alt="icon" class="stat-icon" />
|
<img src="../assets/img/block-stat-icon.png" alt="icon" class="stat-icon" />
|
||||||
<div class="stat-content">
|
<div class="stat-content">
|
||||||
<div class="stat-title">{{ stat.title }}</div>
|
<div class="stat-title">{{ stat.title }}</div>
|
||||||
<div class="stat-value">{{ stat.value }}</div>
|
<div class="stat-value-container">
|
||||||
<div class="stat-unit">公里</div>
|
<div class="stat-value">{{ stat.value }}</div>
|
||||||
<img src="../assets/img/block-stat-decoration.png" alt="decoration" class="stat-decoration" />
|
<div class="stat-unit">公里</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <img src="../assets/img/block-stat-decoration.png" alt="decoration" class="stat-decoration" /> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -113,13 +116,24 @@ const stats = ref([
|
|||||||
}
|
}
|
||||||
|
|
||||||
.stat-unit {
|
.stat-unit {
|
||||||
position: absolute;
|
// position: absolute;
|
||||||
top: vh(50);
|
// top: vh(50);
|
||||||
right: vw(20);
|
// right: vw(20);
|
||||||
color: rgba(255, 255, 255, 1);
|
color: rgba(255, 255, 255, 1);
|
||||||
font-size: fs(15);
|
font-size: fs(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.stat-value-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: url(../assets/img/block-stat-decoration.png) no-repeat;
|
||||||
|
background-size: 100% auto;
|
||||||
|
background-position: bottom;
|
||||||
|
padding: 0 vw(40) vh(10) 0;
|
||||||
|
}
|
||||||
|
|
||||||
.stat-decoration {
|
.stat-decoration {
|
||||||
width: vw(154);
|
width: vw(154);
|
||||||
height: vh(29);
|
height: vh(29);
|
||||||
|
|||||||
@ -13,24 +13,26 @@
|
|||||||
<span>应急设备</span>
|
<span>应急设备</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div class="table-body">
|
||||||
v-for="(resource, index) in resources"
|
<div
|
||||||
:key="resource.id"
|
v-for="(resource, index) in resources"
|
||||||
class="table-row"
|
:key="resource.id"
|
||||||
:class="{ 'row-alt': index % 2 === 0 }"
|
class="table-row"
|
||||||
>
|
:class="{ 'row-alt': index % 2 === 0 }"
|
||||||
<div class="row-number">{{ index + 1 }}</div>
|
>
|
||||||
<span class="district-name">{{ resource.name }}</span>
|
<div class="row-number">{{ index + 1 }}</div>
|
||||||
<span class="count green">{{ resource.stations }}</span>
|
<span class="district-name">{{ resource.qxmc }}</span>
|
||||||
<span class="count orange">{{ resource.supplies }}</span>
|
<span class="count green">{{ resource.yhzCount }}</span>
|
||||||
<div class="equipment-cell">
|
<span class="count orange">{{ resource.wzCount }}</span>
|
||||||
<span class="count" :class="resource.equipmentClass">{{ resource.equipment }}</span>
|
<div class="equipment-cell">
|
||||||
<img
|
<span class="count" :class="resource.equipmentClass">{{ resource.sbCount }}</span>
|
||||||
v-if="resource.hasAlert"
|
<img
|
||||||
src="../assets/img/emergency-alert-icon.png"
|
v-if="resource.hasAlert"
|
||||||
alt="alert"
|
src="../assets/img/emergency-alert-icon.png"
|
||||||
class="alert-icon"
|
alt="alert"
|
||||||
/>
|
class="alert-icon"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -38,7 +40,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { request } from '@shared/utils/request'
|
||||||
|
|
||||||
const resources = ref([
|
const resources = ref([
|
||||||
{
|
{
|
||||||
@ -96,6 +99,25 @@ const resources = ref([
|
|||||||
hasAlert: false
|
hasAlert: false
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
// 请求后端接口 /district/statistics
|
||||||
|
const getDistrictStatistics = async () => {
|
||||||
|
const res = await request({
|
||||||
|
url: '/snow-ops-platform/district/statistics',
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
console.log(res)
|
||||||
|
if(res.code === '00000') {
|
||||||
|
resources.value = res.data
|
||||||
|
} else {
|
||||||
|
console.log(res.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getDistrictStatistics()
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@ -106,6 +128,7 @@ const resources = ref([
|
|||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
padding: vw(20) vw(30);
|
padding: vw(20) vw(30);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
@ -131,6 +154,7 @@ const resources = ref([
|
|||||||
|
|
||||||
.resource-table {
|
.resource-table {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
@ -149,6 +173,34 @@ const resources = ref([
|
|||||||
margin-bottom: vh(5);
|
margin-bottom: vh(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table-body {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgba(28, 161, 255, 0.4) transparent;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: vw(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(28, 161, 255, 0.4);
|
||||||
|
border-radius: vw(2);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(28, 161, 255, 0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.table-row {
|
.table-row {
|
||||||
height: vh(35);
|
height: vh(35);
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@ -15,16 +15,16 @@
|
|||||||
<div class="badge-container">
|
<div class="badge-container">
|
||||||
<!-- 六边形徽章 -->
|
<!-- 六边形徽章 -->
|
||||||
<div class="level-badge">
|
<div class="level-badge">
|
||||||
<img
|
<!-- <img
|
||||||
src="../assets/img/weather-badge-hexagon.png"
|
src="../assets/img/weather-badge-hexagon.png"
|
||||||
alt="badge"
|
alt="badge"
|
||||||
class="badge-bg"
|
class="badge-bg"
|
||||||
/>
|
/> -->
|
||||||
<span class="level-count" :style="{ color: level.color }">{{ level.count }}</span>
|
<span class="level-count" :style="{ color: level.color }">{{ level.count }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 底座光圈(双背景图) -->
|
<!-- 底座光圈(双背景图) -->
|
||||||
<div class="glow-base"></div>
|
<!-- <div class="glow-base"></div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 底部文字 -->
|
<!-- 底部文字 -->
|
||||||
@ -158,7 +158,7 @@ const districts = ref([
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: vh(10);
|
// gap: vh(10);
|
||||||
|
|
||||||
// 徽章和光圈容器
|
// 徽章和光圈容器
|
||||||
.badge-container {
|
.badge-container {
|
||||||
@ -177,6 +177,7 @@ const districts = ref([
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
background: url(../assets/img/weather-badge-bg.png) center center / 100% 100% no-repeat;
|
||||||
|
|
||||||
.badge-bg {
|
.badge-bg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -192,6 +193,7 @@ const districts = ref([
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
margin-top: vh(-18);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user