Merge branch 'zjw'

This commit is contained in:
zhangjunwen 2024-10-12 15:24:04 +08:00
commit 9222ec24a9
6 changed files with 481 additions and 186 deletions

View File

@ -117,6 +117,13 @@ public class DataQueryController {
return success(resMap); return success(resMap);
} }
@GetMapping("/getAllNewestData")
@Operation(summary = "获取所有最新数据")
public CommonResult<Map<String, Object>> getAllNewestData(String equipId){
Map<String, Object> resMap = dataQueryService.getAllNewestData(equipId);
return success(resMap);
}
@GetMapping("/export-current-excel") @GetMapping("/export-current-excel")
@Operation(summary = "导出机床电流传感器参数 Excel") @Operation(summary = "导出机床电流传感器参数 Excel")
@PreAuthorize("@ss.hasPermission('data:query:export')") @PreAuthorize("@ss.hasPermission('data:query:export')")

View File

@ -154,6 +154,7 @@ public class DataQueryService implements IDataQueryService {
/** /**
* 查询当日最新一条数据 * 查询当日最新一条数据
*/ */
@Override
public Map<String, Object> getLatestData(String equipId, String tableName, String columns){ public Map<String, Object> getLatestData(String equipId, String tableName, String columns){
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
@ -181,6 +182,100 @@ public class DataQueryService implements IDataQueryService {
return dataList.get(0); return dataList.get(0);
} }
/**
* 根据设备id查询设备最新一条数据
*/
public Map<String, Object> getAllNewestData(String equipId){
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("current", getNewestCurrentData(equipId));
resultMap.put("hy", getNewestPressData(equipId));
resultMap.put("temp", getNewestTempData(equipId));
resultMap.put("aclr", getNewestVibrData(equipId));
resultMap.put("fanuc", getNewestWorkData(equipId));
return resultMap;
}
/**
* 最新的一条电流数据
* @param equipId 设备id
* @return 电流数据
*/
private Map<String, Object> getNewestCurrentData(String equipId){
String tableName = "gateway_current_data";
String columns = "chip_removal_1,chip_removal_2";
List<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, null, null, "desc");
if (CollUtil.isEmpty(dataList)) {
String[] cols = columns.split(",");
Map<String, Object> resMap = new HashMap<>();
for (String col : cols) {
resMap.put(col, 0.0);
}
return resMap;
}
return dataList.get(0);
}
private Map<String, Object> getNewestPressData(String equipId){
String tableName = "gateway_hy_data";
String columns = "hy_1,hy_2,hy_3";
List<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, null, null, "desc");
if (CollUtil.isEmpty(dataList)) {
String[] cols = columns.split(",");
Map<String, Object> resMap = new HashMap<>();
for (String col : cols) {
resMap.put(col, 0.0);
}
return resMap;
}
return dataList.get(0);
}
private Map<String, Object> getNewestTempData(String equipId){
String tableName = "gateway_temp_data";
String columns = "cr1_temp,cr2_temp,x0_temp,xp_temp,xn_temp,y0_temp,yp_temp,yn_temp,z0_temp,zp_temp,zn_temp";
List<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, null, null, "desc");
if (CollUtil.isEmpty(dataList)) {
String[] cols = columns.split(",");
Map<String, Object> resMap = new HashMap<>();
for (String col : cols) {
resMap.put(col, 0.0);
}
return resMap;
}
return dataList.get(0);
}
private Map<String, Object> getNewestVibrData(String equipId){
String tableName = "gateway_aclr_data";
String columns = "x_aclr_rms,x_speed_rms,x_dis_rms,y_aclr_rms,y_speed_rms,y_dis_rms,z_aclr_rms,z_speed_rms,z_dis_rms," +
"x_aclr_peak,x_speed_peak,x_dis_peak,y_aclr_peak,y_speed_peak,y_dis_peak,z_aclr_peak,z_speed_peak,z_dis_peak";
List<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, null, null, "desc");
if (CollUtil.isEmpty(dataList)) {
String[] cols = columns.split(",");
Map<String, Object> resMap = new HashMap<>();
for (String col : cols) {
resMap.put(col, 0.0);
}
return resMap;
}
return dataList.get(0);
}
private Map<String, Object> getNewestWorkData(String equipId){
String tableName = "gateway_fanuc_data";
String columns = "power_time,process_num,total_process,work_time";
List<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, null, null, "desc");
if (CollUtil.isEmpty(dataList)) {
String[] cols = columns.split(",");
Map<String, Object> resMap = new HashMap<>();
for (String col : cols) {
resMap.put(col, 0.0);
}
return resMap;
}
return dataList.get(0);
}
public Map<String, Object> getAllData2ChartData(String equipId, String tableName, String columns, String startTime, String endTime) { public Map<String, Object> getAllData2ChartData(String equipId, String tableName, String columns, String startTime, String endTime) {
LocalDateTime stime = DateUtils.tranUTCtoLocalDateTime(startTime); LocalDateTime stime = DateUtils.tranUTCtoLocalDateTime(startTime);
LocalDateTime etime = DateUtils.tranUTCtoLocalDateTime(endTime); LocalDateTime etime = DateUtils.tranUTCtoLocalDateTime(endTime);

View File

@ -56,4 +56,9 @@ public interface IDataQueryService {
* 查询当日最旧一条数据 * 查询当日最旧一条数据
*/ */
public Map<String, Object> getOldestData(String equipId, String tableName, String columns); public Map<String, Object> getOldestData(String equipId, String tableName, String columns);
/**
* 根据设备id查询设备最新一条数据
*/
public Map<String, Object> getAllNewestData(String equipId);
} }

View File

@ -112,3 +112,12 @@ export function getWorkData(params) {
params: params, params: params,
}); });
} }
// 根据设备id获取最新数据
export function getAllNewestData(params) {
return request({
url: "/data/query/getAllNewestData",
method: "get",
params: params,
});
}

View File

@ -49,10 +49,10 @@
<span class="title-font">故障数据分析</span> <span class="title-font">故障数据分析</span>
</div> </div>
<div class="item-content"> <div class="item-content">
<!-- <div--> <!-- <div-->
<!-- ref="faultChart"--> <!-- ref="faultChart"-->
<!-- style="height:100%;margin-left: -100px"--> <!-- style="height:100%;margin-left: -100px"-->
<!-- ></div>--> <!-- ></div>-->
<div class="item-content fault-data"> <div class="item-content fault-data">
<div class="fault-icon"></div> <div class="fault-icon"></div>
<div class="fault-content"> <div class="fault-content">
@ -183,7 +183,10 @@
label="故障类型" label="故障类型"
> >
<template v-slot="scope"> <template v-slot="scope">
<dict-tag :type="DICT_TYPE.FAULT_TYPE" :value="scope.row.faultType"/> <dict-tag
:type="DICT_TYPE.FAULT_TYPE"
:value="scope.row.faultType"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -191,7 +194,10 @@
label="进度" label="进度"
> >
<template v-slot="scope"> <template v-slot="scope">
<dict-tag :type="DICT_TYPE.MAINTENANCE_STATUS" :value="scope.row.status"/> <dict-tag
:type="DICT_TYPE.MAINTENANCE_STATUS"
:value="scope.row.status"
/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -238,24 +244,24 @@ import {
getMaintenanceOrderCount, getMaintenanceOrderCount,
getAlarmList, getAlarmList,
getCustomerDistribution, getCustomerDistribution,
getCustomerDistributionByProvinceCode getCustomerDistributionByProvinceCode,
} from '@/api/system/largeScreen/largeScreen'; } from "@/api/system/largeScreen/largeScreen";
import {DICT_TYPE} from "@/utils/dict"; import { DICT_TYPE } from "@/utils/dict";
export default { export default {
computed: { computed: {
DICT_TYPE() { DICT_TYPE() {
return DICT_TYPE return DICT_TYPE;
} },
}, },
data() { data() {
return { return {
alarmList:[], alarmList: [],
companyAndEquipCreate:[], companyAndEquipCreate: [],
alarmData:{}, alarmData: {},
dataCount: { dataCount: {
customerCount: 0, customerCount: 0,
equipCount: 0, equipCount: 0,
onlineEquipCount: 0 onlineEquipCount: 0,
}, },
loading1: false, loading1: false,
equipList: [], equipList: [],
@ -280,25 +286,25 @@ export default {
this.initData(); this.initData();
}, },
methods: { methods: {
initData(){ initData() {
getEquipInfoList().then(res=>{ getEquipInfoList().then((res) => {
this.equipList = res.data; this.equipList = res.data;
}) });
getDataCount().then(res=>{ getDataCount().then((res) => {
this.dataCount = res.data; this.dataCount = res.data;
}) });
getMaintenanceOrder().then(res => { getMaintenanceOrder().then((res) => {
this.maintenanceList = res.data; this.maintenanceList = _.take(res.data, 3);
}) });
getMaintenanceOrderCount().then(res=>{ getMaintenanceOrderCount().then((res) => {
this.orderList = res.data this.orderList = res.data;
}) });
getAlarmList().then(res=>{ getAlarmList().then((res) => {
this.alarmList = res.data this.alarmList = res.data;
}) });
getFaultDataList().then(res=>{ getFaultDataList().then((res) => {
this.faultList = res.data; this.faultList = res.data;
}) });
}, },
closePanel() { closePanel() {
this.showPanel = false; this.showPanel = false;
@ -309,61 +315,61 @@ export default {
changeMark(index) { changeMark(index) {
return "fault-mark" + (index + 1); return "fault-mark" + (index + 1);
}, },
async getFaultChart(){ async getFaultChart() {
await getFaultDataList().then(res=>{ await getFaultDataList().then((res) => {
this.faultList = res.data; this.faultList = res.data;
}) });
this.initFaultChart(this.faultList); this.initFaultChart(this.faultList);
}, },
initFaultChart(data){ initFaultChart(data) {
let p = new Promise((resolve) => { let p = new Promise((resolve) => {
resolve(); resolve();
}); });
let chartData = [] let chartData = [];
data.forEach(item=>{ data.forEach((item) => {
const fault = { const fault = {
name: item.faultLabel, name: item.faultLabel,
value: item.faultCount value: item.faultCount,
}; };
chartData.push(fault) chartData.push(fault);
}) });
p.then(() => { p.then(() => {
this.faultChart = echarts.init(this.$refs.faultChart); this.faultChart = echarts.init(this.$refs.faultChart);
let option = { let option = {
tooltip: { tooltip: {
trigger: 'item' trigger: "item",
}, },
legend: { legend: {
orient: 'vertical', orient: "vertical",
right: 10, right: 10,
top: 'center', top: "center",
textStyle: { textStyle: {
color:'#fff' color: "#fff",
} },
}, },
series: [ series: [
{ {
name: 'Access From', name: "Access From",
type: 'pie', type: "pie",
radius: ['40%', '70%'], radius: ["40%", "70%"],
avoidLabelOverlap: false, avoidLabelOverlap: false,
label: { label: {
show: false, show: false,
position: 'center' position: "center",
}, },
emphasis: { emphasis: {
label: { label: {
show: false, show: false,
fontSize: 40, fontSize: 40,
fontWeight: 'bold' fontWeight: "bold",
} },
}, },
labelLine: { labelLine: {
show: false show: false,
}, },
data: chartData data: chartData,
} },
] ],
}; };
this.faultChart.setOption(option); this.faultChart.setOption(option);
}); });
@ -372,9 +378,9 @@ export default {
async getAlarmCharts() { async getAlarmCharts() {
// let chart1 = echarts.init(this.$refs.chart1); // let chart1 = echarts.init(this.$refs.chart1);
// chart1.showLoading(); // chart1.showLoading();
await getAlarmDataList().then(res=>{ await getAlarmDataList().then((res) => {
this.alarmData = res.data; this.alarmData = res.data;
}) });
this.initAlarmCharts(this.alarmData); this.initAlarmCharts(this.alarmData);
}, },
initAlarmCharts(data) { initAlarmCharts(data) {
@ -454,9 +460,9 @@ export default {
}); });
}, },
async getCompanyAndEquipGrowTrend() { async getCompanyAndEquipGrowTrend() {
await getCompanyAndEquipCreate().then(res => { await getCompanyAndEquipCreate().then((res) => {
this.companyAndEquipCreate = res.data; this.companyAndEquipCreate = res.data;
}) });
this.initTrendChart(this.companyAndEquipCreate); this.initTrendChart(this.companyAndEquipCreate);
}, },
initTrendChart(data) { initTrendChart(data) {
@ -618,7 +624,7 @@ export default {
}); });
p.then(async () => { p.then(async () => {
const _this = this; const _this = this;
echarts.registerMap("china", {geoJSON: chinaMap}); echarts.registerMap("china", { geoJSON: chinaMap });
this.myChart = echarts.init(this.$refs.mapChart); this.myChart = echarts.init(this.$refs.mapChart);
let showdata = []; let showdata = [];
await getCustomerDistribution().then((res) => { await getCustomerDistribution().then((res) => {
@ -638,7 +644,7 @@ export default {
this.provinceName.push(e.provinceName); this.provinceName.push(e.provinceName);
}); });
} }
}) });
// // console.log("selectData:", selectData); // // console.log("selectData:", selectData);
// // console.log("showdata:", showdata); // // console.log("showdata:", showdata);
// }); // });
@ -792,9 +798,9 @@ export default {
var panel = document.getElementById("popPanel"); var panel = document.getElementById("popPanel");
panel.style.left = dx + "px"; panel.style.left = dx + "px";
panel.style.top = dy + "px"; panel.style.top = dy + "px";
getCustomerDistributionByProvinceCode(e.data.code).then(res=>{ getCustomerDistributionByProvinceCode(e.data.code).then((res) => {
this.customerEquNumList = res.data; this.customerEquNumList = res.data;
}) });
} }
}); });
}); });

View File

@ -60,7 +60,10 @@
<div>{{ item.value }}</div> <div>{{ item.value }}</div>
</div> </div>
</div> </div>
<div v-if="!techParamsList.length" style="text-align: center"> <div
v-if="!techParamsList.length"
style="text-align: center"
>
暂无数据 暂无数据
</div> </div>
</div> </div>
@ -76,28 +79,28 @@
<div class="status-info"> <div class="status-info">
<div class="status-detail"> <div class="status-detail">
<span class="status-title">加工总件数</span> <span class="status-title">加工总件数</span>
<span><span class="status-num">118</span><span class="status-title"> </span></span> <span><span class="status-num">{{ totalProcess }}</span><span class="status-title"> </span></span>
</div> </div>
<span class="total-icon"></span> <span class="total-icon"></span>
</div> </div>
<div class="status-info"> <div class="status-info">
<div class="status-detail"> <div class="status-detail">
<span class="status-title">加工时长</span> <span class="status-title">加工时长</span>
<span><span class="status-num">2.5</span><span class="status-title"> 小时</span></span> <span><span class="status-num">{{workTime}}</span><span class="status-title"> 小时</span></span>
</div> </div>
<span class="time-icon"></span> <span class="time-icon"></span>
</div> </div>
<div class="status-info"> <div class="status-info">
<div class="status-detail"> <div class="status-detail">
<span class="status-title">通电时间</span> <span class="status-title">通电时间</span>
<span class="status-num">13:00:00</span> <span><span class="status-num">{{powerTime}}</span><span class="status-title"> 小时</span></span>
</div> </div>
<span class="power-icon"></span> <span class="power-icon"></span>
</div> </div>
<div class="status-info"> <div class="status-info">
<div class="status-detail"> <div class="status-detail">
<span class="status-title">加工件数</span> <span class="status-title">加工件数</span>
<span><span class="status-num">36</span><span class="status-title"> </span></span> <span><span class="status-num">{{processNum}}</span><span class="status-title"> </span></span>
</div> </div>
<span class="work-icon"></span> <span class="work-icon"></span>
</div> </div>
@ -173,59 +176,79 @@
<div> <div>
<el-row> <el-row>
<el-col <el-col
:span="6" :span="12"
style="height: 100%" style="height: 100%; text-align: -webkit-center;"
> >
<div <div
id="xtxdl" id="xtxdl"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>X轴推屑电流</span></div> <div style="height:10%;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>推屑1电流</span></div>
</el-col> </el-col>
<el-col <el-col
:span="6" :span="12"
style="height: 100%" style="height: 100%;text-align: -webkit-center;"
> >
<div <div
id="ytxdl" id="ytxdl"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴推屑电流</span></div> <div style="height:10%;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>推屑2电流</span></div>
</el-col> </el-col>
<el-col <!-- <el-col
:span="6" :span="8"
style="height: 100%" style="height: 100%;text-align: -webkit-center;"
> >
<div <div
id="yzdsz" id="yzdsz"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴振动熵值</span></div> <div style="height:10%;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>液压1</span></div>
</el-col> </el-col> -->
<el-col <!-- <el-col
:span="6" :span="8"
style="height: 100%" style="height: 100%"
> >
<div <div
id="ymczs" id="ymczs"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴脉冲振动指数</span></div> <div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>液压2</span></div>
</el-col> </el-col> -->
</el-row> </el-row>
</div> </div>
<div> <el-row> <div> <el-row>
<el-col <el-col
:span="8" :span="8"
style="height: 100%" style="height: 100%;text-align: -webkit-center;"
>
<div
id="yzdsz"
style="height: 90%"
></div>
<div style="height:10%;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>液压1</span></div>
</el-col>
<el-col
:span="8"
style="height: 100%;text-align: -webkit-center;"
>
<div
id="ymczs"
style="height: 90%"
></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>液压2</span></div>
</el-col>
<el-col
:span="8"
style="height: 100%;text-align: -webkit-center;"
> >
<div <div
id="xrhyy" id="xrhyy"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴脉冲振动指数</span></div> <div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>液压3</span></div>
</el-col> </el-col>
<el-col <!-- <el-col
:span="8" :span="8"
style="height: 100%" style="height: 100%"
> >
@ -244,39 +267,123 @@
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴脉冲振动指数</span></div> <div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴脉冲振动指数</span></div>
</el-col> </el-col> -->
</el-row></div> </el-row></div>
<div class="equip_icon"></div> <!-- <div class="equip_icon"></div> -->
<div>
<el-col
:span="6"
style="height: 100%"
>
<div
id="xptemp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>X+温度</span></div>
</el-col>
<el-col
:span="6"
style="height: 100%"
>
<div
id="xntemp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>X-温度</span></div>
</el-col>
<el-col
:span="6"
style="height: 100%"
>
<div
id="x0temp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>X0温度</span></div>
</el-col>
<el-col
:span="6"
style="height: 100%"
>
<div
id="yptemp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y+温度</span></div>
</el-col>
</div>
<div>
<el-col
:span="6"
style="height: 100%"
>
<div
id="yntemp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y-温度</span></div>
</el-col>
<el-col
:span="6"
style="height: 100%"
>
<div
id="y0temp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y0温度</span></div>
</el-col>
<el-col
:span="6"
style="height: 100%"
>
<div
id="zptemp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Z+温度</span></div>
</el-col>
<el-col
:span="6"
style="height: 100%"
>
<div
id="zntemp"
style="height: 90%"
></div>
<div style="text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Z-温度</span></div>
</el-col>
</div>
<div> <div>
<el-col <el-col
:span="8" :span="8"
style="height: 100%" style="height: 100%"
> >
<div <div
id="xzzcwd" id="z0temp"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>X轴轴承温度</span></div> <div style="margin-right:15%;text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Z0温度</span></div>
</el-col>
<el-col
:span="8"
style="height: 100%;"
>
<div
id="cr1temp"
style="height: 90%"
></div>
<div style="margin-right:13%;text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>排屑1温度</span></div>
</el-col> </el-col>
<el-col <el-col
:span="8" :span="8"
style="height: 100%" style="height: 100%"
> >
<div <div
id="yzzcwd" id="cr2temp"
style="height: 90%" style="height: 90%"
></div> ></div>
<div style="height:10%;text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Y轴轴承温度</span></div> <div style="margin-right:13%;text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>排屑2温度</span></div>
</el-col>
<el-col
:span="8"
style="height: 100%"
>
<div
id="zzzcwd"
style="height: 90%"
></div>
<div style="height:10%;text-align:center;font-size: 16px;color:#26DE86"><span style='cursor:pointer;'>Z轴轴承温度</span></div>
</el-col> </el-col>
</div> </div>
</div> </div>
@ -342,16 +449,23 @@
import { merge } from "lodash"; import { merge } from "lodash";
import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata"; import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata";
import * as echarts from "echarts"; import * as echarts from "echarts";
import {getEquipCascader, getEquipInfoDetails} from "@/api/system/equip/equipInfo"; import {
import {getAlarmCountByEquipId, getAlarmDataTimeLineByEquipId} from "@/api/system/alarm/alarmdata"; getEquipCascader,
import {getMaintenanceCountByEquipId} from "@/api/system/maintenance/maintenance"; 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 { export default {
name: "EquipDetail2", name: "EquipDetail2",
dicts: ["equip_tags", "equip_class", "equip_status"], dicts: ["equip_tags", "equip_class", "equip_status"],
data() { data() {
return { return {
cascaderDisabled: false, cascaderDisabled: false,
cascaderValue:{}, cascaderValue: {},
equipInfo: {}, equipInfo: {},
alarmTimes: 0, alarmTimes: 0,
faultTimes: 0, faultTimes: 0,
@ -366,6 +480,15 @@ export default {
echarts6: null, echarts6: null,
echarts7: null, echarts7: null,
timeLineList: [], timeLineList: [],
currentData: null,
hyData: null,
tempData: null,
aclrData: null,
fanucData: null,
totalProcess: 0,
workTime: 0.0,
powerTime: 0.0,
processNum: 0,
}; };
}, },
created() { created() {
@ -373,68 +496,85 @@ export default {
this.initEquipDetails(); this.initEquipDetails();
}, },
mounted() { mounted() {
this.initCharts(); // this.initTempCharts();
this.initTempCharts();
}, },
computed: {}, computed: {},
watch: {}, watch: {},
methods: { methods: {
initEquipDetails() { initEquipDetails() {
getEquipCascader().then(res=>{ getEquipCascader().then((res) => {
res.forEach(item=>{ res.forEach((item) => {
if (item.children == null){ if (item.children == null) {
item.disabled = true; item.disabled = true;
}else { } else {
item.disabled = false; item.disabled = false;
} }
}) });
this.options = res; this.options = res;
if (this.$route.query.equipId != null){ if (this.$route.query.equipId != null) {
this.cascaderValue = this.$route.query.equipId; this.cascaderValue = this.$route.query.equipId;
this.getEquipDetails(this.$route.query.equipId); this.getEquipDetails(this.$route.query.equipId);
this.getAlarmCountByEquipId(this.$route.query.equipId); this.getAlarmCountByEquipId(this.$route.query.equipId);
this.getMaintenanceCountByEquipId(this.$route.query.equipId); this.getMaintenanceCountByEquipId(this.$route.query.equipId);
this.getAlarmDataTimeLineByEquipId(this.$route.query.equipId); this.getAlarmDataTimeLineByEquipId(this.$route.query.equipId);
this.getAllData(this.$route.query.equipId);
this.cascaderDisabled = true; this.cascaderDisabled = true;
}else { } else {
this.options.every(item => { this.options.every((item) => {
if (item.disabled === false) { if (item.disabled === false) {
this.cascaderValue = item.children[0].id; this.cascaderValue = item.children[0].id;
this.getEquipDetails(item.children[0].id); this.getEquipDetails(item.children[0].id);
this.getAlarmCountByEquipId(item.children[0].id); this.getAlarmCountByEquipId(item.children[0].id);
this.getMaintenanceCountByEquipId(item.children[0].id); this.getMaintenanceCountByEquipId(item.children[0].id);
this.getAlarmDataTimeLineByEquipId(item.children[0].id); this.getAlarmDataTimeLineByEquipId(item.children[0].id);
this.getAllData(item.children[0].id);
this.cascaderDisabled = false; this.cascaderDisabled = false;
return false; return false;
} }
}) });
} }
}) });
}, },
// //
getMaintenanceCountByEquipId(equipId){ getMaintenanceCountByEquipId(equipId) {
getMaintenanceCountByEquipId(equipId).then(res=>{ getMaintenanceCountByEquipId(equipId).then((res) => {
this.faultTimes = res.data; this.faultTimes = res.data;
}) });
}, },
// //
getAlarmCountByEquipId(equipId){ getAlarmCountByEquipId(equipId) {
getAlarmCountByEquipId(equipId).then(res=>{ getAlarmCountByEquipId(equipId).then((res) => {
this.alarmTimes = res.data; this.alarmTimes = res.data;
}) });
}, },
// //
getAlarmDataTimeLineByEquipId(equipId){ getAlarmDataTimeLineByEquipId(equipId) {
getAlarmDataTimeLineByEquipId(equipId).then(res=>{ getAlarmDataTimeLineByEquipId(equipId).then((res) => {
this.timeLineList = res.data; 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) { getEquipDetails(id) {
getEquipInfoDetails(id).then(res => { getEquipInfoDetails(id).then((res) => {
console.log("res.data",res.data); console.log("res.data", res.data);
this.equipInfo = res.data; this.equipInfo = res.data;
this.techParamsList = res.data.paramList; this.techParamsList = res.data.paramList;
}) });
}, },
async getEquipAlarmList() { async getEquipAlarmList() {
var equipAlarmQuery = { var equipAlarmQuery = {
@ -448,12 +588,13 @@ export default {
this.equipAlarmList = res.data.list; this.equipAlarmList = res.data.list;
}, },
handleChange(value) { handleChange(value) {
if (value.length > 0){ if (value.length > 0) {
this.getEquipDetails(value[1]) this.getEquipDetails(value[1]);
this.getAlarmCountByEquipId(value[1]); this.getAlarmCountByEquipId(value[1]);
this.getMaintenanceCountByEquipId(value[1]); this.getMaintenanceCountByEquipId(value[1]);
this.getAlarmDataTimeLineByEquipId(value[1]); this.getAlarmDataTimeLineByEquipId(value[1]);
}else { this.getAllData(value[1]);
} else {
this.$message.error("请选择一个设备"); this.$message.error("请选择一个设备");
} }
}, },
@ -482,8 +623,8 @@ export default {
this.generateGaugeOption({ this.generateGaugeOption({
color: ["26DE86", "93DDBA"], color: ["26DE86", "93DDBA"],
bgColor: "023E44", bgColor: "023E44",
name: "X轴排屑电流", name: "排屑1电流",
value: 70, value: this.currentData.chip_removal_1,
limit: 250, limit: 250,
unit: "A", unit: "A",
}), }),
@ -500,8 +641,8 @@ export default {
this.generateGaugeOption({ this.generateGaugeOption({
color: ["26AE86", "45678E"], color: ["26AE86", "45678E"],
bgColor: "AAAAA", bgColor: "AAAAA",
name: "y轴排屑电流", name: "排屑2电流",
value: 70, value: this.currentData.chip_removal_2,
limit: 250, limit: 250,
unit: "A", unit: "A",
}), }),
@ -518,8 +659,8 @@ export default {
this.generateGaugeOption({ this.generateGaugeOption({
color: ["B07709", "EDBA58"], color: ["B07709", "EDBA58"],
bgColor: "846528", bgColor: "846528",
name: "y轴振动熵值", name: "液压1",
value: 80, value: this.hyData.hy_1,
limit: 250, limit: 250,
unit: "G/S", unit: "G/S",
}), }),
@ -536,8 +677,8 @@ export default {
this.generateGaugeOption({ this.generateGaugeOption({
color: ["707709", "7DBA58"], color: ["707709", "7DBA58"],
bgColor: "A46528", bgColor: "A46528",
name: "Y轴脉冲指数", name: "液压2",
value: 125, value: this.hyData.hy_2,
limit: 250, limit: 250,
unit: "GS", unit: "GS",
}), }),
@ -554,8 +695,8 @@ export default {
this.generateGaugeOption({ this.generateGaugeOption({
color: ["FA604C", "F63319"], color: ["FA604C", "F63319"],
bgColor: "C51D07", bgColor: "C51D07",
name: "x轴润滑液压", name: "液压3",
value: 125, value: this.hyData.hy_3,
limit: 250, limit: 250,
unit: "bar", unit: "bar",
}), }),
@ -566,56 +707,88 @@ export default {
this.echarts5 && this.echarts5.resize(); this.echarts5 && this.echarts5.resize();
}); });
const yrhyy = document.getElementById("yrhyy"); // const yrhyy = document.getElementById("yrhyy");
this.echarts6 = echarts.init(yrhyy); // this.echarts6 = echarts.init(yrhyy);
this.echarts6.setOption( // this.echarts6.setOption(
this.generateGaugeOption({ // this.generateGaugeOption({
color: ["E5F72E", "BFD109"], // color: ["E5F72E", "BFD109"],
bgColor: "A5B505", // bgColor: "A5B505",
name: "y轴润滑液压", // name: "y",
value: 103, // value: 103,
limit: 250, // limit: 250,
unit: "bar", // unit: "bar",
}), // }),
true, // true,
true // true
); // );
window.addEventListener("resize", () => { // window.addEventListener("resize", () => {
this.echarts6 && this.echarts6.resize(); // this.echarts6 && this.echarts6.resize();
}); // });
const zrhyy = document.getElementById("zrhyy"); // const zrhyy = document.getElementById("zrhyy");
this.echarts7 = echarts.init(zrhyy); // this.echarts7 = echarts.init(zrhyy);
this.echarts7.setOption( // this.echarts7.setOption(
this.generateGaugeOption({ // this.generateGaugeOption({
color: ["E5F72E", "BFD109"], // color: ["E5F72E", "BFD109"],
bgColor: "A5B505", // bgColor: "A5B505",
name: "z轴润滑液压", // name: "z",
value: 99, // value: 99,
limit: 250, // limit: 250,
unit: "bar", // unit: "bar",
}), // }),
true, // true,
true // true
); // );
window.addEventListener("resize", () => { // window.addEventListener("resize", () => {
this.echarts7 && this.echarts7.resize(); // this.echarts7 && this.echarts7.resize();
}); // });
}, },
initTempCharts() { initTempCharts() {
// domecharts // domecharts
var myChart1 = echarts.init(document.getElementById("xzzcwd")); var myChart1 = echarts.init(document.getElementById("xptemp"));
var option1 = this.tempOption(20.3); var option1 = this.tempOption(this.tempData.xp_temp);
myChart1.setOption(option1); myChart1.setOption(option1);
var myChart2 = echarts.init(document.getElementById("yzzcwd")); var myChart2 = echarts.init(document.getElementById("xntemp"));
var option2 = this.tempOption(50.5); var option2 = this.tempOption(this.tempData.xn_temp);
myChart2.setOption(option2); myChart2.setOption(option2);
var myChart3 = echarts.init(document.getElementById("zzzcwd")); var myChart3 = echarts.init(document.getElementById("x0temp"));
var option3 = this.tempOption(65.5); var option3 = this.tempOption(this.tempData.x0_temp);
myChart3.setOption(option3); 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) { tempOption(data) {
@ -688,7 +861,7 @@ export default {
// 06010 // 06010
var option = { var option = {
grid: { grid: {
x: 90, //y x: 65, //y
y: -150, //topx y: -150, //topx
x2: -120, //y x2: -120, //y
y2: 20, //bottomx y2: 20, //bottomx
@ -902,7 +1075,7 @@ export default {
center: ["50%", "60%"], center: ["50%", "60%"],
startAngle: 220, startAngle: 220,
endAngle: -40, endAngle: -40,
min: 0, min: -10,
max: option.limit, max: option.limit,
splitNumber: 12, splitNumber: 12,
progress: { progress: {
@ -1236,7 +1409,7 @@ $bordercolor: #ddd;
} }
.main-content { .main-content {
display: grid; 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") background: url("../../../../assets/images/equipdetails/middle_back.png")
no-repeat center center; no-repeat center center;
background-size: cover; background-size: cover;