123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- var _this, dataObj = [],nowDate = null, nowYsy = "";
- var snData = { 412373470: "226940", 413871376: "226941" }
- 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
- },
- getType(_key){
- let _sf = "";
- switch(_key){
- case 'fd':
- _sf = "疲劳驾驶";
- break;
- case 'ya':
- _sf = "打哈欠";
- break;
- case 'cey':
- _sf = "闭眼";
- break;
- case 'am':
- _sf = "分神驾驶";
- break;
- case 't3d':
- _sf = "遮挡摄像头";
- break;
- case 'td':
- _sf = "超时驾驶";
- break;
- }
- return _sf;
- },
- },
- data: function() {
- return {
- warmLi: [],
- ajaxType: 'alljc',
- curPage: 1,
- allTotal: 0,
- starDay: "",
- endDay: "",
- dataLi: [],
- vidSrc: "",
- dialogVisible: false,
- dialogVisibleImg: false,
- queryRame: {
- "typestr": "",
- "startTime":"",
- "endTime":""
- },
- tableData: [],
- isGen: false,
- nowDetItem: {},
- imgSrc: ""
- }
- },
- created() {
- _this = this;
- nowDate = getDTime(new Date());
- _this.queryRame.startTime = nowDate[0];
- _this.queryRame.endTime = nowDate[0];
- nowYsy = JSON.parse(localStorage.getItem("nowShip"));
- _this.initAjax();
- _this.getWarmType();
- },
- mounted(){
- window.addEventListener('message',(data)=>{
- nowYsy = JSON.parse(localStorage.getItem("nowShip"));
- if(_this.isGen){
- _this.getAlarms();
- }else{
- _this.initAjax();
- }
- })
- },
- methods: {
- getWarmType(){
- let _ocjh = JSON.parse(getCookie("Admin-User"));
- let _show = (_ocjh.userId == 354);
- let _obj = [{
- label: '告警总览',
- show: true,
- children: [{
- label: '告警总览',
- type: 'alljc',
- show: true
- }]
- }, {
- label: '行为告警',
- show: false,
- children: [{
- label: '离岗检测',
- type: 'lgjc',
- show: true
- }, {
- label: '区域闯入',
- type: 'qycr',
- show: true
- },{
- label: '打电话检测',
- type: 'ddhjc',
- show: true
- }, {
- label: '玩手机检测',
- type: 'wsjjc',
- show: true
- }, {
- label: '抽烟检测',
- type: 'cyjc',
- show: true
- }, {
- label: '生理疲劳',
- type: 'gen,fd,ya,cey',
- show: _show
- },{
- label: '分神驾驶',
- type: 'gen,am',
- show: _show
- }, {
- label: '遮挡摄像头',
- type: 'gen,t3d',
- show: _show
- }, {
- label: '超时驾驶',
- type: 'gen,td',
- show: _show
- }]
- }, {
- label: '物品识别',
- show: false,
- children: [{
- label: '安全帽检测',
- type: 'aqmjc',
- show: true
- }, {
- label: '工作服检测',
- type: 'gzfjc',
- show: true
- }, {
- label: '口罩检测',
- type: 'kzjc',
- show: true
- }, {
- label: '烟火识别',
- type: 'yhjc',
- show: true
- }, {
- label: '船只识别',
- type: 'czsb',
- show: _show
- }]
- }];
- _this.warmLi = _obj;
- },
- initAjax(){
- if(nowYsy !=null && nowYsy != "null"&&nowYsy.en_name != ""&&nowYsy.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: nowYsy.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 = [];
- }
- },
- getAlarms(){
- const loading = this.$loading({
- background: 'rgba(0, 0, 0, 0.4)'
- })
- setTimeout(()=>{
- let _opts = {
- "types": _this.queryRame.typestr.split(",").slice(1),
- "startTime": _this.queryRame.startTime+" 00:00:00",
- "endTime": _this.queryRame.endTime+" 23:59:59",
- "speedMin":null,
- "duration":null,
- "alarmSrcs":null,
- "states":null,
- "alarmLevels":[],
- "carId": snData[nowYsy.mmsi]
- }
- getAlarmById(_opts).then(res => {
- _this.tableData = res.result
- loading.close();
- })
- },200)
- },
- changeShow(ind){
- _this.warmLi[ind].show = !_this.warmLi[ind].show
- },
- changType(e){
- let val = e.target.dataset.type;
- if(val.indexOf("gen") == -1){
- _this.isGen = false;
- _this.queryRame.typestr = "";
- if(val != _this.ajaxType){
- _this.ajaxType = val;
- _this.curPage = 1;
- _this.initAjax();
- }
- }else{
- _this.isGen = true;
- _this.ajaxType = "";
- if(val != _this.queryRame.typestr){
- _this.queryRame.typestr = val;
- _this.getAlarms();
- }
- }
- },
- 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;
- },
- seeDetail(val, num){
- if(val.markx != _this.nowDetItem.markx){
- _this.nowDetItem = val;
- const loading = this.$loading({
- background: 'rgba(0, 0, 0, 0.4)'
- })
- setTimeout(()=>{
- let data = {
- "carId": val.carId,
- "endTime": val.endTime,
- "seq": "",
- "startTime": val.startTime,
- "types": [val.typeId]
- };
- getAlarmDetail(data).then(res => {
- if(res.result.length){
- let _obj = res.result[0];
- let _time = _obj["time"].split(' ');
- let _str = res.result.filter(item => item.type == 2);
- _this.imgSrc = `${nGenUrl}/gps-web/photos?refPath=${_time[0]}/${_obj.carId}/${_time[1].replace(/:/g,"")}_${_obj.mediaId}.jpg`;
- if(_str.length){
- let videoUrl = `${nGenUrl}/gps-web/photos?refPath=${_time[0]}/${_obj.carId}/${_time[1].replace(/:/g,"")}_${_str[0].mediaId}.mp4`;
- _this.vidSrc = `<video width="100%" controls autobuffer autoplay>
- <source src="${videoUrl}" type="video/mp4"></source>
- </video>`;
- }else{
- _this.vidSrc = "";
- }
- }else{
- _this.vidSrc = "";
- _this.imgSrc = "";
- }
- loading.close();
- if(num == 0){
- _this.dialogVisibleImg = true;
- }else{
- _this.dialogVisible = true;
- }
- })
- },200);
- }else{
- if(num == 0){
- _this.dialogVisibleImg = true;
- }else{
- _this.dialogVisible = true;
- }
- }
- },
- seachGenLi(){
- _this.getAlarms();
- },
- 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();
- },
- }
- })
|