|
|
@@ -3,280 +3,68 @@
|
|
|
<headComponent></headComponent>
|
|
|
<div class="home-page">
|
|
|
<div class="home-left-box">
|
|
|
- <overviewOfFacilityData></overviewOfFacilityData>
|
|
|
- <facilityUtilizationRate></facilityUtilizationRate>
|
|
|
+ <left-top></left-top>
|
|
|
+ <left-bottom></left-bottom>
|
|
|
</div>
|
|
|
<div class="home-center-box">
|
|
|
- <centerNotice></centerNotice>
|
|
|
- <videoSurveillance></videoSurveillance>
|
|
|
+ <center-top></center-top>
|
|
|
+ <center-center></center-center>
|
|
|
+ <div style="display: flex;">
|
|
|
+ <center-bottom-left></center-bottom-left>
|
|
|
+ <center-bottom-right></center-bottom-right>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="home-right-box">
|
|
|
- <scientificResearchProject></scientificResearchProject>
|
|
|
- <personnelEntryRecord></personnelEntryRecord>
|
|
|
+ <right></right>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="button-img-box"></div>
|
|
|
- <alarmComponent v-if="alarmType" :alarmData="alarmData"></alarmComponent>
|
|
|
+ <baseComponent></baseComponent>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import mqtt from 'mqtt'
|
|
|
- import { login } from "@/api/login";
|
|
|
- import { loginYiLi,dashboardsResearchUsage } from "@/api/yiLi";
|
|
|
- import {
|
|
|
- getConfigByType,
|
|
|
- laboratoryBigViewSelectTriggerInfo,
|
|
|
- iotSensorFindBySubId,
|
|
|
- iotCameraFindByCondition
|
|
|
- } from "@/api/index";
|
|
|
- import { setToken,setTokenYiLi } from '@/utils/auth'
|
|
|
- import { Encrypt,Decrypt} from '@/utils/secret'
|
|
|
- import { getFloorMaps } from '@/utils/mapList'
|
|
|
//head组件
|
|
|
import headComponent from './components/headComponent.vue'
|
|
|
- //设施数据概览
|
|
|
- import overviewOfFacilityData from './components/overviewOfFacilityData.vue'
|
|
|
- //设施使用率及状态统计
|
|
|
- import facilityUtilizationRate from './components/facilityUtilizationRate.vue'
|
|
|
- //通知组件
|
|
|
- import centerNotice from './components/centerNotice.vue'
|
|
|
- //实时视频监控
|
|
|
- import videoSurveillance from './components/videoSurveillance.vue'
|
|
|
- //科研项目情况概览
|
|
|
- import scientificResearchProject from './components/scientificResearchProject.vue'
|
|
|
- //人员进入记录
|
|
|
- import personnelEntryRecord from './components/personnelEntryRecord.vue'
|
|
|
- //报警弹窗
|
|
|
- import alarmComponent from './components/components/alarmComponent.vue'
|
|
|
+ import baseComponent from './components/baseComponent.vue'
|
|
|
+ import leftTop from './components/left-top.vue'
|
|
|
+ import leftBottom from './components/left-bottom.vue'
|
|
|
+ import centerTop from './components/center-top.vue'
|
|
|
+ import centerCenter from './components/center-center.vue'
|
|
|
+ import centerBottomLeft from './components/center-bottom-left.vue'
|
|
|
+ import centerBottomRight from './components/center-bottom-right.vue'
|
|
|
+ import right from './components/right.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'home',
|
|
|
components: {
|
|
|
headComponent,
|
|
|
- overviewOfFacilityData,
|
|
|
- facilityUtilizationRate,
|
|
|
- centerNotice,
|
|
|
- videoSurveillance,
|
|
|
- scientificResearchProject,
|
|
|
- personnelEntryRecord,
|
|
|
- alarmComponent,
|
|
|
+ baseComponent,
|
|
|
+ leftTop,
|
|
|
+ leftBottom,
|
|
|
+ centerTop,
|
|
|
+ centerCenter,
|
|
|
+ centerBottomLeft,
|
|
|
+ centerBottomRight,
|
|
|
+ right
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- //预案MQTT
|
|
|
- planOpic:'lab/risk/plan/change',
|
|
|
- planClient:{},
|
|
|
- roomList:[],
|
|
|
- alarmType:false,
|
|
|
- alarmData:null,
|
|
|
- //预案查询定时器
|
|
|
- alarmTimer:null,
|
|
|
- //预案查询定时
|
|
|
- alarmSwitchTime:60000,
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
|
|
|
},
|
|
|
mounted(){
|
|
|
- this.offPlanMQTT('on');
|
|
|
- this.laboratoryBigViewSelectTriggerInfo();
|
|
|
- //开启预案定时查询
|
|
|
- this.alarmTimerFunction();
|
|
|
+
|
|
|
},
|
|
|
methods:{
|
|
|
- login() {
|
|
|
- let self = this
|
|
|
- Promise.all([
|
|
|
- this.getToken(),
|
|
|
- this.getTokenYiLi()
|
|
|
- ]).then((result) => {
|
|
|
- setTimeout(function() {
|
|
|
- self.getExploitConfig()
|
|
|
- },500)
|
|
|
- }).catch((error) => {
|
|
|
- })
|
|
|
- },
|
|
|
- //获取token
|
|
|
- getToken() {
|
|
|
- login().then(res1 => {
|
|
|
- setToken(res1.data.token)
|
|
|
- })
|
|
|
- },
|
|
|
- //获取YiLi-token
|
|
|
- getTokenYiLi() {
|
|
|
- loginYiLi().then(res2 => {
|
|
|
- setTokenYiLi(res2.access_token)
|
|
|
- })
|
|
|
- },
|
|
|
- //获取开发配置
|
|
|
- getExploitConfig() {
|
|
|
- getConfigByType({ category: 2, configType: 5 }).then(response => {
|
|
|
- let obj = JSON.parse(response.data.configValue)
|
|
|
- //判定http或者https
|
|
|
- let urlText = window.location.href.split('://')[0] + '://'
|
|
|
- let outerNet = window.location.href.indexOf(obj.ipIdentify) == -1//true外网 false 内网
|
|
|
- if (outerNet) {//外网
|
|
|
- //MQTT地址
|
|
|
- localStorage.setItem('mqttUrl', 'wss://' + Decrypt(obj.mqttExtranetUrl))
|
|
|
- //MQTT账号
|
|
|
- localStorage.setItem('mqttUser', Decrypt(obj.mqttExtranetUser))
|
|
|
- //MQTT密码
|
|
|
- localStorage.setItem('mqttPassword', Decrypt(obj.mqttExtranetPassword))
|
|
|
- //文件浏览环境
|
|
|
- localStorage.setItem('fileBrowseEnvironment', window.location.href.split('://')[0] + '://' + Decrypt(obj.fileBrowseEnvironmentExtranet))
|
|
|
- } else {
|
|
|
- //MQTT地址
|
|
|
- localStorage.setItem('mqttUrl', 'ws://' + Decrypt(obj.mqttIntranetUrl))
|
|
|
- //MQTT账号
|
|
|
- localStorage.setItem('mqttUser', Decrypt(obj.mqttIntranetUser))
|
|
|
- //MQTT密码
|
|
|
- localStorage.setItem('mqttPassword', Decrypt(obj.mqttIntranetPassword))
|
|
|
- //文件浏览环境
|
|
|
- localStorage.setItem('fileBrowseEnvironment', window.location.href.split('://')[0] + '://' + Decrypt(obj.fileBrowseEnvironment))
|
|
|
- }
|
|
|
- this.laboratoryBigViewSelectTriggerInfo();
|
|
|
- //开启预案定时查询
|
|
|
- this.alarmTimerFunction();
|
|
|
- })
|
|
|
- },
|
|
|
- /*************** 获取报警相关 ***************/
|
|
|
- laboratoryBigViewSelectTriggerInfo(){
|
|
|
- laboratoryBigViewSelectTriggerInfo().then(res => {
|
|
|
- let alarmRoom = getFloorMaps(res.data);
|
|
|
- if(alarmRoom[0]){
|
|
|
- this.dashboardsResearchUsage(alarmRoom);
|
|
|
- }else{
|
|
|
- this.$set(this,'alarmType',false);
|
|
|
- this.$set(this,'alarmData',null);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- //获取房间数据
|
|
|
- dashboardsResearchUsage(list){
|
|
|
- dashboardsResearchUsage('roomNames='+list[0].roomNumName).then(res => {
|
|
|
- let obj = list[0];
|
|
|
- obj.list = JSON.parse(JSON.stringify(list));
|
|
|
- if(res.data[0]){
|
|
|
- obj = {...obj,...res.data[0]};
|
|
|
- obj.status = obj.runningStateName == '维修' ? '3':(obj.stateName == '租用'?'2':'1')
|
|
|
- //假数据
|
|
|
- // obj.monitorVisable = true;
|
|
|
- // obj.subId = '1955554621449019392';
|
|
|
- this.iotSensorFindBySubId(obj);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- //查询传感器
|
|
|
- iotSensorFindBySubId(obj){
|
|
|
- let self = this;
|
|
|
- iotSensorFindBySubId({subId:obj.subId}).then(response => {
|
|
|
- obj.sensor = [];
|
|
|
- for(let i=0;i<obj.alarmData.triggerUploadData.length;i++){
|
|
|
- for(let o=0;o<response.data.length;o++){
|
|
|
- if(obj.alarmData.triggerUploadData[i].deviceNo == response.data[o].deviceNo){
|
|
|
- response.data[i].icon = response.data[i].icon?localStorage.getItem('fileBrowseEnvironment')+response.data[i].icon:null;
|
|
|
- // response.data[i].icon = 'http://192.168.1.8/statics/2025/08/25/9eec5108-2702-4ed0-942a-aced71fd1f57.svg';
|
|
|
- obj.sensor.push(response.data[i])
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- obj.videoList = [];
|
|
|
- //查询实验室监控
|
|
|
- if(obj.monitorVisable){
|
|
|
- let videoObj = {
|
|
|
- page:'1',
|
|
|
- pageSize:'10',
|
|
|
- buildId:'',
|
|
|
- floorId:'',
|
|
|
- passageway:'',
|
|
|
- subIds:[obj.subId],
|
|
|
- protocol:window.location.href.indexOf('https') !== -1?'wss':'ws',
|
|
|
- streamType:1,
|
|
|
- source:1,
|
|
|
- };
|
|
|
- iotCameraFindByCondition(videoObj).then(response => {
|
|
|
- for(let i=0;i<response.data.records.length;i++){
|
|
|
- obj.videoList.push(
|
|
|
- {
|
|
|
- fullShow:true,
|
|
|
- width: 708, //(宽度:非必传-默认600)
|
|
|
- height: 450, //(高度:非必传-默认338)
|
|
|
- url: response.data.records[i].streamUrl,
|
|
|
- cameraIndexCode: response.data.records[i].deviceNo,
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- self.$set(self,'alarmType',true);
|
|
|
- self.$set(self,'alarmData',obj);
|
|
|
- });
|
|
|
- }else{
|
|
|
- self.$set(self,'alarmType',true);
|
|
|
- self.$set(self,'alarmData',obj);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- //预案查询定时器
|
|
|
- alarmTimerFunction(){
|
|
|
- const self = this;
|
|
|
- self.alarmTimer = window.setInterval(() => {
|
|
|
- checkAlarmUpdates();
|
|
|
- }, this.alarmSwitchTime);
|
|
|
- async function checkAlarmUpdates() {
|
|
|
- self.laboratoryBigViewSelectTriggerInfo();
|
|
|
- }
|
|
|
- },
|
|
|
- //预案-MQTT连接
|
|
|
- offPlanMQTT(type){
|
|
|
- let self = this;
|
|
|
- if(self.planClient.unsubscribe){
|
|
|
- self.planClient.unsubscribe(self.planOpic, error => {
|
|
|
- if (error) {
|
|
|
- // console.log('mqtt关闭连接错误:', error)
|
|
|
- }
|
|
|
- })
|
|
|
- self.planClient.end();
|
|
|
- this.$set(this,'planClient',{});
|
|
|
- }
|
|
|
- //判断传入参数如果存在 发起一次新的连接
|
|
|
- if(type){
|
|
|
- this.planMQTT();
|
|
|
- }
|
|
|
- },
|
|
|
- //预案-MQTT订阅
|
|
|
- planMQTT(){
|
|
|
- let self = this;
|
|
|
- this.planClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
|
|
|
- username: localStorage.getItem('mqttUser'),
|
|
|
- password:localStorage.getItem('mqttPassword')
|
|
|
- });
|
|
|
- this.planClient.on("connect", e =>{
|
|
|
- this.planClient.subscribe(self.planOpic, (err) => {
|
|
|
- if (!err) {
|
|
|
- console.log("预案-订阅成功:" + self.planOpic);
|
|
|
- }else{
|
|
|
- // console.log("预案-连接错误:" + err);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.planClient.on("message", (topic, message) => {
|
|
|
- if (message){
|
|
|
- console.log('MQTTmessage',message);
|
|
|
- //获取预案数据
|
|
|
- this.laboratoryBigViewSelectTriggerInfo();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- clearInterval(this.alarmTimer);
|
|
|
- //清除MQTT
|
|
|
- this.offPlanMQTT();
|
|
|
+
|
|
|
},
|
|
|
destroyed() {
|
|
|
- clearInterval(this.alarmTimer);
|
|
|
- //清除MQTT
|
|
|
- this.offPlanMQTT();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -296,45 +84,31 @@
|
|
|
flex:1;
|
|
|
overflow: hidden;
|
|
|
display: flex;
|
|
|
- overflow: hidden;
|
|
|
.home-left-box{
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
overflow: hidden;
|
|
|
- /*width:826px;*/
|
|
|
- /*分辨率调整*/
|
|
|
- width: 1082px;
|
|
|
- margin:0 0 0 32px;
|
|
|
+ width: 950px;
|
|
|
+ margin:0 0 0 46px;
|
|
|
+ /*background-color: #8a6d3b;*/
|
|
|
}
|
|
|
.home-center-box{
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
overflow: hidden;
|
|
|
- /*width:1314px;*/
|
|
|
- /*分辨率调整*/
|
|
|
- width: 1570px;
|
|
|
- margin:0 21px;
|
|
|
- padding-top:38px;
|
|
|
+ width: 1757px;
|
|
|
+ margin:0 46px;
|
|
|
+ padding-top:18px;
|
|
|
+ /*background-color: #13ce66;*/
|
|
|
}
|
|
|
.home-right-box{
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
overflow: hidden;
|
|
|
- /*width:826px;*/
|
|
|
- /*分辨率调整*/
|
|
|
- width: 1082px;
|
|
|
- margin:0 32px 0 0;
|
|
|
+ width: 950px;
|
|
|
+ margin:0 46px 0 0;
|
|
|
+ /*background-color: #2f54eb;*/
|
|
|
}
|
|
|
}
|
|
|
- .button-img-box{
|
|
|
- /*width:3072px;*/
|
|
|
- /*分辨率调整*/
|
|
|
- width: 3840px;
|
|
|
- height:54px;
|
|
|
- margin-top:17px;
|
|
|
- overflow: hidden;
|
|
|
- background-image: url("../assets/ZDimages/img_db_bg@1x.png");
|
|
|
- background-size: 100% 100%;
|
|
|
- }
|
|
|
}
|
|
|
</style>
|