yudao-dev/src/views/OperationalOverview/components/baseContainer/index.vue

311 lines
8.1 KiB
Vue
Raw Normal View History

2023-11-15 09:08:20 +08:00
<!--
* @Author: gtz
* @Date: 2022-01-19 15:58:17
* @LastEditors: zhp
2024-04-22 17:14:59 +08:00
* @LastEditTime: 2024-04-22 09:41:21
2023-11-15 09:08:20 +08:00
* @Description: file content
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue
-->
<template>
<div class="base-container" ref="baseContainer" :style="{ height: '100%', fontSize: 12 + 'px', padding: 12 + 'px' }"
2024-01-09 16:25:12 +08:00
:class="[{ 'no-padding': noPadding, 'border-none': !showLine }, 'base-container__' + size]">
2023-11-15 09:08:20 +08:00
<!-- <div class="base-container" :style="{height: height + 'px', fontSize: 12 + 'px', padding: 12 + 'px'}"> -->
<template v-if="showLine">
<div class="line" />
<div class="line line-vertical" />
<div class="line line-right" />
<div class="line line-right-vertical" />
<div class="line line-bottom" />
<div class="line line-bottom-vertical" />
<div class="line line-bottom-right" />
<div class="line line-bottom-right-vertical" />
</template>
<div class="bar-item">
2024-01-17 15:30:47 +08:00
<div v-if="title" class="bar-title" ds>
2023-11-15 09:08:20 +08:00
<span>
2024-03-12 11:18:06 +08:00
<svg-icon :icon-class="titleIcon" style="font-size: 1em; position: relative; top: .01em" />
2023-11-15 09:08:20 +08:00
{{ title }}
</span>
2024-01-29 15:55:16 +08:00
<!-- <span v-if="showTime" style="font-size: 20px;color:#52FFF8;margin-left: 10px;margin-top: 2px;">
{{ time2 +'-'+ time }}
2024-01-17 15:30:47 +08:00
</span> -->
2024-04-22 17:14:59 +08:00
<span v-if="showTime" style="font-size: 20px;color:#52FFF8;margin-left: 10px;margin-top: 2px;">
2024-01-29 15:55:16 +08:00
{{ startTime + '-' + endTime }}
</span>
2023-11-15 09:08:20 +08:00
</div>
2024-01-16 16:09:52 +08:00
<!-- <div v-if="true" class="bar-title">
<span>
<svg-icon :icon-class="titleIcon" style="font-size: 1em; position: relative; top: .08em" />
{{ title }}
</span>
</div> -->
2023-11-15 09:08:20 +08:00
<div class="bar-content" :class="{ 'p-0': noContentPadding }">
<slot />
</div>
</div>
</div>
</template>
<script>
2024-01-29 15:55:16 +08:00
import moment from "moment";
2023-11-15 09:08:20 +08:00
export default {
name: 'BaseContainer',
props: {
showLine: {
type: Boolean,
default: true
},
2024-04-22 17:14:59 +08:00
showTime: {
type: Boolean,
default: true
},
2023-11-15 09:08:20 +08:00
noPadding: {
type: Boolean,
default: false
},
2024-01-29 15:55:16 +08:00
showTime: {
type: Boolean,
default: false
},
showYesTime: {
type: Boolean,
default: false
},
2023-11-15 09:08:20 +08:00
back: {
type: String,
default: ''
},
noContentPadding: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
},
titleIcon: {
type: String,
default: ''
},
height: {
type: Number,
default: 200
},
baseSize: {
type: Number,
default: 12
},
beilv: {
type: Number,
default: 1
2024-01-09 16:25:12 +08:00
},
size: {
type: String,
default: ''
2023-11-15 09:08:20 +08:00
}
},
data() {
return {
curIndex: 0,
2024-01-16 16:09:52 +08:00
time: null,
2024-01-29 15:55:16 +08:00
time2: null,
startTime: undefined,
endTime: undefined
2023-11-15 09:08:20 +08:00
// imgUrl: require(`../../../../assets/img/${this.back}.png`),
}
},
created() {
2024-01-16 16:09:52 +08:00
},
mounted () {
2024-01-29 15:55:16 +08:00
// this.time = this.format(new Date().setHours(7,0,0));
// // console.log(time);
// //前一天时间
let nowTime = new Date
let hour = nowTime.getHours()
if (hour > 6) {
this.startTime = moment(nowTime).format('yyyy.MM.DD') + ' 7点'
this.endTime = moment(moment(nowTime) + 86400000).format('yyyy.MM.DD') + ' 7点'
} else {
this.endTime = moment(nowTime).format('yyyy.MM.DD') + ' 7点'
this.startTime = moment(moment(nowTime) - 86400000).format('yyyy.MM.DD') + ' 7点'
}
// this.yesStartTime = moment(moment(nowTime) - 86400000).format('yyyy.MM.DD') + ' 0点'
// this.yesEndTime = moment(moment(nowTime) - 86400000).format('yyyy.MM.DD') + ' 24点'
// this.time2 = this.format(new Date().setHours(7, 0, 0) - 86400000 * 1);
// console.log(new Date().setHours(7, 0, 0) - 86400000 * 1);
2023-11-15 09:08:20 +08:00
},
methods: {
2024-01-29 15:55:16 +08:00
// add0(m) {
// return m < 10 ? '0' + m : m
// },
// format(shijianchuo) {
// //shijianchuo是整数否则要parseInt转换
// var time = new Date(shijianchuo);
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
// return y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + h + '时'
// },
// changeTab(num) {
// this.curIndex = num
// this.$emit('tabSelect', num)
// },
2023-11-15 09:08:20 +08:00
}
}
</script>
<style lang="scss" scoped>
2024-02-23 16:02:55 +08:00
2024-03-27 12:01:25 +08:00
2023-11-15 09:08:20 +08:00
.base-container {
color: #fff;
width: 100%;
// background-color: rgba($color: #061027, $alpha: 0.15);
position: relative;
2024-03-29 16:56:21 +08:00
// opacity: calc(.8);
2023-11-15 09:08:20 +08:00
// border: 2px solid;
2024-01-09 16:25:12 +08:00
// background: url('../../../../assets/img/energy.png') no-repeat;
// background-size: 100% 100%;
&__small {
background: url(../../../../assets/img/short.png) no-repeat;
background-size: 100% 100%;
2024-02-23 16:02:55 +08:00
backdrop-filter: blur(5px);
2024-01-09 16:25:12 +08:00
}
2024-02-23 16:02:55 +08:00
// &__small::after {
// content: "";
// position: absolute;
// top: 0;
// left: 0;
// filter: blur(20px);
// z-index: -1;
// }
2024-01-09 16:25:12 +08:00
&__middle {
background: url(../../../../assets/img/middle.png) no-repeat;
background-size: 100% 100%;
2024-02-23 16:02:55 +08:00
backdrop-filter: blur(5px);
2024-01-09 16:25:12 +08:00
}
&__large {
background: url(../../../../assets/img/high.png) no-repeat;
background-size: 100% 100%;
2024-02-23 16:02:55 +08:00
backdrop-filter: blur(5px);
2024-01-09 16:25:12 +08:00
}
2024-01-12 10:00:17 +08:00
&__eqStatus {
2024-03-27 12:01:25 +08:00
background: url(../../../../assets/img/large.png) no-repeat;
2024-01-12 10:00:17 +08:00
background-size: 100% 100%;
2024-02-23 16:02:55 +08:00
backdrop-filter: blur(5px);
2024-01-12 10:00:17 +08:00
}
2024-02-23 16:02:55 +08:00
// &::after {
// content: " ";
// // display: block;
// position: absolute;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// // background: inherit;
// /* 设置模糊,不用 filter */
// backdrop-filter: blur(5px);
// z-index: -1;
// }
2023-11-15 09:08:20 +08:00
// border-radius: 40px 0px 40px 0px;
// border-image: linear-gradient(360deg, rgba(157, 246, 254, 0.05), rgba(100, 233, 252, 0.9)) 2 2;
// .line {
// position: absolute;
// border-top: 4px solid #52fff1;
// width: 2em;
// top: -0.25em;
// left: -0.25em;
// &-vertical {
// top: calc(-5em / 12);
// left: calc(-1em / 12);
// transform: rotate(90deg);
// transform-origin: left;
// }
// &-right {
// top: -0.25em;
// right: -0.25em;
// left: inherit;
// }
// &-right-vertical {
// top: calc(-5em / 12);
// right: calc(-1em / 12);
// left: inherit;
// transform: rotate(-90deg);
// transform-origin: right;
// }
// &-bottom {
// top: inherit;
// left: -0.25em;
// bottom: -0.25em;
// }
// &-bottom-vertical {
// top: inherit;
// left: calc(-1em / 12);
// bottom: calc(-5em / 12);
// transform: rotate(-90deg);
// transform-origin: left;
// }
// &-bottom-right {
// top: inherit;
// left: inherit;
// right: -0.25em;
// bottom: -0.25em;
// }
// &-bottom-right-vertical {
// top: inherit;
// left: inherit;
// right: calc(-1em / 12);
// bottom: calc(-5em / 12);
// transform: rotate(90deg);
// transform-origin: right;
// }
// }
.bar-item {
height: 100%;
display: flex;
flex-direction: column;
}
.bar-title {
width: 100%;
2024-01-09 16:25:12 +08:00
color: #ffffff;
2024-01-12 10:00:17 +08:00
font-size: 24px;
2024-03-29 16:56:21 +08:00
font-weight: normal;
letter-spacing: .8px;
2024-02-01 16:48:58 +08:00
padding: 0.67em 0.67em 0.3em 0.67em;
2024-01-17 15:30:47 +08:00
display: flex;
2023-11-15 09:08:20 +08:00
}
.bar-content {
2024-02-01 16:48:58 +08:00
padding: .5em 1em 1em 1em;
2023-11-15 09:08:20 +08:00
flex: 1 auto;
2024-01-17 15:30:47 +08:00
position: relative;
2023-11-15 09:08:20 +08:00
}
.no-padding {
padding: 0;
}
.p-0 {
padding: 0;
}
&.border-none {
border: none;
}
}
2024-02-21 15:27:09 +08:00
// .base-container::after{
// z-index: -1;
// width: 100%;
// filter: blur(2px);
// }
2023-11-15 09:08:20 +08:00
</style>