Commit 80b1a6a1 authored by qjeslks's avatar qjeslks

报警提示报错和菜单搜索功能

parent 6955c08e
<template> <template>
<el-scrollbar> <el-scrollbar>
<div class="ams-el-menu"> <div class="ams-el-menu">
<!-- <div class="menu-search"> <div class="menu-search">
<el-select placement="bottom" v-model="searchValue" clearable filterable remote reserve-keyword <el-select placement="bottom" v-model="searchValue" clearable filterable
:placeholder="'请输入关键字搜索...'" :remote-method="remoteMethod" @change="selectChange" :loading="loading"> :placeholder="'请输入关键字搜索...'" @change="save(searchValue)">
<template #prefix><i class="el-icon-search"></i></template> <template #prefix><i class="el-icon-search"></i></template>
<el-option v-for="item in menus" :key="item.menuId" :label="item.menuName" :value="item.menuName" /> <el-option v-for="item in options" :key="item.menuId" :label="item.menuName" :value="item.navigateUrl" />
</el-select> </el-select>
</div> --> </div>
<el-menu unique-opened :collapse-transition='false' :collapse='$store.state.iscollapse' router :default-active="defaultActive" active-text-color="#409EFF" background-color="#32363f" text-color="#fff"> <el-menu unique-opened :collapse-transition='false' :collapse='$store.state.iscollapse' router :default-active="defaultActive" active-text-color="#409EFF" background-color="#32363f" text-color="#fff">
<!-- 一级菜单 --> <!-- 一级菜单 -->
...@@ -78,15 +78,29 @@ ...@@ -78,15 +78,29 @@
import { import {
Menu as IconMenu Menu as IconMenu
} from '@element-plus/icons-vue' } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router';
// const searchValue = ref(''); const searchValue = ref();
// const proxy = getCurrentInstance(); const router = useRouter();
// const props = defineProps(['meun', 'thisIndex']); const options = ref([]);
// const emit = defineEmits(['subEvent']);
// const options = ref([]);
// const loading = ref(false);
const store = useStore() const store = useStore()
setTimeout(() => {
getoptions(); // 调用你的函数
}, 2000);
function getoptions(){
var menus = store.state.menus;
for(let i = 0;i < 100;i++){
if(menus[i] === undefined)break;
for(let j = 0;j < 100;j++){
if(menus[i].childs[j] === undefined)break;
options.value.push(menus[i].childs[j])
}
}
console.log(options.value)
}
//定义默认展开 //定义默认展开
let defaultActive = ref('/home') let defaultActive = ref('/home')
...@@ -116,4 +130,10 @@ ...@@ -116,4 +130,10 @@
window.sessionStorage.setItem('activePath',path) window.sessionStorage.setItem('activePath',path)
} }
const save=(routePath)=>{
defaultActive.value=routePath
window.sessionStorage.setItem('activePath',routePath)
router.push({ path: routePath});
}
</script> </script>
\ No newline at end of file
...@@ -799,7 +799,7 @@ export default defineComponent({ ...@@ -799,7 +799,7 @@ export default defineComponent({
http http
.post("/api/alarm/GetAlarmMsg", AlarmInfo.value, false) .post("/api/alarm/GetAlarmMsg", AlarmInfo.value, false)
.then((result) => { .then((result) => {
if (result.data !== null && sta.value === 0) { if (result.data.lenth === 0 && sta.value === 0) {
sta.value = 1; sta.value = 1;
title.value = result.data[0].title; title.value = result.data[0].title;
msg.value = result.data[0].msg; msg.value = result.data[0].msg;
...@@ -832,7 +832,7 @@ export default defineComponent({ ...@@ -832,7 +832,7 @@ export default defineComponent({
} }
function countalarm() { function countalarm() {
http.post("/api/alarm/GetAlarmMsg", AlarmInfo.value).then((result) => { http.post("/api/alarm/GetAlarmMsg", AlarmInfo.value).then((result) => {
if (result.data !== null && consta.value === 0) { if (result.data.lenth === 0 && consta.value === 0) {
consta.value = 1; consta.value = 1;
counttitle.value = result.data[1].title; counttitle.value = result.data[1].title;
countmsg.value = result.data[1].msg; countmsg.value = result.data[1].msg;
......
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