南昌市物联网技防平台-前端
zengh
2023-01-16 8aa3edd56c279100c9053576f3e90fa55459fe77
src/views/animalHeat/animalHeat.vue
@@ -8,6 +8,7 @@
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               :search.sync="search"
               :row-style="rowStyle"
               @row-update="rowUpdate"
               @row-save="rowSave"
@@ -80,7 +81,9 @@
      return {
        form: {},
        query: {},
        search:{},
        showViewer:false,
        activeClass: 0,
        imgUrl:'',
        loading: true,
        page: {
@@ -92,13 +95,12 @@
        option: {
          menu:false,
          height:'auto',
          calcHeight: 30,
          calcHeight: 54,
          border: false,
          stripe:true,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          activeClass: 0,
          index: true,
          viewBtn: true,
          selection: true,
@@ -211,11 +213,14 @@
        this.query = {};
        //清空this.$route.query
        this.$router.push({ query: {} });
        //清空后默认查当日的数据
        this.activeClass=0;
        this.onLoad(this.page);
      },
      //搜索按钮
      searchChange(params, done) {
        console.log(params,222);
        //清空this.$route.query
        this.$router.push({ query: {} });
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
@@ -241,27 +246,104 @@
           if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
             return this.$route.query.startTime
           }
           return '';
           // 当前时间
          var date = new Date();
          //年
          var Y = date.getFullYear();
          //月
          var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
          //日
          var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
           return Y + "-" + M + "-" + D;
      },
      getEndTime(){
           if (this.$route.query.endTime != undefined && this.$route.query.endTime != null && this.$route.query.endTime != "" ) {
             return this.$route.query.endTime
           }
           return '';
            // 当前时间
            var date = new Date();
            //年
            var Y = date.getFullYear();
            //月
            var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
            //日
            var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
            return Y + "-" + M + "-" + D;
      },
      //本日,本周,本月  按钮
      getAnimalData(e) {
        this.activeClass=e;
        this.query={};
        this.$router.push({ query: {} });
        //type 0:本日  1:本周  2:本月   status: 0:正常   1:异常
        var today = new Date();
        var params ={};
        if(e==0){
          //修改搜索框中的值
          this.search.releaseTimeRange=[this.showToDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
        }
        if(e==1){
          //修改搜索框中的值
          this.search.releaseTimeRange=[this.showWeekFirstDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
        }
        if(e==2){
          //修改搜索框中的值
          this.search.releaseTimeRange=[this.showMonthFirstDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
        }
        params = {
          type: e
        };
        if(this.search.status){
          params = {
            ... params,
            status: this.search.status
          };
        }
        this.query=params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      //本日
      showToDay(Nowdate){
        var M=Number(Nowdate.getMonth())+1;
        if(M<10){
          M="0"+M;
        }
        var day = Nowdate.getDate();
        if(day<10){
          day = "0"+day;
        }
        return Nowdate.getFullYear()+"-"+M+"-"+day;
      },
      //本周第一天
      showWeekFirstDay(Nowdate){
        var WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);
        var M=Number(WeekFirstDay.getMonth())+1;
        if(M<10){
          M="0"+M;
        }
        var day = WeekFirstDay.getDate();
        if(day<10){
          day = "0"+day;
        }
        return WeekFirstDay.getFullYear()+"-"+M+"-"+day;
      },
      //本月第一天
      showMonthFirstDay(Nowdate){
        var MonthFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth(),1);
        var M=Number(MonthFirstDay.getMonth())+1;
        if(M<10){
          M="0"+M;
        }
        return MonthFirstDay.getFullYear()+"-"+M+"-"+"0"+MonthFirstDay.getDate();
      },
      //数据导出
      handleExport() {
        this.$confirm("是否导出体温数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          window.open(`/api/blade-jfpts/animalHeat/animalHeat/export-animalHeat?begTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&status=${this.$route.query.status}&timeDesc=${this.$route.query.timeDesc}`);
        });
      },
      //数据报表导出
      handleExportStatis() {
        this.$confirm("是否导出体温报表数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
@@ -270,9 +352,17 @@
          let endTime = this.$route.query.endTime==undefined? '':this.$route.query.endTime;
          let status = this.$route.query.status==undefined? '':this.$route.query.status;
          let timeDesc = this.$route.query.timeDesc==undefined? '':this.$route.query.timeDesc;
          window.open(`/api/blade-jfpts/animalHeat/animalHeat/export-animalHeat?begTime=${begTime}&endTime=${endTime}&status=${status}&timeDesc=${timeDesc}`);
        });
      },
      //数据报表导出
      handleExportStatis() {
          let begTime = this.$route.query.startTime==undefined? '':this.$route.query.startTime;
          let endTime = this.$route.query.endTime==undefined? '':this.$route.query.endTime;
          let status = this.$route.query.status==undefined? '':this.$route.query.status;
          let timeDesc = this.$route.query.timeDesc==undefined? '':this.$route.query.timeDesc;
          //window.open(`/api/blade-jfpts/animalHeat/animalHeat/getAnimalHeatStatis?begTime=${begTime}&endTime=${endTime}&status=${status}&timeDesc=${timeDesc}`);
          window.open(`https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-animalHeat.statis.ureport.xml&begTime=${begTime}&endTime=${endTime}&status=${status}&timeDesc=${timeDesc}`);
        });
      },
      //修改行颜色
      rowStyle({row, column, rowIndex}){
@@ -286,30 +376,20 @@
      rowClick(row){
        var that = this;
        that.imgUrl = row.picture;
        console.log(that.imgUrl,111);
        this.showViewer = true
      },
      // 关闭查看器
      closeViewer() {
        this.showViewer = false
      },
      getAnimalData(e) {
        this.activeClass=e;
        //type 0:本日  1:本月  2:本年   status: 0:正常   1:异常
        var params = {
          type: e
        };
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      //体温状态回填
      getAnimalType(){
          if (this.$route.query.status != undefined) {
              return this.$route.query.status
          }
      },
      onLoad(page, params = {}) {
      onLoad(page, params={}) {
        const { dateTime } = this.query;
        let values = {
          ...params,
@@ -327,20 +407,25 @@
                type:this.$route.query.type
              };
            }
            this.activeClass=4;
        }else if(this.$route.query.status != undefined){
            params = {
              status: this.$route.query.status,
              begTime: this.$route.query.startTime,
              endTime: this.$route.query.endTime
            }
        }else{
            this.activeClass=4;
        }
        //初始进入默认展示当天数据
        if(this.activeClass==0 && this.query.dateTime==null){
            params = {
                status:this.$route.query.status,
                type:this.$route.query.type
                type:this.activeClass
            }
        }
        if (dateTime) {
          this.activeClass=4;
          values = {
            ...params,
            begTime: dateTime[0],