mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
组件之间数据渲染逻辑
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
@@ -79,7 +79,7 @@ export default {
|
||||
getDisChargeData() {
|
||||
const arr=this.curList
|
||||
const keyList=this.curList.map((item)=>item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
const result = this.processData(this.propsInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
|
||||
@@ -2,72 +2,71 @@
|
||||
<div class="onLine">
|
||||
<div class="content">
|
||||
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
|
||||
<a-image :preview="false" :src="item.iconPath" :width="25" class="left"> </a-image>
|
||||
<i
|
||||
:class="`iconfont icon-${item.icon}`"
|
||||
:style="`font-size:25px; cursor: pointer; color: ${item.color};`"
|
||||
/>
|
||||
<div class="right">
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsInfo: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: ()=>({
|
||||
name: '场站111',
|
||||
statusName:'充电'
|
||||
})
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [
|
||||
{
|
||||
key: 'tianshu',
|
||||
value: 26,
|
||||
d: 'Lux',
|
||||
label: '光照',
|
||||
key: 'key1',
|
||||
value: '制冷',
|
||||
d: '',
|
||||
label: '冷机',
|
||||
class: 'item-1',
|
||||
iconPath: require('@/assets/home/guangzhao.png')
|
||||
icon: 'lengji',
|
||||
color: '#F69B52'
|
||||
},
|
||||
{
|
||||
key: 'shouyi',
|
||||
value: 25,
|
||||
d: 'm/s',
|
||||
label: '风速',
|
||||
key: 'key2',
|
||||
value: '开机',
|
||||
d: '',
|
||||
label: '空调',
|
||||
class: 'item-2',
|
||||
iconPath: require('@/assets/home/fengsu.png')
|
||||
icon: 'kongdiaogongcheng',
|
||||
color: '#9BD801'
|
||||
},
|
||||
{
|
||||
key: 'shuliang',
|
||||
key: 'key3',
|
||||
value: 24,
|
||||
d: '℃',
|
||||
label: '环境温度',
|
||||
class: 'item-3',
|
||||
iconPath: require('@/assets/home/hj-wendu.png')
|
||||
icon: 'wenduji',
|
||||
color: '#3DFEFA'
|
||||
},
|
||||
{
|
||||
key: 'shuliang',
|
||||
key: 'key4',
|
||||
value: 26,
|
||||
d: '%',
|
||||
label: '环境湿度',
|
||||
class: 'item-4',
|
||||
iconPath: require('@/assets/home/hj-shidu.png')
|
||||
},
|
||||
|
||||
icon: 'shidu',
|
||||
color: '#D83D6C'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -79,7 +78,19 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(n) {
|
||||
if (n) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
@@ -91,13 +102,11 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:95%;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.content{
|
||||
.content {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -105,35 +114,30 @@ export default {
|
||||
justify-content: space-around;
|
||||
height: 100%;
|
||||
|
||||
.item{
|
||||
height:50%;
|
||||
width: 25%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
.item {
|
||||
height: 50%;
|
||||
width: 25%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -4,33 +4,27 @@
|
||||
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
|
||||
<a-image :preview="false" :src="item.iconPath" :width="50" class="left"> </a-image>
|
||||
<div class="right">
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsInfo: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: ()=>({
|
||||
name: '场站111',
|
||||
statusName:'充电'
|
||||
})
|
||||
}
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -94,7 +88,19 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(n) {
|
||||
if (n) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
@@ -106,14 +112,11 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:95%;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.content{
|
||||
.content {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -121,35 +124,30 @@ export default {
|
||||
justify-content: space-around;
|
||||
height: 100%;
|
||||
|
||||
.item{
|
||||
height:50%;
|
||||
width: 30%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
.item {
|
||||
height: 50%;
|
||||
width: 30%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="content-left">
|
||||
<div v-for="item in leftList" :key="item.key" :class="`item ${item.class}`">
|
||||
<div>
|
||||
<span>{{ item.value }}</span
|
||||
<span>{{ item.value ? item.value :0}}</span
|
||||
><span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
<span>{{ item.label }}</span>
|
||||
@@ -11,13 +11,13 @@
|
||||
</div>
|
||||
<div style="text-align: center;font-weight: 500;">
|
||||
<div class="online-icon"></div>
|
||||
<span>{{ propsInfo.statusName }}</span>
|
||||
<span>{{ curStatus }}</span>
|
||||
</div>
|
||||
|
||||
<div class="content-right">
|
||||
<div v-for="item in rightList" :key="item.key" :class="`item ${item.class}`">
|
||||
<div>
|
||||
<span>{{ item.value }}</span
|
||||
<span>{{ item.value ? item.value :0 }}</span
|
||||
><span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
<span>{{ item.label }}</span>
|
||||
@@ -27,21 +27,22 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsInfo: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
name: '场站111',
|
||||
statusName: '充电'
|
||||
})
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
curStatus:'充电',
|
||||
list: [
|
||||
{
|
||||
key: 'tianshu',
|
||||
@@ -96,7 +97,19 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(n) {
|
||||
if (n) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
getRevenueData() {
|
||||
const arr=this.curList
|
||||
const keyList=this.curList.map((item)=>item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
const result = this.processData(this.propsInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="onLine">
|
||||
<div class="content">
|
||||
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
|
||||
<span>{{ item.value }} {{ item.d }}</span>
|
||||
<span>{{ item.value ? item.value : 0 }} {{ item.d }}</span>
|
||||
<span>{{ item.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -10,11 +10,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
@@ -77,7 +79,19 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(n) {
|
||||
if (n) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
@@ -89,7 +103,7 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:95%;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
@@ -73,7 +73,7 @@ export default {
|
||||
getUtilizationData() {
|
||||
const arr=this.curList
|
||||
const keyList=this.curList.map((item)=>item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
const result = this.processData(this.propsInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
|
||||
Reference in New Issue
Block a user