Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
c59fc08c5f
@ -98,8 +98,10 @@
|
||||
</div>
|
||||
<div class="realTable">
|
||||
<el-table height="100%" :data="tableData">
|
||||
<template v-for="(item,index) in tableColumn">
|
||||
<el-table-column :prop="item.prop" :label="item.label" />
|
||||
<template v-for="item in tableColumn">
|
||||
<el-table-column :prop="item.prop" :label="item.label" :align="item.align" />
|
||||
<!-- <el-table-column v-if="item.custom === 'default'" :prop="item.prop" :label="item.label" :align="item.align" />
|
||||
<el-table-column v-if="item.custom === 'header'" :prop="item.prop" :label="item.label+item.unit" :align="item.align" />-->
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
@ -109,7 +111,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import {Crop,Download,Top,Bottom} from '@element-plus/icons-vue'
|
||||
import {onMounted, onUnmounted, reactive, ref, watch,computed} from 'vue'
|
||||
import {onMounted, onUnmounted, reactive, ref, watch,computed,nextTick} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {equipList,getModelAttributeList,getsnapshotData} from "/@/api/backend/realData/request.ts";
|
||||
|
||||
@ -117,70 +119,107 @@ const tableData = ref()
|
||||
const tableItem0: any = [
|
||||
{
|
||||
label: '风机列表',
|
||||
unit:' ',
|
||||
prop: 'code',
|
||||
align: 'center',
|
||||
},
|
||||
custom: 'default',
|
||||
name:''
|
||||
}]
|
||||
const tableItem1: any = [
|
||||
{
|
||||
label: '风速 (m/s)',
|
||||
unit:' (m/s)',
|
||||
prop: 'iwindspeed',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iWindSpeed',
|
||||
title: '风速'
|
||||
},
|
||||
{
|
||||
label: '有功功率 (MW)',
|
||||
unit:' (MW)',
|
||||
prop: 'igenpower',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iGenPower',
|
||||
title: '有功功率'
|
||||
},
|
||||
{
|
||||
label: '日发电量 (kWh)',
|
||||
unit:' (kWh)',
|
||||
prop: 'ikwhthisday',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iKWhThisDay',
|
||||
title: '日发电量'
|
||||
},
|
||||
{
|
||||
label: '总发电量 (万kWh)',
|
||||
unit:' (万kWh)',
|
||||
prop: 'ikwhoverall',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iKWhOverall',
|
||||
title: '总发电量'
|
||||
},
|
||||
{
|
||||
label: '机舱角度',
|
||||
unit:'',
|
||||
prop: 'ivanedirection',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iVaneDirection',
|
||||
title: '机舱角度'
|
||||
},
|
||||
{
|
||||
label: '叶轮转速 (rmp)',
|
||||
unit:' (rmp)',
|
||||
prop: 'irotorspeed',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iRotorSpeed',
|
||||
title: '叶轮转速'
|
||||
},
|
||||
{
|
||||
label: '发电机转速 (rmp)',
|
||||
unit:' (rmp)',
|
||||
prop: 'igenspeed',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iGenSpeed',
|
||||
title: '发电机转速'
|
||||
},
|
||||
{
|
||||
label: '机舱温度 (℃)',
|
||||
unit:' (℃)',
|
||||
prop: 'itempnacelle_1sec',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iItemPnAcelle_1Sec',
|
||||
title: '机舱温度'
|
||||
},
|
||||
{
|
||||
label: '主油路压力 (kpa)',
|
||||
unit:' (kpa)',
|
||||
prop: 'ihydrpress',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iHydrPress',
|
||||
title: '主油路压力'
|
||||
},
|
||||
{
|
||||
label: '变桨角度',
|
||||
unit:' ',
|
||||
//prop: 'ipitchangle1',
|
||||
prop: 'ipitchangle',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name:'iPitchAngle1',
|
||||
title: '变桨角度'
|
||||
}
|
||||
]
|
||||
const tableColumn=ref(
|
||||
tableItem0
|
||||
[...tableItem0,...tableItem1]
|
||||
)
|
||||
|
||||
const deviceList = ref()
|
||||
@ -198,46 +237,58 @@ const deviceQuery = (data: any) => {
|
||||
deviceList.value = res.data
|
||||
tableData.value = res.data
|
||||
iotModelId.value=res.data[0].iotModelId
|
||||
const deviceId=deviceList.value.map((item) => item.id);
|
||||
deviceId.forEach((item,index) => {
|
||||
objparms.deviceId=item
|
||||
objparms.attributes=tableColumn.value.map((item1)=>item1.prop)
|
||||
snapshotParms.push({...objparms})
|
||||
})
|
||||
getsnapshotData(snapshotParms).then((res) => {
|
||||
if (res.code == 200) {
|
||||
const tsnapshotVoObject: any = res.data;
|
||||
const tsnapshotVoMap = new Map(Object.entries(tsnapshotVoObject));
|
||||
const updatedTableData = tableColumn.value.reduce((acc, item1) => {
|
||||
acc.forEach((item, i) => {
|
||||
const itemKey = item.id;
|
||||
if (tsnapshotVoMap.has(itemKey)) {
|
||||
const tsnapshotVoItem = tsnapshotVoMap.get(itemKey);
|
||||
//const attributeCodeLower = item1.attributeCode?.toLowerCase();
|
||||
const attributeCodeLower = item1.prop;
|
||||
if(attributeCodeLower!='code'){
|
||||
if (attributeCodeLower) {
|
||||
const value = tsnapshotVoItem[attributeCodeLower];
|
||||
const formattedValue = value !== undefined ? (value % 1 === 0 ? value : value.toFixed(3)) : '-';
|
||||
acc[i] = { ...item, [attributeCodeLower]: formattedValue };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return acc;
|
||||
}, [...tableData.value]);
|
||||
tableData.value = updatedTableData;
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
})
|
||||
defaultdeviceQuery()
|
||||
})
|
||||
}
|
||||
const defaultdeviceQuery = () => {
|
||||
const deviceId=deviceList.value.map((item) => item.id);
|
||||
let attributesCode:any[]=[]
|
||||
deviceId.forEach((item,index) => {
|
||||
objparms.deviceId=item
|
||||
attributesCode=tableColumn.value.map((item1)=>item1.prop)
|
||||
attributesCode.push('iPitchAngle1','iPitchAngle2', 'iPitchAngle3')
|
||||
objparms.attributes=attributesCode
|
||||
snapshotParms.push({...objparms})
|
||||
})
|
||||
getsnapshotData(snapshotParms).then((res) => {
|
||||
if (res.code == 200) {
|
||||
const tsnapshotVoObject: any = res.data;
|
||||
const tsnapshotVoMap = new Map(Object.entries(tsnapshotVoObject));
|
||||
const updatedTableData = tableColumn.value.reduce((acc, item1) => {
|
||||
acc.forEach((item, i) => {
|
||||
const itemKey = item.id;
|
||||
if (tsnapshotVoMap.has(itemKey)) {
|
||||
const tsnapshotVoItem = tsnapshotVoMap.get(itemKey);
|
||||
//const attributeCodeLower = item1.attributeCode?.toLowerCase();
|
||||
const attributeCodeLower = item1.prop;
|
||||
if(attributeCodeLower!='code'){
|
||||
if (attributeCodeLower) {
|
||||
const ipitchangle=Math.min(tsnapshotVoItem.ipitchangle1, tsnapshotVoItem.ipitchangle2, tsnapshotVoItem.ipitchangle3)
|
||||
let ipitchanglevalue;
|
||||
if(isNaN(ipitchangle)){
|
||||
ipitchanglevalue='-'
|
||||
}else{
|
||||
ipitchanglevalue=ipitchangle !== undefined ? (ipitchangle % 1 === 0 ? ipitchangle : ipitchangle.toFixed(3)) : '-';
|
||||
}
|
||||
const value=tsnapshotVoItem[attributeCodeLower];
|
||||
const formattedValue = value !== undefined ? (value % 1 === 0 ? value : value.toFixed(3)) : '-';
|
||||
acc[i] = { ...item, [attributeCodeLower]: formattedValue,ipitchangle:ipitchanglevalue};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return acc;
|
||||
}, [...tableData.value]);
|
||||
tableData.value = updatedTableData;
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const queryListData = reactive({
|
||||
pageSize: 20,
|
||||
pageNum: 1,
|
||||
@ -276,6 +327,30 @@ interface TableType {
|
||||
|
||||
}
|
||||
|
||||
const selectList=ref([])
|
||||
const getSel = () => {
|
||||
debugger
|
||||
selectList.value=[]
|
||||
tableColumn.value.forEach(item => {
|
||||
if (item.prop) {
|
||||
if(item.prop!='code'){
|
||||
selectList.value.push({
|
||||
attributeName: item.title,
|
||||
attributeCode: item.name,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//tableRef.value.clearSelection()
|
||||
if (selectList.value.length > 0) {
|
||||
//setTimeout(()=>{
|
||||
selectList.value.forEach((item1, index1) => {
|
||||
tableRef.value.toggleRowSelection(item1, true);
|
||||
});
|
||||
//},0)
|
||||
}
|
||||
};
|
||||
const tableRef=ref()
|
||||
const multipleSelection = ref<TableType[]>([])
|
||||
const Statistic = computed(() => multipleSelection.value.length)
|
||||
@ -284,15 +359,29 @@ const selectTable = (selected: TableType[] | null) => {
|
||||
console.error('Selected is null or undefined')
|
||||
return
|
||||
}
|
||||
multipleSelection.value = selected
|
||||
if (Array.isArray(selected) && Array.isArray(multipleSelection.value)) {
|
||||
const selectedAttributeCodes = new Set(selected.map(item => item?.attributeCode));
|
||||
multipleSelection.value = multipleSelection.value.filter(item => selectedAttributeCodes.has(item?.attributeCode));
|
||||
selected.forEach((item, index) => {
|
||||
if (!multipleSelection.value.some(item1 => item1.attributeCode === item.attributeCode)) {
|
||||
multipleSelection.value.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
//multipleSelection.value = selected
|
||||
}
|
||||
const getRowKey = (row) => row.id;
|
||||
//const getRowKey = (row) => row.id;
|
||||
const getRowKey = (row) => row.attributeCode;
|
||||
const visible = ref(false)
|
||||
const openMeasure=() =>{
|
||||
visible.value=true
|
||||
queryListData.iotModelId=iotModelId.value
|
||||
queryListData.attributeType=radioActiveName.value
|
||||
modelAttributeList(queryListData)
|
||||
nextTick(() => {
|
||||
//tableRef.value.clearSelection()
|
||||
getSel()
|
||||
})
|
||||
}
|
||||
|
||||
const moveUp = (index:number) => {
|
||||
@ -333,8 +422,8 @@ watch(autoUpdate, (newVal: boolean) => {
|
||||
if (autoUpdateInterval.value) return
|
||||
ElMessage.success('开启自动刷新')
|
||||
autoUpdateInterval.value = setInterval(() => {
|
||||
deviceQuery(devicelistData)
|
||||
getTableData()
|
||||
defaultdeviceQuery()
|
||||
//getTableData()
|
||||
}, 2000)
|
||||
} else {
|
||||
ElMessage.warning('关闭自动刷新')
|
||||
@ -344,6 +433,7 @@ watch(autoUpdate, (newVal: boolean) => {
|
||||
})
|
||||
|
||||
const currentPage = ref(1)
|
||||
//const currentPageSize = ref(20)
|
||||
const currentPageSize = ref(20)
|
||||
const pageTotal = ref(0)
|
||||
const pagePagination = ref([20, 50, 100])
|
||||
@ -364,14 +454,8 @@ const selectcurrentPage = ref(1)
|
||||
const selectcurrentPageSize = ref(10)
|
||||
const selectpageTotal = ref(0)
|
||||
const selecthandleSizeChange = (val: number) => {
|
||||
/*queryListData.pageSize = val
|
||||
queryListData.iotModelId=iotModelId.value
|
||||
modelAttributeList(queryListData)*/
|
||||
}
|
||||
const selecthandleCurrentChange = (val: number) => {
|
||||
/*queryListData.pageNum = val
|
||||
queryListData.iotModelId=iotModelId.value
|
||||
modelAttributeList(queryListData)*/
|
||||
}
|
||||
|
||||
|
||||
@ -388,6 +472,7 @@ const objparms = reactive({
|
||||
|
||||
|
||||
const getTableData = () => {
|
||||
debugger
|
||||
const deviceId=deviceList.value.map((item) => item.id);
|
||||
const tableColumnEnds = ref([]);
|
||||
const tableColumnup = ref([]);
|
||||
@ -397,8 +482,10 @@ const getTableData = () => {
|
||||
tableColumnMap.set(item1.prop, item1);
|
||||
tableColumnup.value.push({
|
||||
label: item1.label,
|
||||
unit:item1.unit,
|
||||
prop: item1.prop,
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -408,16 +495,32 @@ const getTableData = () => {
|
||||
multipleSelection.value.forEach(item => {
|
||||
if (item.attributeCode) {
|
||||
const attributeCodeLower = item.attributeCode.toLowerCase();
|
||||
if (!tableColumnMap.has(attributeCodeLower)) {
|
||||
//if (!tableColumnMap.has(attributeCodeLower)) {
|
||||
if(attributeCodeLower==='ipitchangle1'||attributeCodeLower==='ipitchangle2'||attributeCodeLower==='ipitchangle3'){
|
||||
tableColumnEnds.value.push({
|
||||
label: '变桨角度',
|
||||
unit:'',
|
||||
prop: 'ipitchangle',
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
});
|
||||
}else{
|
||||
tableColumnEnds.value.push({
|
||||
label: item.attributeName+'\n'+item.unit,
|
||||
unit:item.unit,
|
||||
prop: attributeCodeLower,
|
||||
align: 'center',
|
||||
custom: 'header',
|
||||
name: item.attributeCode,
|
||||
title: item.attributeName,
|
||||
});
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
});
|
||||
tableColumn.value = [...tableColumnup.value, ...tableColumnEnds.value];
|
||||
tableColumn.value = [...tableItem0, ...tableColumnEnds.value];
|
||||
//tableColumn.value = [...tableColumnup.value, ...tableColumnEnds.value];
|
||||
}
|
||||
|
||||
|
||||
@ -435,9 +538,17 @@ const getTableData = () => {
|
||||
for (const itemKey in tsnapshotVoObject) {
|
||||
if (item.id === itemKey) {
|
||||
const attributeCodeLower = item1.attributeCode?.toLowerCase();
|
||||
const ipitchangle='';
|
||||
const ipitchangle1=Math.min(item1.ipitchangle1, item1.ipitchangle2, item1.ipitchangle3)
|
||||
let ipitchanglevalue;
|
||||
if(isNaN(ipitchangle1)){
|
||||
ipitchanglevalue='-'
|
||||
}else{
|
||||
ipitchanglevalue=ipitchangle1 !== undefined ? (ipitchangle1 % 1 === 0 ? ipitchangle1 : ipitchangle1.toFixed(3)) : '-';
|
||||
}
|
||||
const value = tsnapshotVoObject[itemKey]?.[attributeCodeLower];
|
||||
const formattedValue =value ? (value % 1 === 0 ? value : value.toFixed(3)) : '-';
|
||||
arr[i] = { ...item, [attributeCodeLower]: formattedValue };
|
||||
arr[i] = { ...item, [attributeCodeLower]: formattedValue,[ipitchangle]: ipitchanglevalue};
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -456,6 +567,7 @@ const sureBtn = (done: () => void) => {
|
||||
visible.value = false
|
||||
}
|
||||
const downFun=(tableColumn,tableData)=>{
|
||||
debugger
|
||||
const itemsWithoutAge = tableData.map(item => {
|
||||
const { id, belongLine, iotModelId, location,madeinFactory,model,name,nominalCapacity,objectType,parentEquipmentId,remarks,standard,...rest } = item;
|
||||
return rest;
|
||||
@ -489,11 +601,14 @@ const downFun=(tableColumn,tableData)=>{
|
||||
onUnmounted(() => {
|
||||
autoUpdateInterval.value && clearInterval(autoUpdateInterval.value)
|
||||
autoUpdateInterval.value = null
|
||||
//selectList.value=[]
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
deviceQuery(devicelistData)
|
||||
//queryListData.pageSize=200
|
||||
modelAttributeList(queryListData)
|
||||
//tableRef.value.toggleRowSelection(modalTbleData.value[0], true);
|
||||
})
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user