对接配电箱监测大屏,左上实时数据,右上报警列表,中间配电箱实时数据接口,计算右上角实时时间。
This commit is contained in:
parent
eaaf9cdd86
commit
1ff0303729
27
src/api/modules/distribution.ts
Normal file
27
src/api/modules/distribution.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import http from "@/api";
|
||||
const BASEURL = import.meta.env.VITE_API_URL;
|
||||
|
||||
// 配电箱设备统计
|
||||
export const getDevStatisticsApi = (params: {}) => {
|
||||
return http.post(BASEURL + `/xmgl/electricalDev/selectElectricalDevStatistics`, params);
|
||||
};
|
||||
// 获取设备--实时数据
|
||||
export const getRealTimeDataApi = (params: {}) => {
|
||||
return http.post(BASEURL + `/xmgl/electricalData/getRealTimeDustNoiseData`, params);
|
||||
};
|
||||
// 配电箱报警统计
|
||||
export const getBoxAlarmStatisticsApi = (params: {}) => {
|
||||
return http.post(BASEURL + `/xmgl/electricAlarm/selectElectricAlarmStatistics`, params);
|
||||
};
|
||||
//获取 配电箱24小时实时数据
|
||||
export const getSelectDataListApi = (params: {}) => {
|
||||
return http.post(BASEURL + `/xmgl/electricalData/selectElectricalDataList`, params);
|
||||
};
|
||||
//获取设备--下拉列表
|
||||
export const getDevListApi = (params: {}) => {
|
||||
return http.post(BASEURL + `/xmgl/electricalDev/list`, params);
|
||||
};
|
||||
|
||||
// export const getDevListApi = data => post('xmgl/electricalDev/list', data); //获取设备--下拉列表
|
||||
// export const getAlarmInfoListApi = data => post('xmgl/electricAlarm/list', data); //获取设备--报警信息
|
||||
// export const getHistoryApi = data => post('xmgl/electricalData/selectElectricalDataPage', data); //获取 配电箱 历史数据
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
<div class="content">
|
||||
<div class="selectRight">
|
||||
<el-select v-model="value" class="m-2" placeholder="Select" size="small">
|
||||
<el-select v-model="devValue" class="m-2" placeholder="Select" size="small">
|
||||
<el-option v-for="item in noiseList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
@ -56,24 +56,54 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const value = ref("电箱1");
|
||||
const noiseList = [
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, reactive, ref, onBeforeUnmount } from "vue";
|
||||
// import * as echarts from "echarts";
|
||||
import { getRealTimeDataApi, getDevListApi } from "@/api/modules/distribution";
|
||||
// import Card from "@/components/card.vue";
|
||||
import { GlobalStore } from "@/stores";
|
||||
const store = GlobalStore();
|
||||
// 下拉框存放的value
|
||||
let devValue = ref("" as any);
|
||||
let noiseList = ref([
|
||||
{
|
||||
value: 0,
|
||||
label: "电箱2"
|
||||
}
|
||||
];
|
||||
]
|
||||
);
|
||||
|
||||
const getDevOption = async () => {
|
||||
const res: any = await getDevListApi({
|
||||
projectSn: store.sn
|
||||
});
|
||||
if (res.result) {
|
||||
devValue.value = res.result[0].devSn;
|
||||
noiseList.value = res.result.map(item => {
|
||||
return {
|
||||
value,
|
||||
noiseList
|
||||
value: item.devSn,
|
||||
label: item.devName
|
||||
};
|
||||
});
|
||||
console.log("电箱option", noiseList.value);
|
||||
}
|
||||
};
|
||||
|
||||
// let devSn = ref("" as any);
|
||||
const getRealTimeList = async () => {
|
||||
const res: any = await getRealTimeDataApi({
|
||||
projectSn: store.sn,
|
||||
devSn: devValue.value
|
||||
});
|
||||
if (res.result) {
|
||||
console.log("当前电箱实时数据", res.result);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await getDevOption();
|
||||
await getRealTimeList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -9,21 +9,21 @@
|
||||
<div class="deviceData">
|
||||
<div class="onlineDev">
|
||||
<div class="dev">在线设备</div>
|
||||
<div class="num">12</div>
|
||||
<div class="num">{{ deviceData.onlineNum }}</div>
|
||||
</div>
|
||||
<div class="lineDev">
|
||||
<div class="dev">离线设备</div>
|
||||
<div class="num">6</div>
|
||||
<div class="num">{{ deviceData.offlineNum }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="decivList">
|
||||
<div class="menuDev" v-for="item in deciData.devicList" :class="item.status == 0 ? 'online' : 'offline'">
|
||||
<div class="menuDev" v-for="item in deviceData.list" :key="item.id" :class="item.isClosed != 0 ? 'online' : 'offline'">
|
||||
<div class="decName">
|
||||
<span v-show="item.status == 0"><img src="@/assets/images/dustNoise/onlineImg.png" alt="" /></span>
|
||||
<span v-show="item.status == 1"><img src="@/assets/images/dustNoise/offImg.png" alt="" /></span>
|
||||
<span> {{ item.decName }}</span>
|
||||
<span v-show="item.isClosed != 0"><img src="@/assets/images/dustNoise/onlineImg.png" alt="" /></span>
|
||||
<span v-show="item.isClosed != 1"><img src="@/assets/images/dustNoise/offImg.png" alt="" /></span>
|
||||
<span> {{ item.devName }}</span>
|
||||
</div>
|
||||
<div class="status">{{ item.status == 0 ? "在线" : "离线" }}</div>
|
||||
<div class="status">{{ item.isClosed != 0 ? "在线" : "离线" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -31,17 +31,20 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { reactive, ref, onMounted } from "vue";
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, reactive, ref, onBeforeUnmount } from "vue";
|
||||
import * as echarts from "echarts";
|
||||
export default {
|
||||
setup() {
|
||||
const data = reactive({
|
||||
import { getDevStatisticsApi } from "@/api/modules/distribution";
|
||||
import Card from "@/components/card.vue";
|
||||
import { GlobalStore } from "@/stores";
|
||||
const store = GlobalStore();
|
||||
|
||||
const data = ref({
|
||||
name: "应用",
|
||||
value: 66
|
||||
});
|
||||
const posCenter = reactive(["50%", "64%"]);
|
||||
const option = reactive({
|
||||
});
|
||||
const posCenter = reactive(["50%", "64%"]);
|
||||
const option = reactive({
|
||||
series: [
|
||||
{
|
||||
// 外围刻度
|
||||
@ -145,7 +148,7 @@ export default {
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: data.value
|
||||
value: data.value.value
|
||||
}
|
||||
],
|
||||
z: 9
|
||||
@ -310,7 +313,7 @@ export default {
|
||||
width: 26,
|
||||
color: [
|
||||
[
|
||||
data.value / 100,
|
||||
data.value.value / 100,
|
||||
new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
||||
{
|
||||
offset: 0.5,
|
||||
@ -348,7 +351,7 @@ export default {
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: data.value,
|
||||
value: data.value.value,
|
||||
itemStyle: {
|
||||
color: "red"
|
||||
}
|
||||
@ -420,8 +423,8 @@ export default {
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
let deciData = reactive({
|
||||
});
|
||||
let deciData = reactive({
|
||||
devicList: [
|
||||
{
|
||||
decName: "配电箱设备1",
|
||||
@ -444,21 +447,29 @@ export default {
|
||||
status: 0
|
||||
}
|
||||
]
|
||||
});
|
||||
function drawChart() {
|
||||
});
|
||||
function drawChart() {
|
||||
let leftTopEcharts = echarts.init(document.getElementById("topLeftEcharts"));
|
||||
leftTopEcharts.setOption(option);
|
||||
}
|
||||
onMounted(() => {
|
||||
drawChart();
|
||||
}
|
||||
// 配电箱设备统计
|
||||
let deviceData = ref({} as any)
|
||||
|
||||
const getDevStatisticsList = async () => {
|
||||
const res: any = await getDevStatisticsApi({
|
||||
projectSn: store.sn
|
||||
});
|
||||
return {
|
||||
deciData,
|
||||
data,
|
||||
posCenter
|
||||
};
|
||||
if (res.result) {
|
||||
deviceData.value = res.result;
|
||||
data.value.value = res.result.grade;
|
||||
drawChart();
|
||||
}
|
||||
console.log("配电箱实时数据", res);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getDevStatisticsList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
<template>
|
||||
<div class="topRightBox">
|
||||
<div class="topRightBox" v-if="boxAlarmData">
|
||||
<div class="title"><i>报警列表</i></div>
|
||||
<div class="content">
|
||||
<div class="titleData">
|
||||
<div class="numPolice police">
|
||||
<div class="numText">总报警次数</div>
|
||||
<div class="num">307</div>
|
||||
<div class="num">{{ boxAlarmData.alarmNum.totalAlarmNum }}</div>
|
||||
</div>
|
||||
<div class="monthPolice police2">
|
||||
<div class="numText2">本月报警次数</div>
|
||||
<div class="num2">102</div>
|
||||
<div class="num2">{{ boxAlarmData.alarmNum.monthAlarmNum }}</div>
|
||||
</div>
|
||||
<div class="dayPolice police">
|
||||
<div class="numText">今日报警次数</div>
|
||||
<div class="num">34</div>
|
||||
<div class="num">{{ boxAlarmData.alarmNum.dayAlarmNum }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tableBox">
|
||||
@ -23,10 +23,10 @@
|
||||
<div class="tabThree">报警类型</div>
|
||||
</div>
|
||||
<div class="listBox" ref="scrollRef">
|
||||
<div v-for="item in list" class="listStyle">
|
||||
<div class="dev" style="margin-left: 5%">{{ item.dev }}</div>
|
||||
<div class="time">{{ item.time }}</div>
|
||||
<div class="type" style="margin-right: 5%">{{ item.type }}</div>
|
||||
<div v-for="item in boxAlarmData.list" class="listStyle" :key="item.id">
|
||||
<div class="dev" style="margin-left: 5%">{{ item.devName }}</div>
|
||||
<div class="time">{{ item.creatTime }}</div>
|
||||
<div class="type" style="margin-right: 5%">{{ item.alarmType }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -34,61 +34,27 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { reactive, ref } from "vue";
|
||||
import Card from "@/components/card.vue";
|
||||
export default {
|
||||
components: {
|
||||
Card
|
||||
},
|
||||
setup() {
|
||||
const list = reactive([
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
},
|
||||
{
|
||||
dev: "配电箱1",
|
||||
time: "2023-01-01 12:00:00",
|
||||
type: "室内水浸"
|
||||
}
|
||||
]);
|
||||
return {
|
||||
list
|
||||
};
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from "vue";
|
||||
// import * as echarts from "echarts";
|
||||
import { getBoxAlarmStatisticsApi } from "@/api/modules/distribution";
|
||||
// import Card from "@/components/card.vue";
|
||||
import { GlobalStore } from "@/stores";
|
||||
const store = GlobalStore();
|
||||
let boxAlarmData = ref(null as any);
|
||||
const getBoxAlarmList = async () => {
|
||||
const res: any = await getBoxAlarmStatisticsApi({
|
||||
projectSn: store.sn
|
||||
});
|
||||
if (res.result) {
|
||||
boxAlarmData.value = res.result;
|
||||
console.log("右中报警数据", res.result);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await getBoxAlarmList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<p>数字化项目监管平台</p>
|
||||
</span>
|
||||
<div class="rightIcon">
|
||||
<div class="time">2023-04-16 09:22:12</div>
|
||||
<div class="time">{{ nowTime }}</div>
|
||||
<div class="Icon">
|
||||
<img src="@/assets/images/dustNoise/jobIcon.png" alt="" />
|
||||
</div>
|
||||
@ -45,13 +45,12 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { reactive, onMounted } from "vue";
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, onMounted, onBeforeUnmount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
let nowTime = ref("2023-04-16 09:22:12" as any);
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
let menuData = reactive({
|
||||
let menuData = reactive({
|
||||
menuList: [
|
||||
{ moduleName: "扬尘噪声", modulePath: "/headNoise" },
|
||||
{ moduleName: "劳务管理", modulePath: "/laborManagement" },
|
||||
@ -63,27 +62,44 @@ export default {
|
||||
{ moduleName: "BIM模型", modulePath: "/bImModel" }
|
||||
],
|
||||
activeIndex: 0
|
||||
});
|
||||
const router = useRouter();
|
||||
});
|
||||
const router = useRouter();
|
||||
|
||||
const menuClick = (item, index) => {
|
||||
const menuClick = (item, index) => {
|
||||
menuData.activeIndex = index;
|
||||
console.log("点击了tab", item);
|
||||
if (item.modulePath.includes("/")) {
|
||||
router.push(item.modulePath);
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
console.log("进入页面, ");
|
||||
|
||||
menuClick(menuData.menuList[0], menuData.activeIndex);
|
||||
});
|
||||
return {
|
||||
menuData,
|
||||
menuClick
|
||||
};
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
console.log("进入页面, ");
|
||||
menuClick(menuData.menuList[0], menuData.activeIndex);
|
||||
getNowTime();
|
||||
});
|
||||
|
||||
let timer = ref(null as any);
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(timer);
|
||||
});
|
||||
|
||||
function getNowTime() {
|
||||
let speed = 1000;
|
||||
let theNowTime = function () {
|
||||
nowTime.value = timeNumber();
|
||||
};
|
||||
timer.value = setInterval(theNowTime, speed);
|
||||
}
|
||||
function timeNumber() {
|
||||
let today = new Date();
|
||||
let date = today.getFullYear() + "-" + twoDigits(today.getMonth() + 1) + "-" + twoDigits(today.getDate());
|
||||
let time = twoDigits(today.getHours()) + ":" + twoDigits(today.getMinutes()) + ":" + twoDigits(today.getSeconds());
|
||||
return date + " " + time;
|
||||
}
|
||||
function twoDigits(val: any) {
|
||||
if (val < 10) return "0" + val;
|
||||
return val;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user