diff --git a/imt-ui/src/api/data/query.js b/imt-ui/src/api/data/query.js index 17e3df2..c51e7a3 100644 --- a/imt-ui/src/api/data/query.js +++ b/imt-ui/src/api/data/query.js @@ -112,3 +112,12 @@ export function getWorkData(params) { params: params, }); } + +// 根据设备id获取最新数据 +export function getAllNewestData(params) { + return request({ + url: "/data/query/getAllNewestData", + method: "get", + params: params, + }); +} diff --git a/imt-ui/src/views/system/bigscreen/index.vue b/imt-ui/src/views/system/bigscreen/index.vue index 4d1ff6d..0634899 100644 --- a/imt-ui/src/views/system/bigscreen/index.vue +++ b/imt-ui/src/views/system/bigscreen/index.vue @@ -49,10 +49,10 @@ 故障数据分析
- - - - + + + +
@@ -183,7 +183,10 @@ label="故障类型" > @@ -238,24 +244,24 @@ import { getMaintenanceOrderCount, getAlarmList, getCustomerDistribution, - getCustomerDistributionByProvinceCode -} from '@/api/system/largeScreen/largeScreen'; -import {DICT_TYPE} from "@/utils/dict"; + getCustomerDistributionByProvinceCode, +} from "@/api/system/largeScreen/largeScreen"; +import { DICT_TYPE } from "@/utils/dict"; export default { computed: { DICT_TYPE() { - return DICT_TYPE - } + return DICT_TYPE; + }, }, data() { return { - alarmList:[], - companyAndEquipCreate:[], - alarmData:{}, + alarmList: [], + companyAndEquipCreate: [], + alarmData: {}, dataCount: { customerCount: 0, equipCount: 0, - onlineEquipCount: 0 + onlineEquipCount: 0, }, loading1: false, equipList: [], @@ -280,25 +286,25 @@ export default { this.initData(); }, methods: { - initData(){ - getEquipInfoList().then(res=>{ + initData() { + getEquipInfoList().then((res) => { this.equipList = res.data; - }) - getDataCount().then(res=>{ + }); + getDataCount().then((res) => { this.dataCount = res.data; - }) - getMaintenanceOrder().then(res => { - this.maintenanceList = res.data; - }) - getMaintenanceOrderCount().then(res=>{ - this.orderList = res.data - }) - getAlarmList().then(res=>{ - this.alarmList = res.data - }) - getFaultDataList().then(res=>{ + }); + getMaintenanceOrder().then((res) => { + this.maintenanceList = _.take(res.data, 3); + }); + getMaintenanceOrderCount().then((res) => { + this.orderList = res.data; + }); + getAlarmList().then((res) => { + this.alarmList = res.data; + }); + getFaultDataList().then((res) => { this.faultList = res.data; - }) + }); }, closePanel() { this.showPanel = false; @@ -309,61 +315,61 @@ export default { changeMark(index) { return "fault-mark" + (index + 1); }, - async getFaultChart(){ - await getFaultDataList().then(res=>{ + async getFaultChart() { + await getFaultDataList().then((res) => { this.faultList = res.data; - }) + }); this.initFaultChart(this.faultList); }, - initFaultChart(data){ + initFaultChart(data) { let p = new Promise((resolve) => { resolve(); }); - let chartData = [] - data.forEach(item=>{ + let chartData = []; + data.forEach((item) => { const fault = { name: item.faultLabel, - value: item.faultCount + value: item.faultCount, }; - chartData.push(fault) - }) + chartData.push(fault); + }); p.then(() => { this.faultChart = echarts.init(this.$refs.faultChart); let option = { tooltip: { - trigger: 'item' + trigger: "item", }, legend: { - orient: 'vertical', + orient: "vertical", right: 10, - top: 'center', + top: "center", textStyle: { - color:'#fff' - } + color: "#fff", + }, }, series: [ { - name: 'Access From', - type: 'pie', - radius: ['40%', '70%'], + name: "Access From", + type: "pie", + radius: ["40%", "70%"], avoidLabelOverlap: false, label: { show: false, - position: 'center' + position: "center", }, emphasis: { label: { show: false, fontSize: 40, - fontWeight: 'bold' - } + fontWeight: "bold", + }, }, labelLine: { - show: false + show: false, }, - data: chartData - } - ] + data: chartData, + }, + ], }; this.faultChart.setOption(option); }); @@ -372,9 +378,9 @@ export default { async getAlarmCharts() { // let chart1 = echarts.init(this.$refs.chart1); // chart1.showLoading(); - await getAlarmDataList().then(res=>{ + await getAlarmDataList().then((res) => { this.alarmData = res.data; - }) + }); this.initAlarmCharts(this.alarmData); }, initAlarmCharts(data) { @@ -454,9 +460,9 @@ export default { }); }, async getCompanyAndEquipGrowTrend() { - await getCompanyAndEquipCreate().then(res => { + await getCompanyAndEquipCreate().then((res) => { this.companyAndEquipCreate = res.data; - }) + }); this.initTrendChart(this.companyAndEquipCreate); }, initTrendChart(data) { @@ -618,7 +624,7 @@ export default { }); p.then(async () => { const _this = this; - echarts.registerMap("china", {geoJSON: chinaMap}); + echarts.registerMap("china", { geoJSON: chinaMap }); this.myChart = echarts.init(this.$refs.mapChart); let showdata = []; await getCustomerDistribution().then((res) => { @@ -638,7 +644,7 @@ export default { this.provinceName.push(e.provinceName); }); } - }) + }); // // console.log("selectData:", selectData); // // console.log("showdata:", showdata); // }); @@ -792,9 +798,9 @@ export default { var panel = document.getElementById("popPanel"); panel.style.left = dx + "px"; panel.style.top = dy + "px"; - getCustomerDistributionByProvinceCode(e.data.code).then(res=>{ + getCustomerDistributionByProvinceCode(e.data.code).then((res) => { this.customerEquNumList = res.data; - }) + }); } }); }); diff --git a/imt-ui/src/views/system/equip/equipdetails/index.vue b/imt-ui/src/views/system/equip/equipdetails/index.vue index aac7d8a..3151858 100644 --- a/imt-ui/src/views/system/equip/equipdetails/index.vue +++ b/imt-ui/src/views/system/equip/equipdetails/index.vue @@ -60,7 +60,10 @@
{{ item.value }}
-
+
暂无数据
@@ -76,28 +79,28 @@
加工总件数: - 118 + {{ totalProcess }}
加工时长: - 2.5 小时 + {{workTime}} 小时
通电时间: - 13:00:00 + {{powerTime}} 小时
加工件数: - 36 + {{processNum}}
@@ -173,59 +176,79 @@
-
X轴推屑电流
+
推屑1电流
-
Y轴推屑电流
+
推屑2电流
-
-
Y轴振动熵值
-
- 液压1
+ --> +
+
+
液压1
+
+ +
+
液压2
+
+
-
Y轴脉冲振动指数
+
液压3
- @@ -244,39 +267,123 @@ style="height: 90%" >
Y轴脉冲振动指数
- + --> -
+ +
+ +
+
X+温度
+
+ +
+
X-温度
+
+ +
+
X0温度
+
+ +
+
Y+温度
+
+
+
+ +
+
Y-温度
+
+ +
+
Y0温度
+
+ +
+
Z+温度
+
+ +
+
Z-温度
+
+
-
X轴轴承温度
+
Z0温度
+
+ +
+
排屑1温度
-
Y轴轴承温度
-
- -
-
Z轴轴承温度
+
排屑2温度
@@ -342,16 +449,23 @@ import { merge } from "lodash"; import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata"; import * as echarts from "echarts"; -import {getEquipCascader, getEquipInfoDetails} from "@/api/system/equip/equipInfo"; -import {getAlarmCountByEquipId, getAlarmDataTimeLineByEquipId} from "@/api/system/alarm/alarmdata"; -import {getMaintenanceCountByEquipId} from "@/api/system/maintenance/maintenance"; +import { + getEquipCascader, + getEquipInfoDetails, +} from "@/api/system/equip/equipInfo"; +import { + getAlarmCountByEquipId, + getAlarmDataTimeLineByEquipId, +} from "@/api/system/alarm/alarmdata"; +import { getMaintenanceCountByEquipId } from "@/api/system/maintenance/maintenance"; +import { getAllNewestData } from "@/api/data/query.js"; export default { name: "EquipDetail2", dicts: ["equip_tags", "equip_class", "equip_status"], data() { return { cascaderDisabled: false, - cascaderValue:{}, + cascaderValue: {}, equipInfo: {}, alarmTimes: 0, faultTimes: 0, @@ -366,6 +480,15 @@ export default { echarts6: null, echarts7: null, timeLineList: [], + currentData: null, + hyData: null, + tempData: null, + aclrData: null, + fanucData: null, + totalProcess: 0, + workTime: 0.0, + powerTime: 0.0, + processNum: 0, }; }, created() { @@ -373,68 +496,85 @@ export default { this.initEquipDetails(); }, mounted() { - this.initCharts(); - this.initTempCharts(); + // this.initTempCharts(); }, computed: {}, watch: {}, methods: { initEquipDetails() { - getEquipCascader().then(res=>{ - res.forEach(item=>{ - if (item.children == null){ + getEquipCascader().then((res) => { + res.forEach((item) => { + if (item.children == null) { item.disabled = true; - }else { + } else { item.disabled = false; } - }) + }); this.options = res; - if (this.$route.query.equipId != null){ + if (this.$route.query.equipId != null) { this.cascaderValue = this.$route.query.equipId; this.getEquipDetails(this.$route.query.equipId); this.getAlarmCountByEquipId(this.$route.query.equipId); this.getMaintenanceCountByEquipId(this.$route.query.equipId); this.getAlarmDataTimeLineByEquipId(this.$route.query.equipId); + this.getAllData(this.$route.query.equipId); this.cascaderDisabled = true; - }else { - this.options.every(item => { + } else { + this.options.every((item) => { if (item.disabled === false) { this.cascaderValue = item.children[0].id; this.getEquipDetails(item.children[0].id); this.getAlarmCountByEquipId(item.children[0].id); this.getMaintenanceCountByEquipId(item.children[0].id); this.getAlarmDataTimeLineByEquipId(item.children[0].id); + this.getAllData(item.children[0].id); this.cascaderDisabled = false; return false; } - }) + }); } - }) + }); }, //获取设备维修次数 - getMaintenanceCountByEquipId(equipId){ - getMaintenanceCountByEquipId(equipId).then(res=>{ + getMaintenanceCountByEquipId(equipId) { + getMaintenanceCountByEquipId(equipId).then((res) => { this.faultTimes = res.data; - }) + }); }, //获取设备报警次数 - getAlarmCountByEquipId(equipId){ - getAlarmCountByEquipId(equipId).then(res=>{ + getAlarmCountByEquipId(equipId) { + getAlarmCountByEquipId(equipId).then((res) => { this.alarmTimes = res.data; - }) + }); }, //获取设备报警时间轴 - getAlarmDataTimeLineByEquipId(equipId){ - getAlarmDataTimeLineByEquipId(equipId).then(res=>{ + getAlarmDataTimeLineByEquipId(equipId) { + getAlarmDataTimeLineByEquipId(equipId).then((res) => { this.timeLineList = res.data; - }) + }); + }, + //获取设备所有传感器数据 + getAllData(equipId) { + getAllNewestData({ equipId: equipId }).then((res) => { + this.currentData = res.data.current; + this.hyData = res.data.hy; + this.tempData = res.data.temp; + this.aclrData = res.data.aclr; + this.fanucData = res.data.fanuc; + this.totalProcess = this.fanucData.total_process; + this.workTime = (this.fanucData.work_time / 60.0).toFixed(1); + this.powerTime = (this.fanucData.power_time / 60.0).toFixed(1); + this.processNum = this.fanucData.process_num; + this.initCharts(); + this.initTempCharts(); + }); }, getEquipDetails(id) { - getEquipInfoDetails(id).then(res => { - console.log("res.data",res.data); + getEquipInfoDetails(id).then((res) => { + console.log("res.data", res.data); this.equipInfo = res.data; this.techParamsList = res.data.paramList; - }) + }); }, async getEquipAlarmList() { var equipAlarmQuery = { @@ -448,12 +588,13 @@ export default { this.equipAlarmList = res.data.list; }, handleChange(value) { - if (value.length > 0){ - this.getEquipDetails(value[1]) + if (value.length > 0) { + this.getEquipDetails(value[1]); this.getAlarmCountByEquipId(value[1]); this.getMaintenanceCountByEquipId(value[1]); this.getAlarmDataTimeLineByEquipId(value[1]); - }else { + this.getAllData(value[1]); + } else { this.$message.error("请选择一个设备"); } }, @@ -482,8 +623,8 @@ export default { this.generateGaugeOption({ color: ["26DE86", "93DDBA"], bgColor: "023E44", - name: "X轴排屑电流", - value: 70, + name: "排屑1电流", + value: this.currentData.chip_removal_1, limit: 250, unit: "A", }), @@ -500,8 +641,8 @@ export default { this.generateGaugeOption({ color: ["26AE86", "45678E"], bgColor: "AAAAA", - name: "y轴排屑电流", - value: 70, + name: "排屑2电流", + value: this.currentData.chip_removal_2, limit: 250, unit: "A", }), @@ -518,8 +659,8 @@ export default { this.generateGaugeOption({ color: ["B07709", "EDBA58"], bgColor: "846528", - name: "y轴振动熵值", - value: 80, + name: "液压1", + value: this.hyData.hy_1, limit: 250, unit: "G/S", }), @@ -536,8 +677,8 @@ export default { this.generateGaugeOption({ color: ["707709", "7DBA58"], bgColor: "A46528", - name: "Y轴脉冲指数", - value: 125, + name: "液压2", + value: this.hyData.hy_2, limit: 250, unit: "GS", }), @@ -554,8 +695,8 @@ export default { this.generateGaugeOption({ color: ["FA604C", "F63319"], bgColor: "C51D07", - name: "x轴润滑液压", - value: 125, + name: "液压3", + value: this.hyData.hy_3, limit: 250, unit: "bar", }), @@ -566,56 +707,88 @@ export default { this.echarts5 && this.echarts5.resize(); }); - const yrhyy = document.getElementById("yrhyy"); - this.echarts6 = echarts.init(yrhyy); - this.echarts6.setOption( - this.generateGaugeOption({ - color: ["E5F72E", "BFD109"], - bgColor: "A5B505", - name: "y轴润滑液压", - value: 103, - limit: 250, - unit: "bar", - }), - true, - true - ); - window.addEventListener("resize", () => { - this.echarts6 && this.echarts6.resize(); - }); + // const yrhyy = document.getElementById("yrhyy"); + // this.echarts6 = echarts.init(yrhyy); + // this.echarts6.setOption( + // this.generateGaugeOption({ + // color: ["E5F72E", "BFD109"], + // bgColor: "A5B505", + // name: "y轴润滑液压", + // value: 103, + // limit: 250, + // unit: "bar", + // }), + // true, + // true + // ); + // window.addEventListener("resize", () => { + // this.echarts6 && this.echarts6.resize(); + // }); - const zrhyy = document.getElementById("zrhyy"); - this.echarts7 = echarts.init(zrhyy); - this.echarts7.setOption( - this.generateGaugeOption({ - color: ["E5F72E", "BFD109"], - bgColor: "A5B505", - name: "z轴润滑液压", - value: 99, - limit: 250, - unit: "bar", - }), - true, - true - ); - window.addEventListener("resize", () => { - this.echarts7 && this.echarts7.resize(); - }); + // const zrhyy = document.getElementById("zrhyy"); + // this.echarts7 = echarts.init(zrhyy); + // this.echarts7.setOption( + // this.generateGaugeOption({ + // color: ["E5F72E", "BFD109"], + // bgColor: "A5B505", + // name: "z轴润滑液压", + // value: 99, + // limit: 250, + // unit: "bar", + // }), + // true, + // true + // ); + // window.addEventListener("resize", () => { + // this.echarts7 && this.echarts7.resize(); + // }); }, initTempCharts() { // 基于准备好的dom,初始化echarts实例 - var myChart1 = echarts.init(document.getElementById("xzzcwd")); - var option1 = this.tempOption(20.3); + var myChart1 = echarts.init(document.getElementById("xptemp")); + var option1 = this.tempOption(this.tempData.xp_temp); myChart1.setOption(option1); - var myChart2 = echarts.init(document.getElementById("yzzcwd")); - var option2 = this.tempOption(50.5); + var myChart2 = echarts.init(document.getElementById("xntemp")); + var option2 = this.tempOption(this.tempData.xn_temp); myChart2.setOption(option2); - var myChart3 = echarts.init(document.getElementById("zzzcwd")); - var option3 = this.tempOption(65.5); + var myChart3 = echarts.init(document.getElementById("x0temp")); + var option3 = this.tempOption(this.tempData.x0_temp); myChart3.setOption(option3); + + var myChart4 = echarts.init(document.getElementById("yptemp")); + var option4 = this.tempOption(this.tempData.yp_temp); + myChart4.setOption(option4); + + var myChart5 = echarts.init(document.getElementById("yntemp")); + var option5 = this.tempOption(this.tempData.yn_temp); + myChart5.setOption(option5); + + var myChart6 = echarts.init(document.getElementById("y0temp")); + var option6 = this.tempOption(this.tempData.y0_temp); + myChart6.setOption(option6); + + var myChart7 = echarts.init(document.getElementById("zptemp")); + var option7 = this.tempOption(this.tempData.zp_temp); + myChart7.setOption(option7); + + var myChart8 = echarts.init(document.getElementById("zntemp")); + var option8 = this.tempOption(this.tempData.zn_temp); + myChart8.setOption(option8); + + var myChart9 = echarts.init(document.getElementById("z0temp")); + var option9 = this.tempOption(this.tempData.z0_temp); + myChart9.setOption(option9); + + var myChart10 = echarts.init(document.getElementById("cr1temp")); + var option10 = this.tempOption(this.tempData.cr1_temp); + myChart10.setOption(option10); + + var myChart11 = echarts.init(document.getElementById("cr2temp")); + var option11 = this.tempOption(this.tempData.cr2_temp); + myChart11.setOption(option11); }, tempOption(data) { @@ -688,7 +861,7 @@ export default { // 因为柱状初始化为0,温度存在负值,所以加上负值60和空出距离10 var option = { grid: { - x: 90, //左侧与y轴的距离 + x: 65, //左侧与y轴的距离 y: -150, //top部与x轴的距离 x2: -120, //右侧与y轴的距离 y2: 20, //bottom部与x轴的距离 @@ -902,7 +1075,7 @@ export default { center: ["50%", "60%"], startAngle: 220, endAngle: -40, - min: 0, + min: -10, max: option.limit, splitNumber: 12, progress: { @@ -1236,7 +1409,7 @@ $bordercolor: #ddd; } .main-content { display: grid; - grid-template-rows: 20% 20% 40% 20%; + grid-template-rows: 20% 20% 20% 20% 20%; background: url("../../../../assets/images/equipdetails/middle_back.png") no-repeat center center; background-size: cover;