Commit 84432966 authored by hubaoshan's avatar hubaoshan

循环泵页面 问题 删除了所有页面的getSupplys()方法

parent 103c1b63
...@@ -89,12 +89,6 @@ function getDataByParams(){ ...@@ -89,12 +89,6 @@ function getDataByParams(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
// function getName(name) {
// if (AlarmData && AlarmData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
function getDataNew(item) { function getDataNew(item) {
getMoveListAlarmNewData(item).then(res => { getMoveListAlarmNewData(item).then(res => {
...@@ -104,65 +98,6 @@ function getDataNew(item) { ...@@ -104,65 +98,6 @@ function getDataNew(item) {
}) })
} }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -85,12 +85,6 @@ function getDataByParams(){ ...@@ -85,12 +85,6 @@ function getDataByParams(){
historyPage.rows = res.pageSize historyPage.rows = res.pageSize
}) })
} }
// function getName(name) {
// if (HistoryData && HistoryData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
function getDataNew(item) { function getDataNew(item) {
getMoveListHistoryData(item).then(res => { getMoveListHistoryData(item).then(res => {
...@@ -100,65 +94,6 @@ function getDataNew(item) { ...@@ -100,65 +94,6 @@ function getDataNew(item) {
}) })
} }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -88,12 +88,6 @@ function getData(){ ...@@ -88,12 +88,6 @@ function getData(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
// function getName(name) {
// if (data && data.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
function getDataNew(item) { function getDataNew(item) {
getMoveListNewData(item).then(res => { getMoveListNewData(item).then(res => {
...@@ -103,65 +97,6 @@ function getDataNew(item) { ...@@ -103,65 +97,6 @@ function getDataNew(item) {
}) })
} }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -80,60 +80,6 @@ function getDataByParams(){ ...@@ -80,60 +80,6 @@ function getDataByParams(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
// function getName(name){
// if(AlarmData && AlarmData.value.length > 0 && name !== undefined && options && options.value.length>0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
getEnterprise();
function getEnterprise(){
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys(){
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element=>{
let allItems = []
if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949"){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
});
});
})
}else{
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -91,72 +91,6 @@ function getDataByParams() { ...@@ -91,72 +91,6 @@ function getDataByParams() {
}) })
} }
// function getName(name) {
// if (HistoryData && HistoryData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -88,14 +88,6 @@ function getDataByParams() { ...@@ -88,14 +88,6 @@ function getDataByParams() {
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
// function getName(name) {
// if (data && data.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
const enterpriseId = ref(); const enterpriseId = ref();
const loading = ref(true); const loading = ref(true);
watch( watch(
...@@ -107,65 +99,6 @@ watch( ...@@ -107,65 +99,6 @@ watch(
} }
) )
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -75,12 +75,6 @@ function getDataByParams(){ ...@@ -75,12 +75,6 @@ function getDataByParams(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
function getName(name) {
if (TransTempAlarmData && TransTempAlarmData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
const option = options.value.find(item => item.stationId === name);
return option.stationName
}
}
function getDataNew(item) { function getDataNew(item) {
getRecycleListAlarmData(item).then(res => { getRecycleListAlarmData(item).then(res => {
...@@ -90,65 +84,21 @@ function getDataNew(item) { ...@@ -90,65 +84,21 @@ function getDataNew(item) {
}) })
} }
getEnterprise(); defineExpose({
getData
function getEnterprise() { });
const result = store.getters.getEnterprise(); // 处理排序事件
if (result) { const handleSortChange = (column, prop, order) => {
enterpriseId.value = result[0].enterpriseId; params.value.sortBy = prop;
} params.value.sortOrder = order === 'ascending' ? 'asc' : 'desc';
} if((Object.keys(params.value).length === 2 && params.value.constructor === Object)){
getData()
//获取换热机组列表 console.log('空对象')
function getSupplys() { }else{
loading.value = true; getDataByParams();
// tableData.length = 0; console.log('非空对象')
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
} }
} };
getSupplys()
</script> </script>
<template> <template>
...@@ -162,30 +112,31 @@ getSupplys() ...@@ -162,30 +112,31 @@ getSupplys()
height="calc(86vh - 170px)" height="calc(86vh - 170px)"
:header-cell-class-name="tableHeaderClass" :header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass" :row-class-name="tableBodyClass"
@sort-change="handleSortChange"
> >
<el-table-column type="index" label="序号" align="center" width="100"/> <el-table-column type="index" label="序号" align="center" width="100"/>
<el-table-column prop="stationId" label="换热站" align="center" sortable> <el-table-column prop="stationName" label="换热站" align="center" sortable>
<template #default="scope"> <template #default="scope">
<span>{{getName(scope.row.stationId) || '-' }}</span> <span>{{scope.row.stationName || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="relateDeviceId" label="设备名称" align="center" sortable/> <el-table-column prop="srcName" label="设备名称" align="center" sortable/>
<el-table-column prop="eventTime" label="报警时间" align="center" width="180px" sortable/> <el-table-column prop="eventTime" label="报警时间" align="center" width="180px" sortable/>
<el-table-column prop="alarmType" align="center" label="报警类型"> <el-table-column prop="eventType" align="center" label="报警类型">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.alarmType=== '0'">最高温度</span> <span v-if="scope.row.eventType=== 0">最高温度</span>
<span v-else-if="scope.row.alarmType=== '1'">最低温度</span> <span v-else-if="scope.row.eventType=== 1">最低温度</span>
<span v-else-if="scope.row.alarmType=== '2'">平均温度</span> <span v-else-if="scope.row.eventType=== 2">平均温度</span>
<span v-else-if="scope.row.alarmType=== '3'">温差</span> <span v-else-if="scope.row.eventType=== 3">温差</span>
<span v-else-if="scope.row.alarmType=== '4'">温度突升</span> <span v-else-if="scope.row.eventType=== 4">温度突升</span>
<span v-else-if="scope.row.alarmType=== '5'">温度突降</span> <span v-else-if="scope.row.eventType=== 5">温度突降</span>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="handleStatus" align="center" label="处理状态"> <el-table-column prop="handleStatus" align="center" label="处理状态">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.handleStatus=== '0'" style="color: red">未处理</span> <span v-if="scope.row.handleStatus=== 0" style="color: red">未处理</span>
<span v-else-if="scope.row.handleStatus=== '1'">已处理</span> <span v-else-if="scope.row.handleStatus=== 1">已处理</span>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
......
...@@ -82,11 +82,17 @@ async function fetchAudioStream() { ...@@ -82,11 +82,17 @@ async function fetchAudioStream() {
return response.arrayBuffer(); // 或 response.blob() 取决于返回的流类型 return response.arrayBuffer(); // 或 response.blob() 取决于返回的流类型
} }
// 初始化时选中第一行 // 初始化时选中第一行
onMounted(() => { // 初始化时选中第一行
if (RecyclePumpData.value.length > 0) { watch(
selectRow(RecyclePumpData.value[0], 0); ()=>RecyclePumpData.value,
} ()=>{
}); if (RecyclePumpData.value.length > 0) {
selectRow(RecyclePumpData.value[0], 0);
}else{
console.log('没有数据')
}
}
)
//子组件接收父组件传递过来的值 //子组件接收父组件传递过来的值
const props = defineProps({ const props = defineProps({
queryParams: { queryParams: {
...@@ -129,12 +135,6 @@ function getDataByParams(){ ...@@ -129,12 +135,6 @@ function getDataByParams(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
function getName(name) {
if (RecyclePumpData && RecyclePumpData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
const option = options.value.find(item => item.stationId === name);
return option.stationName
}
}
function getDataNew(item) { function getDataNew(item) {
getRecycleListHistoryData(item).then(res => { getRecycleListHistoryData(item).then(res => {
...@@ -143,66 +143,21 @@ function getDataNew(item) { ...@@ -143,66 +143,21 @@ function getDataNew(item) {
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
// 处理排序事件
getEnterprise(); const handleSortChange = (column, prop, order) => {
params.value.sortBy = prop;
function getEnterprise() { params.value.sortOrder = order === 'ascending' ? 'asc' : 'desc';
const result = store.getters.getEnterprise(); if((Object.keys(params.value).length === 2 && params.value.constructor === Object)){
if (result) { getData()
enterpriseId.value = result[0].enterpriseId; console.log('空对象')
} }else{
} getDataByParams();
console.log('非空对象')
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
} }
} };
defineExpose({
getSupplys() getData
});
</script> </script>
<template> <template>
...@@ -217,11 +172,12 @@ getSupplys() ...@@ -217,11 +172,12 @@ getSupplys()
:header-cell-class-name="tableHeaderClass" :header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass" :row-class-name="tableBodyClass"
@row-click="selectRow" @row-click="selectRow"
@sort-change="handleSortChange"
> >
<el-table-column type="index" label="序号" align="center" width="100"/> <el-table-column type="index" label="序号" align="center" width="100"/>
<el-table-column prop="stationId" align="center" label="换热站" sortable> <el-table-column prop="stationName" align="center" label="换热站" sortable>
<template #default="scope"> <template #default="scope">
<span>{{getName(scope.row.stationId || '-' )}}</span> <span>{{scope.row.stationName || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="deviceName" align="center" label="设备名称" sortable/> <el-table-column prop="deviceName" align="center" label="设备名称" sortable/>
...@@ -245,7 +201,7 @@ getSupplys() ...@@ -245,7 +201,7 @@ getSupplys()
<el-col :span="12"> <el-col :span="12">
<div class="details-item"> <div class="details-item">
<span>换热站:</span> <span>换热站:</span>
<span>{{ selectedRow.stationId }}</span> <span>{{ selectedRow.stationName }}</span>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -265,13 +221,13 @@ getSupplys() ...@@ -265,13 +221,13 @@ getSupplys()
<el-col :span="12"> <el-col :span="12">
<div class="details-item"> <div class="details-item">
<span>告警状态:</span> <span>告警状态:</span>
<span>{{ selectedRow.alarmStatus }}</span> <span>{{ selectedRow.alarmStatus === '0'? '正常' : '异常' }}</span>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<div class="details-item"> <div class="details-item">
<span>波形图:</span> <span>波形图:</span>
<span>{{ selectedRow.audioUrl }}</span> <!-- <span>{{ selectedRow.audioUrl }}</span>-->
</div> </div>
<div ref="waveform" style="width: 800px; height: 150px;"></div> <div ref="waveform" style="width: 800px; height: 150px;"></div>
...@@ -279,7 +235,7 @@ getSupplys() ...@@ -279,7 +235,7 @@ getSupplys()
<span>音频:</span> <span>音频:</span>
<audio ref="audioPlayer" controls></audio> <audio ref="audioPlayer" controls></audio>
<button @click="playAudio">获取音频</button> <button @click="playAudio">获取音频</button>
<span>{{ selectedRow.audioUrl }}</span> <!-- <span>{{ selectedRow.audioUrl }}</span>-->
</div> </div>
</div> </div>
</div> </div>
......
...@@ -43,11 +43,16 @@ function selectRow(row) { ...@@ -43,11 +43,16 @@ function selectRow(row) {
} }
// 初始化时选中第一行 // 初始化时选中第一行
onMounted(() => { watch(
if (RecyclePumpData.value.length > 0) { ()=>RecyclePumpData.value,
selectRow(RecyclePumpData.value[0], 0); ()=>{
} if (RecyclePumpData.value.length > 0) {
}); selectRow(RecyclePumpData.value[0], 0);
}else{
console.log('没有数据')
}
}
)
//子组件接收父组件传递过来的值 //子组件接收父组件传递过来的值
const props = defineProps({ const props = defineProps({
queryParams: { queryParams: {
...@@ -66,7 +71,10 @@ watch( ...@@ -66,7 +71,10 @@ watch(
} }
) )
getData() // getData()
if(localStorage.getItem('AIToken')){
getData()
}
function getData(){ function getData(){
const item = reactive({ const item = reactive({
page: Page.page, page: Page.page,
...@@ -90,12 +98,6 @@ function getDataByParams(){ ...@@ -90,12 +98,6 @@ function getDataByParams(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
function getName(name) {
if (RecyclePumpData && RecyclePumpData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
const option = options.value.find(item => item.stationId === name);
return option.stationName
}
}
function getDataNew(item) { function getDataNew(item) {
getRecycleListNewData(item).then(res => { getRecycleListNewData(item).then(res => {
...@@ -105,65 +107,21 @@ function getDataNew(item) { ...@@ -105,65 +107,21 @@ function getDataNew(item) {
}) })
} }
getEnterprise(); // 处理排序事件
const handleSortChange = (column, prop, order) => {
function getEnterprise() { params.value.sortBy = prop;
const result = store.getters.getEnterprise(); params.value.sortOrder = order === 'ascending' ? 'asc' : 'desc';
if (result) { if((Object.keys(params.value).length === 2 && params.value.constructor === Object)){
enterpriseId.value = result[0].enterpriseId; getData()
} console.log('空对象')
} }else{
getDataByParams();
//获取换热机组列表 console.log('非空对象')
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
} }
} };
defineExpose({
getSupplys() getData
});
</script> </script>
<template> <template>
...@@ -178,11 +136,12 @@ getSupplys() ...@@ -178,11 +136,12 @@ getSupplys()
:header-cell-class-name="tableHeaderClass" :header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass" :row-class-name="tableBodyClass"
@row-click="selectRow" @row-click="selectRow"
@sort-change="handleSortChange"
> >
<el-table-column type="index" label="序号" align="center" width="100"/> <el-table-column type="index" label="序号" align="center" width="100"/>
<el-table-column prop="stationId" align="center" label="换热站" sortable> <el-table-column prop="stationName" align="center" label="换热站" sortable>
<template #default="scope"> <template #default="scope">
<span>{{getName(scope.row.stationId) || '-' }}</span> <span>{{scope.row.stationName || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="deviceName" align="center" label="设备名称" sortable/> <el-table-column prop="deviceName" align="center" label="设备名称" sortable/>
...@@ -206,7 +165,7 @@ getSupplys() ...@@ -206,7 +165,7 @@ getSupplys()
<el-col :span="12"> <el-col :span="12">
<div class="details-item"> <div class="details-item">
<span>换热站:</span> <span>换热站:</span>
<span>{{ selectedRow.stationId }}</span> <span>{{ selectedRow.stationName }}</span>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -226,17 +185,17 @@ getSupplys() ...@@ -226,17 +185,17 @@ getSupplys()
<el-col :span="12"> <el-col :span="12">
<div class="details-item"> <div class="details-item">
<span>告警状态:</span> <span>告警状态:</span>
<span>{{ selectedRow.alarmStatus }}</span> <span>{{ selectedRow.alarmStatus === '0'? '正常' : '异常' }}</span>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<div class="details-item"> <div class="details-item">
<span>波形图:</span> <span>波形图:</span>
<span>{{ selectedRow.audioUrl }}</span> <!-- <span>{{ selectedRow.audioUrl }}</span>-->
</div> </div>
<div class="details-item"> <div class="details-item">
<span>音频:</span> <span>音频:</span>
<span>{{ selectedRow.audioUrl }}</span> <!-- <span>{{ selectedRow.audioUrl }}</span>-->
</div> </div>
</div> </div>
</div> </div>
......
<script setup> <script setup>
import {getCurrentInstance, onMounted, reactive, ref} from 'vue' import {getCurrentInstance, onMounted, reactive, ref, watch} from 'vue'
import RecyclePumpNewDataPage from './RecyclePumpNewDataPage.vue' // 导入组件 import RecyclePumpNewDataPage from './RecyclePumpNewDataPage.vue' // 导入组件
import RecyclePumpHistoryPage from './RecyclePumpHistoryPage.vue' // 导入组件 import RecyclePumpHistoryPage from './RecyclePumpHistoryPage.vue' // 导入组件
import RecyclePumpAlarmPage from './RecyclePumpAlarmPage.vue' // 导入组件 import RecyclePumpAlarmPage from './RecyclePumpAlarmPage.vue' // 导入组件
...@@ -11,6 +11,8 @@ import { ...@@ -11,6 +11,8 @@ import {
exportRecyclePumpHistoryData, exportRecyclePumpHistoryData,
exportRecyclePumpAlarmData, exportRecyclePumpAlarmData,
} from "../../../api/AIStation/RecyclePump.js"; } from "../../../api/AIStation/RecyclePump.js";
import {handleGetAIToken} from "../AItoken.js";
import {useRoute} from "vue-router";
const {proxy} = getCurrentInstance(); const {proxy} = getCurrentInstance();
// 列表 // 列表
...@@ -106,6 +108,13 @@ const search = () => { ...@@ -106,6 +108,13 @@ const search = () => {
beginTime: queryParams.beginTime, beginTime: queryParams.beginTime,
endTime: queryParams.endTime, endTime: queryParams.endTime,
} }
if(item.alarmStatus === undefined || item.alarmType === undefined || item.beginTime == null || item.endTime == null || item.stationId === undefined){
item.alarmStatus = ''
item.endTime = ''
item.stationId = ''
item.beginTime = ''
item.alarmType = ''
}
if (selectedBtn.value === 1) { if (selectedBtn.value === 1) {
childParams.value = item childParams.value = item
} else if (selectedBtn.value === 2) { } else if (selectedBtn.value === 2) {
...@@ -115,7 +124,6 @@ const search = () => { ...@@ -115,7 +124,6 @@ const search = () => {
} }
console.log('查询:', item); console.log('查询:', item);
}; };
getNumber()
function getNumber() { function getNumber() {
getRecycleAlarmNumber().then(res => { getRecycleAlarmNumber().then(res => {
...@@ -185,7 +193,35 @@ const resetSearch = () => { ...@@ -185,7 +193,35 @@ const resetSearch = () => {
queryParams.alarmType = '' queryParams.alarmType = ''
queryParams.stationId = '' queryParams.stationId = ''
searchData.value = [] searchData.value = []
getData()
};
const childComponentRef = ref(null);
const getData = () => {
if (childComponentRef.value && childComponentRef.value.getData) {
console.log('能不能成功啊')
childComponentRef.value.getData(); // 调用子组件的 getData 方法
}
}; };
const route = useRoute()
watch(
() => route.path, // 只监听路径变化
() => {
if(route.path === '/AIStation/RecyclePump') {
// 路由变化,执行相应操作
handleGetAIToken();
// 轮询检测 localStorage 是否更新
const checkAIToken = setInterval(() => {
if (localStorage.getItem('AIToken')) {
clearInterval(checkAIToken); // 停止轮询
getNumber();
getData();
}
}, 100); // 每100ms检查一次
console.log('route.path', route.path)
}
},
{ immediate: true } // 只在路径变化时触发
)
const options = ref([]); const options = ref([]);
const enterpriseId = ref(); const enterpriseId = ref();
const props = {multiple: true, emitPath: false} const props = {multiple: true, emitPath: false}
...@@ -312,7 +348,7 @@ getSupplys(); ...@@ -312,7 +348,7 @@ getSupplys();
> >
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<component :is="selectedComponent" :queryParams='childParams'></component> <component :is="selectedComponent" ref="childComponentRef" :queryParams='childParams'></component>
</div> </div>
</div> </div>
......
...@@ -82,13 +82,6 @@ function getDataByParams() { ...@@ -82,13 +82,6 @@ function getDataByParams() {
}) })
} }
// function getName(name) {
// if (TransTempAlarmData && TransTempAlarmData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
function getDataNew(item) { function getDataNew(item) {
getTransListAlarmData(item).then(res => { getTransListAlarmData(item).then(res => {
TransTempAlarmData.value = res.rows TransTempAlarmData.value = res.rows
...@@ -96,66 +89,6 @@ function getDataNew(item) { ...@@ -96,66 +89,6 @@ function getDataNew(item) {
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -85,13 +85,6 @@ function getDataByParams() { ...@@ -85,13 +85,6 @@ function getDataByParams() {
}) })
} }
// function getName(name) {
// if (TransTempHistoryData && TransTempHistoryData.value.length > 0 && name !== undefined && options && options.value.length > 0) {
// const option = options.value.find(item => item.stationId === name);
// return option.stationName
// }
// }
function getDataNew(item) { function getDataNew(item) {
getTransListHistoryData(item).then(res => { getTransListHistoryData(item).then(res => {
TransTempHistoryData.value = res.rows TransTempHistoryData.value = res.rows
...@@ -100,65 +93,6 @@ function getDataNew(item) { ...@@ -100,65 +93,6 @@ function getDataNew(item) {
}) })
} }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
...@@ -99,65 +99,6 @@ function getDataNew(item) { ...@@ -99,65 +99,6 @@ function getDataNew(item) {
}) })
} }
getEnterprise();
function getEnterprise() {
const result = store.getters.getEnterprise();
if (result) {
enterpriseId.value = result[0].enterpriseId;
}
}
//获取换热机组列表
function getSupplys() {
loading.value = true;
// tableData.length = 0;
options.length = 0;
const result = store.getters.getEnterprise();
if (result) {
result.forEach(element => {
let allItems = []
if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9bca54bc-8f27-4849-8d7d-50c5099e1949") {
element.serviceCenterList.forEach(center => {//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if (unit.stationId === station.stationId) {
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId,
unitId: unitId
})
});
});
})
} else {
element.supplyList.forEach(element => {
element.stationList.forEach(station => {
allItems.push({
stationId: station.stationId,
stationName: station.stationName,
supplyId: station.supplyId
})
})
})
}
}
options.value = allItems;
});
}
}
getSupplys()
defineExpose({ defineExpose({
getData getData
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment