Merge pull request 'dev' (#318) from dev into master

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/318
This commit is contained in:
2024-03-13 03:21:55 +00:00
15 changed files with 1146 additions and 287 deletions

View File

@@ -16,7 +16,7 @@ steps:
- export NODE_MODULES_PATH=`pwd`/node_modules
# - npm config set registry https://registry.npm.taobao.org
- set NODE_OPTIONS=--openssl-legacy-provider
# - npm install
- npm install
- npm run build
- echo $NODE_MODULES_PATH
- cp -r dist /app/build/$DRONE_REPO_NAME

View File

@@ -12,8 +12,10 @@
"@element-plus/icons-vue": "^2.3.1",
"autofit.js": "^3.0.4",
"axios": "^1.4.0",
"csv-exportor": "^1.0.2",
"echarts": "^5.4.2",
"element-plus": "^2.3.5",
"element-resize-detector": "^1.2.4",
"js-cookie": "^3.0.5",
"nprogress": "^0.2.0",
"pinia": "^2.0.35",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -18,13 +18,15 @@
body {
background-color: #f5f5f5;
}
.allLoading.el-loading-mask.is-fullscreen{
.el-loading-spinner{
.circular{
.allLoading.el-loading-mask.is-fullscreen {
.el-loading-spinner {
.circular {
width: 75px;
height: 75px;
}
.el-loading-text{
.el-loading-text {
font-size: 26px;
letter-spacing: 2px;
}
@@ -312,51 +314,30 @@ body,
}
}
//弹窗样式
.digital-tunnel {
.chat-dialog {
display: flex;
.shrink-screen-dialog {
width: 2175px !important;
//width: 100% !important;
//height: 100% !important;
height: 1300px !important;
margin: 520px auto 0 auto !important;
background: rgba(6, 34, 71, 0.8) !important;
}
#container {
flex: 1;
height: 1200px;
//width: 1300px;
}
.alarm-tunnel {
.el-tag {
font-size: 36px;
height: 60px;
padding: 0 20px;
border-radius: 10px;
}
#containerFan {
flex: 1;
height: 1200px;
//width: 1300px;
}
.detail {
font-size: 50px;
color: #FFFFFF;
#containerBad {
flex: 1;
height: 1200px;
//width: 1300px;
}
#containerWind {
flex: 1;
height: 1200px;
//width: 1300px;
}
#containerWindDirection {
flex: 1;
height: 1160px;
//width: 1300px;
}
#containerEle {
flex: 1;
height: 1010px;
//width: 2180px;
}
#containerAir {
flex: 1;
height: 1150px;
//width: 2180px;
> div {
color: #f5f5f5;
margin-bottom: 10px;
}
}
@@ -364,9 +345,9 @@ body,
position: relative;
display: flex;
flex-direction: column;
height: 1300px;
height: 1400px;
border: 2px solid #0f82af;
background: rgba(6, 34, 71, 0.78);
background: rgba(6, 34, 71, 0.8);
border-radius: 20px;
padding: 47px 30px;
box-sizing: border-box;
@@ -473,6 +454,212 @@ body,
transform: rotate(180deg);
}
}
.shrink-icon {
margin: -36px -20px 0 30px;
cursor: pointer;
width: 65px;
height: 65px;
background-image: url("@/assets/images/fanInfo/shrink.png");
}
.full-icon {
cursor: pointer;
margin: -36px -20px 0 30px;
}
//弹窗样式
.digital-tunnel {
.chat-dialog {
display: flex;
#container {
flex: 1;
height: 1200px;
//width: 1300px;
}
#containerFan {
//width: 100%;
//height: 100%;
flex: 1;
//height: calc(100vh - 100px);
//height: 100vh;
height: 1200px;
//width: 1300px;
}
#containerBad {
flex: 1;
height: 1200px;
//width: 1300px;
}
#containerWind {
flex: 1;
height: 1200px;
//width: 1300px;
}
#containerWindDirection {
flex: 1;
height: 1160px;
//width: 1300px;
}
#containerEle {
flex: 1;
height: 1010px;
//width: 2180px;
}
#containerAir {
flex: 1;
height: 1150px;
//width: 2180px;
}
}
.el-dialog {
position: relative;
display: flex;
flex-direction: column;
width: 99.9%;
height: 99.9%;
//height: 1300px;
border: 2px solid #0f82af;
//background: rgba(6, 34, 71, 0.78);
background: rgba(6, 34, 71, 0.95);
border-radius: 20px;
padding: 47px 30px;
box-sizing: border-box;
//margin: 520px auto 0 auto;
margin: 0;
.el-dialog__header {
padding: 0 0 28px 0;
//display: none;
.el-dialog__title {
font-size: 50px;
font-weight: bold;
color: #d6f1fa;
}
.el-dialog__headerbtn {
right: 22px;
.el-dialog__close {
color: #05feff;
font-size: 73px;
}
}
}
.el-dialog__body {
padding: 0;
}
}
.left-top-icon {
position: absolute;
top: -3px;
left: -3px;
width: 41px;
height: 41px;
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
}
.right-top-icon {
position: absolute;
top: -3px;
right: -3px;
width: 41px;
height: 41px;
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
transform: rotate(90deg);
}
.export-btn {
cursor: pointer;
//padding-left: 53px;
width: 178px;
height: 92px;
line-height: 92px;
border-radius: 11px;
border: 2px solid #08B7B8;
background: #264A78;
//border-radius: 11px;
color: #FFFFFF;
font-size: 48px;
text-align: center;
margin-right: 30px;
}
.change-screen {
position: absolute;
right: 126px;
top: 50px;
}
.time-select {
position: absolute;
top: 20px;
right: 200px;
display: flex;
.choose-day {
margin-right: 40px;
.el-date-editor {
width: 370px;
height: 92px;
}
.el-input__wrapper {
height: 92px;
background-color: transparent;
border-radius: 10px;
border: 2px solid #0F82AF;
box-shadow: none;
//padding: 18px 24px;
.el-input__prefix, .el-input__suffix {
.el-icon {
font-size: 40px;
color: #FFFFFF;
}
}
.el-input__inner {
height: 80px;
font-size: 40px;
color: #FFFFFF;
}
}
}
}
.left-bottom-icon {
position: absolute;
bottom: -3px;
left: -3px;
width: 41px;
height: 41px;
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
transform: rotate(-90deg);
}
.right-bottom-icon {
position: absolute;
bottom: -3px;
right: -3px;
width: 41px;
height: 41px;
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
transform: rotate(180deg);
}
//用电量
.top-tag {
position: absolute;

View File

@@ -5,11 +5,11 @@
<div>
<img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/>
<div class="fan-info" @click="handleOpenChart(windSpeedType,windSpeedId)">
<div class="input-fan"><span>风速</span>{{ windSpeed }}m/s</div>
<div class="input-fan"><span>风速</span>{{ windSpeed }} {{ windSpeedUnit }}</div>
</div>
</div>
<div class="wind-direction-info" @click="handleOpenChart(windDirectionSpeedType,windDirectionSpeedId)">
<div class="input-fan"><span>风向</span>{{ windDirection }} °</div>
<div class="input-fan"><span>风向</span>{{ windDirection }} {{ windDirectionUnit }}</div>
</div>
</div>
<item-info
@@ -21,7 +21,7 @@
<div style="height: 1px" v-if="airList.length!==0"></div>
<div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isWindSpeedVisited" :title="dialogTitle+'监控数据'" width="2175px"
:modal="false">
:modal="false" id="airDialog">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="loading-block" v-if="showSpeedLoading">
@@ -33,6 +33,9 @@
<div style="width: 1px;"></div>
</div>
<div class="time-select">
<div class="export-btn" @click="handleExport">
导出
</div>
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
<time-range-btn
@@ -41,6 +44,13 @@
@select="timeSelect"
/>
</div>
<div class="change-screen">
<el-icon size="55" color="#05feff" class="full-icon" title="放大" @click.stop="handleFullScreen"
v-if="isFullScreen">
<FullScreen/>
</el-icon>
<div v-else class="shrink-icon" title="缩小" @click.stop="shrinkScreen"></div>
</div>
<div class="left-bottom-icon"></div>
<div class="right-bottom-icon"></div>
</el-dialog>
@@ -55,16 +65,24 @@ import * as echarts from 'echarts';
import {getEchartsInfo} from "@/api/largeScreen";
import ChooseDay from "@/components/chooseDay/index.vue"
import ChooseMonth from "@/components/chooseMonth/index.vue"
import elementResizeDetectorMaker from "element-resize-detector";
import {getNowFormatDate} from "@/utils/date.js";
import CsvExportor from "csv-exportor";
let myEcharts = reactive({});
const props = defineProps({
list: Array,
airData: Array
});
const isFullScreen = ref(false);
let dataZoomTop = reactive('87%')
let chartData = reactive([])
const chooseDayRef = ref();
const chooseMonthRef = ref();
const windSpeed = ref(0)
const windSpeedUnit = ref('m/s')
const windDirection = ref(null)
const windDirectionUnit = ref('°')
const loadingText = ref('加载中...')
const windSpeedId = ref(0)
const windSpeedType = ref(null)
@@ -77,6 +95,8 @@ const timeList = ref(["年", "月", "日"]);
const selectTimeButton = ref(2);
const isWindSpeedVisited = ref(false);
const showSpeedLoading = ref(false)
const clickMonth = ref('')
const clickDay = ref('')
watch(() => props.list, (now) => {
airList.value?.forEach(item => {
now.forEach(newItem => {
@@ -105,20 +125,125 @@ watch(() => props.airData, (now) => {
// windSpeed.value = 0
// }
}, {deep: true});
//导出csv
const handleExport = () => {
let clickUnit = ''
if(dialogTitle.value==='风速'){
clickUnit=windSpeedUnit.value
}else if(dialogTitle.value==='风向'){
clickUnit=windDirectionUnit.value
}else {
airList.value.forEach(item => {
if (item.name=== dialogTitle.value) {
clickUnit = item.unit
}
})
}
const header = ['时间', `${dialogTitle.value}值(${clickUnit})`];
let newArray = []
chartData.dates.forEach((item, index) => {
let obj = {
dates: chartData.dates[index],
values: chartData.values[index]
}
newArray.push(obj)
})
let time = ''
if (selectTimeButton.value === 1) {
if (clickMonth.value) {
const index = clickMonth.value.lastIndexOf("\-");
time = clickMonth.value.substring(0, index)
} else {
time = getNowFormatDate(false)
}
} else if (selectTimeButton.value === 2) {
if (clickDay.value) {
time = clickDay.value
} else {
time = getNowFormatDate(true)
}
} else if (selectTimeButton.value === 0) {
time = new Date().getFullYear() + '年'
}
const name = dialogTitle.value + '监控数据-' + time
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
}
const daySelect = (val) => {
getChartInfo(openDialogId.value, 'day', val)
clickDay.value = val
if (isFullScreen.value) {
getChartInfo(openDialogId.value, 'day', val)
} else {
getChartInfo(openDialogId.value, 'day', val,true)
}
}
const monthSelect = (val) => {
getChartInfo(openDialogId.value, 'month', val)
clickMonth.value = val
if (isFullScreen.value) {
getChartInfo(openDialogId.value, 'month', val)
} else {
getChartInfo(openDialogId.value, 'month', val,true)
}
}
const getChartInfo = (equipmentId, type = 'day', time = '') => {
isWindSpeedVisited.value = true
//放大弹窗
const handleFullScreen = () => {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
const fan = document.getElementById('airDialog')
const fanChart = document.getElementById('containerWind')
const erd = elementResizeDetectorMaker();
fan.classList.remove('shrink-screen-dialog')
titleName.style.fontSize = '70px'
erd.listenTo(document.getElementById('airDialog'), (element) => {
fanChart.style.height = (element.offsetHeight - 120) + 'px'
myEcharts.resize();
});
nextTick(() => {
isFullScreen.value = false
initChart(chartData.dates, chartData.values, '93%')
})
}
const shrinkScreen = () => {
const fan = document.getElementById('airDialog')
const fanChart = document.getElementById('containerWind')
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '50px'
fan.classList.add('shrink-screen-dialog')
fanChart.style.height = '1200px'
myEcharts.resize();
nextTick(() => {
isFullScreen.value = true
initChart(chartData.dates, chartData.values,dataZoomTop)
})
}
const getChartInfo = (equipmentId, type = 'day', time = '', flag) => {
showSpeedLoading.value = true
nextTick(() => {
if (flag) {
const fan = document.getElementById('airDialog')
fan.classList.remove('shrink-screen-dialog')
if (!isFullScreen.value) {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '70px'
}
}
})
getEchartsInfo(equipmentId, time, type).then(res => {
if (res?.code === 1000) {
showSpeedLoading.value = false
chartData=res.data
nextTick(() => {
initChart(res.data.dates, res.data.values)
if (flag) {
const fanChart = document.getElementById('containerWind')
const erd = elementResizeDetectorMaker();
erd.listenTo(document.getElementById('airDialog'), (element) => {
fanChart.style.height = element.offsetHeight - 120 + 'px'
myEcharts.resize();
});
if (!isFullScreen.value) {
initChart(res.data.dates, res.data.values,'93%')
}
} else {
shrinkScreen()
}
})
} else {
loadingText.value = res.msg
@@ -130,6 +255,9 @@ const getChartInfo = (equipmentId, type = 'day', time = '') => {
}
const handleOpenChart = (id, type) => {
selectTimeButton.value = 2
isWindSpeedVisited.value = true
clickMonth.value=''
clickDay.value=''
nextTick(() => {
if (chooseMonthRef.value) {
chooseMonthRef.value.clearData()
@@ -138,10 +266,11 @@ const handleOpenChart = (id, type) => {
chooseDayRef.value.clearData()
}
})
isFullScreen.value = false
if (type === 'air') {
dialogTitle.value = id.name
openDialogId.value = id.equipmentId
getChartInfo(id.equipmentId, 'day')
getChartInfo(id.equipmentId, 'day','',true)
} else {
if (id === "windDirection") {
dialogTitle.value = '风向'
@@ -149,9 +278,8 @@ const handleOpenChart = (id, type) => {
dialogTitle.value = '风速'
}
openDialogId.value = type
getChartInfo(type, 'day')
getChartInfo(type, 'day','',true)
}
}
const changeDate = (index) => {
switch (index) {
@@ -164,7 +292,11 @@ const changeDate = (index) => {
}
}
const timeSelect = (index) => {
getChartInfo(openDialogId.value, changeDate(index))
if (isFullScreen.value) {
getChartInfo(openDialogId.value, changeDate(index))
} else {
getChartInfo(openDialogId.value, changeDate(index),'',true)
}
};
const changeData = (item) => {
@@ -172,7 +304,7 @@ const changeData = (item) => {
equipmentId: item.equipmentId,
icon: changeIcon(item.equipmentType),
name: item.equipmentName.slice(0, 2),
max: 120,
max: item.maxRange,
value: item.value,
point: item.valueThreshold,
unit: item.unit
@@ -200,10 +332,12 @@ const getAirInfo = (now) => {
windSpeedType.value = item.equipmentType
windSpeedId.value = item.equipmentId
windSpeed.value = item.value
windSpeedUnit.value = item.unit
} else if (item.equipmentType === "windDirection") {
windDirectionSpeedType.value = item.equipmentType
windDirectionSpeedId.value = item.equipmentId
windDirection.value = item.value
windDirectionUnit.value = item.unit
}
})
if (airArr.length !== 0) {
@@ -211,7 +345,7 @@ const getAirInfo = (now) => {
airList.value = airArr
}
}
const initChart = (type, values) => {
const initChart = (type, values,top) => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById('containerWind'));
//5.传入数据
@@ -268,7 +402,7 @@ const initChart = (type, values) => {
},
{
type: 'slider',
top: 1050,
top: top,
height: 100,
textStyle: {
fontSize: 45,
@@ -367,7 +501,7 @@ const initChart = (type, values) => {
.input-fan {
cursor: pointer;
padding-right: 20px;
&:hover {
//width: 230px;
padding-left: 20px;
@@ -391,8 +525,9 @@ const initChart = (type, values) => {
.input-fan {
//margin: 0 26px;
padding-right: 20px;
&:hover {
width: 230px;
//width: 230px;
background: #2E5589;
border-radius: 6px;
}

View File

@@ -110,8 +110,8 @@ const setValue = () => {
}
.container {
width: 422px;
height: 24px;
width: 468px;
height: 25px;
border-radius: 12px;
border: 1px solid #0f82af;
position: relative;
@@ -138,7 +138,7 @@ const setValue = () => {
.value-num {
height: 37px;
width: 160px;
//width: 160px;
font-size: 28px;
font-family: MicrosoftYaHei;
color: #d6f1fa;

View File

@@ -7,7 +7,7 @@
<div class="loading" v-if="loading===0"></div>
{{ loading === 0 ? '加载中...' : '暂无数据~' }}
</div>
<div v-else class="info-list" @click="handleOpenChart">
<div v-else class="info-list" @click="handleOpenChart">
<gas-info-item
v-for="item in badGasList"
:key="item.equipmentId"
@@ -21,6 +21,7 @@
title="有害气体监控数据"
width="2175px"
:modal="false"
id="badDialog"
>
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
@@ -33,7 +34,10 @@
<div style="width: 1px"></div>
</div>
<div class="time-select">
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
<div class="export-btn" @click="handleExport">
导出
</div>
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
<time-range-btn
:buttonList="timeList"
@@ -41,6 +45,13 @@
@select="timeSelect"
/>
</div>
<div class="change-screen">
<el-icon size="55" color="#05feff" class="full-icon" title="放大" @click.stop="handleFullScreen"
v-if="isFullScreen">
<FullScreen/>
</el-icon>
<div v-else class="shrink-icon" title="缩小" @click.stop="shrinkScreen"></div>
</div>
<div class="left-bottom-icon"></div>
<div class="right-bottom-icon"></div>
</el-dialog>
@@ -55,6 +66,10 @@ import TimeRangeBtn from "@/components/timeRangeBtn/index.vue";
import {getBadGasEchartsInfo} from "@/api/largeScreen";
import ChooseDay from "@/components/chooseDay/index.vue"
import ChooseMonth from "@/components/chooseMonth/index.vue"
import elementResizeDetectorMaker from "element-resize-detector";
import {getNowFormatDate} from "@/utils/date.js";
import CsvExportor from "csv-exportor";
const props = defineProps({
list: Array,
@@ -68,8 +83,13 @@ const timeList = ref(["年", "月", "日"]);
const selectTimeButton = ref(2);
const isBadGasVisited = ref(false);
const showLoading = ref(false)
const isFullScreen = ref(false);
let chartData = reactive([])
let dataZoomTop = reactive('87%')
const badGasList = ref([]);
let myEcharts = reactive({});
const clickMonth = ref('')
const clickDay = ref('')
const bgImage = computed(() => (isBadGasVisited.value ? "sp_active.png" : "bg.png"));
watch(
() => props.list,
@@ -104,11 +124,113 @@ watch(
},
{deep: true}
);
//导出csv
const handleExport = () => {
console.log(badGasList.value)
let dustUnit
let carbonUnit
let carbonMonoxideUnit
let nitrogenUnit
let sulfurMonoxideUnit
let sulfurDioxideUnit
let hydrogenSulfideUnit
badGasList.value.forEach((item) => {
if(item.name==='粉尘'){
dustUnit=item.unit
}else if(item.name==='二氧化碳'){
carbonUnit=item.unit
}else if(item.name==='一氧化碳'){
carbonMonoxideUnit=item.unit
}else if(item.name==='二氧化氮'){
nitrogenUnit=item.unit
}else if(item.name==='一氧化氮'){
sulfurMonoxideUnit=item.unit
}else if(item.name==='二氧化硫'){
sulfurDioxideUnit=item.unit
}else if(item.name==='硫化氢'){
hydrogenSulfideUnit=item.unit
}
});
const header = ['时间', `粉尘(${dustUnit})`, `二氧化碳(${carbonUnit})`, `一氧化碳(${carbonMonoxideUnit})`,`二氧化氮(${nitrogenUnit})`,`一氧化氮(${sulfurMonoxideUnit})`,`二氧化硫(${sulfurDioxideUnit})`,`硫化氢(${hydrogenSulfideUnit})`];
let newArray = []
chartData.dates.forEach((item, index) => {
let obj = {
dates: chartData.dates[index],
dustValues: chartData.dustValues[index],
carbonDioxideValues: chartData.carbonDioxideValues[index],
carbonMonoxideValues: chartData.carbonMonoxideValues[index],
nitrogenDioxideValues: chartData.nitrogenDioxideValues[index],
sulfurMonoxideValues: chartData.sulfurMonoxideValues[index],
sulfurDioxideValues: chartData.sulfurDioxideValues[index],
hydrogenSulfideValues: chartData.hydrogenSulfideValues[index]
}
newArray.push(obj)
})
let time = ''
if (selectTimeButton.value === 1) {
if (clickMonth.value) {
const index = clickMonth.value.lastIndexOf("\-");
time = clickMonth.value.substring(0, index)
} else {
time = getNowFormatDate(false)
}
} else if (selectTimeButton.value === 2) {
if (clickDay.value) {
time = clickDay.value
} else {
time = getNowFormatDate(true)
}
} else if (selectTimeButton.value === 0) {
time = new Date().getFullYear() + '年'
}
const name = '有害气体监控数据-' + time
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
}
//放大弹窗
const handleFullScreen = () => {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
const fan = document.getElementById('badDialog')
const fanChart = document.getElementById('containerBad')
const erd = elementResizeDetectorMaker();
fan.classList.remove('shrink-screen-dialog')
titleName.style.fontSize = '70px'
erd.listenTo(document.getElementById('badDialog'), (element) => {
fanChart.style.height = (element.offsetHeight - 120) + 'px'
myEcharts.resize();
});
nextTick(() => {
isFullScreen.value = false
initChart(chartData.dates, chartData, '93%')
})
}
const shrinkScreen = () => {
const fan = document.getElementById('badDialog')
const fanChart = document.getElementById('containerBad')
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '50px'
fan.classList.add('shrink-screen-dialog')
fanChart.style.height = '1200px'
myEcharts.resize();
nextTick(() => {
isFullScreen.value = true
initChart(chartData.dates, chartData, dataZoomTop)
})
}
const daySelect = (val) => {
getBadGasChartInfo('day', val)
clickDay.value = val
if (isFullScreen.value) {
getBadGasChartInfo('day', val)
} else {
getBadGasChartInfo('day', val, true)
}
}
const monthSelect = (val) => {
getBadGasChartInfo('month', val)
clickMonth.value = val
if (isFullScreen.value) {
getBadGasChartInfo('month', val)
} else {
getBadGasChartInfo('month', val, true)
}
}
const changeDate = (index) => {
switch (index) {
@@ -121,7 +243,11 @@ const changeDate = (index) => {
}
}
const timeSelect = (index) => {
getBadGasChartInfo(changeDate(index))
if (isFullScreen.value) {
getBadGasChartInfo(changeDate(index))
} else {
getBadGasChartInfo(changeDate(index), '', true)
}
};
const getBadGasInfo = (now) => {
if (now === null) return;
@@ -147,35 +273,61 @@ const changeData = (item) => {
return {
equipmentId: item.equipmentId,
name: item.equipmentName.slice(0, item.equipmentName.length - 2),
max: 120,
max: item.maxRange,
value: item.value,
point: item.valueThreshold,
unit: item.unit,
};
};
const getBadGasChartInfo = (type, time = '') => {
isBadGasVisited.value = true
const getBadGasChartInfo = (type, time = '', flag) => {
showLoading.value = true
let id = props.tunnelId
nextTick(() => {
if (flag) {
const fan = document.getElementById('badDialog')
fan.classList.remove('shrink-screen-dialog')
if (!isFullScreen.value) {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '70px'
}
}
})
getBadGasEchartsInfo(id, time, type).then(res => {
if (res?.code === 1000) {
showLoading.value = false
chartData = res.data
nextTick(() => {
initChart(res.data.dates, res.data)
if (flag) {
const fanChart = document.getElementById('containerBad')
const erd = elementResizeDetectorMaker();
erd.listenTo(document.getElementById('badDialog'), (element) => {
fanChart.style.height = element.offsetHeight - 120 + 'px'
myEcharts.resize();
});
if (!isFullScreen.value) {
initChart(res.data.dates, res.data, '93%')
}
} else {
shrinkScreen()
}
})
}
})
}
const handleOpenChart = () => {
nextTick(()=>{
if(chooseMonthRef.value){
clickMonth.value = ''
clickDay.value = ''
nextTick(() => {
if (chooseMonthRef.value) {
chooseMonthRef.value.clearData()
}
if(chooseDayRef.value){
if (chooseDayRef.value) {
chooseDayRef.value.clearData()
}
})
getBadGasChartInfo('day')
isBadGasVisited.value = true
isFullScreen.value = false
getBadGasChartInfo('day', '', true)
};
const getImageUrl = (name) => {
return new URL(`../../../assets/images/badGasInfo/${name}`, import.meta.url)
@@ -184,7 +336,7 @@ const getImageUrl = (name) => {
/**
* 初始化echarts实例方法
*/
const initChart = (type, values) => {
const initChart = (type, values, top) => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById("containerBad"));
//5.传入数据
@@ -245,7 +397,7 @@ const initChart = (type, values) => {
},
{
type: 'slider',
top: 1050,
top: top,
height: 100,
textStyle: {
fontSize: 45,
@@ -289,7 +441,7 @@ const initChart = (type, values) => {
lineStyle: {
width: 5,
},
},{
}, {
name: "二氧化碳",
// data: [
// 56, 12, 89, 34, 71, 43, 67, 20, 98, 72, 19, 61, 3, 85, 47, 92, 17, 76,

View File

@@ -79,7 +79,7 @@ const option = {
color: `${
params.gasInfo.value >= params.gasInfo.point ? "#F94236" : "#FFCE23"
}`,
formatter: "Vo{value}%",
formatter: `{value}${params.gasInfo.unit}`,
},
},
],

View File

@@ -13,8 +13,8 @@
<div class="fan-name">{{ changeNum(item) }}号风机</div>
<div class="option-nav">
<div class="state">
<!-- :class="{ stopColor:changeStopColor(item.breakdown,item.running)}"-->
<div class="blue-state" :style="{backgroundColor:changeStopColor(item.breakdown,item.running)}" >
<!-- :class="{ stopColor:changeStopColor(item.breakdown,item.running)}"-->
<div class="blue-state" :style="{backgroundColor:changeStopColor(item.breakdown,item.running)}">
<div class="state-icon"></div>
状态<span class="fan-state">{{ changeStateText(item.breakdown, item.running) }}</span>
</div>
@@ -86,7 +86,7 @@
<div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isVisited" :title="fanIndex+'号风机电流监控数据'"
width="2175px"
:modal="false">
:modal="false" id="fanDialog">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="loading-block" v-if="showLoading">
@@ -98,6 +98,9 @@
<div style="width: 1px;"></div>
</div>
<div class="time-select">
<div class="export-btn" @click="handleExport">
导出
</div>
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
<time-range-btn
@@ -106,6 +109,13 @@
@select="timeSelect"
/>
</div>
<div class="change-screen">
<el-icon size="55" color="#05feff" class="full-icon" title="放大" @click.stop="handleFullScreen"
v-if="isFullScreen">
<FullScreen/>
</el-icon>
<div v-else class="shrink-icon" title="缩小" @click.stop="shrinkScreen"></div>
</div>
<div class="left-bottom-icon"></div>
<div class="right-bottom-icon"></div>
</el-dialog>
@@ -126,6 +136,9 @@ import {
getFanEchartsInfo
} from "@/api/largeScreen";
import {ElMessage, ElMessageBox} from "element-plus";
import elementResizeDetectorMaker from "element-resize-detector";
import CsvExportor from "csv-exportor";
import {getNowFormatDate} from "@/utils/date.js";
const timeList = ref(["年", "月", "日"]);
const selectTimeButton = ref(2);
@@ -161,8 +174,13 @@ const stateB = ref(false)
const stateC = ref(false)
const isVisited = ref(false)
const showLoading = ref(false)
const isFullScreen = ref(false);
let dataZoomTop = reactive('87%')
let chartData = reactive([])
const fanIndex = ref('')
const openEquipmentId = ref(0)
const clickMonth = ref('')
const clickDay = ref('')
let myEcharts = reactive({});
watch(() => props.loading, (now) => {
props.loading = now
@@ -203,11 +221,55 @@ watch(() => props.list, (now) => {
})
handleOnMounted()
}, {deep: true});
//导出csv
const handleExport = () => {
const header = ['时间', 'A相电流(A)', 'B相电流(A)', 'C相电流(A)'];
let newArray = []
chartData.dates.forEach((item, index) => {
let obj = {
dates: chartData.dates[index],
currentsA: chartData.currentsA[index],
currentsB: chartData.currentsB[index],
currentsC: chartData.currentsC[index]
}
newArray.push(obj)
})
let time = ''
if (selectTimeButton.value === 1) {
if (clickMonth.value) {
const index = clickMonth.value.lastIndexOf("\-");
time = clickMonth.value.substring(0, index)
} else {
time = getNowFormatDate(false)
}
} else if (selectTimeButton.value === 2) {
if (clickDay.value) {
time = clickDay.value
} else {
time = getNowFormatDate(true)
}
} else if (selectTimeButton.value === 0) {
time = new Date().getFullYear() + '年'
}
const name = fanIndex.value + '号风机电流监控数据-' + time
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
}
const daySelect = (val) => {
getFanInfo(openEquipmentId.value, 'day', val)
clickDay.value = val
if (isFullScreen.value) {
getFanInfo(openEquipmentId.value, 'day', val)
} else {
getFanInfo(openEquipmentId.value, 'day', val, true)
}
}
const monthSelect = (val) => {
getFanInfo(openEquipmentId.value, 'month', val)
clickMonth.value = val
if (isFullScreen.value) {
getFanInfo(openEquipmentId.value, 'month', val)
} else {
getFanInfo(openEquipmentId.value, 'month', val, true)
}
}
const changeDate = (index) => {
switch (index) {
@@ -220,8 +282,42 @@ const changeDate = (index) => {
}
}
const timeSelect = (index) => {
getFanInfo(openEquipmentId.value, changeDate(index))
};
if (isFullScreen.value) {
getFanInfo(openEquipmentId.value, changeDate(index))
} else {
getFanInfo(openEquipmentId.value, changeDate(index), '', true)
}
}
//放大弹窗
const handleFullScreen = () => {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
const fan = document.getElementById('fanDialog')
const fanChart = document.getElementById('containerFan')
const erd = elementResizeDetectorMaker();
fan.classList.remove('shrink-screen-dialog')
titleName.style.fontSize = '70px'
erd.listenTo(document.getElementById('fanDialog'), (element) => {
fanChart.style.height = (element.offsetHeight - 120) + 'px'
myEcharts.resize();
});
nextTick(() => {
isFullScreen.value = false
initChart(chartData.dates, chartData.currentsA, chartData.currentsB, chartData.currentsC, '93%')
})
}
const shrinkScreen = () => {
const fan = document.getElementById('fanDialog')
const fanChart = document.getElementById('containerFan')
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '50px'
fan.classList.add('shrink-screen-dialog')
fanChart.style.height = '1200px'
myEcharts.resize();
nextTick(() => {
isFullScreen.value = true
initChart(chartData.dates, chartData.currentsA, chartData.currentsB, chartData.currentsC, dataZoomTop)
})
}
const packageData = (item, type, flag) => {
let number = 0
if (item.equipmentType === "frequency1") {
@@ -302,14 +398,39 @@ const changeModel = (item) => {
item.autoMode = !item.autoMode
});
}
const getFanInfo = (equipmentId, type = 'day', time = '') => {
isVisited.value = true
const getFanInfo = (equipmentId, type = 'day', time = '', flag) => {
showLoading.value = true
nextTick(() => {
if (flag) {
const fan = document.getElementById('fanDialog')
fan.classList.remove('shrink-screen-dialog')
if (!isFullScreen.value) {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '70px'
}
}
})
getFanEchartsInfo(equipmentId, time, type).then(res => {
if (res?.code === 1000) {
showLoading.value = false
chartData = res.data
nextTick(() => {
initChart(res.data.dates, res.data.currentsA, res.data.currentsB, res.data.currentsC)
if (flag) {
const fanChart = document.getElementById('containerFan')
const erd = elementResizeDetectorMaker();
erd.listenTo(document.getElementById('fanDialog'), (element) => {
fanChart.style.height = element.offsetHeight - 120 + 'px'
myEcharts.resize();
});
if (!isFullScreen.value) {
initChart(res.data.dates, res.data.currentsA, res.data.currentsB, res.data.currentsC, '93%')
}
} else {
shrinkScreen()
// const fan = document.getElementById('fanDialog')
// fan.classList.add('shrink-screen-dialog')
// initChart(res.data.dates, res.data.currentsA, res.data.currentsB, res.data.currentsC, dataZoomTop)
}
})
}
})
@@ -323,10 +444,14 @@ const handleOpenChart = (item) => {
chooseDayRef.value.clearData()
}
})
clickMonth.value=''
clickDay.value=''
isVisited.value = true
selectTimeButton.value = 2
openEquipmentId.value = item.equipmentId
getFanInfo(item.equipmentId, 'day')
if (item.equipmentId === 22) {
isFullScreen.value = false
getFanInfo(item.equipmentId, 'day', '', true)
if (item.equipmentType === "frequency1") {
fanIndex.value = '一'
} else {
fanIndex.value = '二'
@@ -338,7 +463,7 @@ const getTransData = (data) => {
data?.map(item => {
tranObj = {
equipmentId: item.equipmentId,
max: 800,
max: 600,
valueA: item.phaseCurrentA,
pointA: item.phaseCurrentAThreshold,
valueB: item.phaseCurrentB,
@@ -357,10 +482,10 @@ const getTransData = (data) => {
}
const changeNum = (item) => {
switch (item.equipmentName) {
case '1号变频器':
switch (item.equipmentType) {
case "frequency1":
return '一';
case '2号变频器':
case "frequency2":
return '二';
}
}
@@ -388,7 +513,6 @@ const getBasicData = (data) => {
}
const handleOnMounted = () => {
// console.log('socketData.value[i]',socketData.value)
const chart = document.getElementsByClassName('echart');
for (let i = 0; i < chart.length; i++) {
Echarts_info1 = echarts.init(chart[i]);
@@ -530,7 +654,7 @@ const changeStateText = (breakdown, running) => {
/**
* 初始化echarts实例方法
*/
const initChart = (type, valueA, valueB, valueC) => {
const initChart = (type, valueA, valueB, valueC, top) => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById('containerFan'));
//5.传入数据
@@ -575,21 +699,12 @@ const initChart = (type, valueA, valueB, valueC) => {
return res
},
},
toolbox: {
show: false,
right: 10,
feature: {
dataZoom: {
yAxisIndex: 'none'
}
}
},
dataZoom: [{
type: 'inside',
},
{
type: 'slider',
top: 1050,
top: top,
height: 100,
textStyle: {
fontSize: 45,
@@ -665,6 +780,11 @@ const initChart = (type, valueA, valueB, valueC) => {
<style lang="scss" scoped>
#fanDialog {
overflow: hidden;
}
:deep( .el-radio__input.is-checked + .el-radio__label) {
color: #38CAFB;
}
@@ -711,7 +831,7 @@ input[type="number"] {
}
:deep( .el-radio__label) {
font-size: 28px;
font-size: 30px;
color: #38cafb;
margin-top: -5px;
}
@@ -843,7 +963,7 @@ input[type="number"] {
.fan-name {
width: 39px;
height: 140px;
font-size: 26px;
font-size: 29px;
color: #38cafb;
line-height: 35px;
text-align: center;
@@ -861,7 +981,7 @@ input[type="number"] {
display: flex;
flex-direction: column;
justify-content: center;
font-size: 28px;
font-size: 29px;
color: #38cafb;
line-height: 35px;
gap: 40px;
@@ -874,7 +994,7 @@ input[type="number"] {
display: flex;
align-items: center;
height: 45px;
margin-right: 15px;
//margin-right: 15px;
color: #fff;
background-color: #3eab3f;
padding-left: 10px;
@@ -919,9 +1039,9 @@ input[type="number"] {
flex-direction: column;
justify-content: center;
//padding: 0 20px;
font-size: 28px;
font-size: 29px;
color: #38cafb;
line-height: 37px;
line-height: 43px;
gap: 40px;
.check-box {
@@ -1011,7 +1131,7 @@ input[type="number"] {
margin-right: 20px;
margin-left: 26px;
//height: 37px;
font-size: 28px;
font-size: 29px;
color: #FFFFFF;
cursor: pointer;

View File

@@ -1,10 +1,10 @@
<template>
<div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart">
<div v-if="electricityConsumptionMonthly===0&&monthlySavings===0" class="showNull ">
<div class="loading" v-if="loading===0"></div>
{{ loading === 0 ? '加载中...' : '暂无数据~' }}
</div>
<div v-else class="content">
<!-- <div v-if="electricityConsumptionMonthly===0&&monthlySavings===0" class="showNull ">-->
<!-- <div class="loading" v-if="loading===0"></div>-->
<!-- {{ loading === 0 ? '加载中...' : '暂无数据~' }}-->
<!-- </div>-->
<div class="content">
<div class="item">
<div class="container" ref="length">
<div class="value" ref="valueA"></div>
@@ -29,7 +29,7 @@
</div>
<div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isVisited" width="2175px" :modal="false">
<el-dialog :close-on-click-modal="false" v-model="isVisited" width="2175px" :modal="false" id="eleDialog">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="user-select">
@@ -72,6 +72,9 @@
<div style="width: 1px;"></div>
</div>
<div class="time-select">
<div class="export-btn" @click="handleExport">
导出
</div>
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
<time-range-btn
:buttonList="timeList"
@@ -79,6 +82,12 @@
@select="timeSelect"
/>
</div>
<div class="change-screen">
<el-icon size="55" color="#05feff" class="full-icon" title="放大" @click="fullScreen" v-if="isFullScreen">
<FullScreen/>
</el-icon>
<div v-else class="shrink-icon" title="缩小" @click="shrinkScreen"></div>
</div>
<div class="left-bottom-icon"></div>
<div class="right-bottom-icon"></div>
</el-dialog>
@@ -90,6 +99,9 @@ import * as echarts from 'echarts';
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
import ChooseMonth from "@/components/chooseMonth/index.vue"
import {getEleEchartsInfo} from "@/api/largeScreen";
import elementResizeDetectorMaker from "element-resize-detector";
import CsvExportor from "csv-exportor";
import {getNowFormatDate} from "@/utils/date.js";
const props = defineProps({
list: Array,
@@ -104,6 +116,9 @@ const chooseMonthRef = ref();
const monthValue = ref('');
const chooseChartFan = ref('');
let myEcharts = reactive({});
const isFullScreen = ref(false);
let chartData = reactive([])
let dataZoomTop = reactive('89%')
const isVisited = ref(false);
const showLoading = ref(false)
const electricityConsumptionMonthly = ref(0)
@@ -120,9 +135,9 @@ const bgImage = computed(() =>
? "#2E5589"
: "rgba(6,34,71,0.78)"
);
watch(() => props.loading, (now) => {
props.loading = now
}, {deep: true});
// watch(() => props.loading, (now) => {
// props.loading = now
// }, {deep: true});
watch(() => props.eleData, (now) => {
if (now) {
let fanObj = {}
@@ -137,7 +152,7 @@ watch(() => props.eleData, (now) => {
})
getBasicData(now.largeScreenElectricity)
}
nextTick(() => {
nextTick(() => {
setValueA()
setValueB()
})
@@ -156,6 +171,59 @@ watch(() => props.eleData, (now) => {
// setValueA()
// setValueB()
// }, {deep: true});
const handleExport = () => {
const header = ['月总用电量(kwh)', '月总节省电量(kwh)', '时间', '日用电量(kwh)', '日节省量(kwh)'];
let newArray = []
chartData.dates.forEach((item, index) => {
let obj = {
totalElectricityConsumption: chartData.totalElectricityConsumption,
saveElectricity: chartData.saveElectricity,
dates: chartData.dates[index],
consumptionValues: chartData.consumptionValues[index],
saveElectricityValues: chartData.saveElectricityValues[index]
}
newArray.push(obj)
})
let time = ''
if (selectTimeButton.value === 1) {
if (monthValue.value) {
const index = monthValue.value.lastIndexOf("\-");
time = monthValue.value.substring(0, index)
} else {
time = getNowFormatDate(false)
}
} else if (selectTimeButton.value === 0) {
time = new Date().getFullYear() + '年'
}
const name = changeNum(chooseChartFan.value) + '用电量监控数据-' + time
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
}
//放大弹窗
const fullScreen = () => {
const fan = document.getElementById('eleDialog')
const fanChart = document.getElementById('containerEle')
const erd = elementResizeDetectorMaker();
fan.classList.remove('shrink-screen-dialog')
erd.listenTo(document.getElementById('eleDialog'), (element) => {
fanChart.style.height = (element.offsetHeight - 280) + 'px'
myEcharts.resize();
});
nextTick(() => {
isFullScreen.value = false
initChart(chartData.dates, chartData.consumptionValues, chartData.saveElectricityValues, '94%')
})
}
const shrinkScreen = () => {
const fan = document.getElementById('eleDialog')
const fanChart = document.getElementById('containerEle')
fan.classList.add('shrink-screen-dialog')
fanChart.style.height = '1010px'
myEcharts.resize();
nextTick(() => {
isFullScreen.value = true
initChart(chartData.dates, chartData.consumptionValues, chartData.saveElectricityValues, dataZoomTop)
})
}
const changeNum = (item) => {
switch (item) {
case 22:
@@ -168,14 +236,14 @@ const setValueA = () => {
if (electricityConsumptionMonthly.value === 0 || length.value === null) {
valueA.value.style.height = `0px`;
}
let width = (electricityConsumptionMonthly.value * length.value?.offsetHeight) / 40000;
let width = (electricityConsumptionMonthly.value * length.value?.offsetHeight) / 100000;
valueA.value.style.height = `${width}px`;
}
const setValueB = () => {
if (monthlySavings.value === 0 || length.value === null) {
valueB.value.style.height = `0px`;
}
let width = (monthlySavings.value * length.value?.offsetHeight) / 40000;
let width = (monthlySavings.value * length.value?.offsetHeight) / 100000;
valueB.value.style.height = `${width}px`;
}
const getBasicData = (data) => {
@@ -185,7 +253,12 @@ const getBasicData = (data) => {
const monthSelect = (val) => {
monthValue.value = val
getFanInfo(openEquipmentId.value, 'month', val)
if (isFullScreen.value) {
getFanInfo(openEquipmentId.value, 'month', val)
} else {
getFanInfo(openEquipmentId.value, 'month', val, true)
}
}
const changeDate = (index) => {
switch (index) {
@@ -193,27 +266,59 @@ const changeDate = (index) => {
return 'years'
case 1:
return 'month'
default:
return 1
}
}
const timeSelect = (index) => {
monthValue.value = ''
getFanInfo(openEquipmentId.value, changeDate(index))
if (isFullScreen.value) {
getFanInfo(openEquipmentId.value, changeDate(index))
} else {
getFanInfo(openEquipmentId.value, changeDate(index), '', true)
}
};
const changeFanData = (val) => {
selectTimeButton.value = 1
// selectTimeButton.value = 1
openEquipmentId.value = val
getFanInfo(val, 'month', monthValue.value)
if (isFullScreen.value) {
getFanInfo(val, changeDate(selectTimeButton.value), monthValue.value)
} else {
getFanInfo(val, changeDate(selectTimeButton.value), monthValue.value, true)
}
}
const getFanInfo = (equipmentId, type = 'month', time = '') => {
isVisited.value = true
const getFanInfo = (equipmentId, type = 'month', time = '', flag) => {
showLoading.value = true
nextTick(() => {
if (flag) {
const fan = document.getElementById('eleDialog')
fan.classList.remove('shrink-screen-dialog')
if (!isFullScreen.value) {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '70px'
}
}
})
getEleEchartsInfo(equipmentId, time, type).then(res => {
if (res?.code === 1000) {
showLoading.value = false
chartData = res.data
totalElectricityConsumption.value = res.data.totalElectricityConsumption
saveElectricity.value = res.data.saveElectricity
nextTick(() => {
initChart(res.data.dates, res.data.consumptionValues, res.data.saveElectricityValues)
if (flag) {
const fanChart = document.getElementById('containerEle')
const erd = elementResizeDetectorMaker();
erd.listenTo(document.getElementById('eleDialog'), (element) => {
fanChart.style.height = element.offsetHeight - 280 + 'px'
myEcharts.resize();
});
if (!isFullScreen.value) {
initChart(res.data.dates, res.data.consumptionValues, res.data.saveElectricityValues, '94%')
}
} else {
shrinkScreen()
}
})
}
})
@@ -222,19 +327,23 @@ const getFanInfo = (equipmentId, type = 'month', time = '') => {
})
}
const handleOpenChart = () => {
monthValue.value=''
selectTimeButton.value = 1
isVisited.value = true
openEquipmentId.value = fanList.value[0].value
chooseChartFan.value = fanList.value[0].value
nextTick(() => {
chooseMonthRef.value.clearData()
if (chooseMonthRef.value) {
chooseMonthRef.value.clearData()
}
})
getFanInfo(openEquipmentId.value, 'month')
isFullScreen.value = false
getFanInfo(openEquipmentId.value, 'month', '', true)
}
/**
* 初始化echarts实例方法
*/
const initChart = (type, valueA, valueB) => {
const initChart = (type, valueA, valueB, top) => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById('containerEle'));
//5.传入数据
@@ -292,7 +401,7 @@ const initChart = (type, valueA, valueB) => {
},
{
type: 'slider',
top: 900,
top: top,
height: 100,
textStyle: {
fontSize: 45,

View File

@@ -11,7 +11,7 @@
</div>
<div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isVisited" :title="windSort+'监控数据'" width="2175px"
:modal="false">
:modal="false" id="windDialog">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="loading-block" v-if="showLoading">
@@ -23,6 +23,9 @@
<div style="width: 1px;"></div>
</div>
<div class="time-select">
<div class="export-btn" @click="handleExport">
导出
</div>
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
<time-range-btn
@@ -31,6 +34,13 @@
@select="timeSelect"
/>
</div>
<div class="change-screen">
<el-icon size="55" color="#05feff" class="full-icon" title="放大" @click.stop="handleFullScreen"
v-if="isFullScreen">
<FullScreen/>
</el-icon>
<div v-else class="shrink-icon" title="缩小" @click.stop="shrinkScreen"></div>
</div>
<div class="left-bottom-icon"></div>
<div class="right-bottom-icon"></div>
</el-dialog>
@@ -45,6 +55,9 @@ import * as echarts from 'echarts';
import {getEchartsInfo} from "@/api/largeScreen";
import ChooseDay from "@/components/chooseDay/index.vue"
import ChooseMonth from "@/components/chooseMonth/index.vue"
import elementResizeDetectorMaker from "element-resize-detector";
import CsvExportor from "csv-exportor";
import {getNowFormatDate} from "@/utils/date.js";
const props = defineProps({
list: Array,
@@ -59,9 +72,14 @@ const windSortId = ref(1)
const timeList = ref(["年", "月", "日"]);
const selectTimeButton = ref(2);
const isVisited = ref(false);
const isFullScreen = ref(false);
let chartData = reactive([])
let dataZoomTop = reactive('87%')
const showLoading = ref(false)
let myEcharts = reactive({});
const wpList = ref([]);
const clickMonth = ref('')
const clickDay = ref('')
watch(() => props.list, (now) => {
wpList.value.forEach(item => {
now.forEach(newItem => {
@@ -75,22 +93,122 @@ watch(() => props.list, (now) => {
watch(() => props.winData, (now) => {
getScreenInfo(now.windPressureSensorList)
}, {deep: true});
//导出csv
const handleExport = () => {
let clickUnit = ''
wpList.value.forEach(item => {
if (item.equipmentName === windSort.value) {
clickUnit = item.unit
}
})
const header = ['时间', `风压值(${clickUnit})`];
let newArray = []
chartData.dates.forEach((item, index) => {
let obj = {
dates: chartData.dates[index],
values: chartData.values[index]
}
newArray.push(obj)
})
let time = ''
if (selectTimeButton.value === 1) {
if (clickMonth.value) {
const index = clickMonth.value.lastIndexOf("\-");
time = clickMonth.value.substring(0, index)
} else {
time = getNowFormatDate(false)
}
} else if (selectTimeButton.value === 2) {
if (clickDay.value) {
time = clickDay.value
} else {
time = getNowFormatDate(true)
}
} else if (selectTimeButton.value === 0) {
time = new Date().getFullYear() + '年'
}
const name = windSort.value + '监控数据-' + time
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
}
//放大弹窗
const handleFullScreen = () => {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
const fan = document.getElementById('windDialog')
const fanChart = document.getElementById('container')
const erd = elementResizeDetectorMaker();
fan.classList.remove('shrink-screen-dialog')
titleName.style.fontSize = '70px'
erd.listenTo(document.getElementById('windDialog'), (element) => {
fanChart.style.height = (element.offsetHeight - 120) + 'px'
myEcharts.resize();
});
nextTick(() => {
isFullScreen.value = false
initChart(chartData.dates, chartData.values, '93%')
})
}
const shrinkScreen = () => {
const fan = document.getElementById('windDialog')
const fanChart = document.getElementById('container')
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '50px'
fan.classList.add('shrink-screen-dialog')
fanChart.style.height = '1200px'
myEcharts.resize();
nextTick(() => {
isFullScreen.value = true
initChart(chartData.dates, chartData.values, dataZoomTop)
})
}
const daySelect = (val) => {
getWindInfo(windSortId.value, 'day', val)
clickDay.value = val
if (isFullScreen.value) {
getWindInfo(windSortId.value, 'day', val)
} else {
getWindInfo(windSortId.value, 'day', val, true)
}
}
const monthSelect = (val) => {
getWindInfo(windSortId.value, 'month', val)
clickMonth.value = val
if (isFullScreen.value) {
getWindInfo(windSortId.value, 'month', val)
} else {
getWindInfo(windSortId.value, 'month', val, true)
}
}
const getWindInfo = (equipmentId, type = 'day', time = '') => {
const getWindInfo = (equipmentId, type = 'day', time = '', flag) => {
isVisited.value = true
showLoading.value = true
nextTick(() => {
if (flag) {
const fan = document.getElementById('windDialog')
fan.classList.remove('shrink-screen-dialog')
if (!isFullScreen.value) {
const titleName = document.getElementsByClassName('el-dialog__title')[0]
titleName.style.fontSize = '70px'
}
}
})
getEchartsInfo(equipmentId, time, type).then(res => {
if (res?.code === 1000) {
showLoading.value = false
chartData = res.data
nextTick(() => {
initChart(res.data.dates, res.data.values)
if (flag) {
const fanChart = document.getElementById('container')
const erd = elementResizeDetectorMaker();
erd.listenTo(document.getElementById('windDialog'), (element) => {
fanChart.style.height = element.offsetHeight - 120 + 'px'
myEcharts.resize();
});
if (!isFullScreen.value) {
initChart(res.data.dates, res.data.values, '93%')
}
} else {
shrinkScreen()
}
})
}else {
} else {
loadingText.value = res.msg
}
})
@@ -101,15 +219,18 @@ const getWindInfo = (equipmentId, type = 'day', time = '') => {
const handleOpenChart = (item) => {
selectTimeButton.value = 2
nextTick(()=>{
if(chooseMonthRef.value){
clickMonth.value = ''
clickDay.value = ''
nextTick(() => {
if (chooseMonthRef.value) {
chooseMonthRef.value.clearData()
}
if(chooseDayRef.value){
if (chooseDayRef.value) {
chooseDayRef.value.clearData()
}
})
getWindInfo(item.equipmentId)
isFullScreen.value = false
getWindInfo(item.equipmentId, 'day', '', true)
windSort.value = item.equipmentName
windSortId.value = item.equipmentId
}
@@ -124,7 +245,11 @@ const changeDate = (index) => {
}
}
const timeSelect = (index) => {
getWindInfo(windSortId.value, changeDate(index))
if (isFullScreen.value) {
getWindInfo(windSortId.value, changeDate(index))
} else {
getWindInfo(windSortId.value, changeDate(index), '', true)
}
};
const getScreenInfo = (now) => {
let windPressureObj = {}
@@ -133,14 +258,14 @@ const getScreenInfo = (now) => {
windPressureObj = {
equipmentId: item.equipmentId,
equipmentName: item.equipmentName,
max: 120,
max: item.maxRange,
value: item.value,
point: item.valueThreshold,
unit: item.unit
}
windPressureArr.push(windPressureObj)
})
if(windPressureArr.map(item=>item.equipmentName).includes('10号风压')){
if (windPressureArr.map(item => item.equipmentName).includes('10号风压')) {
windPressureArr.push(windPressureArr.shift())
}
wpList.value = windPressureArr
@@ -148,7 +273,7 @@ const getScreenInfo = (now) => {
/**
* 初始化echarts实例方法
*/
const initChart = (type, values) => {
const initChart = (type, values, top) => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById('container'));
//5.传入数据
@@ -204,7 +329,7 @@ const initChart = (type, values) => {
},
{
type: 'slider',
top: 1050,
top: top,
height: 100,
textStyle: {
fontSize: 45,

View File

@@ -1,7 +1,7 @@
<template>
<div id="wind-pressure-item" :class="{ abnormal:isWaring }">
<div class="label">
<img src="../../../../assets/images/windPressure/icon.png" alt=""/>
<img src="@/assets/images/windPressure/icon.png" alt=""/>
<span>{{params.wp.equipmentName}}</span>
</div>
<div class="container" ref="length">
@@ -27,17 +27,15 @@ const params = defineProps({
const length = ref(null);
const value = ref(null);
const point = ref(null);
onMounted(handleOnMounted);
function handleOnMounted() {
onMounted(()=>{
setValue();
}
});
watch(() => params.wp.value, () => {
setValue();
});
function setValue() {
const setValue=()=> {
let width = (params.wp.value * length.value.offsetWidth) / params.wp.max;
value.value.style.width = `${width}px`;
let flag = (params.wp.point * length.value.offsetWidth) / params.wp.max;
@@ -107,7 +105,7 @@ let isWaring = computed(() => {
.container {
width: 500px;
height: 24px;
height: 25px;
border-radius: 12px;
border: 1px solid #0f82af;
position: relative;

View File

@@ -18,9 +18,22 @@ export const dateFormat = (time = new Date().getTime(),flag) => { //YYYY年MM月
return `${Y}${M}${D}日 星期${week}`;
}
}
export const getNowFormatDate = (flag) => {
let date = new Date(),
year = date.getFullYear(), //获取完整的年份(4位)
month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
strDate = date.getDate() // 获取当前日(1-31)
if (month < 10) month = `0${month}` // 如果月份是个位数在前面补0
if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数在前面补0
if(flag){
return `${year}-${month}-${strDate}`
}else {
return `${year}-${month}`
}
}
export default {
dateFormat
dateFormat,
getNowFormatDate
}

View File

@@ -76,7 +76,7 @@
@change="changeFanData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center" min-width="86">
<el-table-column prop="state" label="状态" align="center" min-width="86">
<template #default="scope">
<div class="switch">
<div
@@ -135,6 +135,18 @@
@change="changeWindData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="miniRange" label="最小范围" align="center">
<template #default="scope">
<el-input placeholder="最小范围" v-model="scope.row.miniRange"
@change="changeWindData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="maxRange" label="最大范围" align="center">
<template #default="scope">
<el-input placeholder="最大范围" v-model="scope.row.maxRange"
@change="changeWindData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
<template #default="scope">
<div class="switch wind-switch">
@@ -194,6 +206,18 @@
@change="changeOtherData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="miniRange" label="最小范围" align="center">
<template #default="scope">
<el-input placeholder="最小范围" v-model="scope.row.miniRange"
@change="changeOtherData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="maxRange" label="最大范围" align="center">
<template #default="scope">
<el-input placeholder="最大范围" v-model="scope.row.maxRange"
@change="changeOtherData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
<template #default="scope">
<div class="switch wind-switch">
@@ -286,6 +310,7 @@
import {ElLoading, ElMessage} from "element-plus";
import {getEquipmentList, editEquipment, getTunnelDetail} from "@/api/tunnelManage";
import TunnelTitle from "@/components/tunnelTitle/index.vue";
const router = useRouter()
const tunnelId = reactive(router.currentRoute.value.params.tunnelId)
const userId = reactive(router.currentRoute.value.params.userId)
@@ -306,45 +331,88 @@ const frequencyData = ref([])
const siteId = ref(0)
const tunnelName = ref('')
const changeFan = (e) => {
const fanObj = {
acquisitionPeriod: e * 1000,
tunnelId: tunnelId,
typeKey: 'frequency'
}
frequencyData.value.push(fanObj)
// const fanObj = {
// acquisitionPeriod: e * 1000,
// tunnelId: tunnelId,
// typeKey: 'frequency'
// }
// frequencyData.value.push(fanObj)
}
const changeFanData = (row) => {
editFanData.value.push(row)
// editFanData.value.push(row)
}
const changeWind = (e) => {
const windObj = {
acquisitionPeriod: e * 1000,
tunnelId: tunnelId,
typeKey: 'windPressure'
}
frequencyData.value.push(windObj)
// const windObj = {
// acquisitionPeriod: e * 1000,
// tunnelId: tunnelId,
// typeKey: 'windPressure'
// }
// frequencyData.value.push(windObj)
}
const changeWindData = (row) => {
editWinData.value.push(row)
// editWinData.value.push(row)
}
const changeOther = (e) => {
const otherObj = {
acquisitionPeriod: e * 1000,
tunnelId: tunnelId,
typeKey: 'sensor'
}
frequencyData.value.push(otherObj)
// const otherObj = {
// acquisitionPeriod: e * 1000,
// tunnelId: tunnelId,
// typeKey: 'sensor'
// }
// frequencyData.value.push(otherObj)
}
const changeOtherData = (row) => {
editOtherData.value.push(row)
// editOtherData.value.push(row)
}
const changeData = (item) => {
return {
equipmentId: item.equipmentId,
unit: item.unit,
alarmValue: item.alarmValue,
miniRange: parseInt(item.miniRange),
maxRange: parseInt(item.maxRange),
state: item.state,
}
}
const editEquip = () => {
let newFrequency = [{
acquisitionPeriod: fanFrequency.value * 1000,
tunnelId: parseInt(tunnelId),
typeKey: 'frequency'
}, {
acquisitionPeriod: windFrequency.value * 1000,
tunnelId: parseInt(tunnelId),
typeKey: 'windPressure'
}, {
acquisitionPeriod: otherFrequency.value * 1000,
tunnelId: parseInt(tunnelId),
typeKey: 'sensor'
}]
let newFan = []
let newWind = []
let newSensor = []
fanData.value.forEach(item => {
let obj = {
equipmentId: item.equipmentId,
ratedPower:parseInt(item.ratedPower),
acurrentValue: parseInt(item.acurrentValue),
bcurrentValue: parseInt(item.bcurrentValue),
ccurrentValue: parseInt(item.ccurrentValue),
state: parseInt(item.state)
}
newFan.push(obj)
})
winData.value.forEach(item => {
newWind.push(changeData(item))
})
otherData.value.forEach(item => {
newSensor.push(changeData(item))
})
const basicData = {
tunnelId: tunnelId,
acquisitionList: frequencyData.value,
frequencyChangerList: editFanData.value,
windPressureSensorList: editWinData.value,
sensorList: editOtherData.value,
acquisitionList: newFrequency,
frequencyChangerList: newFan,
windPressureSensorList: newWind,
sensorList: newSensor,
// shuntList: editFenLiuData.value,
}
editEquipment(basicData).then(res => {
@@ -366,7 +434,7 @@ const getList = () => {
lock: true,
text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
customClass: 'allLoading'
})
getEquipmentList(tunnelId).then(res => {
if (res.code === 1000) {
@@ -577,7 +645,7 @@ getList()
}
.wind-switch {
margin-left: 65px;
margin-left: 26px;
}
.switch {

View File

@@ -4,8 +4,8 @@
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu"/>
<tunnel-title v-if="showTunnelTitle"/>
<div class="top-length">
<!-- <span>隧道总长度: {{ tunnelLength }}</span>-->
<span>当前施工长度: {{ constructionLength }}</span>
<span>隧道总长度: {{ tunnelLength }}</span>
<!-- <span>当前施工长度: {{ constructionLength }}</span>-->
</div>
<div class="top-right">
<div class="current-site">
@@ -52,7 +52,7 @@
:close-on-click-modal="false" :close-on-press-escape="false">
<wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData"
:loading="showWindLoading"/>
<air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData" />
<air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData"/>
<bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData" :tunnelId="tunnelId"
:loading="showBadLoading"/>
</el-drawer>
@@ -72,7 +72,7 @@
<div class="arrow right" @click="nextBtn"></div>
</div>
</div>
<div class="alarm-dialog digital-tunnel">
<div class="alarm-dialog alarm-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isDetailVisited" title="报警信息详情"
width="1500px">
<div class="detail">
@@ -85,7 +85,7 @@
</div>
</el-dialog>
</div>
<div class="digital-tunnel">
<div class="alarm-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isVisited" title="报警信息"
width="2175px"
:modal="false">
@@ -105,16 +105,12 @@
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<div class="device-table">
<div class="device-table" :style="{marginTop: roleKey==='administrator'?'40px':'0'}">
<el-table stripe v-loading="loading" :empty-text="tableEmptyText"
style="background-color: #011c29;--el-table-border-color: none;"
:header-cell-style="{backgroundColor: '#064B66',color: '#fff',fontSize: '40px',borderBottom: 'none' }"
:data="alarmList">
<!-- <el-table-column prop="equipmentId" label="设备名称" align="center" width="400px">-->
<!-- <template #default="scope">-->
<!-- {{ changeName(scope.row.equipmentId) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="tunnelName" label="隧道名称" align="center" width="400px"/>
<el-table-column prop="alarmContent" label="告警信息" align="center"/>
<el-table-column prop="alarmTime" label="告警时间" align="center" width="480px"/>
<el-table-column prop="lookupStatus" label="查阅状态" align="center" width="200px"
@@ -134,7 +130,7 @@
</template>
</el-table-column>
</el-table>
<div class="pagination" :style="{bottom: roleKey==='administrator'?'50px':''}">
<div class="pagination" :style="{bottom: roleKey==='administrator'?'40px':'0'}">
<el-pagination background v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize"
:total="total" prev-text="上一页" next-text="下一页" layout="prev, pager, next"
@current-change="handleCurrentChange" :hide-on-single-page="true"/>
@@ -210,7 +206,7 @@ const routeList = ref([]);
let socket = reactive("");
let pattern = reactive(new RegExp("[A-Za-z]+"));
let isTunnel = reactive(false)
const equipmentOption = ref([])
// const equipmentOption = ref([])
const btnList = ref([
{
route: '/site',
@@ -336,10 +332,10 @@ const getAlarmList = () => {
}).then(res => {
if (res.code === 1000) {
loading.value = false
if(res.data.rows.length===0){
tableEmptyText.value='暂无数据~'
}else {
tableEmptyText.value=''
if (res.data.rows.length === 0) {
tableEmptyText.value = '暂无数据~'
} else {
tableEmptyText.value = ''
}
alarmList.value = res.data.rows
total.value = res.data.total
@@ -370,9 +366,7 @@ const getOtherInfo = () => {
routeList.value = routeArr
showMenu.value = true
siteList.value = res.data.siteOption
if (!siteId) {
tunnelList.value = res.data.tunnelOption
}
tunnelList.value = res.data.tunnelOption
if (siteId) {
currentSiteId.value = siteId
@@ -395,50 +389,30 @@ const getOtherInfo = () => {
const getScreenInfo = (id) => {
if (id) {
tunnelId.value = id
equipmentOption.value = []
// equipmentOption.value = []
getLargeScreen(id).then((res) => {
if (res?.code === 1000) {
let option = {}
if (res.data.frequencyChangerList.length !== 0) {
res.data.frequencyChangerList.forEach((item) => {
option = {
value: item.equipmentId,
label: item.equipmentName,
}
equipmentOption.value.push(option)
})
showFanLoading.value = 0
} else {
showFanLoading.value = 1
}
const useEleData=res.data.largeScreenElectricity
if(useEleData.electricityConsumptionCount==null||useEleData.monthlySavings==null){
showUsedLoading.value = 0
}else {
showUsedLoading.value = 1
}
if (res.data.windPressureSensorList.length !== 0) {
res.data.windPressureSensorList.forEach((item) => {
option = {
value: item.equipmentId,
label: item.equipmentName,
}
equipmentOption.value.push(option)
})
showWindLoading.value = 0
} else {
showWindLoading.value = 1
}
if (res.data.sensorList.length !== 0) {
res.data.sensorList.forEach((item) => {
option = {
value: item.equipmentId,
label: item.equipmentName,
}
equipmentOption.value.push(option)
})
// res.data.sensorList.forEach((item) => {
// option = {
// value: item.equipmentId,
// label: item.equipmentName,
// }
// equipmentOption.value.push(option)
// })
res.data.sensorList.forEach((item) => {
if (
item.equipmentType === "dust" ||
item.equipmentType === "carbonDioxide" ||
item.equipmentType === "carbonMonoxide" ||
item.equipmentType === "hydrogenSulfide" ||
@@ -455,7 +429,6 @@ const getScreenInfo = (id) => {
showBadLoading.value = 1
}
largeScreenData.value = res.data;
// console.log(largeScreenData.value);
} else {
ElMessage.warning(res.msg)
}
@@ -494,19 +467,18 @@ const getTunnel = (id) => {
} else {
ElMessage.warning('该站点下没有隧道, 请新增隧道后再试!')
}
tunnelList.value = []
} else {
if (!pattern.test(previewId)) {
getScreenInfo(previewId)
tunnelList.value.forEach((item, index) => {
if (item.value == previewId) {
initialIndex.value = index
tunnelBtn.value.setActiveItem(index)
}
})
} else {
getScreenInfo(res.data[0]?.value)
}
tunnelList.value = res.data
tunnelList.value.forEach((item, index) => {
if (item.value == previewId) {
initialIndex.value = index
}
})
}
}
});
@@ -518,19 +490,18 @@ const changeTunnel = (e) => {
newObj = item
}
})
showFan.value = false
showBadLoading.value = 0
showWindLoading.value = 0
showFanLoading.value = 0
showUsedLoading.value = 0
// showUsedLoading.value = 0
pageInfo.pageNum = 1
getScreenInfo(newObj.value)
showFan.value = false
nextTick(() => {
showFan.value = true;
});
}
const manageSelect = (index) => {
console.log("首页点击-", index);
if (index === '站点管理') {
if (currentUserId.value) {
router.push("/site/" + currentUserId.value + '/' + currentSiteId.value);
@@ -707,14 +678,17 @@ const initWebSocket = () => {
height: 90px;
}
:deep(.el-table--fit) {
width: auto;
//height: 600px;
background-color: transparent!important;
.el-loading-mask{
background-color: transparent !important;
.el-loading-mask {
background: rgba(6, 34, 71, 0.78);
.el-loading-spinner{
.circular{
.el-loading-spinner {
.circular {
width: 150px;
height: 150px;
}
@@ -723,38 +697,14 @@ const initWebSocket = () => {
}
:deep(.el-table__empty-block) {
height: 200px!important;
height: 200px !important;
//display: none;
.el-table__empty-text{
.el-table__empty-text {
font-size: 60px;
color: #08B7B8;
}
}
.digital-tunnel {
.detail {
font-size: 50px;
color: #FFFFFF;
> div {
color: #f5f5f5;
margin-bottom: 10px;
}
}
}
.digital-tunnel {
:deep(.el-dialog ) {
height: 1410px;
.el-tag {
font-size: 36px;
height: 60px;
padding: 0 20px;
border-radius: 10px;
}
}
}
.query-form {
:deep(.el-form-item__label) {
@@ -958,7 +908,7 @@ const initWebSocket = () => {
font-weight: bold;
:deep(.el-pagination.is-background ) {
.btn-next,.btn-prev {
.btn-next, .btn-prev {
background-color: transparent;
}