221 lines
4.8 KiB
Vue
221 lines
4.8 KiB
Vue
<template>
|
|
<div class="coreItem">
|
|
<div @click="handleRoute(item.path)" 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" :style="{ color: getTargetColor(item.currentValue, item.targetValue) }">
|
|
{{ 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 + '%',
|
|
background: getTargetColor(item.currentValue, item.targetValue)
|
|
}"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yield" style="display: flex;justify-content: space-between;">
|
|
<div class="progress-percent" :style="{ color: getTargetColor(item.currentValue, item.targetValue) }">完成率
|
|
</div>
|
|
<div class="progress-percent" :style="{ color: getTargetColor(item.currentValue, item.targetValue) }">
|
|
{{ item.progress }}%
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "Container",
|
|
components: {},
|
|
props: ["purchase",'dateData'],
|
|
data() {
|
|
return {
|
|
itemList: []
|
|
};
|
|
},
|
|
watch: {
|
|
purchase: {
|
|
handler(newVal) {
|
|
if (newVal) {
|
|
this.itemList = this.transformData(newVal);
|
|
}
|
|
},
|
|
immediate: true,
|
|
deep: true
|
|
}
|
|
},
|
|
methods: {
|
|
handleRoute(path) {
|
|
this.$router.push({
|
|
path: path,
|
|
query: {
|
|
dateData: this.dateData
|
|
}
|
|
})
|
|
},
|
|
transformData(rawData) {
|
|
const dataMap = [
|
|
{
|
|
key: 'increase',
|
|
unit: '本月增效额·万元',
|
|
path:'/procurementGainAnalysis/procurementGainAnalysis'
|
|
},
|
|
{
|
|
key: 'totalIncrease',
|
|
unit: '累计增效额·万元',
|
|
path: '/procurementGainAnalysis/procurementGainAnalysis'
|
|
}
|
|
];
|
|
|
|
return dataMap.map(itemInfo => {
|
|
const rawItem = rawData[itemInfo.key] || {};
|
|
const progress = rawItem.rate || 0;
|
|
|
|
return {
|
|
unit: itemInfo.unit,
|
|
targetValue: rawItem.target || 0,
|
|
currentValue: rawItem.real || 0,
|
|
progress: progress,
|
|
path: itemInfo.path
|
|
};
|
|
});
|
|
},
|
|
getTargetColor(currentValue, targetValue) {
|
|
return currentValue >= targetValue
|
|
? "rgba(98, 213, 180, 1)"
|
|
: "rgba(249, 164, 74, 1)";
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.coreItem {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.item {
|
|
width: 252px;
|
|
height: 122px;
|
|
background: #f9fcff;
|
|
padding: 12px 12px 0 12px;
|
|
box-sizing: border-box;
|
|
&:hover {
|
|
box-shadow: 0px 4px 12px 2px #B5CDE5;
|
|
}
|
|
.unit {
|
|
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;
|
|
}
|
|
|
|
.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),
|
|
rgba(40, 203, 151, 1));
|
|
}
|
|
|
|
.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: 230px;
|
|
height: 10px;
|
|
background: #ECEFF7;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-bar {
|
|
height: 100%;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.progress-percent {
|
|
font-family: PingFangSC, PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 12px;
|
|
color: #868687;
|
|
line-height: 1;
|
|
}
|
|
|
|
.yield {
|
|
margin-top: 3px;
|
|
}
|
|
}
|
|
</style>
|