This commit is contained in:
朱菊兰 2025-04-29 13:49:17 +08:00
parent 1e9bfee1e7
commit afb62375da
7 changed files with 477 additions and 1 deletions

4
src/assets/font/font.css Normal file
View File

@ -0,0 +1,4 @@
@font-face {
font-family: '站酷庆科黄油体';
src: url('./站酷庆科黄油体.ttf') format('truetype');;
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -4,6 +4,7 @@ import Element from 'element-ui';
import './assets/styles/element-variables.scss';
import '@/assets/styles/index.scss'; // global css
import '@/assets/styles/ruoyi.scss'; // ruoyi css
import '@/assets/font/font.css'
import App from './App';
import store from './store';
import router from './router';
@ -34,7 +35,6 @@ import {
getDictDatas,
getDictDatas2,
} from '@/utils/dict';
import './theme/index.css'; // 自定义主题包 - code-brick-zj
// 全局方法挂载

View File

@ -0,0 +1,261 @@
<template>
<div class="dataBox">
<div class="side1"></div>
<div class="side2"></div>
<div class='titleBox'>
<svg-icon icon-class="energy" />
{{title}}
<span class='line1' style='left: 0px'></span>
<span class='line2' style='left: 0px'></span>
<span class='line2' style='right: 0px'></span>
<span class='line1' style='right: 0px'></span>
</div>
<span class='lt' v-if='position == "lt"'></span>
<span class='rt' v-if='position == "rt"'></span>
<span class='lb' v-if='position == "lb"'></span>
<span class='rb' v-if='position == "rb"'></span>
<div class="centerBox">
<div class="centerBoxItem1">
<span class='num'>213,452</span>
<span class='name'>- 预计切割片数 -</span>
</div>
<div class="centerBoxItem1">
<span class='num'>95.32%</span>
<span class='name'>- 综合面积良品率 -</span>
</div>
<div class="centerBoxItem2">
<span class='name'>掰边后片数</span>
<span class='num'>23,452</span>
</div>
<div class="centerBoxItem2">
<span class='name'>掰边后良品率</span>
<span class='num'>98%</span>
</div>
<div class="centerBoxItem2">
<span class='name'>顶板后片数</span>
<span class='num'>23,452</span>
</div>
<div class="centerBoxItem2">
<span class='name'>顶板后良品率</span>
<span class='num'>98%</span>
</div>
<div class="centerBoxItem2">
<span class='name'>下片片数</span>
<span class='num'>23,452</span>
</div>
<div class="centerBoxItem2">
<span class='name'>下片良品率</span>
<span class='num'>98%</span>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'DataBox',
props: {
title: {
type: String,
default: ''
},
position:{
type: String,
default: ''
}
},
data() {
return {}
},
created() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.dataBox {
width: 909px;
height: 430px;
position: relative;
overflow: hidden;
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
backdrop-filter: blur(10px);
z-index: 0;
}
&::after {
content: "";
position: absolute;
display: inline-block;
width: 909px;
height: 2px;
border-radius: 2px;
left: 0;
bottom: 0;
background: radial-gradient(circle at center,
rgba(88, 194, 255, 1) 10%,
rgba(0, 176, 243, 0) 90%,
transparent);
}
.side1 {
content: "";
position: absolute;
display: inline-block;
height: 400px;
width: 2px;
border-radius: 2px;
top: 40px;
left: 0;
background: radial-gradient(circle at center,
rgba(88, 194, 255, 1) 10%,
rgba(0, 176, 243, 0) 80%,
transparent);
}
.side2 {
content: "";
position: absolute;
display: inline-block;
height: 400px;
width: 2px;
border-radius: 2px;
top: 40px;
right: 0;
background: radial-gradient(circle at center,
rgba(88, 194, 255, 1) 10%,
rgba(0, 176, 243, 0) 80%,
transparent);
}
.titleBox {
width: 100%;
height: 48px;
line-height: 48px;
padding-left: 23px;
background-color: rgba(0, 106, 205, 0.22);
font-size: 22px;
color: #fff;
.line1 {
display: inline-block;
width: 2px;
height: 16px;
background-color: #0078E4;
position: absolute;
top: 0px;
}
.line2 {
display: inline-block;
width: 16px;
height: 2px;
background-color: #0078E4;
position: absolute;
top: 0px;
}
}
.lt {
position: absolute;
left: 0;
top: 0;
display: inline-block;
width: 0;
height: 0;
border: 10px solid transparent;
border-left-color: #1F8FFF;
border-top-color: #1F8FFF;
}
.rt {
position: absolute;
right: 0;
top: 0;
display: inline-block;
width: 0;
height: 0;
border: 10px solid transparent;
border-right-color: #1F8FFF;
border-top-color: #1F8FFF;
}
.lb {
position: absolute;
left: 0;
bottom: 0;
display: inline-block;
width: 0;
height: 0;
border: 10px solid transparent;
border-left-color: #1F8FFF;
border-bottom-color: #1F8FFF;
}
.rb {
position: absolute;
right: 0;
bottom: 0;
display: inline-block;
width: 0;
height: 0;
border: 10px solid transparent;
border-right-color: #1F8FFF;
border-bottom-color: #1F8FFF;
}
.centerBox {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: space-between;
padding: 20px 24px 35px 24px;
.centerBoxItem1 {
width: 426px;
height: 106px;
background: url(../../../../assets/img/cold-data-board-msg1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 16px;
box-shadow: inset 0px 0px 20px 0px rgba(255,255,255,0.15);
text-align: center;
.num {
font-family: '站酷庆科黄油体';
font-size: 32px;
font-weight: bold;
display: block;
margin-top:15px;
margin-bottom: 3px;
color: #48D6FF;
letter-spacing: 6px;
text-shadow: 1px 4px 2px #000000;
}
.name {
display: block;
font-size: 20px;
letter-spacing: 1px;
color: rgba(255,255,255,0.9);
}
}
.centerBoxItem2 {
width: 426px;
height: 56px;
line-height: 56px;
background: url(../../../../assets/img/cold-data-board-msg2.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 16px;
font-size: 20px;
letter-spacing: 1px;
.name {
display: inline-block;
text-align: right;
width: 213px;
color: rgba(255,255,255,0.9);
}
.num {
display: inline-block;
text-align: left;
width: 213px;
color: #15C1F2;
}
}
}
}
.dataBox > * {
position: relative;
z-index: 1;
}
</style>

View File

@ -0,0 +1,211 @@
<template>
<div id="coldContainerB" ref="coldContainerB" style="width: 100%; height: 100%">
<div id="coldContainer" class="coldContainer" style="width: 1920px; height: 1080px" :style="{ transform: 'scale(' + scaleNum + ')' }">
<KHeader
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="自贡冷端数据看板" />
<DataBox title='冷端1线' position='lt' class="box1"/>
<DataBox title='冷端2线' position='rt' class="box2"/>
<DataBox title='冷端3线' position='lb' class="box3"/>
<DataBox title='冷端4线' position='rb' class="box4"/>
</div>
</div>
</template>
<script>
import KHeader from '../components/Header';
import DataBox from './components/dataBox';
import screenfull from 'screenfull';
import { debounce } from '@/utils/debounce';
import { getUserProfile } from '@/api/system/user';
export default {
name: 'ColdDashboard',
components: {
KHeader,
DataBox
},
data() {
return {
isFullScreen: false,
scaleNum:1,
permission: false,
url: process.env.VUE_APP_WS_API,
websock: '',
}
},
created() {
this.init();
this.permission = false;
getUserProfile().then((response) => {
const user = response.data;
if (user.roles[0].name !== 'dashborad') {
this.permission = true;
} else {
this.permission = false;
}
this.initWebSocket();
});
},
mounted() {
this.boxReset();
window.addEventListener('resize', this.boxReset);
},
destroyed() {
window.removeEventListener('resize', this.boxReset);
},
methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() {
this.isFullScreen = screenfull.isFullscreen;
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change);
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change);
}
},
//
screenfullChange() {
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning',
});
return false;
}
screenfull.toggle(this.$refs.coldContainerB);
},
resetSize() {
let coldContainerBox = document.getElementById(
'coldContainer'
);
let rw = parseFloat(window.innerWidth);
let rh = parseFloat(window.innerHeight);
let bw = parseFloat(coldContainerBox.style.width);
let bh = parseFloat(coldContainerBox.style.height);
let wx = 0;
let hx = 0;
if (screenfull.isFullscreen) {
wx = rw / bw;
hx = rh / bh;
} else {
if (this.$store.state.app.sidebar.opened) {
wx = (rw - 280) / bw;
hx = (rh - 116) / bh;
} else {
wx = (rw - 85) / bw;
hx = (rh - 116) / bh;
}
}
this.scaleNum = wx;
},
initWebSocket() {
// weosocket
const path = `${this.url}/websocket/message?userId=4`;
this.websock = new WebSocket(path);
this.websock.onmessage = this.websocketonmessage;
this.websock.onopen = this.websocketonopen;
this.websock.onerror = this.websocketonerror;
this.websock.onclose = this.websocketclose;
},
websocketonopen() {
// send
this.websocketsend();
},
websocketonerror() {
//
this.initWebSocket();
},
websocketonmessage(e) {
let dataJson = JSON.parse(e.data);
console.log(dataJson);
//
if ('DeepState' in dataJson) {
this.topData = dataJson.DeepState;
if(!this.permission){
this.topData.yestodaySum = '***'
this.topData.monthSum = '***'
this.topData.monthAreaCost = '***'
}
}
if ('DeepEnergyTableList' in dataJson) {
this.tableData1 = dataJson.DeepEnergyTableList;
if(!this.permission){
this.tableData1.forEach(item=>{
item.elecPrice = null
})
}
}
if ('DeepCostTableList' in dataJson) {
this.tableData2 = dataJson.DeepCostTableList;
if(!this.permission){
this.tableData2.forEach(item=>{
item.priceD = null
})
}
}
if ('DeepPdTables' in dataJson) {
this.tableData3 = dataJson.DeepPdTables;
}
if ('DeepCostTrendList' in dataJson) {
this.echartData = dataJson.DeepCostTrendList;
this.$nextTick(() => {
this.$refs.chartRef.initChart(!this.permission);
});
}
},
websocketsend(val) {
//
this.websock.send(val);
},
websocketclose(e) {
//
console.log('断开连接', e);
},
}
}
</script>
<style lang='scss' scoped>
.coldContainer {
position: absolute;
transform-origin: 16px 8px;
font-size: 16px;
top: 0px;
left: 0px;
width: 1920px;
height: 1080px;
background: url(../assets/bg1.png) no-repeat;
background-size: cover;
background-position: 0 0;
overflow: auto;
.box1 {
position: absolute;
top: 141px;
left: 40px;
}
.box2 {
position: absolute;
top: 141px;
right: 40px;
}
.box3 {
position: absolute;
bottom: 66px;
left: 40px;
}
.box4 {
position: absolute;
bottom: 66px;
right: 40px;
}
}
</style>