Compare commits

..

No commits in common. "8fc6b73179b5de0fb0ae8fd503c0dd30f55ea529" and "ed46ed7d09bba6565539d1f79af9813e28ab83df" have entirely different histories.

20 changed files with 847 additions and 901 deletions

View File

@ -1,368 +1,348 @@
<template> <template>
<div class="choicepart-container"> <div class="choicepart-container">
<navbar /> <navbar />
<div class="choicepart-wrapper"> <div class="choicepart-wrapper">
<div <div class="choicepart-box" id="choicepartBox" :style="'transform:scale('+scale+');width:1710px;height:538px;'" v-show="showItem">
class="choicepart-box" <div class="choicepart-line1">
id="choicepartBox" <div
:style="'transform:scale(' + scale + ')'" v-for="(item, index) in menuArr1"
style="width: 1710px; height: 538px" :key="index"
v-show="showItem"> class="choicepart-item"
<div class="choicepart-line1"> @click="handelClick(item, item.choicepart)"
<div :style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}"
v-for="(item, index) in menuArr1" >
:key="index" <div>
class="choicepart-item" <img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt="">
@click="handelClick(item, item.choicepart)" </div>
:style="{ <div class="choicepart-item-title">{{item.meta.title}}</div>
opacity: item.visible ? 1 : 0.4, </div>
pointerEvents: item.visible ? 'auto' : 'none', </div>
}"> <div class="choicepart-line2">
<div> <div
<img v-for="(item, index) in menuArr2"
:src=" :key="index"
require(`../../assets/images/choicepart/${item.name}.png`) class="choicepart-item"
" @click="handelClick(item, item.choicepart)"
alt="" /> :style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}"
</div> >
<div class="choicepart-item-title">{{ item.meta.title }}</div> <div>
</div> <img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt="">
</div> </div>
<div class="choicepart-line2"> <div class="choicepart-item-title">{{item.meta.title}}</div>
<div </div>
v-for="(item, index) in menuArr2" </div>
:key="index" </div>
class="choicepart-item" </div>
@click="handelClick(item, item.choicepart)" <div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div>
:style="{ </div>
opacity: item.visible ? 1 : 0.4,
pointerEvents: item.visible ? 'auto' : 'none',
}">
<div>
<img
:src="
require(`../../assets/images/choicepart/${item.name}.png`)
"
alt="" />
</div>
<div class="choicepart-item-title">{{ item.meta.title }}</div>
</div>
</div>
</div>
</div>
<div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div>
</div>
</template> </template>
<script> <script>
import Navbar from './components/Navbar'; import Navbar from './components/Navbar'
import { debounce } from '@/utils/debounce'; import { debounce } from '@/utils/debounce'
export default { export default {
components: { Navbar }, components: { Navbar },
name: 'choicePart', name: 'choicePart',
data() { data() {
return { return {
scale: 1, boxReset: '',
menuArr1: [ scale: 1,
{ menuArr1: [
name: 'Core', {
title: '基础核心', name: 'Core',
visible: false, title: '基础核心',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Order', {
title: '订单管理', name: 'Order',
visible: false, title: '订单管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Equipment', {
title: '设备管理', name: 'Equipment',
visible: false, title: '设备管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Group', {
title: '班组管理', name: 'Group',
visible: false, title: '班组管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Quality', {
title: '质量管理', name: 'Quality',
visible: false, title: '质量管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Warehouse', {
title: '仓库管理', name: 'Warehouse',
visible: false, title: '仓库管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Energy', {
title: '能源管理', name: 'Energy',
visible: false, title: '能源管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Packaging', {
title: '包装管理', name: 'Packaging',
visible: false, title: '包装管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
], }
menuArr2: [ ],
{ menuArr2: [
name: 'Material', {
title: '物料管理', name: 'Material',
visible: false, title: '物料管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Extend', {
title: '工艺管理', name: 'Extend',
visible: false, title: '工艺管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
// { },
// name: 'Delivery', // {
// title: '', // name: 'Delivery',
// visible: false, // title: '',
// meta: { // visible: false,
// title: '' // meta: {
// } // title: ''
// }, // }
{ // },
name: 'Report', {
title: '报表管理', name: 'Report',
visible: false, title: '报表管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Cost', {
title: '成本管理', name: 'Cost',
visible: false, title: '成本管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'SafetyEnvironmental', {
title: '安环管理', name: 'SafetyEnvironmental',
visible: false, title: '安环管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'Databoard', {
title: '数据驾驶舱', name: 'Databoard',
visible: false, title: '数据驾驶舱',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
{ },
name: 'System', {
title: '系统管理', name: 'System',
visible: false, title: '系统管理',
meta: { visible: false,
title: '', meta: {
}, title: ''
}, }
], }
showItem: false, ],
}; showItem: false
}, }
// computed:{ },
// ...mapGetters(['sidebarRouters']) // computed:{
// }, // ...mapGetters(['sidebarRouters'])
mounted() { // },
this.getMsg(); mounted() {
this.boxReset(); this.getMsg()
window.addEventListener('resize', this.boxReset); this.boxReset = debounce(() => {
}, this.resetSize()
destroyed() { }, 300)
window.removeEventListener('resize', this.boxReset); this.boxReset()
}, window.addEventListener('resize', () => {
methods: { this.boxReset()
boxReset() { })
debounce(() => { },
this.resetSize(); methods: {
}, 300)(); getMsg() {
}, let menuList = this.$store.state.permission.sidebarRouters
getMsg() { console.log(menuList)
let menuList = this.$store.state.permission.sidebarRouters; if (menuList.length > 0) {
console.log(menuList); for (let i = 0; i < menuList.length; i ++) {
if (menuList.length > 0) { for (let k = 0; k < 8; k++) {
for (let i = 0; i < menuList.length; i++) { if (menuList[i].name === this.menuArr1[k].name) {
for (let k = 0; k < 8; k++) { this.menuArr1[k].visible = true
if (menuList[i].name === this.menuArr1[k].name) { this.menuArr1[k].id = menuList[i].id
this.menuArr1[k].visible = true; this.menuArr1[k].choicepart = i
this.menuArr1[k].id = menuList[i].id; this.menuArr1[k].children = menuList[i].children
this.menuArr1[k].choicepart = i; this.menuArr1[k].meta = menuList[i].meta
this.menuArr1[k].children = menuList[i].children; }
this.menuArr1[k].meta = menuList[i].meta; }
} for (let j = 0; j < 7; j++) {
} if (menuList[i].name === this.menuArr2[j].name) {
for (let j = 0; j < 7; j++) { this.menuArr2[j].visible = true
if (menuList[i].name === this.menuArr2[j].name) { this.menuArr2[j].id = menuList[i].id
this.menuArr2[j].visible = true; this.menuArr2[j].choicepart = i
this.menuArr2[j].id = menuList[i].id; this.menuArr2[j].children = menuList[i].children
this.menuArr2[j].choicepart = i; this.menuArr2[j].meta = menuList[i].meta
this.menuArr2[j].children = menuList[i].children; }
this.menuArr2[j].meta = menuList[i].meta; }
} }
} }
} console.log(this.menuArr1)
} console.log(this.menuArr2)
console.log(this.menuArr1); },
console.log(this.menuArr2); handelClick(item, index) {
}, // this.$router.push({name: 'SystemUser'})
handelClick(item, index) { this.$store.dispatch('app/setChoicepart', index)
// this.$router.push({name: 'SystemUser'}) this.toRouter(item)
this.$store.dispatch('app/setChoicepart', index); // if (item.meta.unuse) {
this.toRouter(item); // this.$message.warning(this.$t(''))
// if (item.meta.unuse) { // } else {
// this.$message.warning(this.$t('')) // this.toRouter(item)
// } else { // }
// this.toRouter(item) },
// } toRouter(item) {
}, console.log(item)
toRouter(item) { if (item.children) {
console.log(item); this.toRouter(item.children[0])
if (item.children) { } else {
this.toRouter(item.children[0]); this.$router.push({ name: item.name })
} else { }
this.$router.push({ name: item.name }); },
} resetSize() {
}, let _this = this
resetSize() { _this.showItem = false
let _this = this; _this.loading = true
_this.showItem = false; let choicepartBox = document.querySelector('#choicepartBox')
_this.loading = true; let rw = parseFloat(window.innerWidth)
let choicepartBox = document.querySelector('#choicepartBox'); let rh = parseFloat(window.innerHeight)
let rw = parseFloat(window.innerWidth); let bw = parseFloat(choicepartBox.style.width)
let rh = parseFloat(window.innerHeight); let bh = parseFloat(choicepartBox.style.height)
let bw = parseFloat(choicepartBox.style.width); let wx = 0.82/(bw / rw)
let bh = parseFloat(choicepartBox.style.height); let hx = 0.56/(bh / rh)
let wx = 0.82 / (bw / rw); _this.scale = wx > hx ? hx : wx
let hx = 0.56 / (bh / rh); setTimeout(_this.showItemFun, 700)
_this.scale = wx > hx ? hx : wx; },
setTimeout(_this.showItemFun, 700); showItemFun() {
}, this.loading = false
showItemFun() { this.showItem = true
this.loading = false; }
this.showItem = true; },
}, beforeDestroy() {
}, this.showItem = false
beforeDestroy() { }
this.showItem = false; }
},
};
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.choicepart-container { .choicepart-container {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: url('../../assets/images/choicepart/choicepart-back.png') repeat; background: url('../../assets/images/choicepart/choicepart-back.png') repeat;
background-size: 100% 100%; background-size: 100% 100%;
.choicepart-wrapper { .choicepart-wrapper {
width: 100vw; width: 100vw;
height: calc(100vh - 94px); height: calc(100vh - 94px);
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.choicepart-box { .choicepart-box {
// transition: all 0.3s linear; // transition: all 0.3s linear;
.choicepart-line1 { .choicepart-line1 {
width: 100%; width: 100%;
margin-bottom: 80px; margin-bottom: 80px;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.choicepart-line2 { .choicepart-line2 {
width: 100%; width: 100%;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: center; justify-content: center;
} }
.choicepart-item { .choicepart-item {
width: 184px; width: 184px;
height: 224px; height: 224px;
background: url('../../assets/images/choicepart/choice-item-back.png') background: url('../../assets/images/choicepart/choice-item-back.png') no-repeat;
no-repeat; background-size: 100% 100%;
background-size: 100% 100%; border-radius: 5px;
border-radius: 5px; overflow: hidden;
overflow: hidden; cursor: pointer;
cursor: pointer; position: relative;
position: relative; margin: 0 20px;
margin: 0 20px; img {
img { width: 184px;
width: 184px; height: 224px;
height: 224px; }
} .choicepart-item-title {
.choicepart-item-title { overflow: hidden;
overflow: hidden; padding: 0 10px;
padding: 0 10px; text-overflow: ellipsis;
text-overflow: ellipsis; white-space: nowrap;
white-space: nowrap; position: absolute;
position: absolute; bottom: 0;
bottom: 0; left: 2px;
left: 2px; right: 2px;
right: 2px; text-align: center;
text-align: center; color: #fff;
color: #fff; font-size: 16px;
font-size: 16px; line-height: 40px;
line-height: 40px; height: 40px;
height: 40px; letter-spacing: 2px;
letter-spacing: 2px; background-color: rgba($color: #0b58ff, $alpha: 0.45);
background-color: rgba($color: #0b58ff, $alpha: 0.45); }
} }
} .choicepart-item:hover {
.choicepart-item:hover { .choicepart-item-title {
.choicepart-item-title { background-color: rgba($color: #0b58ff, $alpha: 1);
background-color: rgba($color: #0b58ff, $alpha: 1); }
} }
} }
} .choicepart-footer {
.choicepart-footer { position: absolute;
position: absolute; width: 100%;
width: 100%; color: #C7C7C7;
color: #c7c7c7; user-select: none;
user-select: none; font-size: 12px;
font-size: 12px; letter-spacing: 1px;
letter-spacing: 1px; height: 30px;
height: 30px; display: grid;
display: grid; place-content: center;
place-content: center; bottom: 0;
bottom: 0; opacity: 0.5;
opacity: 0.5; }
}
} }
</style> </style>

View File

@ -1,11 +1,8 @@
<template> <template>
<div <div id='deepProcessingContainerB' ref='deepProcessingContainerB' style="width: 100%;height: 100%;">
id="deepProcessingContainerB"
ref="deepProcessingContainerB"
style="width: 100%; height: 100%">
<div <div
id="deepProcessingContainer" id='deepProcessingContainer'
ref="deepProcessingContainer" ref='deepProcessingContainer'
class="deepProcessingBoard" class="deepProcessingBoard"
style=" style="
position: absolute; position: absolute;
@ -19,14 +16,15 @@
flex-direction: column; flex-direction: column;
gap: 24px; gap: 24px;
" "
:style="{ transform: 'scale(' + scaleNum + ')' }"> :style="{transform:'scale('+scaleNum+')'}">
<KHeader <KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='深加工生产运行驾驶舱'/>
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="深加工生产运行驾驶舱" />
<div <div
class="main-body" class="main-body"
style="display: grid; gap: 16px; grid-template-rows: 462px 462px"> style="
display: grid;
gap: 16px;
grid-template-rows: 462px 462px;
">
<TopThree /> <TopThree />
<BottomTwo /> <BottomTwo />
</div> </div>
@ -49,16 +47,16 @@
import KHeader from '../components/Header'; import KHeader from '../components/Header';
import TopThree from './TopThree'; import TopThree from './TopThree';
import BottomTwo from './BottomTwo'; import BottomTwo from './BottomTwo';
import screenfull from 'screenfull'; import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'; import { debounce } from '@/utils/debounce'
import { getDcsMsg, getMesMsg } from './../utils/wsInterface'; import { getDcsMsg, getMesMsg } from './../utils/wsInterface'
export default { export default {
name: 'deepProcessingBoard', name: 'deepProcessingBoard',
components: { components: {
KHeader, KHeader,
TopThree, TopThree,
BottomTwo, BottomTwo
}, },
// provide() { // provide() {
// return { // return {
@ -68,90 +66,83 @@ export default {
data() { data() {
return { return {
isFullScreen: false, isFullScreen: false,
scaleNum: 0.8, scaleNum: 0.8
}; };
}, },
created() { created() {
this.init(); this.init()
}, },
destroy() { destroy() {
this.destroy(); this.destroy()
}, },
mounted() { mounted() {
this.boxReset = debounce(() => { this.boxReset = debounce(() => {
this.resetSize(); this.resetSize()
}, 300); }, 300)
this.boxReset(); this.boxReset()
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.boxReset(); this.boxReset()
}); })
// closeWebsocket() // closeWebsocket()
// getDcsMsg() // getDcsMsg()
// getMesMsg() // getMesMsg()
}, console.log('mounted...........')
mounted() {
this.boxReset();
window.addEventListener('resize', this.boxReset);
}, },
destroyed() { destroyed() {
window.removeEventListener('resize', this.boxReset); console.log('destroyed...........')
this.destroy();
}, },
methods: { methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() { change() {
this.isFullScreen = screenfull.isFullscreen; this.isFullScreen = screenfull.isFullscreen
}, },
init() { init() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.on('change', this.change); screenfull.on('change', this.change)
} }
}, },
destroy() { destroy() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.off('change', this.change); screenfull.off('change', this.change)
} }
}, },
// //
screenfullChange() { screenfullChange() {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
this.$message({ this.$message({
message: 'you browser can not work', message: 'you browser can not work',
type: 'warning', type: 'warning'
}); })
return false; return false
} }
screenfull.toggle(this.$refs.deepProcessingContainerB); screenfull.toggle(this.$refs.deepProcessingContainerB)
}, },
resetSize() { resetSize() {
let deepProcessingContainer = document.getElementById( let deepProcessingContainer = document.getElementById('deepProcessingContainer')
'deepProcessingContainer' let rw = parseFloat(window.innerWidth)
); let rh = parseFloat(window.innerHeight)
let rw = parseFloat(window.innerWidth); let bw = parseFloat(deepProcessingContainer.style.width)
let rh = parseFloat(window.innerHeight); let bh = parseFloat(deepProcessingContainer.style.height)
let bw = parseFloat(deepProcessingContainer.style.width); let wx = 0
let bh = parseFloat(deepProcessingContainer.style.height); let hx = 0
let wx = 0;
let hx = 0;
if (screenfull.isFullscreen) { if (screenfull.isFullscreen) {
wx = rw / bw; console.log('全屏')
hx = rh / bh; wx = rw / bw
} else { hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
if (this.$store.state.app.sidebar.opened) { if (this.$store.state.app.sidebar.opened) {
wx = (rw - 280) / bw; wx = (rw-280) / bw
hx = (rh - 116) / bh; hx = (rh-116) / bh
} else { }else{
wx = (rw - 85) / bw; wx = (rw-85) / bw
hx = (rh - 116) / bh; hx = (rh-116) / bh
} }
} }
this.scaleNum = wx; this.scaleNum = wx
}, }
}, }
}; };
</script> </script>

View File

@ -1,11 +1,8 @@
<template> <template>
<div <div id='kilnContainerB' ref='kilnContainerB' style="width: 100%;height: 100%;">
id="kilnContainerB"
ref="kilnContainerB"
style="width: 100%; height: 100%">
<div <div
id="kilnContainer" id='kilnContainer'
ref="kilnContainer" ref='kilnContainer'
class="KilnDataBoard" class="KilnDataBoard"
style=" style="
position: absolute; position: absolute;
@ -19,22 +16,15 @@
flex-direction: column; flex-direction: column;
gap: 24px; gap: 24px;
" "
:style="{ transform: 'scale(' + scaleNum + ')' }"> :style="{transform:'scale('+scaleNum+')'}">
<KHeader <KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='窑炉生产运行驾驶舱'/>
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="窑炉生产运行驾驶舱" />
<div <div
class="main-body" class="main-body"
style="flex: 1; display: flex; gap: 20px; padding: 0px 16px"> style="flex: 1; display: flex; gap: 20px; padding: 0px 16px">
<div <div class="left-side" style="flex: 2">
class="left-side"
style="flex: 2">
<LeftFour /> <LeftFour />
</div> </div>
<div <div class="right-side" style="flex: 1">
class="right-side"
style="flex: 1">
<RightTwo /> <RightTwo />
</div> </div>
</div> </div>
@ -46,8 +36,8 @@
import KHeader from '../components/Header'; import KHeader from '../components/Header';
import LeftFour from './LeftFour'; import LeftFour from './LeftFour';
import RightTwo from './RightTwo.vue'; import RightTwo from './RightTwo.vue';
import screenfull from 'screenfull'; import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'; import { debounce } from '@/utils/debounce'
export default { export default {
name: 'Kiln', name: 'Kiln',
@ -56,10 +46,10 @@ export default {
LeftFour, LeftFour,
RightTwo, RightTwo,
}, },
computed: { computed:{
sidebarStatus() { sidebarStatus() {
return this.$store.state.app.sidebar.opened; return this.$store.state.app.sidebar.opened;
}, }
}, },
// provide() { // provide() {
// return { // return {
@ -69,80 +59,84 @@ export default {
data() { data() {
return { return {
isFullScreen: false, isFullScreen: false,
scaleNum: 0.8, scaleNum: 0.8
}; };
}, },
watch: { watch: {
sidebarStatus() { sidebarStatus() {
this.boxReset(); this.boxReset()
}, },
}, },
created() { created() {
this.init(); this.init()
},
destroy() {
this.destroy()
}, },
mounted() { mounted() {
this.boxReset(); this.boxReset = debounce(() => {
window.addEventListener('resize', this.boxReset); this.resetSize()
}, }, 300)
destroyed() { this.boxReset()
window.removeEventListener('resize', this.boxReset); window.addEventListener('resize', () => {
this.destroy(); this.boxReset()
})
}, },
methods: { methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() { change() {
this.isFullScreen = screenfull.isFullscreen; this.isFullScreen = screenfull.isFullscreen
}, },
init() { init() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.on('change', this.change); screenfull.on('change', this.change)
} }
}, },
destroy() { destroy() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.off('change', this.change); screenfull.off('change', this.change)
} }
}, },
// //
screenfullChange() { screenfullChange() {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
this.$message({ this.$message({
message: 'you browser can not work', message: 'you browser can not work',
type: 'warning', type: 'warning'
}); })
return false; return false
} }
screenfull.toggle(this.$refs.kilnContainerB); screenfull.toggle(this.$refs.kilnContainerB)
}, },
resetSize() { resetSize() {
let kilnContainerBox = document.getElementById('kilnContainer'); let kilnContainerBox = document.getElementById('kilnContainer')
let rw = parseFloat(window.innerWidth); console.log(kilnContainerBox)
let rh = parseFloat(window.innerHeight); let rw = parseFloat(window.innerWidth)
let bw = parseFloat(kilnContainerBox.style.width); let rh = parseFloat(window.innerHeight)
let bh = parseFloat(kilnContainerBox.style.height); let bw = parseFloat(kilnContainerBox.style.width)
let wx = 0; let bh = parseFloat(kilnContainerBox.style.height)
let hx = 0; let wx = 0
let hx = 0
if (screenfull.isFullscreen) { if (screenfull.isFullscreen) {
wx = rw / bw; console.log('全屏')
hx = rh / bh; wx = rw / bw
} else { hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
if (this.$store.state.app.sidebar.opened) { if (this.$store.state.app.sidebar.opened) {
wx = (rw - 280) / bw; wx = (rw-280) / bw
hx = (rh - 116) / bh; hx = (rh-116) / bh
} else { }else{
wx = (rw - 85) / bw; wx = (rw-85) / bw
hx = (rh - 116) / bh; hx = (rh-116) / bh
} }
} }
this.scaleNum = wx; this.scaleNum = wx
}, }
}, }
}; };
</script> </script>

View File

@ -1,11 +1,8 @@
<template> <template>
<div <div id='wholePlantContainerB' ref='wholePlantContainerB' style="width: 100%;height: 100%;">
id="wholePlantContainerB"
ref="wholePlantContainerB"
style="width: 100%; height: 100%">
<div <div
id="wholePlantContainer" id='wholePlantContainer'
ref="wholePlantContainer" ref='wholePlantContainer'
class="wholePlantBoard" class="wholePlantBoard"
style=" style="
position: absolute; position: absolute;
@ -19,27 +16,18 @@
flex-direction: column; flex-direction: column;
gap: 24px; gap: 24px;
" "
:style="{ transform: 'scale(' + scaleNum + ')' }"> :style="{transform:'scale('+scaleNum+')'}">
<KHeader <KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='全厂总览驾驶舱'/>
:isFullScreen="isFullScreen"
@screenfullChange="screenfullChange"
topTitle="全厂总览驾驶舱" />
<div <div
class="main-body" class="main-body"
style="flex: 1; display: flex; gap: 20px; padding: 0px 16px"> style="flex: 1; display: flex; gap: 20px; padding: 0px 16px">
<div <div class="left-side" style="flex: 1">
class="left-side"
style="flex: 1">
<LeftTwo /> <LeftTwo />
</div> </div>
<div <div class="middle-side" style="flex: 1">
class="middle-side"
style="flex: 1">
<MiddleTwo /> <MiddleTwo />
</div> </div>
<div <div class="right-side" style="flex: 1">
class="right-side"
style="flex: 1">
<RightTwo /> <RightTwo />
</div> </div>
</div> </div>
@ -52,8 +40,8 @@ import KHeader from '../components/Header';
import LeftTwo from './LeftTwo'; import LeftTwo from './LeftTwo';
import MiddleTwo from './MiddleTwo'; import MiddleTwo from './MiddleTwo';
import RightTwo from './RightTwo'; import RightTwo from './RightTwo';
import screenfull from 'screenfull'; import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'; import { debounce } from '@/utils/debounce'
export default { export default {
name: 'wholePlantBoard', name: 'wholePlantBoard',
@ -61,7 +49,7 @@ export default {
KHeader, KHeader,
LeftTwo, LeftTwo,
MiddleTwo, MiddleTwo,
RightTwo, RightTwo
}, },
// provide() { // provide() {
// return { // return {
@ -71,77 +59,80 @@ export default {
data() { data() {
return { return {
isFullScreen: false, isFullScreen: false,
scaleNum: 0.8, scaleNum: 0.8
}; };
}, },
created() { created() {
this.init(); this.init()
}, },
destroy() { destroy() {
this.destroy(); this.destroy()
}, },
mounted() { mounted() {
this.boxReset(); this.boxReset = debounce(() => {
window.addEventListener('resize', this.boxReset); this.resetSize()
}, 300)
this.boxReset()
window.addEventListener('resize', () => {
this.boxReset()
})
console.log('mounted...........')
}, },
destroyed() { destroyed() {
window.removeEventListener('resize', this.boxReset); console.log('destroyed...........')
}, },
methods: { methods: {
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
change() { change() {
this.isFullScreen = screenfull.isFullscreen; this.isFullScreen = screenfull.isFullscreen
}, },
init() { init() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.on('change', this.change); screenfull.on('change', this.change)
} }
}, },
destroy() { destroy() {
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.off('change', this.change); screenfull.off('change', this.change)
} }
}, },
// //
screenfullChange() { screenfullChange() {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
this.$message({ this.$message({
message: 'you browser can not work', message: 'you browser can not work',
type: 'warning', type: 'warning'
}); })
return false; return false
} }
screenfull.toggle(this.$refs.wholePlantContainerB); screenfull.toggle(this.$refs.wholePlantContainerB)
}, },
resetSize() { resetSize() {
let wholePlantContainerBox = document.getElementById( let wholePlantContainerBox = document.getElementById('wholePlantContainer')
'wholePlantContainer' let rw = parseFloat(window.innerWidth)
); let rh = parseFloat(window.innerHeight)
let rw = parseFloat(window.innerWidth); let bw = parseFloat(wholePlantContainerBox.style.width)
let rh = parseFloat(window.innerHeight); let bh = parseFloat(wholePlantContainerBox.style.height)
let bw = parseFloat(wholePlantContainerBox.style.width); let wx = 0
let bh = parseFloat(wholePlantContainerBox.style.height); let hx = 0
let wx = 0;
let hx = 0;
if (screenfull.isFullscreen) { if (screenfull.isFullscreen) {
wx = rw / bw; console.log('全屏')
hx = rh / bh; wx = rw / bw
} else { hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
if (this.$store.state.app.sidebar.opened) { if (this.$store.state.app.sidebar.opened) {
wx = (rw - 280) / bw; wx = (rw-280) / bw
hx = (rh - 116) / bh; hx = (rh-116) / bh
} else { }else{
wx = (rw - 85) / bw; wx = (rw-85) / bw
hx = (rh - 116) / bh; hx = (rh-116) / bh
} }
} }
this.scaleNum = wx; this.scaleNum = wx
}, }
}, }
}; };
</script> </script>

View File

@ -1,7 +1,8 @@
<template> <template>
<div <div
class="searchBarBox divHeight" class="searchBarBox divHeight"
ref="searchBarRef"> ref="searchBarRef"
:style="{ paddingRight: isFold ? '55px' : '0px' }">
<el-form <el-form
:inline="true" :inline="true"
class="demo-form-inline"> class="demo-form-inline">
@ -199,6 +200,13 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span
v-if="isFold"
class="foldClass"
@click="switchMode">
{{ isExpand ? '收起' : '展开' }}
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
</span>
</div> </div>
</template> </template>
<script> <script>
@ -209,8 +217,16 @@ import { getFactoryList } from '@/api/core/base/factory';
import moment from 'moment'; import moment from 'moment';
export default { export default {
name: 'searchArea', name: 'searchArea',
props: {
isFold: {
//
type: Boolean,
default: false,
},
},
data() { data() {
return { return {
isExpand: false, //
// //
queryParams: { queryParams: {
energyTypeId: null, energyTypeId: null,
@ -509,6 +525,16 @@ export default {
let value = new Date(newData).getTime(); let value = new Date(newData).getTime();
return value; return value;
}, },
switchMode() {
//
this.isExpand = !this.isExpand;
const element = this.$refs.searchBarRef;
if (this.isExpand) {
element.classList.remove('divHeight');
} else {
element.classList.add('divHeight');
}
},
}, },
}; };
</script> </script>
@ -547,6 +573,21 @@ export default {
margin-bottom: 4px; margin-bottom: 4px;
} }
} }
.searchBarBox .foldClass {
position: absolute;
top: 14px;
right: 0;
cursor: pointer;
font-size: 12px;
color: #0b58ff;
}
.searchBarBox .foldClass .iconfont {
font-size: 14px;
}
.divHeight {
height: 45px;
overflow: hidden;
}
.separateStyle { .separateStyle {
display: inline-block; display: inline-block;
width: 1px; width: 1px;

View File

@ -4,6 +4,7 @@
id="contrastAnalysisBox"> id="contrastAnalysisBox">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-area <search-area
:isFold="isFold"
@submit="getList" @submit="getList"
@export="exportExl" /> @export="exportExl" />
<div v-show="chartData.length"> <div v-show="chartData.length">
@ -37,6 +38,7 @@ export default {
mixins: [tableHeightMixin], mixins: [tableHeightMixin],
data() { data() {
return { return {
isFold: false,
chartData: [], chartData: [],
timeDim: '', timeDim: '',
tableProps: [], tableProps: [],
@ -44,6 +46,13 @@ export default {
tableH: this.tableHeight(250) / 2, tableH: this.tableHeight(250) / 2,
}; };
}, },
mounted() {
window.addEventListener('resize', () => {
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
});
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
},
methods: { methods: {
_setTableHeight() { _setTableHeight() {
this.tableH = this.tableHeight(250) / 2; this.tableH = this.tableHeight(250) / 2;

View File

@ -1,7 +1,8 @@
<template> <template>
<div <div
class="searchBarBox" class="searchBarBox divHeight"
ref="searchBarRef"> ref="searchBarRef"
:style="{ paddingRight: isFold ? '55px' : '0px' }">
<el-form <el-form
:inline="true" :inline="true"
class="demo-form-inline"> class="demo-form-inline">
@ -171,9 +172,9 @@
</el-button> </el-button>
<span <span
class="separateStyle" class="separateStyle"
v-hasPermi="['analysis:energy-analysis:query']"></span> v-hasPermi="['analysis:trend-analysis:export']"></span>
<el-button <el-button
v-hasPermi="['analysis:energy-analysis:query']" v-hasPermi="['analysis:trend-analysis:export']"
type="primary" type="primary"
size="small" size="small"
plain plain
@ -182,6 +183,13 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span
v-if="isFold"
class="foldClass"
@click="switchMode">
{{ isExpand ? '收起' : '展开' }}
<svg-icon :icon-class="isExpand ? 'upward' : 'downward'" />
</span>
</div> </div>
</template> </template>
<script> <script>
@ -190,8 +198,16 @@ import { getEnergyTypeListAll } from '@/api/base/energyType';
import moment from 'moment'; import moment from 'moment';
export default { export default {
name: 'searchArea', name: 'searchArea',
props: {
isFold: {
//
type: Boolean,
default: false,
},
},
data() { data() {
return { return {
isExpand: false, //
// //
queryParams: { queryParams: {
energyTypeId: null, energyTypeId: null,
@ -493,6 +509,16 @@ export default {
let value = new Date(newData).getTime(); let value = new Date(newData).getTime();
return value; return value;
}, },
switchMode() {
//
this.isExpand = !this.isExpand;
const element = this.$refs.searchBarRef;
if (this.isExpand) {
element.classList.remove('divHeight');
} else {
element.classList.add('divHeight');
}
},
}, },
}; };
</script> </script>
@ -531,6 +557,21 @@ export default {
margin-bottom: 4px; margin-bottom: 4px;
} }
} }
.searchBarBox .foldClass {
position: absolute;
top: 14px;
right: 0;
cursor: pointer;
font-size: 12px;
color: #0b58ff;
}
.searchBarBox .foldClass .iconfont {
font-size: 14px;
}
.divHeight {
height: 45px;
overflow: hidden;
}
.separateStyle { .separateStyle {
display: inline-block; display: inline-block;
width: 1px; width: 1px;

View File

@ -4,6 +4,7 @@
id="trendAnalysisBox"> id="trendAnalysisBox">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-area <search-area
:isFold="isFold"
@submit="getList" @submit="getList"
@export="exportExl" /> @export="exportExl" />
<div v-show="chartData.length"> <div v-show="chartData.length">
@ -32,12 +33,20 @@ export default {
components: { SearchArea, LineChart }, components: { SearchArea, LineChart },
data() { data() {
return { return {
isFold: false,
chartData: [], chartData: [],
timeDim: '', timeDim: '',
tableProps: [], tableProps: [],
list: [], list: [],
}; };
}, },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
});
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
},
methods: { methods: {
getList(params) { getList(params) {
this.timeDim = params.timeDim; this.timeDim = params.timeDim;

View File

@ -89,13 +89,13 @@ export default {
param: 'name', param: 'name',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc:query') ? 'button' : '', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc:create') ? 'separate' : '', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '', type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',

View File

@ -22,9 +22,7 @@
readonly readonly
style="width: 250px"></el-input> style="width: 250px"></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item v-if="showBtn">
v-if="showBtn"
v-hasPermi="['base:energy-plc-param:create']">
<el-button <el-button
type="success" type="success"
size="small" size="small"
@ -162,19 +160,15 @@ export default {
this.drawerTitle = '参数绑定'; this.drawerTitle = '参数绑定';
this.showBtn = true; this.showBtn = true;
this.tableBtn = [ this.tableBtn = [
this.$auth.hasPermi('base:energy-plc-param:update') {
? { type: 'edit',
type: 'edit', btnName: '编辑',
btnName: '编辑', },
} {
: undefined, type: 'delete',
this.$auth.hasPermi('base:energy-plc-param:delete') btnName: '删除',
? { },
type: 'delete', ];
btnName: '删除',
}
: undefined,
].filter((v) => v);
} }
}, },
getList() { getList() {

View File

@ -107,17 +107,13 @@ export default {
param: 'cnName', param: 'cnName',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc-connect:query') type: 'button',
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc-connect:create') type: 'separate',
? 'separate'
: '',
}, },
{ {
type: this.$auth.hasPermi('base:energy-plc-connect:create') type: this.$auth.hasPermi('base:energy-plc-connect:create')
@ -131,25 +127,17 @@ export default {
], ],
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermiAnd([ this.$auth.hasPermi('base:energy-plc-connect:bind')
'base:energy-plc-param:query',
'base:energy-type:query',
])
? { ? {
type: 'connect', type: 'connect',
btnName: '绑定', btnName: '绑定',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:energy-plc-param:query') {
? { type: 'detail',
type: 'detail', btnName: '详情',
btnName: '详情', },
} this.$auth.hasPermi('base:energy-plc-connect:update')
: undefined,
this.$auth.hasPermiAnd([
'base:energy-plc-connect:update',
'base:energy-plc-connect:query',
])
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',

View File

@ -114,20 +114,13 @@ export default {
defaultSelect: [], defaultSelect: [],
}, },
{ {
type: this.$auth.hasPermi('base:energy-quantity-manual:query') type: 'button',
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermiOr([ type: 'separate',
'base:energy-quantity-manual:export',
'base:energy-quantity-manual:create',
])
? 'separate'
: '',
}, },
{ {
type: this.$auth.hasPermi('base:energy-quantity-manual:export') type: this.$auth.hasPermi('base:energy-quantity-manual:export')
@ -154,19 +147,13 @@ export default {
// //
list: [], list: [],
tableBtn: [ tableBtn: [
this.$auth.hasPermiAnd([ this.$auth.hasPermi('base:energy-quantity-manual:create')
'base:energy-quantity-manual:query',
'base:energy-quantity-manual:create',
])
? { ? {
type: 'meterReading', type: 'meterReading',
btnName: '抄表', btnName: '抄表',
} }
: undefined, : undefined,
this.$auth.hasPermiAnd([ this.$auth.hasPermi('base:energy-quantity-manual:update')
'base:energy-quantity-manual:update',
'base:energy-quantity-manual:query',
])
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',

View File

@ -90,9 +90,7 @@ export default {
width: 350, width: 350,
}, },
{ {
type: this.$auth.hasPermi('base:energy-quantity-realtime:query') type: 'button',
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',

View File

@ -52,10 +52,7 @@ export default {
return { return {
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermiAnd([ this.$auth.hasPermi('base:table-name-config:edit')
'base:energy-table:query',
'base:energy-table:update',
])
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',

View File

@ -125,17 +125,13 @@ export default {
param: 'limitType', param: 'limitType',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-limit:query') type: 'button',
? 'button'
: '',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-limit:create') type: 'separate',
? 'separate'
: '',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-limit:create') type: this.$auth.hasPermi('monitoring:energy-limit:create')

View File

@ -113,9 +113,7 @@ export default {
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-report:export') type: 'separate',
? 'separate'
: '',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-report:export') type: this.$auth.hasPermi('monitoring:energy-report:export')

View File

@ -22,7 +22,6 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button
v-hasPermi="['monitoring:energy-statistics-det:query']"
type="success" type="success"
size="small" size="small"
v-if="showBtn" v-if="showBtn"
@ -31,7 +30,6 @@
新增 新增
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['monitoring:energy-statistics-det:delete']"
type="danger" type="danger"
size="small" size="small"
v-if="showBtn" v-if="showBtn"
@ -163,13 +161,11 @@ export default {
this.drawerTitle = '参数绑定'; this.drawerTitle = '参数绑定';
this.showBtn = true; this.showBtn = true;
this.tableBtn = [ this.tableBtn = [
this.$auth.hasPermi('monitoring:energy-statistics-det:delete') {
? { type: 'delete',
type: 'delete', btnName: '删除',
btnName: '删除', },
} ];
: undefined,
].filter((v) => v);
} }
}, },
getList() { getList() {

View File

@ -88,9 +88,7 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-statistics-det:create') type: 'button',
? 'button'
: '',
btnName: '关联', btnName: '关联',
name: 'add', name: 'add',
color: 'primary', color: 'primary',

View File

@ -104,9 +104,7 @@ export default {
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-statistics:create') type: 'separate',
? 'separate'
: '',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-statistics:create') type: this.$auth.hasPermi('monitoring:energy-statistics:create')
@ -120,22 +118,17 @@ export default {
], ],
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi('monitoring:energy-statistics-det:query') this.$auth.hasPermi('monitoring:energy-statistics:bind')
? { ? {
type: 'connect', type: 'connect',
btnName: '绑定', btnName: '绑定',
} }
: undefined, : undefined,
this.$auth.hasPermi('monitoring:energy-statistics:query') {
? { type: 'detail',
type: 'detail', btnName: '详情',
btnName: '详情', },
} this.$auth.hasPermi('monitoring:energy-statistics:update')
: undefined,
this.$auth.hasPermiAnd([
'monitoring:energy-statistics:update',
'monitoring:energy-statistics:query',
])
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',

View File

@ -1,223 +1,168 @@
<template> <template>
<div> <div>
<div class="boxTitle"> <div class="boxTitle">
<span class="blueTitle"></span> <span class="blueTitle"></span>
<span>各集团订单环形图</span> <span>各集团订单环形图</span>
</div> </div>
<div <div class="chartBox" id='orderChartBox' v-show='chartList.length'>
class="chartBox" <div class="chartItem" v-for="(item, index) in chartList" :key='index' :style="{width: 388*beilv+'px',height: 286*beilv+'px',padding:14*beilv+'px',marginRight:9*beilv+'px',marginBottom:9*beilv+'px'}">
id="orderChartBox" <div class="topTitle" :style="{fontSize: 14 * beilv + 'px'}">
v-show="chartList.length"> <svg-icon icon-class="order-monitoring" :style="{fontSize: 16*beilv+'px'}"/>
<div <span class="orderName" :style="{paddingRight:8*beilv+'px',marginRight:8*beilv+'px'}">{{item.orderGroupName}}</span>
class="chartItem" <span>订单计划数量{{item.num}}</span>
v-for="(item, index) in chartList" </div>
:key="index" <div
:style="{ :id="item.id"
width: 388 * beilv + 'px', :style="{width: 166*beilv+'px',height: 166*beilv+'px',margin: 'auto'}"
height: 286 * beilv + 'px', ></div>
padding: 14 * beilv + 'px', <div class="legend" :style="{height: 54 * beilv + 'px', marginTop: 10*beilv+'px'}">
marginRight: 9 * beilv + 'px', <div class="legendItem" v-for="(subItem, i) in item.order" :key='i' :style="{paddingRight:9*beilv+'px',marginRight:9*beilv+'px'}">
marginBottom: 9 * beilv + 'px', <span class="itemNum" :style="{fontSize: 18 * beilv + 'px'}">{{subItem.value}}</span>
}"> <div>
<div <span class="itemName" :style="{fontSize: 14 * beilv + 'px'}">
class="topTitle" <span class="smallBlock" :style="{backgroundColor:subItem.color,width:8*beilv+'px',height:8*beilv+'px'}"></span>
:style="{ fontSize: 14 * beilv + 'px' }"> {{subItem.name}}
<svg-icon </span>
icon-class="order-monitoring" </div>
:style="{ fontSize: 16 * beilv + 'px' }" /> </div>
<span </div>
class="orderName" </div>
:style="{ </div>
paddingRight: 8 * beilv + 'px', <!-- 空图 -->
marginRight: 8 * beilv + 'px', <div class="no-data-bg" v-show='!chartList.length'></div>
}"> </div>
{{ item.orderGroupName }}
</span>
<span>订单计划数量{{ item.num }}</span>
</div>
<div
:id="item.id"
:style="{
width: 166 * beilv + 'px',
height: 166 * beilv + 'px',
margin: 'auto',
}"></div>
<div
class="legend"
:style="{ height: 54 * beilv + 'px', marginTop: 10 * beilv + 'px' }">
<div
class="legendItem"
v-for="(subItem, i) in item.order"
:key="i"
:style="{
paddingRight: 9 * beilv + 'px',
marginRight: 9 * beilv + 'px',
}">
<span
class="itemNum"
:style="{ fontSize: 18 * beilv + 'px' }">
{{ subItem.value }}
</span>
<div>
<span
class="itemName"
:style="{ fontSize: 14 * beilv + 'px' }">
<span
class="smallBlock"
:style="{
backgroundColor: subItem.color,
width: 8 * beilv + 'px',
height: 8 * beilv + 'px',
}"></span>
{{ subItem.name }}
</span>
</div>
</div>
</div>
</div>
</div>
<!-- 空图 -->
<div
class="no-data-bg"
v-show="!chartList.length"></div>
</div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
import { debounce } from '@/utils/debounce'; import { debounce } from '@/utils/debounce'
export default { export default {
name: 'MonitoringRingCharts', name: 'MonitoringRingCharts',
props: { props: {
chartList: { chartList: {
type: Array, type: Array,
default: () => { default: () => {
return []; return []
}, }
}, }
}, },
data() { data() {
return { return {
myChart: [], myChart: [],
beilv: 1, beilv: 1,
}; canvasReset: ''
}, }
mounted() { },
this.canvasReset(); mounted() {
window.addEventListener('resize', this.canvasReset); this.beilv = document.getElementById('orderChartBox').offsetWidth / 1610
}, this.canvasReset = debounce(() => {
destroyed() { this.initChart()
window.removeEventListener('resize', this.canvasReset); }, 500)
}, window.addEventListener('resize', () => {
methods: { this.beilv = document.getElementById('orderChartBox').offsetWidth / 1610
canvasReset() { this.canvasReset()
debounce(() => { })
this.initChart(); },
}, 500)(); methods: {
this.beilv = document.getElementById('orderChartBox').offsetWidth / 1610; //
}, initChart() {
// if (this.chartList.length <= 0) {
initChart() { return false
if (this.chartList.length <= 0) { }
return false; //
} for (let j = 0;j < this.chartList.length; j++) {
// if (this.myChart[j]) {
for (let j = 0; j < this.chartList.length; j++) { this.myChart[j].dispose() // Dom
if (this.myChart[j]) { }
this.myChart[j].dispose(); // Dom }
} for (let i = 0; i < this.chartList.length; i++) {
} var chartDom = document.getElementById(this.chartList[i].id);
for (let i = 0; i < this.chartList.length; i++) { this.myChart[i] = echarts.init(chartDom);
var chartDom = document.getElementById(this.chartList[i].id); let colorList = []
this.myChart[i] = echarts.init(chartDom); this.chartList[i].order.map(item => {
let colorList = []; colorList.push(item.color)
this.chartList[i].order.map((item) => { })
colorList.push(item.color); let percentage = (this.chartList[i].sunNum/this.chartList[i].num*100).toFixed(0)
}); var option = {
let percentage = ( color: colorList,
(this.chartList[i].sunNum / this.chartList[i].num) * series: [
100 {
).toFixed(0); name: 'Access From',
var option = { type: 'pie',
color: colorList, radius: ['75%', '95%'],
series: [ avoidLabelOverlap: false,
{ itemStyle: {
name: 'Access From', borderRadius: 5,
type: 'pie', borderColor: '#fff',
radius: ['75%', '95%'], borderWidth: 2
avoidLabelOverlap: false, },
itemStyle: { label: {
borderRadius: 5, show: true,
borderColor: '#fff', position: 'center',
borderWidth: 2, color: '#000',
}, formatter: [
label: { '{a|'+percentage+'%}',
show: true, '{b|生产'+this.chartList[i].sunNum+'}'
position: 'center', ].join('\n\n'),
color: '#000', rich: {
formatter: [ a: {
'{a|' + percentage + '%}', fontSize: this.beilv*24 +'px'
'{b|生产' + this.chartList[i].sunNum + '}', },
].join('\n\n'), b: {
rich: { fontSize: this.beilv*12 +'px'
a: { }
fontSize: this.beilv * 24 + 'px', }
}, },
b: { emphasis: {
fontSize: this.beilv * 12 + 'px', disabled: true
}, },
}, labelLine: {
}, show: false
emphasis: { },
disabled: true, data: this.chartList[i].order
}, }
labelLine: { ]
show: false, };
}, option && this.myChart[i].setOption(option)
data: this.chartList[i].order, }
}, }
], }
}; }
option && this.myChart[i].setOption(option);
}
},
},
};
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.chartBox { .chartBox {
width: 100%; width: 100%;
padding-right: 6px; padding-right: 6px;
height: calc(100vh - 356px); height: calc(100vh - 356px);
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
overflow: auto; overflow: auto;
align-content: flex-start; align-content: flex-start;
.chartItem { .chartItem {
border-radius: 8px; border-radius: 8px;
border: 1px solid #cacaca; border: 1px solid #CACACA;
.topTitle { .topTitle {
margin-bottom: 10px; margin-bottom: 10px;
.orderName { .orderName {
border-right: 1px solid #cacaca; border-right: 1px solid #CACACA;
} }
} }
.legend { .legend {
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
overflow: auto; overflow: auto;
.legendItem { .legendItem {
display: inline-block; display: inline-block;
border-right: 1px solid #e8e8e8; border-right: 1px solid #E8E8E8;
.itemName { .itemName {
.smallBlock { .smallBlock {
display: inline-block; display: inline-block;
} }
} }
} }
.legendItem:last-child { .legendItem:last-child {
border: none; border: none;
} }
} }
} }
} }
</style> </style>