var _this, dataObj = [],nowDate = null, nowEnna = ""; new Vue({ el: '#app', filters: { setTime(_key){ let _sf = getDTime(new Date((_key+"").length>10?parseInt(_key):parseInt(_key)*1000)); return _sf[0] + _sf[1]; }, setImg(_key,num){ let _sfj = ""; if(_key != undefined){ let _safd = _key.split(";"); let _arr = []; _safd.forEach(item =>{ item = "https://www.enstation.vip:9443" + item.split(":8170")[1]; if(item.indexOf("Waring") == -1){ item = item.replace(/faceImg\/businessFile/g,"alarm_folder/display_image"); } _arr.push(item); }); _sfj = (num == 0?_arr[0]:_arr); } return _sfj } }, data: function() { return { warmLi: [], ajaxType: 'alljc', curPage: 1, allTotal: 0, starDay: "", endDay: "", dataLi: [], vidSrc: "", dialogVisible: false, mapVisible: false } }, created() { _this = this; nowDate = getDTime(new Date()); nowEnna = JSON.parse(localStorage.getItem("nowShip")); _this.getWarmType(); _this.initAjax(); }, mounted(){ window.addEventListener('message',(data)=>{ nowEnna = JSON.parse(localStorage.getItem("nowShip")); _this.initAjax(); }) }, methods: { getWarmType(){ let _ocjh = JSON.parse(getCookie("Admin-User")); let _show = (_ocjh.userId == 380); let _obj = [{ label: '告警总览', show: true, children: [{ label: '告警总览', type: 'alljc', show: true }] }, { label: '行为告警', show: false, children: [{ label: '离岗检测', type: 'lgjc', show: true }, { label: '区域闯入', type: 'jjjc', show: !_show },{ label: '打电话检测', type: 'ddhjc', show: true }, { label: '玩手机检测', type: 'wsjjc', show: true }, { label: '抽烟检测', type: 'xyjc', show: true },{ label: '打瞌睡检测', type: 'dksjc', show: _show }, { label: '睡觉检测', type: 'sjjc', show: _show },{ label: '瞭望检测', type: 'lwjc', show: _show }, { label: '巡检检测', type: 'xjjc', show: _show }, { label: '遮挡摄像头检测', type: 'zdjc', show: _show }] }, { label: '物品识别', show: false, children: [{ label: '安全帽检测', type: 'tkjc', show: true }, { label: '工作服检测', type: 'gzfjc', show: true }, { label: '口罩检测', type: 'kzjc', show: !_show }, { label: '烟火识别', type: 'yhjc', show: !_show }] }]; _this.warmLi = _obj; }, initAjax(){ if(nowEnna !=null && nowEnna != "null"&&nowEnna.en_name != ""&&nowEnna.en_name != null){ const loading = this.$loading({ background: 'rgba(0, 0, 0, 0.4)' }) setTimeout(()=>{ let _opts = { url: vipUrl + "/receive", type:"GET" }; let _data = { // user: "ruigaozhuoyue", user: nowEnna.en_name, msgType: _this.ajaxType == "alljc"?"":_this.ajaxType, enddate: _this.endDay, startdate: _this.starDay, pageNum: (_this.curPage - 1), pageSize: 12, }; let _hea = { "Authorization": "ZDhlNjhjOTAwM2EyJWd6eXolaWUldXNlciV6aF9DTg==", "Content-Type": "application/json;charset=UTF-8" }; getAxios(_opts, _data, _hea).then((res) => { if(res.success&&res.data.length){ _this.allTotal = res.total; _this.dataLi = res.data; }else{ _this.allTotal = 0; _this.dataLi = []; } loading.close(); }) },200) }else{ _this.allTotal = 0; _this.dataLi = []; } }, changeShow(ind){ _this.warmLi[ind].show = !_this.warmLi[ind].show }, changType(e){ let val = e.target.dataset.type; if(val != _this.ajaxType){ _this.ajaxType = val; _this.curPage = 1; _this.initAjax(); } }, handleCurrentChange(val) { if(val != _this.curPage){ _this.curPage = val; _this.checkQuery(); } }, seeVid(_src){ _this.dialogVisible = true; if(_src.indexOf(":8170/") != -1){ _this.vidSrc = `` }else{ _this.vidSrc = ""; } }, handleClose(done) { _this.vidSrc = ""; _this.dialogVisible = false; _this.mapVisible = false; }, seachLi(){ _this.curPage = 1; _this.checkQuery(); }, checkQuery(){ if((isNaN(_this.endDay)&&!isNaN(Date.parse(_this.endDay)))&&(!isNaN(_this.starDay)||isNaN(Date.parse(_this.starDay)))){ _this.$message({ message: '请选择开始时间!', type: 'warning' }); return; } if((isNaN(_this.endDay)&&!isNaN(Date.parse(_this.endDay)))&&(isNaN(_this.starDay)&&!isNaN(Date.parse(_this.starDay)))){ if(new Date(_this.endDay).getTime()