123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- 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 = `<video width="100%" controls autobuffer autoplay>
- <source src="https://www.enstation.vip:9443${_src.split(":8170")[1]}" type="video/mp4"></source>
- </video>`
- }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()<new Date(_this.starDay).getTime()){
- let a = _this.endDay;
- _this.endDay = _this.starDay;
- _this.starDay = a;
- }
- }else if((!isNaN(_this.endDay)||!isNaN(Date.parse(_this.endDay)))&&(isNaN(_this.starDay)&&!isNaN(Date.parse(_this.starDay)))){
- _this.endDay = nowDate[0];
- }
- _this.initAjax();
- },
- }
- })
|