190 lines
3.9 KiB
Vue
190 lines
3.9 KiB
Vue
<template>
|
|
<div class="coreItem">
|
|
<!-- 用 v-for 动态生成每个 item -->
|
|
<div class="item" v-for="(item, index) in itemList" :key="index">
|
|
<div class="unit">{{ item.unit }}</div>
|
|
<div class="item-content">
|
|
<!-- 左右内容容器 -->
|
|
<div class="content-wrapper">
|
|
<div class="left">
|
|
<div class="number">{{ item.targetValue }}</div>
|
|
<div class="title">预算值</div>
|
|
</div>
|
|
<div class="line"></div>
|
|
<div class="right">
|
|
<div class="number">{{ item.currentValue }}</div>
|
|
<div class="title">实际值</div>
|
|
</div>
|
|
</div>
|
|
<!-- 进度条和百分比 -->
|
|
<div class="progress-group">
|
|
<div class="progress-container">
|
|
<div class="progress-bar" :style="{ width: item.progress + '%' }"></div>
|
|
</div>
|
|
<div class="progress-percent">{{ item.progress }}%</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "Container",
|
|
components: {},
|
|
props: ["name", "size", "icon"],
|
|
data() {
|
|
return {
|
|
progress: 90, // 进度值,方便统一控制
|
|
itemList: [
|
|
{
|
|
unit: "单价·元/㎡",
|
|
targetValue: 16,
|
|
currentValue: 14.5,
|
|
progress: 90
|
|
},
|
|
{
|
|
unit: "净价·元/㎡",
|
|
targetValue: 16,
|
|
currentValue: 15.2,
|
|
progress: 85
|
|
},
|
|
{
|
|
unit: "销量·万㎡",
|
|
targetValue: 20,
|
|
currentValue: 16,
|
|
progress: 80
|
|
},
|
|
{
|
|
unit: "双镀面板·万㎡",
|
|
targetValue: 15,
|
|
currentValue: 13.8,
|
|
progress: 92
|
|
}
|
|
]
|
|
};
|
|
},
|
|
computed: {},
|
|
methods: {},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.coreItem {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
grid-template-rows: 1fr 1fr;
|
|
gap: 8px;
|
|
}
|
|
|
|
.item {
|
|
width: 252px;
|
|
height: 110px;
|
|
background: #f9fcff;
|
|
padding: 12px;
|
|
box-sizing: border-box;
|
|
&:hover {
|
|
box-shadow: 0px 4px 12px 2px #B5CDE5;
|
|
}
|
|
.unit {
|
|
// width: 124px;
|
|
height: 18px;
|
|
font-family: PingFangSC, PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 18px;
|
|
color: #000000;
|
|
line-height: 18px;
|
|
letter-spacing: 1px;
|
|
text-align: left;
|
|
font-style: normal;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.item-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
height: calc(100% - 26px);
|
|
}
|
|
|
|
.content-wrapper {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-around;
|
|
flex: 1;
|
|
}
|
|
|
|
.line {
|
|
width: 1px;
|
|
height: 46px;
|
|
background: linear-gradient(to bottom,
|
|
rgba(255, 0, 0, 0),
|
|
#cbcbcb);
|
|
}
|
|
|
|
.left,
|
|
.right {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 2px;
|
|
flex: 1;
|
|
}
|
|
|
|
.number {
|
|
height: 22px;
|
|
font-family: PingFangSC, PingFang SC;
|
|
font-weight: 600;
|
|
font-size: 24px;
|
|
color: rgba(103, 103, 103, 0.79);
|
|
line-height: 22px;
|
|
text-align: center;
|
|
font-style: normal;
|
|
}
|
|
|
|
.title {
|
|
height: 14px;
|
|
font-family: PingFangSC, PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 12px;
|
|
color: #868687;
|
|
line-height: 14px;
|
|
text-align: center;
|
|
font-style: normal;
|
|
}
|
|
|
|
/* 进度条和百分比的外层容器 */
|
|
.progress-group {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
/* 进度条和百分比的间距 */
|
|
}
|
|
|
|
.progress-container {
|
|
width: 190px;
|
|
height: 10px;
|
|
background: #ECEFF7;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-bar {
|
|
height: 100%;
|
|
background: #28CB97;
|
|
border-radius: 8px;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
/* 百分比文本样式 */
|
|
.progress-percent {
|
|
font-family: PingFangSC, PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 12px;
|
|
color: #868687;
|
|
line-height: 1;
|
|
}
|
|
}
|
|
</style>
|