This commit is contained in:
trp
2023-12-30 13:24:04 +08:00
2 changed files with 204 additions and 168 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="manage-btn"> <div class="manage-btn">
<div v-for="(item,index) in btnList" :key="item.name" class="btn-box" @click="select(item,index)"> <div v-for="(item,index) in list" :key="item.name" class="btn-box" @click="select(item,index)">
<div :style="{ backgroundImage:'url(' +getImageUrl(item.icon)+')' }"></div> <div :style="{ backgroundImage:'url(' +getImageUrl(item.icon)+')' }"></div>
<div :class="{'select-active':selectButton===index}">{{ item.name }}</div> <div :class="{'select-active':selectButton===index}">{{ item.name }}</div>
</div> </div>
@@ -18,17 +18,17 @@ const props = defineProps({
default: [] default: []
}, },
}) })
watch(() => props.list, (now) => { // watch(() => props.list, (now) => {
let newArr=[] // let newArr=[]
btnList.value.forEach((btnList) => { // btnList.value.forEach((btnList) => {
now.forEach((item) => { // now.forEach((item) => {
if (btnList.route==item) { // if (btnList.route==item) {
newArr.push(btnList) // newArr.push(btnList)
} // }
}) // })
}) // })
btnList.value=newArr // btnList.value=newArr
}, {deep: true}); // }, {deep: true});
const emit = defineEmits(["update:modelValue", "select"]); const emit = defineEmits(["update:modelValue", "select"]);
const btnList = ref([ const btnList = ref([
{ {
@@ -56,6 +56,7 @@ const btnList = ref([
// name: '模拟仿真' // name: '模拟仿真'
// }, // },
]) ])
const newList=ref([])
const selectButton = ref(props.modelValue); const selectButton = ref(props.modelValue);
const getImageUrl = (name) => { const getImageUrl = (name) => {
return new URL(`../../assets/images/topAndDown/${name}`, import.meta.url).href return new URL(`../../assets/images/topAndDown/${name}`, import.meta.url).href

View File

@@ -106,6 +106,32 @@ const tunnelLength = ref(0);
const constructionLength = ref(0); const constructionLength = ref(0);
const routeList = ref([]); const routeList = ref([]);
let socket = reactive(""); let socket = reactive("");
const btnList = ref([
{
route: '/site',
icon: 'sp_icon_zdgl.png',
name: '站点管理'
},
{
route: '/tunnel',
icon: 'sp_icon_sdgl.png',
name: '隧道管理'
},
{
route: '/user',
icon: 'sp_icon_yhgl.png',
name: '用户管理'
},
// {
// route: '/system',
// icon: 'sp_icon_xtgl.png',
// name: '系统管理'
// },
// {
// icon: 'sp_icon_mngl.png',
// name: '模拟仿真'
// },
])
const serialNumber = ref("SC00DY00GH00ELBT"); const serialNumber = ref("SC00DY00GH00ELBT");
let token = getToken(); let token = getToken();
let send = { let send = {
@@ -126,7 +152,6 @@ onMounted(() => {
}); });
const getUser = () => { const getUser = () => {
getUserInfo().then(res => { getUserInfo().then(res => {
showMenu.value=true
currentUser.value = res.data.user.userName currentUser.value = res.data.user.userName
currentUserId.value = res.data.user.userId currentUserId.value = res.data.user.userId
}) })
@@ -140,7 +165,17 @@ const getDefaultSite = (siteId) => {
const getOtherInfo = () => { const getOtherInfo = () => {
getLargeScreenInfo().then((res) => { getLargeScreenInfo().then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
routeList.value = res.data.routeList let routeArr = [];
console.log(res.data.routeList,"res.data.routeList")
res.data.routeList.forEach((item, index) => {
for (let btn of btnList.value) {
if (item === btn.route){
routeArr.push(btn)
}
}
})
routeList.value = routeArr
showMenu.value = true
siteList.value = res.data.siteOption siteList.value = res.data.siteOption
currentSiteId.value = res.data.siteOption[res.data.siteOption.length - 1].value currentSiteId.value = res.data.siteOption[res.data.siteOption.length - 1].value
currentSite.value = res.data.siteOption[res.data.siteOption.length - 1].label currentSite.value = res.data.siteOption[res.data.siteOption.length - 1].label