From 1f04491f701273f11df11943ad4bdd0b2351ceda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C002001lixiaobang=E2=80=9D?= <2547956374@qq.com> Date: Tue, 11 Apr 2023 17:08:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api.js | 52 +- src/components/layout/header.vue | 1 + src/main.js | 15 + src/router/index.js | 6 +- src/views/land/child/index.vue | 1971 +++++++++++++++++++----------- src/views/land/index.vue | 278 +++-- src/views/login/login.vue | 29 +- vue.config.js | 17 +- 8 files changed, 1506 insertions(+), 863 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index ee6a5e9..43c8f12 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,21 +1,21 @@ import axios from 'axios' // if (process.env.NODE_ENV === 'development') { - // axios.defaults.baseURL = '/api' -// } else if (process.env.NODE_ENV === 'test') { +// axios.defaults.baseURL = '/electric_interface'} else +// if (process.env.NODE_ENV === 'test') { // axios.defaults.baseURL = 'https://309k63x452.oicp.vip' // } // 设置请求头参数 common 为设置所有的接口 post为设置post请求的接口 -axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access_token')}`; +axios.defaults.headers.common['Authorization'] = `Bearer ${sessionStorage.getItem('tokenStr')}`; // 首页数据 axios.interceptors.request.use(function (config) { - const tokenStr = localStorage.getItem('tokenStr') - const account= localStorage.getItem('account') - const roleId = localStorage.getItem('roleId') + const tokenStr = sessionStorage.getItem('tokenStr') + const account= sessionStorage.getItem('account') + const roleId = sessionStorage.getItem('roleId') if (tokenStr) { // 如果本地有token,给它加上请求头 config.headers.token = tokenStr config.headers.account = account config.headers.roleId = roleId - // console.log(config,'配置'); + } return config }, function (error) { @@ -25,58 +25,62 @@ axios.interceptors.request.use(function (config) { }) // 登录的请求 export const doLogin = (data) =>{ - return axios.post('api/login/doLogin',data) + return axios.post('electric_interface/login/doLogin', + data, + {headers: {'Content-Type': 'application/json'}} + ) } // export const getHomePageInfo = (params) => { // return axios.post('/gk/homePage/getHomePageInfo?cityId='+params) // }; // 首页数据 -export const getHomePageInfo = (params) => { - return axios.get('api/gk/homePage/getHomePageInfo', { - params +export const getHomePageInfo = (data) => { + return axios.post('electric_interface/gk/homePage/getHomePageInfo?cityId='+data.cityId, { + data }) }; // 环境信息 -export const getEnvironmentInfo = (params) => { - return axios.get('api/gk/info/getEnvironmentInfo', { params +export const getEnvironmentInfo = (data) => { + return axios.post('electric_interface/gk/info/getEnvironmentInfo?siteId='+data.siteId, + { data }) }; export const getSiteInfo = (params) => { - return axios.get('api/gk/info/getSiteInfo', { + return axios.get('electric_interface/gk/info/getSiteInfo', { params }) }; export const getSwitchInfo = (params) => { - return axios.get('api/gk/info/getSwitchInfo', { + return axios.get('electric_interface/gk/info/getSwitchInfo', { params }) }; //查询实时事件 export const getDeviceRecord = (params) => { - return axios.get('api/gk/info/getDeviceRecord', { + return axios.get('electric_interface/gk/info/getDeviceRecord', { params }) }; //查询实时记录下拉框 export const getDeviceNum = (params) => { - return axios.get('api/gk/info/getDeviceNum', { + return axios.get('electric_interface/gk/info/getDeviceNum', { params }) }; // 修改提交 export const updateDeviceRecord = (params) => { - return axios.get('api/gk/info/updateDeviceRecord', { + return axios.get('electric_interface/gk/info/updateDeviceRecord', { params }) }; // 获取城市列表 -// export const getCityList = (params)=>{ -// return axios.post('/gk/homePage/getCityList') -// } +export const getCityList = (params)=>{ + return axios.post('electric_interface/gk/homePage/getCityList') +} // 点击城市查询详情列表 -// export const getCityDetail = (params)=>{ -// return axios.post('/gk/homePage/getCityDetail?cityId='+params) -// } +export const getCityDetail = (data)=>{ + return axios.post('electric_interface/gk/homePage/getCityDetail?cityId='+data.cityId) +} diff --git a/src/components/layout/header.vue b/src/components/layout/header.vue index 19c9425..f18e0f7 100644 --- a/src/components/layout/header.vue +++ b/src/components/layout/header.vue @@ -132,6 +132,7 @@ export default { message: '返回登录' }); this.$router.push('/') + sessionStorage.clear(); //清除所有session值 }) .catch(action => { this.$message({ diff --git a/src/main.js b/src/main.js index d1cb72d..dbc2694 100644 --- a/src/main.js +++ b/src/main.js @@ -68,6 +68,21 @@ function receiveMessageFromIframePage (event) { } window.addEventListener("message", receiveMessageFromIframePage, false); + +//判断是否登录 +router.beforeEach((to, from, next) => { + if (to.matched.some(record => record.meta.requireLogin)) { // 判断该路由是否需要登录权限 + if (sessionStorage.getItem('tokenStr')) { // 判断当前用户的登录信息authorities是否存在 + next(); + } else { + next({ + path: '/' + }) + } + } else { + next(); + } +}) new Vue({ router, store, diff --git a/src/router/index.js b/src/router/index.js index e7a0d4d..05817fd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,7 +18,8 @@ const routes = [ path: '/index', name: 'index', meta: { - title: '首页' + title: '首页', + requireLogin: true }, component: () => import ('../views/land/index.vue'), @@ -46,7 +47,8 @@ const routes = [ path: '/landChildren', name: 'landChildren', meta: { - title: '侵华日军南京大屠杀遇难同胞纪念馆' + title: '侵华日军南京大屠杀遇难同胞纪念馆', + requireLogin: true }, component: () => import ('../views/land/child/index.vue'), diff --git a/src/views/land/child/index.vue b/src/views/land/child/index.vue index 8262b9c..7611752 100644 --- a/src/views/land/child/index.vue +++ b/src/views/land/child/index.vue @@ -1,102 +1,141 @@ @@ -1188,11 +1736,16 @@ import { getDeviceRecord, getDeviceNum, updateDeviceRecord, + getCityDetail } from "@/api/api"; export default { mixins: [drawMixin], data() { return { + siteId1:'', //新馆id + siteId2:'',//旧馆id + timer:null,//定时器 + checkUpShow: true, //检查通知单切换 maskBgShow: true, //遮罩消失 popStatus: "", modelOthers: false, @@ -1537,32 +2090,32 @@ export default { { path: require("@/assets/mapInfo/资源 37.png"), name: "门禁1", - nametwo: "高压侧温度(℃)", - value: "26", + // nametwo: "高压侧温度(℃)", + // value: "26", fieldName: "doorState", fieldNameTwo: "temperature", }, { path: require("@/assets/mapInfo/资源 37.png"), name: "门禁2", - nametwo: "高压侧湿度(%RH)", - value: "40.5", + // nametwo: "高压侧湿度(%RH)", + // value: "40.5", fieldName: "doorState", fieldNameTwo: "temperature", }, { path: require("@/assets/mapInfo/资源 36.png"), name: "烟感1", - nametwo: "低压侧温度(℃)", - value: "24.1", + // nametwo: "低压侧温度(℃)", + // value: "24.1", fieldName: "doorState", fieldNameTwo: "temperature", }, { path: require("@/assets/mapInfo/资源 36.png"), name: "烟感2", - nametwo: "低压侧湿度(%RH)", - value: "44.7", + // nametwo: "低压侧湿度(%RH)", + // value: "44.7", fieldName: "smokeSensation", fieldNameTwo: "temperature", }, @@ -1574,21 +2127,9 @@ export default { fieldName: "smokeSensation", fieldNameTwo: "waterout", }, - { - path: require("@/assets/mapInfo/资源 36.png"), - name: "烟感4", - nametwo: "", - value: "", - fieldName: "smokeSensation", - }, - { - path: require("@/assets/mapInfo/资源 36.png"), - name: "烟感4", - nametwo: "", - value: "", - fieldName: "smokeSensation", - }, ], + wenduList:[],//旧馆温度数组 + shiduList:[],//旧馆湿度 fuzaiArr: [ { name: "总负荷", @@ -1694,10 +2235,11 @@ export default { hwg1: false, hwg4: false, //sencetitle 新馆旧馆标题 - senceTitle: '纪念馆-新馆', + senceTitle: "纪念馆-新馆", senceTitleShow: false, // 切换新旧馆 - updateSenceN:false + updateSenceN: false, + cityId:'' }; }, components: { @@ -1726,6 +2268,7 @@ export default { this.searchHandle("1"); } else { this.unityUrl = "/htWeb/unity.html?src=3"; + this.searchHandle("2"); } }, immediate: true, @@ -1737,6 +2280,14 @@ export default { window.setTimeout(() => { that.maskBgShow = false; }, 2500); + let data = { + cityId:sessionStorage.getItem('cityId') + } + getCityDetail(data).then((res) => { + console.log(res, "城市详情数据-----------------"); + this.siteId1 = res.data.data[0].siteId + this.siteId2 = res.data.data[1].siteId + }); //切换模型 window.addEventListener("message", function (e) { var res = e.data; @@ -1776,7 +2327,7 @@ export default { var url = "http://" + that.locanionIp + - ":5501/demo/demo_window_simple_previewNew.html"; + ":5500/demo/demo_window_simple_previewNew.html"; window.open(url, "baidu", "top=200,left=450,width=1000,height=600"); console.log("bbb"); }, 1000 * 1.5); @@ -1787,200 +2338,81 @@ export default { var url = "http://" + that.locanionIp + - ":5501/demo/demo_window_simple_preview.html"; + ":5500/demo/demo_window_simple_preview.html"; window.open(url, "baidu", "top=200,left=450,width=1000,height=600"); }, 1000 * 1.5); } else if (res.val == "Human") { window.openVideo = setTimeout(() => { - var url = "https://ddns.thirdtec.cn:41127/njbd/video/index-copy.html"; + var url = + "https://ddns.thirdtec.cn:41127/njbd/video/index-copy.html"; window.open(url, "baidu", "top=200,left=250,width=1500,height=680"); }, 1000 * 1.5); } else if (res.val == "1_UPS") { - that.UPS1Show = true + that.UPS1Show = true; } else if (res.val == "2_UPS") { - that.UPS2Show = true + that.UPS2Show = true; } else if (res.val == "YJDY_Car") { - that.carShow = true - } else if (res.val == '10kV_JSX_4_hwg') { - that.hwg4 = true - } else if (res.val == '10kV_CXX_1_hwg') { - that.hwg1 = true + that.carShow = true; + } else if (res.val == "10kV_JSX_4_hwg") { + that.hwg4 = true; + } else if (res.val == "10kV_CXX_1_hwg") { + that.hwg1 = true; } } }); this.init(); - // //查询实时记录 - window.setInterval(() => { - if (that.unityChange == 3 || that.unityChange == 0) { - // getEnvironmentInfo( "2" ).then((res) => { - getEnvironmentInfo( { siteId: "2" } ).then((res) => { - // this.eniorArr - console.log(res,'实时记录'); - for (const key in res.data.data) { - if (key == "doorState") { - for (let i = 0; i < res.data.data.doorState.length; i++) { - this.eniorArr[i].name = res.data.data.doorState[i].doorName; - if (res.data.data.doorState[i].isOpen == 0) { - this.eniorArr[ - i - ].path = require("@/assets/mapInfo/资源 38.png"); - } else { - this.eniorArr[ - i - ].path = require("@/assets/mapInfo/资源 37.png"); - } - } - } - if (key == "smokeSensation") { - for (let i = 0; i < res.data.data.smokeSensation.length; i++) { - this.eniorArr[i + res.data.data.doorState.length].name = - res.data.data.smokeSensation[i].doorName; - if (res.data.data.smokeSensation[i].isOpen == 0) { - this.eniorArr[ - i + res.data.data.doorState.length - ].path = require("@/assets/mapInfo/资源 36.png"); - } else { - this.eniorArr[ - i + res.data.data.doorState.length - ].path = require("@/assets/mapInfo/资源 40.png"); - } - } - } - if (key == "waterout") { - if (res.data.data.waterout == 0) { - this.eniorArr[2].value = require("@/assets/mapInfo/资源 35.png"); - } else { - this.eniorArr[2].value = require("@/assets/mapInfo/资源 39.png"); - } - } - if (key == "temperature") { - for (let i = 0; i < res.data.data.temperature.length; i++) { - if (res.data.data.temperature[i].type == 3) { - this.eniorArr[0].value = res.data.data.temperature[ - i - ].value.substring( - 0, - res.data.data.temperature[i].value.indexOf(".") + 2 - ); - } - // if (res.data.data.temperature[i].type == 2) { - // this.eniorArr[2].value = res.data.data.temperature[i].value - // } - // if (res.data.data.temperature[i].type == 3) { - // this.eniorArr1[2].value = res.data.data.temperature[i].value - // } - } - } - if (key == "humidity") { - for (let i = 0; i < res.data.data.humidity.length; i++) { - if (res.data.data.humidity[i].type == 3) { - this.eniorArr[1].value = res.data.data.humidity[ - i - ].value.substring( - 0, - res.data.data.humidity[i].value.indexOf(".") + 2 - ); - } - // if (res.data.data.humidity[i].type == 2) { - // this.eniorArr[3].value = res.data.data.humidity[i].value - // } - } - } - } - }); - } else { - // getEnvironmentInfo("96445C7C4AD6F0C5" ).then((res) => { - getEnvironmentInfo({ siteId: "1" } ).then((res) => { - // this.eniorArr - for (const key in res.data.data) { - if (key == "doorState") { - for (let i = 0; i < res.data.data.doorState.length; i++) { - this.eniorArr1[i].name = res.data.data.doorState[i].doorName; - if (res.data.data.doorState[i].isOpen == 0) { - this.eniorArr1[ - i - ].path = require("@/assets/mapInfo/资源 38.png"); - } else { - this.eniorArr1[ - i - ].path = require("@/assets/mapInfo/资源 37.png"); - } - } - } - if (key == "smokeSensation") { - for (let i = 0; i < res.data.data.smokeSensation.length; i++) { - this.eniorArr1[i + res.data.data.doorState.length].name = - res.data.data.smokeSensation[i].doorName; - if (res.data.data.smokeSensation[i].isOpen == 0) { - this.eniorArr1[ - i + res.data.data.doorState.length - ].path = require("@/assets/mapInfo/资源 36.png"); - } else { - this.eniorArr1[ - i + res.data.data.doorState.length - ].path = require("@/assets/mapInfo/资源 40.png"); - } - } - } - if (key == "waterout") { - if (res.data.data.waterout == 0) { - this.eniorArr1[4].value = require("@/assets/mapInfo/资源 35.png"); - } else { - this.eniorArr1[4].value = require("@/assets/mapInfo/资源 39.png"); - } - } - if (key == "temperature") { - for (let i = 0; i < res.data.data.temperature.length; i++) { - if (res.data.data.temperature[i].type == 1) { - this.eniorArr1[0].value = res.data.data.temperature[ - i - ].value.substring( - 0, - res.data.data.temperature[i].value.indexOf(".") + 2 - ); - } - if (res.data.data.temperature[i].type == 2) { - this.eniorArr1[2].value = res.data.data.temperature[ - i - ].value.substring( - 0, - res.data.data.temperature[i].value.indexOf(".") + 2 - ); - } - // if (res.data.data.temperature[i].type == 3) { - // this.eniorArr1[2].value = res.data.data.temperature[i].value - // } - } - } - if (key == "humidity") { - for (let i = 0; i < res.data.data.humidity.length; i++) { - if (res.data.data.humidity[i].type == 1) { - this.eniorArr1[1].value = res.data.data.humidity[ - i - ].value.substring( - 0, - res.data.data.humidity[i].value.indexOf(".") + 2 - ); - } - if (res.data.data.humidity[i].type == 2) { - this.eniorArr1[3].value = res.data.data.humidity[ - i - ].value.substring( - 0, - res.data.data.humidity[i].value.indexOf(".") + 2 - ); - } - } - } - } - }); - } - }, 3000); + this.handleMenus(0) + window.openVideo = this.openVideo; + this.timeFn(); + this.cancelLoading(); + this.titleData = this.$route.params.id.slice(0, 4); + console.log("jdMain", this.$route.params); + this.type = this.$route.params.type; - // 环境信息 - window.setInterval(() => { + window.OnSceneLoaded = function (scene) { + console.log("scene", scene); + window.FloorUI("true"); + }; + this.file.promise.then((pdf) => { + this.numPages = pdf.numPages; + }); + getCityList().then((res) => { + console.log(res.data, "城市数据================"); + if (res.data.code == 200) { + this.cityId = res.data.data[0].cityId + } + }).catch((err)=>{ + console.log(err); + }) + }, + beforeDestroy() { + // 离开当前路由前的操作 + clearInterval(this.timer); + this.timer = null; + }, + methods: { + // 切换新旧管 + updateSence() { + this.updateSenceN = !this.updateSenceN; + if (this.updateSenceN == false) { + this.threeUrl = "http://221.226.19.85:10133/bdz_360_22_12_8/index.html"; + this.senceTitle = "纪念馆-新馆"; + } else { + this.threeUrl = + "http://221.226.19.85:10133/bdz_360_22_11_11/index.html"; + this.senceTitle = "纪念馆-旧馆"; + } + }, + // 关闭弹窗 + closeDialog() { + // console.log(11111); + this.UPS1Show = false; + }, + //获取配电房信息 + getSiteInfo(){ + let that = this if (that.unityChange == 0 || that.unityChange == 3) { - getSiteInfo({ siteId: "2" }).then((res) => { + getSiteInfo({ siteId: this.siteId1}).then((res) => { that.infoArr[0].text = res.data.data.siteName; that.infoArr[1].text = res.data.data.siteAdress; that.infoArr[2].text = res.data.data.totalTransformationSite; @@ -2031,7 +2463,7 @@ export default { } }); } else { - getSiteInfo({ siteId: "1" }).then((res) => { + getSiteInfo({ siteId: this.siteId2 }).then((res) => { that.infoArr1[0].text = res.data.data.siteName; that.infoArr1[1].text = res.data.data.siteAdress; that.infoArr1[2].text = res.data.data.totalTransformationSite; @@ -2082,54 +2514,186 @@ export default { } }); } - }, 3000); - window.setInterval(() => { - this.getTableData(); - }, 3000); - window.openVideo = this.openVideo; - this.timeFn(); - this.cancelLoading(); - this.titleData = this.$route.params.id.slice(0, 4); - console.log("jdMain", this.$route.params); - this.type = this.$route.params.type; - this.getJdData(this.type); - // this.getJdData() - window.OnSceneLoaded = function (scene) { - console.log("scene", scene); - window.FloorUI("true"); - }; - this.file.promise.then((pdf) => { - this.numPages = pdf.numPages; - }); - - - - }, - beforeDestroy() { - // clearInterval(this.timing); - }, - methods: { - // 切换新旧管 - updateSence(){ - this.updateSenceN = !this.updateSenceN - if(this.updateSenceN==false){ - this.threeUrl = 'http://221.226.19.85:10133/bdz_360_22_12_8/index.html' - this.senceTitle = '纪念馆-新馆' - } else{ - this.threeUrl = 'http://221.226.19.85:10133/bdz_360_22_11_11/index.html' - this.senceTitle = '纪念馆-旧馆' + }, + //获取环境信息数据 + getEnvironmentInfo() { + let that = this + if (that.unityChange == 3 || that.unityChange == 0) { + // getEnvironmentInfo( "2" ).then((res) => { + getEnvironmentInfo({ siteId: this.siteId1 }).then((res) => { + // this.eniorArr + console.log(res, "实时记录"); + for (const key in res.data.data) { + if (key == "doorState") { + for (let i = 0; i < res.data.data.doorState.length; i++) { + this.eniorArr[i].name = res.data.data.doorState[i].name; + if (res.data.data.doorState[i].value == 0) { + this.eniorArr[ + i + ].path = require("@/assets/mapInfo/资源 38.png"); + } else { + this.eniorArr[ + i + ].path = require("@/assets/mapInfo/资源 37.png"); + } + } + } + if (key == "smokeSensation") { + for (let i = 0; i < res.data.data.smokeSensation.length; i++) { + this.eniorArr[i + res.data.data.doorState.length].name = + res.data.data.smokeSensation[i].name; + if (res.data.data.smokeSensation[i].value == 0) { + this.eniorArr[ + i + res.data.data.doorState.length + ].path = require("@/assets/mapInfo/资源 36.png"); + } else { + this.eniorArr[ + i + res.data.data.doorState.length + ].path = require("@/assets/mapInfo/资源 40.png"); + } + } + } + if (key == "waterout") { + if (res.data.data.waterout[0].value == '0') { + this.eniorArr[2].value = require("@/assets/mapInfo/资源 35.png"); + } else { + this.eniorArr[2].value = require("@/assets/mapInfo/资源 39.png"); + } + } + if (key == "temperature") { + for (let i = 0; i < res.data.data.temperature.length; i++) { + if (res.data.data.temperature[i].type == 3) { + this.eniorArr[0].value = res.data.data.temperature[ + i + ].value.substring( + 0, + res.data.data.temperature[i].value.indexOf(".") + 2 + ); + } + // if (res.data.data.temperature[i].type == 2) { + // this.eniorArr[2].value = res.data.data.temperature[i].value + // } + // if (res.data.data.temperature[i].type == 3) { + // this.eniorArr1[2].value = res.data.data.temperature[i].value + // } + } + } + if (key == "humidity") { + for (let i = 0; i < res.data.data.humidity.length; i++) { + if (res.data.data.humidity[i].type == 3) { + this.eniorArr[1].value = res.data.data.humidity[ + i + ].value.substring( + 0, + res.data.data.humidity[i].value.indexOf(".") + 2 + ); + } + // if (res.data.data.humidity[i].type == 2) { + // this.eniorArr[3].value = res.data.data.humidity[i].value + // } + } + } + } + }); + } else { + // getEnvironmentInfo("96445C7C4AD6F0C5" ).then((res) => { + getEnvironmentInfo({ siteId: this.siteId2 }).then((res) => { + // this.eniorArr + for (const key in res.data.data) { + if (key == "doorState") { + for (let i = 0; i < res.data.data.doorState.length; i++) { + this.eniorArr1[i].name = res.data.data.doorState[i].name; + if (res.data.data.doorState[i].value == 0) { + this.eniorArr1[ + i + ].path = require("@/assets/mapInfo/资源 38.png"); + } else { + this.eniorArr1[ + i + ].path = require("@/assets/mapInfo/资源 37.png"); + } + } + } + if (key == "smokeSensation") { + for (let i = 0; i < res.data.data.smokeSensation.length; i++) { + this.eniorArr1[i + res.data.data.doorState.length].name = + res.data.data.smokeSensation[i].name; + if (res.data.data.smokeSensation[i].value == '0') { + this.eniorArr1[ + i + res.data.data.doorState.length + ].path = require("@/assets/mapInfo/资源 36.png"); + } else { + this.eniorArr1[ + i + res.data.data.doorState.length + ].path = require("@/assets/mapInfo/资源 40.png"); + } + } + } + if (key == "waterout") { + if (res.data.data.waterout[0].value == '0') { + this.eniorArr1[4].value = require("@/assets/mapInfo/资源 35.png"); + } else { + this.eniorArr1[4].value = require("@/assets/mapInfo/资源 39.png"); + } + } + if (key == "temperature") { + // for (let i = 0; i < res.data.data.temperature.length; i++) { + // if (res.data.data.temperature[i].type == 1) { + // this.eniorArr1[0].value = res.data.data.temperature[ + // i + // ].value.substring( + // 0, + // res.data.data.temperature[i].value.indexOf(".") + 2 + // ); + // } + // if (res.data.data.temperature[i].type == 2) { + // this.eniorArr1[2].value = res.data.data.temperature[ + // i + // ].value.substring( + // 0, + // res.data.data.temperature[i].value.indexOf(".") + 2 + // ); + // } + // if (res.data.data.temperature[i].type == 3) { + // this.eniorArr1[2].value = res.data.data.temperature[i].value + // } + this.shiduList = Object.keys(res.data.data.temperature).map((item,index)=>{ + return {name:res.data.data.temperature[item].name,value:res.data.data.temperature[item].value} + }) + } + if (key == "humidity") { + // for (let i = 0; i < res.data.data.humidity.length; i++) { + // if (res.data.data.humidity[i].type == 1) { + // this.eniorArr1[1].value = res.data.data.humidity[ + // i + // ].value.substring( + // 0, + // res.data.data.humidity[i].value.indexOf(".") + 2 + // ); + // } + // if (res.data.data.humidity[i].type == 2) { + // this.eniorArr1[3].value = res.data.data.humidity[ + // i + // ].value.substring( + // 0, + // res.data.data.humidity[i].value.indexOf(".") + 2 + // ); + // } + // } + this.wenduList = Object.keys(res.data.data.humidity).map((item,index)=>{ + return {name:res.data.data.humidity[item].name,value:res.data.data.humidity[item].value} + }) + } + } + }); } }, - // 关闭弹窗 - closeDialog() { - // console.log(11111); - this.UPS1Show = false - }, + //获取开关信息数据 getTableData() { // this.tableData = []; - if (this.unityChange == 0 ||this.unityChange == 3) { - getSwitchInfo({ siteId: "2" }).then((res) => { - this.tableData = res.data.data.items; + if (this.unityChange == 0 || this.unityChange == 3) { + getSwitchInfo({ siteId: this.siteId1 }).then((res) => { + this.tableData = res.data.data; for (let i = 0; i < this.tableData.length; i++) { this.tableData[i].electricCurrent = this.tableData[ i @@ -2150,8 +2714,8 @@ export default { } }); } else { - getSwitchInfo({ siteId: "1" }).then((res) => { - this.tableData = res.data.data.items; + getSwitchInfo({ siteId: this.siteId2 }).then((res) => { + this.tableData = res.data.data; for (let i = 0; i < this.tableData.length; i++) { this.tableData[i].electricCurrent = this.tableData[ i @@ -2226,13 +2790,13 @@ export default { let params = { deviceNum: this.optionsOpen[this.chaValue].label, operation: "", - siteId: this.unityChange == "1" ? "1" : "2", + siteId: this.unityChange == 1 ? "1" : "2", }; let paramsChange = { deviceNum: this.optionsOpen[this.chaValue].label, operation: "", - siteId: this.unityChange == "1" ? "1" : "2", + siteId: this.unityChange == 1 ? "1" : "2", id: this.siteRecord[this.chaValue].id, }; if (this.radio == 1) { @@ -2301,11 +2865,17 @@ export default { // let label = this.optionsOpen[event].label console.log(this.optionsOpen[val].label, "chaxun"); // this.chaValue = this.optionsOpen[val].label + let siteId = '' + if (this.unityChange == 0 || this.unityChange == 3) { + siteId = "2" + }else{ + siteId = "1" + } getDeviceRecord({ - siteId: this.unityChange == "1" ? "1" : "2", + siteId: siteId, deviceNum: this.optionsOpen[val].label, }).then((res) => { - // console.log(res.data.data,'实时记录'); + console.log(res.data,'0----------------'); // this.siteRecord = res.data.data for (let i = 0; i < res.data.data.length; i++) { let date = this.$moment(res.data.data[i].operationDate).format( @@ -2372,7 +2942,7 @@ export default { this.file = pdf.createLoadingTask(fileUrl); } else if (val == 51) { let fileUrl = - this.unityChange == "1" + this.unityChange == 1 ? "/pdf/jiuguanyongdian.pdf" : "/pdf/xinguanyongdian.pdf"; this.fileType = true; @@ -2405,14 +2975,22 @@ export default { return ""; } }, + deactivated(){ + clearInterval(this.timer) + }, handleMenus(index) { + this.deactivated() this.menusActive = index; if (index == 9) { this.unityUrl = "/htWeb/unity.html?src=4"; } else if (index == 8) { - this.senceTitleShow = true - if ((this.unityChange != 0 && this.unityChange != 1) || this.popStatus == '') { - this.threeUrl = "http://221.226.19.85:10133/bdz_360_22_12_8/index.html"; + this.senceTitleShow = true; + if ( + (this.unityChange != 0 && this.unityChange != 1) || + this.popStatus == "" + ) { + this.threeUrl = + "http://221.226.19.85:10133/bdz_360_22_12_8/index.html"; this.handleUnity(); let val = "goThree"; @@ -2422,7 +3000,7 @@ export default { }, "*" ); // * 通配符 匹配所有地址; content 表示传递过去嵌套iframe页面的数据 - } else if (this.popStatus == 'XG' || this.popStatus == 'JG') { + } else if (this.popStatus == "XG" || this.popStatus == "JG") { this.handleUnity(); let val = "goThree"; window.parent.postMessage( @@ -2432,7 +3010,21 @@ export default { "*" ); // * 通配符 匹配所有地址; content 表示传递过去嵌套iframe页面的数据 } - + } else if (index == 3) { + this.getEnvironmentInfo(); + this.timer = window.setInterval(() => { + this.getEnvironmentInfo(); + }, 3000); + } else if (index == 1) { + this.getTableData(); + this.timer= window.setInterval(() => { + this.getTableData(); + }, 3000); + }else if (index == 0) { + this.getSiteInfo() + this.timer= window.setInterval(()=>{ + this.getSiteInfo() + },3000) } }, //弹窗 @@ -2598,8 +3190,7 @@ export default { }, unityJiazai() { if (this.unityChange == 0) { - this.threeUrl = - "http://221.226.19.85:10133/bdz_360_22_12_8/index.html"; + this.threeUrl = "http://221.226.19.85:10133/bdz_360_22_12_8/index.html"; } else this.threeUrl = "http://221.226.19.85:10133/bdz_360_22_11_11/index.html"; @@ -2671,114 +3262,7 @@ export default { this.$refs.iframe.contentWindow.unity.g3d.setEye([0, 500, 500]); this.carChangeShow = false; }, - //获取基地数据 - getJdData(val) { - if (val == "不动产") { - console.log("val", val); - this.workListData = []; - axios - .get("/json/jdData.json") - .then((result) => { - console.log("getMenuData111", result.data); - for (var i = 0; i < result.data.length; i++) { - if (result.data[i].jd == this.$route.params.id) { - console.log("result.data[i]", result.data[i]); - this.workListData.push(result.data[i]); - this.changeWorkList(result.data[i]); - } - } - }) - .catch((error) => { - console.log(error); - }); - } else if (val == "土地证") { - this.tit = "土地证信息"; - this.workListData = []; - this.fczShow = true; - axios - .get("/json/tdData.json") - .then((result) => { - console.log("getMenuData111", result.data); - for (var i = 0; i < result.data.length; i++) { - if (result.data[i].jd == this.$route.params.id) { - console.log("result.data[i]", result.data[i]); - this.workListData.push(result.data[i]); - this.changeWorkListTd(result.data[i]); - } - } - }) - .catch((error) => { - console.log(error); - }); - this.workListDatafcz = []; - axios - .get("/json/fczData.json") - .then((result) => { - console.log("getMenuData111", result.data); - for (var i = 0; i < result.data.length; i++) { - if (result.data[i].jd == this.$route.params.id) { - console.log("result.data[i]", result.data[i]); - this.workListDatafcz.push(result.data[i]); - this.changeWorkListfcz(result.data[i]); - } - } - }) - .catch((error) => { - console.log(error); - }); - } - }, - //不动产 - changeWorkList(data) { - var entries = Object.entries(data); - var list = entries.map(function (item) { - return { - value: item[1], - name: item[0], - }; - }); - for (var i = 0; i < list.length; i++) { - for (var t = 0; t < this.workList.length; t++) { - if (list[i].name == this.workList[t].name) { - this.workList[t].value = list[i].value; - } - } - } - }, - //土地证 - changeWorkListTd(data) { - var entries = Object.entries(data); - var list = entries.map(function (item) { - return { - value: item[1], - name: item[0], - }; - }); - for (var i = 0; i < list.length; i++) { - for (var t = 0; t < this.workListNew.length; t++) { - if (list[i].name == this.workListNew[t].name) { - this.workListNew[t].value = list[i].value; - } - } - } - this.workList = this.workListNew; - }, - changeWorkListfcz(data) { - var entries = Object.entries(data); - var list = entries.map(function (item) { - return { - value: item[1], - name: item[0], - }; - }); - for (var i = 0; i < list.length; i++) { - for (var t = 0; t < this.workListFCZ.length; t++) { - if (list[i].name == this.workListFCZ[t].name) { - this.workListFCZ[t].value = list[i].value; - } - } - } - }, + cancelLoading() { setTimeout(() => { this.loading = false; @@ -2938,7 +3422,7 @@ export default { // word-break: break-all; } - ::v-deep .el-table th.el-table__cell>.cell { + ::v-deep .el-table th.el-table__cell > .cell { color: rgb(86, 254, 226); } @@ -3463,7 +3947,6 @@ export default { } @-webkit-keyframes mymove { - /* Safari and Chrome */ 0% { opacity: 1; @@ -3763,7 +4246,7 @@ export default { padding: 0 10px; box-sizing: border-box; - &>div { + & > div { width: 50%; height: 100%; display: flex; @@ -3776,12 +4259,14 @@ export default { .envior1 { width: 427px; - height: 241px; + height: 330px; background: url("../../../assets/newbanImg/rightbg.png") no-repeat; background-size: 100% 100%; margin-top: 35%; padding: 10px 5px; - + ::-webkit-scrollbar { + display: none; + } .toptitle { width: 100%; height: 40px; @@ -3800,17 +4285,17 @@ export default { display: flex; flex-flow: column nowrap; margin-top: 10px; - + position: relative; .list { width: 100%; display: flex; justify-content: space-between; - height: 32px; + height: 20%; align-items: center; padding: 0 10px; box-sizing: border-box; - &>div { + & > div { width: 50%; height: 100%; display: flex; @@ -3841,7 +4326,6 @@ export default { justify-content: space-evenly; .changeselect { - // width: 160px; // height: 35px; ::v-deep .el-input__inner { @@ -3930,7 +4414,8 @@ export default { line-height: 45px; color: #ffffff; letter-spacing: 1px; - background: url("../../../assets/newimgs/commitXuanzhong.png") no-repeat; + background: url("../../../assets/newimgs/commitXuanzhong.png") + no-repeat; background-size: 100% 100%; } } @@ -4094,7 +4579,8 @@ export default { } .rightsub { - background: url("../../../assets/newimgs/commitXuanzhong.png") no-repeat; + background: url("../../../assets/newimgs/commitXuanzhong.png") + no-repeat; background-size: 100% 100%; width: 123px; height: 40px; @@ -4206,7 +4692,8 @@ export default { } .rightsub { - background: url("../../../assets/newimgs/commitXuanzhong.png") no-repeat; + background: url("../../../assets/newimgs/commitXuanzhong.png") + no-repeat; background-size: 100% 100%; width: 123px; height: 40px; @@ -4559,5 +5046,37 @@ h1 { margin-top: 10px; box-sizing: border-box; } +.huanjing{ + width: 50%; + height: 60%; + position:absolute; + left: 48%; + padding-top: 3.5%; + overflow: auto; + .wendu{ + height: 17%; + width: 100%; + display: flex; + flex-wrap: nowrap; + justify-content: space-between; + color:#ffffff + } +} +.shidu{ + width: 50%; + height: 20%; + position:absolute; + left: 48%; + overflow: auto; + top: 61%; + .huanjingshidu{ + height: 45%; + width: 100%; + display: flex; + flex-wrap: nowrap; + justify-content: space-between; + color:#ffffff + } +} \ No newline at end of file diff --git a/src/views/land/index.vue b/src/views/land/index.vue index dd8feef..786f8fd 100644 --- a/src/views/land/index.vue +++ b/src/views/land/index.vue @@ -1,6 +1,5 @@