liuyg
2021-07-16 f5641fd76ef90a66599e8ce121f3acfd97d779e8
src/views/healthcode/healthcode.vue
@@ -1,6 +1,7 @@
<template>
  <basic-container>
    <avue-crud :option="option"
    <avue-crud
      :option="option"
               :table-loading="loading"
               :data="data"
               :page="page"
@@ -19,7 +20,8 @@
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      @on-load="onLoad"
    >
        <template slot="menuLeft">
          <el-button
            v-bind:class="activeClass == 0 ? 'btn-color' : ''"
@@ -42,20 +44,23 @@
        </template>
        <template slot="menuLeft">
          <el-button type="warning"
        <el-button
          type="warning"
                      size="small"
                      plain
                      icon="el-icon-download"
                      @click="handleExport">导出
          @click="handleExport"
          >导出
          </el-button>
          <el-button type="warning"
        <el-button
          type="warning"
                      size="small"
                      plain
                      icon="el-icon-pie-chart"
                      @click="handleExportStatis">导出报表
          @click="handleExportStatis"
          >导出报表
          </el-button>
        </template>
    </avue-crud>
  </basic-container>
</template>
@@ -75,15 +80,15 @@
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        total: 0,
        },
        selectionList: [],
        option: {
          menu:false,
          height:'auto',
        height: "auto",
          calcHeight: 54,
          border: false,
          stripe:true,
        //stripe:true,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
@@ -92,27 +97,27 @@
          selection: true,
          labelWidth:120,
          dialogClickModal: false,
          headerAlign: 'center',
          align: 'center',
        headerAlign: "center",
        align: "center",
          column: [
            {
              label: '坐标',
              prop: 'test',
            label: "坐标",
            prop: "test",
              hide: true,
              span: 24,
              component: "avueMap",
              clickChild: (obj) => {
                this.form.jd = obj.latitude
                this.form.wd = obj.longitude
              this.form.jd = obj.latitude;
              this.form.wd = obj.longitude;
              },
            },
            {
              label: "检测时间",
              prop: "dtime"
            prop: "dtime",
            },
            {
              label: '性别',
              prop: 'sex'
            label: "性别",
            prop: "sex",
            },
            {
              label: "检测时间",
@@ -132,48 +137,48 @@
                {
                  required: true,
                  message: "请输入时间",
                  trigger: "blur"
                }
              ]
                trigger: "blur",
              },
            ],
            },
            {
              label: '省份',
              prop: 'province',
            label: "省份",
            prop: "province",
              //search: true,
              searchSpan: 3,
              type: 'select',
            type: "select",
              props: {
                label: 'name',
                value: 'name'
              label: "name",
              value: "name",
              },
              cascaderItem: ['city', 'district'],
              dicUrl: '/api/blade-system/region/select',
            cascaderItem: ["city", "district"],
            dicUrl: "/api/blade-system/region/select",
              span: 6,
            },
            {
              label: '地市',
              prop: 'city',
              type: 'select',
            label: "地市",
            prop: "city",
            type: "select",
              searchSpan: 3,
              //search: true,
              props: {
                label: 'name',
                value: 'name'
              label: "name",
              value: "name",
              },
              dicUrl: '/api/blade-system/region/select?code={{key}}',
            dicUrl: "/api/blade-system/region/select?code={{key}}",
              span: 6,
            },
            {
              label: '区县',
            label: "区县",
              searchSpan: 3,
              //search: true,
              prop: 'district',
              type: 'select',
            prop: "district",
            type: "select",
              props: {
                label: 'name',
                value: 'name'
              label: "name",
              value: "name",
              },
              dicUrl: '/api/blade-system/region/select?code={{key}}',
            dicUrl: "/api/blade-system/region/select?code={{key}}",
              span: 6,
            },
            {
@@ -188,28 +193,26 @@
              dicData: [
                {
                  label: "绿色",
                  value: "1"
                value: "1",
                },
                {
                  label: "黄色",
                  value: "2"
                value: "2",
                },
                {
                  label: "红色",
                  value: "3"
                }
                value: "3",
              },
              ],
            }
          ]
          },
        ],
        },
        data: [],
        isActive: false,
        recorder: null,
      };
    },
    mounted(){
    },
  mounted() {},
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
@@ -217,20 +220,19 @@
          addBtn: this.vaildData(null, false),
          viewBtn: this.vaildData(null, false),
          delBtn: this.vaildData(null, false),
          editBtn: this.vaildData(null, false)
        editBtn: this.vaildData(null, false),
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
      this.selectionList.forEach((ele) => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    },
    methods: {
      beforeOpen(done, type) {
      },
    beforeOpen(done, type) {},
      searchReset() {
        //清空搜索框中的内容
        this.query = {};
@@ -266,34 +268,48 @@
      rowStyle({row, column, rowIndex}){
         if(row.type=="3"){
           return {
             color:"#fe1515"
           }
          color: "#fe1515",
        };
         }
      },
      getStartTime(){
           if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
             return this.$route.query.startTime
      if (
        this.$route.query.startTime != undefined &&
        this.$route.query.startTime != null &&
        this.$route.query.startTime != ""
      ) {
        return this.$route.query.startTime;
           }
           // 当前时间
          var date = new Date();
          //年
          var Y = date.getFullYear();
          //月
          var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
      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
      if (
        this.$route.query.endTime != undefined &&
        this.$route.query.endTime != null &&
        this.$route.query.endTime != ""
      ) {
        return this.$route.query.endTime;
           }
            // 当前时间
            var date = new Date();
            //年
            var Y = date.getFullYear();
            //月
            var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
      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;
@@ -315,24 +331,33 @@
        var params ={};
        if(e==0){
          //修改搜索框中的值
          this.search.releaseTimeRange=[this.showToDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
        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"]
        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"]
        this.search.releaseTimeRange = [
          this.showMonthFirstDay(today) + " 00:00:00",
          this.showToDay(today) + " 23:59:59",
        ];
        }
        params = {
          ... params,
          status: e
        status: e,
        };
        if(this.search.type){
          params = {
            ... params,
            type: this.search.type
          type: this.search.type,
          };
        }
        this.query=params;
@@ -368,48 +393,76 @@
      //本月第一天
      showMonthFirstDay(Nowdate){
        var MonthFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth(),1);
      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();
      return (
        MonthFirstDay.getFullYear() +
        "-" +
        M +
        "-" +
        "0" +
        MonthFirstDay.getDate()
      );
      },
      //数据导出
      handleExport() {
        this.$confirm("是否导出健康码数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        type: "warning",
        }).then(() => {
          window.open(`/api/healthcode/healthcode/export-healthcode?begTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&type=${this.$route.query.type}&timeDesc=${this.$route.query.timeDesc}`);
        window.open(
          `/api/healthcode/healthcode/export-healthcode?begTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&type=${this.$route.query.type}&timeDesc=${this.$route.query.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 type = this.$route.query.type==undefined? '':this.$route.query.type;
          let timeDesc = this.$route.query.timeDesc==undefined? '':this.$route.query.timeDesc;
      let begTime =
        this.$route.query.startTime == undefined
          ? ""
          : this.$route.query.startTime;
      let endTime =
        this.$route.query.endTime == undefined ? "" : this.$route.query.endTime;
      let type =
        this.$route.query.type == undefined ? "" : this.$route.query.type;
      let timeDesc =
        this.$route.query.timeDesc == undefined
          ? ""
          : this.$route.query.timeDesc;
          //window.open(`http://localhost:8108/ureport/excel?_u=blade-healthcode.statis.xml.ureport.xml&begTime=${begTime}&endTime=${endTime}&type=${type}&timeDesc=${timeDesc}`);
          window.open(`https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-healthcode.statis.xml.ureport.xml&begTime=${begTime}&endTime=${endTime}&type=${type}&timeDesc=${timeDesc}`);
      window.open(
        `https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-healthcode.statis.xml.ureport.xml&begTime=${begTime}&endTime=${endTime}&type=${type}&timeDesc=${timeDesc}`
      );
      },
      onLoad(page, params={}) {
        const { dateTime } = this.query;
        let values = {
          ...params,
        };
        if (this.$route.query.status!=undefined && this.$route.query != undefined && this.$route.query != null && this.$route.query != "" ) {
      if (
        this.$route.query.status != undefined &&
        this.$route.query != undefined &&
        this.$route.query != null &&
        this.$route.query != ""
      ) {
            if (this.$route.query.type != undefined) {
              this.page.currentPage = 1;
              params = {
                status:this.$route.query.status,
                type:this.$route.query.type
              }
            type: this.$route.query.type,
          };
            } else {
              this.page.currentPage = 1;
              params = {
                type:this.$route.query.status
            type: this.$route.query.status,
              };
            }
            this.activeClass =4;
@@ -417,8 +470,8 @@
          params = {
            type: this.$route.query.type,
            begTime: this.$route.query.startTime,
            endTime: this.$route.query.endTime
          }
          endTime: this.$route.query.endTime,
        };
          this.activeClass =4;
        }
        // else{
@@ -431,7 +484,7 @@
        if(this.activeClass == 0 && this.query.dateTime==null){
          params = {
              status:this.activeClass,
          }
        };
        }
        if (dateTime) {
@@ -459,15 +512,15 @@
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize,values).then(res => {
      getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
    },
  },
  };
</script>
<style scoped>