diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index cc24f42..e2e813a 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -170,6 +170,7 @@ export default { this.$nextTick(() => { this.activeIndex = this.$route.path; // 通过他就可以监听到当前路由状态并激活当前菜单 console.log(this.activeIndex); + localStorage.setItem("menuActive", this.activeIndex); }); }, @@ -185,6 +186,7 @@ export default { }; const assetManagementSubs = []; // 用于存储资产管理子菜单的对象 const systemManagementSubs = []; // 用于存储系统管理子菜单的对象 + const weatherManagementSubs = []; // 用于存储系统管理子菜单的对象 const newArray = []; // 遍历原始数组,根据条件构建新数组 @@ -226,12 +228,26 @@ export default { index: "/" + index, title: processedDesc, }); + } else if (["weather", "icing"].includes(index)) { + // 如果包含用户列表等,则添加到系统管理子菜单 + weatherManagementSubs.push({ + index: "/" + index, + title: processedDesc, + }); } else { // 其他菜单项直接添加到新数组中 newArray.push({ icon, index: "/" + index, title: processedDesc }); } }); - + // 如果存在资产管理子菜单项,则添加资产管理菜单 + if (weatherManagementSubs.length > 0) { + newArray.push({ + icon: "iconfont icon-fubing", + index: "weatherIce", + title: "气象覆冰", + subs: weatherManagementSubs, + }); + } // 如果存在资产管理子菜单项,则添加资产管理菜单 if (assetManagementSubs.length > 0) { newArray.push({ diff --git a/src/utils/api/iceApi.js b/src/utils/api/iceApi.js index d9d346e..d31cb9d 100644 --- a/src/utils/api/iceApi.js +++ b/src/utils/api/iceApi.js @@ -8,10 +8,22 @@ export function getICEdyTreeList(data) { data, }); } -//气象相关的接口 -export function weatherLastJoggle(data) { +//查询附带天气 + +export function weatherJoggle(data) { + return request({ + url: "/xymanager/terminal/listWithWeather", + method: "get", + params: data, + headers: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + }, + }); +} +//查询天气列表 +export function weatherListJoggle(data) { return request({ - url: "/xymanager/weather/latest", + url: "/xymanager/weather/list", method: "get", params: data, headers: { @@ -19,11 +31,22 @@ export function weatherLastJoggle(data) { }, }); } +//查询附带覆冰拉力 -//获取数据接口 -export function getDataListJoggle(data) { +export function LeadPullJoggle(data) { + return request({ + url: "/xymanager/terminal/listWithLeadPull", + method: "get", + params: data, + headers: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + }, + }); +} +//查询覆冰拉力列表 +export function leadpullsListJoggle(data) { return request({ - url: "/xapi/query.php", + url: "/xymanager/leadpulls/list", method: "get", params: data, headers: { diff --git a/src/views/iceWeather/components/leftTree.vue b/src/views/iceWeather/components/leftTree.vue index 0dc9c5e..8f4fee6 100644 --- a/src/views/iceWeather/components/leftTree.vue +++ b/src/views/iceWeather/components/leftTree.vue @@ -97,7 +97,7 @@ export default { children: "list", label: "name", }, - currentData: {}, //当前选中的数据 + icecurrentData: {}, //当前选中的数据 currentNodekey: "", //默认选中的节点树, role: "", }; @@ -108,8 +108,8 @@ export default { }, }, created() { - // this.getLineTreeList(); //获取树状图 - // this.companyVal = this.companyOptions[0].value; + this.getLineTreeList(); //获取树状图 + //this.companyVal = this.companyOptions[0].value; }, methods: { handleClick(val) { @@ -136,16 +136,29 @@ export default { getLineTreeList() { this.role = localStorage.getItem("role"); console.log(this.role); + const menuName = localStorage.getItem("menuActive"); + console.log(menuName); this.treeLoading = true; - + let devtypeList; + //气象 + if (menuName == "/weather") { + devtypeList = [2]; + } + //覆冰 + if (menuName == "/icing") { + devtypeList = [3]; + } + console.log(devtypeList); getICEdyTreeList({ type: -1, - devtype: [2, 3], + devtype: devtypeList, }) .then((res) => { this.lineTreeData = res.data.list; this.treeLoading = false; - this.currentData = JSON.parse(localStorage.getItem("currentData")); + this.icecurrentData = JSON.parse( + localStorage.getItem("icecurrentData") + ); this.lineTreeData.forEach((node) => { if (node.list) { node.list.forEach((child) => { @@ -164,15 +177,15 @@ export default { if (this.lineTreeData[0].list[0].list.length > 0) { } if ( - this.currentData !== null && - Object.keys(this.currentData).length !== 0 + this.icecurrentData !== null && + Object.keys(this.icecurrentData).length !== 0 ) { - this.currentNodekey = this.currentData.id; - this.handleNodeClick(this.currentData); + this.currentNodekey = this.icecurrentData.id; + this.handleNodeClick(this.icecurrentData); } else { - this.currentData = this.lineTreeData[0]; //第一个选中的数据 + this.icecurrentData = this.lineTreeData[0]; //第一个选中的数据 this.currentNodekey = this.lineTreeData[0].id; //第一个数据 - this.handleNodeClick(this.currentData); + this.handleNodeClick(this.icecurrentData); } this.$nextTick(() => { this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来 @@ -184,8 +197,8 @@ export default { }, //点击当前选中的treenode handleNodeClick(data) { - this.currentData = data; - this.$parent.getCurrentData(this.currentData); + this.icecurrentData = data; + this.$parent.getCurrentData(this.icecurrentData); }, }, }; diff --git a/src/views/iceWeather/icing/index.vue b/src/views/iceWeather/icing/index.vue index a890971..bfbb50a 100644 --- a/src/views/iceWeather/icing/index.vue +++ b/src/views/iceWeather/icing/index.vue @@ -199,7 +199,7 @@