124 lines
4.8 KiB
JavaScript
124 lines
4.8 KiB
JavaScript
|
var vms = Vue.component("amplify-jkycyj", {
|
|||
|
template: `
|
|||
|
<div>
|
|||
|
<div class="amplify-title-icon">
|
|||
|
<img src="https://fileimg.makalu.cc/WEB_DBD5893450984E50AFF356EF44FF4139.png" @click="openAmplify">
|
|||
|
</div>
|
|||
|
<transition name="el-zoom-in-top">
|
|||
|
<div class="amplify-fixed" v-show="show" style="display: none" @click="closeAmplifyAll">
|
|||
|
<div class="amplify-max">
|
|||
|
<div class="amplify-title">
|
|||
|
<div>监控异常预警</div>
|
|||
|
<div class="amplify-close" @click="closeAmplify"><i class="el-icon-close"></i></div>
|
|||
|
</div>
|
|||
|
<div class="amplify-content">
|
|||
|
<!--内容区域-->
|
|||
|
<div class="amplify-warning-info">
|
|||
|
<div class="amplify-warning-info-table">
|
|||
|
<el-table ref="wgzpOne" :data="showTableDataOne" :header-row-style="headerRowOne" height="500" :row-style="rowStyleOne" @cell-mouse-enter="MouseEnterOne" @cell-mouse-leave="MouseLeaveOne" class="elTable">
|
|||
|
<el-table-column v-for="st in showTableTileOne" :prop="st.value" :label="st.name" width="200" show-overflow-tooltip></el-table-column>
|
|||
|
</el-table>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</transition>
|
|||
|
</div>
|
|||
|
`,
|
|||
|
props: {
|
|||
|
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
show:false,
|
|||
|
//监控异常预警
|
|||
|
showTableDataOne:[],
|
|||
|
showTableTileOne: [],
|
|||
|
rowStyleOne:{
|
|||
|
color:'#ffffff',
|
|||
|
fontSize:'24px',
|
|||
|
height:'64px'
|
|||
|
},
|
|||
|
headerRowOne:{
|
|||
|
fontSize: '20px'
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
mounted(){
|
|||
|
this.intervalOne = setInterval(this.scrollOne,50);
|
|||
|
},
|
|||
|
methods: {
|
|||
|
openAmplify(){
|
|||
|
this.show = true
|
|||
|
this.getExceptionAlert()
|
|||
|
this.getDeviceWarnData()
|
|||
|
},
|
|||
|
closeAmplify(){
|
|||
|
this.show = false
|
|||
|
},
|
|||
|
closeAmplifyAll(e){
|
|||
|
if(e.target.className == 'amplify-fixed'){
|
|||
|
this.show = false
|
|||
|
}
|
|||
|
},
|
|||
|
getExceptionAlert(){
|
|||
|
axios.get(requestUrl+"getExceptionAlert?deptId="+deptId+"&projectId="+JSON.parse(localStorage.getItem("data")).jzgj+"&size=10", {
|
|||
|
}).then(res => {
|
|||
|
this.showTableDataOne = res.data;
|
|||
|
this.showTableTileOne = [{name:"归属项目",value:"project_abbreviation"},{name:"机械名称",value:"device_name"},{name:"预警类型",value:"alarm_type_name"},{name:"预警地址",value:"address"}];
|
|||
|
this.getDeviceWarnData();
|
|||
|
}).catch(err => {
|
|||
|
})
|
|||
|
},
|
|||
|
getDeviceWarnData(){
|
|||
|
//安全预警
|
|||
|
axios.get("https://aqzg.makalu.cc/api/statistics/getDeviceWarnData",{params:{"deptId":131,"projectId":JSON.parse(localStorage.getItem("data")).aqzg}}
|
|||
|
).then(res => {
|
|||
|
if(res.data.length>0){
|
|||
|
let objArray = [];
|
|||
|
for(let i = 0;i<res.data.length;i++){
|
|||
|
let obj = {
|
|||
|
"address":"",
|
|||
|
"alarm_time":res.data[i].warn_time,
|
|||
|
"alarm_type_name":res.data[i].warn_context,
|
|||
|
"device_name":res.data[i].towerName,
|
|||
|
"project_abbreviation":res.data[i].project_abbreviation,
|
|||
|
}
|
|||
|
objArray.push(obj);
|
|||
|
}
|
|||
|
|
|||
|
for(let i = 0;i<this.showTableDataOne.length;i++){
|
|||
|
objArray.push(this.showTableDataOne[i]);
|
|||
|
}
|
|||
|
this.showTableDataOne = objArray;
|
|||
|
}
|
|||
|
}).catch(err => {
|
|||
|
});
|
|||
|
},
|
|||
|
//表格滚动
|
|||
|
scrollOne(){
|
|||
|
let maxHeight=this.$refs.wgzpOne.$el.querySelectorAll ('.el-table__body')[0].offsetHeight;
|
|||
|
let clientHeight=this.$refs.wgzpOne.bodyWrapper.clientHeight;
|
|||
|
if(Math.abs(this.$refs.wgzpOne.bodyWrapper.scrollTop-(maxHeight-clientHeight))<5){ //预留5像素误差
|
|||
|
this.$refs.wgzpOne.bodyWrapper.scrollTop=0;
|
|||
|
}else{
|
|||
|
this.$refs.wgzpOne.bodyWrapper.scrollTop+= 1;//32是每一行表格的高度,每秒滚一行
|
|||
|
}
|
|||
|
},
|
|||
|
MouseEnterOne(){//鼠标移入停止滚动
|
|||
|
clearInterval(this.intervalOne);
|
|||
|
},
|
|||
|
MouseLeaveOne(){//鼠标离开继续滚动
|
|||
|
this.intervalOne=setInterval(this.scrollOne,50);
|
|||
|
}
|
|||
|
|
|||
|
},
|
|||
|
watch:{
|
|||
|
|
|||
|
},
|
|||
|
|
|||
|
})
|
|||
|
|
|||
|
|