yudao-dev/src/views/home/index.vue
2024-08-05 15:34:57 +08:00

445 lines
10 KiB
Vue

<template>
<div class="home-page">
<div>
<navbar />
</div>
<div class="date-tabs">
<el-tabs v-model="activeName" :stretch="true">
<el-tab-pane
:label="'\u2002\u2002日\u2002\u2002'"
name="日"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002周\u2002\u2002'"
name="周"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002月\u2002\u2002'"
name="月"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002年\u2002\u2002'"
name="年"></el-tab-pane>
</el-tabs>
<div class="current-date">(6.13-6.20)</div>
<div class="current-time">
<span style="display: inline-block; margin-right: 16px">
{{ topTime + timeZone }}
</span>
<span>{{ topDate }}</span>
</div>
</div>
<el-row class="main-top" :gutter="16">
<el-col :span="12" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">生产总览</span>
</div>
<el-row class="box">
<el-col :span="6" class="num-box shadow">
<div class="num-style">9,301.01</div>
<div class="unit-style">产量/千片</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">94.34</div>
<div class="unit-style">良品率/%</div>
</el-col>
<el-col :span="8" class="num-box shadow">
<div class="num-style">29,301.01</div>
<div class="unit-style">完成工单数量/千片</div>
</el-col>
<el-col :span="6" class="num-box">
<div class="num-style">1,340</div>
<div class="unit-style">完成订单数量/个</div>
</el-col>
</el-row>
</el-col>
<el-col :span="12" style="position: relative">
<div class="title">
<svg-icon icon-class="home-device" />
<span class="title-inner">设备总览</span>
</div>
<el-row class="box">
<el-col :span="6" class="num-box shadow">
<div class="num-style">2,931</div>
<div class="unit-style">设备总数/台</div>
</el-col>
<el-col :span="6" class="num-box shadow">
<div class="num-style">931</div>
<div class="unit-style">在线设备总数/台</div>
</el-col>
<el-col :span="6" class="num-box shadow">
<div class="num-style">7</div>
<div class="unit-style">故障设备总数/台</div>
</el-col>
<el-col :span="6" class="num-box">
<div class="num-style">0</div>
<div class="unit-style">停机设备总数/台</div>
</el-col>
</el-row>
</el-col>
</el-row>
<div class="main-middle">
<div
class="item"
:class="{ shadow: index !== middleMenu.length - 1 }"
v-for="(item, index) in middleMenu"
:key="index">
<div style="width: 160px; margin: 0 auto; padding-top: 20px">
<svg-icon :icon-class="item.icon" style="font-size: 56px" />
<div class="title-box">
<div class="title">{{ item.name }}</div>
<div class="triangle">
<span class="c1"></span>
<span class="c2"></span>
<span class="c3"></span>
</div>
</div>
</div>
</div>
</div>
<el-row class="main-bottom" :gutter="16">
<el-col :span="12">
<div class="box">
<div class="title-box">
<svg-icon icon-class="home-order-monitor" />
<span class="title">工单监控</span>
</div>
<div class="order-box">
<div
class="order-item"
v-for="(item, index) in orderList"
:key="index">
<div>
<span class="order-name">{{ item.name }}</span>
<span class="order-value">{{ item.value }}%</span>
</div>
<el-progress
:percentage="item.value"
:text-inside="false"
:stroke-width="15"
:show-text="false"></el-progress>
</div>
</div>
</div>
</el-col>
<el-col :span="12">
<div class="box">
<div class="title-box">
<svg-icon icon-class="home-device-alarm" />
<span class="title">设备告警</span>
</div>
<base-table
:page="1"
:limit="100000"
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
</div>
</el-col>
</el-row>
<div
class="main-footer"
style="
color: #c7c7c7;
user-select: none;
font-size: 14px;
letter-spacing: 1px;
height: 30px;
display: grid;
place-content: center;
">
&copy; 中建材智能自动化研究院有限公司
</div>
</div>
</template>
<script>
import Navbar from './components/Navbar';
import moment from 'moment';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'Home',
mixins: [tableHeightMixin],
components: { Navbar },
computed: {
gradientBackground() {
return {
'background-image':
'linear-gradient(90deg, #f0f0f0 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, #f0f0f0 50%, #f0f0f0 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0))',
'background-size': '100px 100px', // 调整条纹的大小
};
},
},
data() {
return {
activeName: '日',
topDate: '',
topTime: '',
timeZone: '',
middleMenu: [
{ name: '工单管理', url: '', icon: 'home-work-menu' },
{ name: '订单管理', url: '', icon: 'home-order-menu' },
{ name: '设备管理', url: '', icon: 'home-device-menu' },
{ name: '质量管理', url: '', icon: 'home-quality-menu' },
{ name: '仓库管理', url: '', icon: 'home-store-menu' },
],
orderList: [
{ name: '工单1', value: 50 },
{ name: '工单2', value: 60 },
{ name: '工单3', value: 30 },
{ name: '工单4', value: 60 },
{ name: '工单5', value: 10 },
{ name: '工单6', value: 60 },
{ name: '工单7', value: 40 },
{ name: '工单8', value: 70 },
{ name: '工单9', value: 90 },
],
heightNum: 640,
tableProps: [
{
prop: 'productionLineName',
label: '设备名称',
showOverflowtooltip: true,
},
{
prop: 'sectionName',
label: '告警内容',
showOverflowtooltip: true,
},
{
prop: 'createTime',
label: '告警时间',
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
],
list: [
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
],
};
},
created() {
this.getTime();
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
getTime() {
let _this = this;
this.timer = setInterval(function () {
_this.topDate = moment().format('YYYY.MM.DD');
let temp = moment().format('A-hh:mm').split('-');
_this.timeZone = temp[0];
_this.topTime = temp[1];
}, 1000);
},
},
};
</script>
<style lang="scss" scoped>
.home-page {
background-image: url('~@/assets/img/home-bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
height: 300px;
width: 100%;
}
.date-tabs {
padding-left: 40px;
padding-top: 20px;
position: relative;
}
:deep(.date-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
font-size: 18px;
color: #fff;
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
.el-tabs__item.is-active {
color: #0b58ff;
}
}
.current-date {
color: #fff;
font-size: 18px;
position: absolute;
left: 260px;
top: 14px;
}
.current-time {
color: #fff;
font-size: 18px;
position: absolute;
right: 38px;
top: 14px;
}
.main-top {
width: 100%;
padding: 0 20px 0 40px;
.title {
position: absolute;
left: 34px;
top: 20px;
width: 180px;
font-size: 32px;
z-index: 10;
.title-inner {
position: absolute;
left: 42px;
top: 5px;
font-size: 24px;
}
}
.box {
background-color: #fff;
border-radius: 24px;
height: 192px;
padding: 40px 24px 32px 24px;
.num-box {
height: 120px;
padding-top: 26px;
text-align: center;
.num-style {
color: #000;
font-size: 40px;
}
.unit-style {
color: rgba(0, 0, 0, 0.7);
font-size: 18px;
}
}
.shadow {
background: linear-gradient(90deg, #ffffff 80%, #f2f4f9 100%);
}
}
}
.main-middle {
display: flex;
flex-flow: row nowrap;
background-color: #fff;
border-radius: 24px;
height: 133px;
margin: 16px 38px 16px 40px;
padding-top: 15px;
.item {
width: 20%;
height: 100px;
cursor: pointer;
.title-box {
display: inline-block;
padding-left: 20px;
vertical-align: bottom;
.title {
height: 35px;
font-size: 18px;
color: #000;
padding-top: 6px;
letter-spacing: 2px;
}
.triangle {
height: 15px;
span {
display: inline-block;
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
}
.c1 {
border-left: 12px solid rgba(11, 88, 255, 1);
margin-right: 5px;
}
.c2 {
border-left: 12px solid rgba(11, 88, 255, 0.5);
margin-right: 5px;
}
.c3 {
border-left: 12px solid rgba(11, 88, 255, 0.2);
}
}
}
}
.shadow {
background: linear-gradient(90deg, #ffffff 90%, #f2f4f9 100%);
}
}
.main-bottom {
width: 100%;
padding: 0 20px 0 40px;
.box {
background-color: #fff;
border-radius: 24px;
height: calc(100vh - 534px);
padding: 24px;
.title-box {
position: relative;
font-size: 32px;
margin-bottom: 16px;
.title {
position: absolute;
left: 44px;
top: 6px;
font-size: 24px;
}
}
.order-box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
font-size: 18px;
padding: 0 30px;
.order-item {
width: 48%;
margin-bottom: 16px;
position: relative;
.order-name {
color: #000000;
}
.order-value {
position: absolute;
right: 0;
color: #0b58ff;
}
}
}
}
}
</style>
<style lang="scss">
.home-page {
.el-progress-bar__inner {
background-image: url('~@/assets/img/home-progress-bg.png');
background-size: cover;
}
}
</style>