Commit bcd59b45 authored by hubaoshan's avatar hubaoshan

页面优化

parent f9e743d1
......@@ -127,8 +127,13 @@ function getToken () {
// return "";
// }
//console.log("token:" + store.getters.getToken());
const AIToken = localStorage.getItem('AIToken')
return AIToken;
if(localStorage.getItem('AIToken')) {
const AIToken = 'Bearer' + ' ' + localStorage.getItem('AIToken')
return AIToken;
}else {
return null
}
}
/*
......
......@@ -9,6 +9,10 @@ const data = ref([])
//子组件接收父组件传递过来的值
const props = defineProps({
searchData: {
type: Array,
required: true
},
queryParams: {
type: Object,
required: true
......@@ -75,18 +79,7 @@ function getDataByParams() {
Page.rows = res.pageSize
})
}
// const route = useRoute()
// watch(
// () => route.path, // 只监听路径变化
// () => {
// if(route.path === '/AIStation/ExtinguisherPage/ExtinguisherNewDataPage') {
// // 路由变化,执行相应操作
// handleGetAIToken();
// console.log('route.path',route.path)
// }
// },
// { immediate: true } // 只在路径变化时触发
// )
watch(
() => props.queryParams,
(newData) => {
......@@ -94,6 +87,15 @@ watch(
getDataNew(params.value)
}
)
watch(
() => props.searchData,
(newData) => {
console.log('ppppppppppp',props.searchData)
if(props.searchData.includes(1)){
getData()
}
},{ immediate: true }
) // TODO 等待后续优化
function getDataNew(item) {
getListNewData(item).then(res => {
......
......@@ -10,15 +10,18 @@ import {
getAlarmNumData,
exportNewExtinguisherData,
exportHistoryExtinguisherData,
exportExtinguisherAlarmData
exportExtinguisherAlarmData, getListNewData
} from "../../../api/AIStation/Extinguisher.js";
import {useRoute} from "vue-router";
const options = ref([]);
const enterpriseId = ref();
const props = {multiple: true, emitPath: false}
const dynamicComponent = ref(ExtinguisherNewDataPage);
// 初始化选中的标签页
onMounted(() => {
// selectedComponent.value
activeName.value = topBtn.value[0].component;
selectedBtn.value = topBtn.value[0].id;
getSupplys()
......@@ -40,7 +43,7 @@ const activeName = ref(ExtinguisherNewDataPage);
// 报警数量
const alarmNum = ref(0);
// 查询结果数据
const searchData = ref({});
const searchData = ref([]);
// 点击标签页切换事件
const handleTabClick = (tab, event) => {
console.log('id', tab)
......@@ -96,7 +99,7 @@ const search = () => {
}
console.log('查询:', item);
}
getNumber()
function getNumber() {
getAlarmNumData().then(res => {
......@@ -225,6 +228,47 @@ function getSupplys() {
});
}
}
const route = useRoute()
const number = ref(0)
watch(
() => route.path, // 只监听路径变化
() => {
if(route.path === '/AIStation/Extinguisher') {
// 路由变化,执行相应操作
handleGetAIToken();
number.value = 1
console.log('11111ppppppppppppp1',number.value)
getNumber()
console.log('route.path', route.path)
}
},
{ immediate: true } // 只在路径变化时触发
)
watch(
() => number.value,
() => {
console.log('0000000000000', number.value);
if (number.value === 1) {
console.log(']]]]]]]]]]]]]]]]]]]]]]');
searchData.value.push(1);
console.log('searchData.value', searchData.value)
}
},
{ immediate: true }
);
function ChildMethod() {
if (dynamicComponent) {
console.log('selectedComponent.value', dynamicComponent.value);
if (typeof dynamicComponent.value.getData === 'function') {
console.log('子组件方法存在,开始调用...');
dynamicComponent.value.getData();
} else {
console.error('子组件方法不存在');
}
}
}
</script>
<template>
<div class="app-content">
......@@ -286,7 +330,7 @@ function getSupplys() {
>
</el-tab-pane>
</el-tabs>
<component :is="selectedComponent" :queryParams='childParams'></component>
<component :is="selectedComponent" :queryParams='childParams' :search-data="searchData" ></component>
</div>
</div>
......
......@@ -154,7 +154,7 @@ getSupplys()
<span>{{getName(scope.row.stationId) || '-' }}</span>
</template>
</el-table-column>
<el-table-column prop="srcParentIndex" align="center" label="设施名称" sortable/>
<el-table-column prop="srcName" align="center" label="设施名称" sortable/>
<el-table-column prop="eventTime" align="center" label="报警时间" sortable/>
<el-table-column prop="thermalAlarmType" align="center" label="报警类型">
<template #default="scope">
......
......@@ -176,23 +176,23 @@ getSupplys()
<span>{{ getName(scope.row.stationId) || '-' }}</span>
</template>
</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="alarmLevel" align="center" label="报警等级">
<template #default="scope">
<span v-if="scope.row.alarmLevel=== '0'">预警</span>
<span v-else-if="scope.row.alarmLevel=== '1'">报警</span>
<span v-if="scope.row.alarmLevel=== 0">预警</span>
<span v-else-if="scope.row.alarmLevel=== 1">报警</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column prop="alarmType" align="center" label="报警类型">
<template #default="scope">
<span v-if="scope.row.alarmType=== '0'">最高温度</span>
<span v-else-if="scope.row.alarmType=== '1'">最低温度</span>
<span v-else-if="scope.row.alarmType=== '2'">平均温度</span>
<span v-else-if="scope.row.alarmType=== '3'">温差</span>
<span v-else-if="scope.row.alarmType=== '4'">温度突升</span>
<span v-else-if="scope.row.alarmType=== '5'">温度突降</span>
<span v-if="scope.row.alarmType=== 0">最高温度</span>
<span v-else-if="scope.row.alarmType=== 1">最低温度</span>
<span v-else-if="scope.row.alarmType=== 2">平均温度</span>
<span v-else-if="scope.row.alarmType=== 3">温差</span>
<span v-else-if="scope.row.alarmType=== 4">温度突升</span>
<span v-else-if="scope.row.alarmType=== 5">温度突降</span>
<span v-else>-</span>
</template>
</el-table-column>
......@@ -211,8 +211,8 @@ getSupplys()
</el-table-column>
<el-table-column prop="handleStatus" align="center" label="处理状态">
<template #default="scope">
<span v-if="scope.row.handleStatus=== '0'" style="color: red">未处理</span>
<span v-else-if="scope.row.handleStatus=== '1'">已处理</span>
<span v-if="scope.row.handleStatus=== 0" style="color: red">未处理</span>
<span v-else-if="scope.row.handleStatus=== 1">已处理</span>
<span v-else>-</span>
</template>
</el-table-column>
......
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