南昌市物联网技防平台-前端
Administrator
2021-05-07 14e02654e0545ee69456d64aef2f35c7c219d708
src/views/healthcode/healthcode.vue
@@ -8,6 +8,8 @@
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               :row-style="rowStyle"
               :search.sync="search"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
@@ -21,24 +23,39 @@
        <template slot="menuLeft">
          <el-button
            v-bind:class="activeClass == 0 ? 'btn-color' : ''"
            size="medium "
            size="small "
            @click="getHealthcodeData(0)"
            >本日
          </el-button>
          <el-button
            v-bind:class="activeClass == 1 ? 'btn-color' : ''"
            size="medium "
            size="small "
            @click="getHealthcodeData(1)"
            >本周
          </el-button>
          <el-button
            v-bind:class="activeClass == 2 ? 'btn-color' : ''"
            size="medium "
            size="small "
            @click="getHealthcodeData(2)"
            >本月
          </el-button>
        </template>
        <template slot="menuLeft">
          <el-button type="warning"
                      size="small"
                      plain
                      icon="el-icon-download"
                      @click="handleExport">导出
          </el-button>
          <el-button type="warning"
                      size="small"
                      plain
                      icon="el-icon-pie-chart"
                      @click="handleExportStatis">导出报表
          </el-button>
        </template>
    </avue-crud>
  </basic-container>
</template>
@@ -52,6 +69,7 @@
      return {
        form: {},
        query: {},
        search:{},
        loading: true,
        page: {
          pageSize: 10,
@@ -62,12 +80,13 @@
        option: {
          menu:false,
          height:'auto',
          calcHeight: 30,
          calcHeight: 54,
          border: false,
          stripe:true,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          activeClass: 3,
          border: true,
          activeClass: 0,
          index: true,
          viewBtn: true,
          selection: true,
@@ -102,6 +121,7 @@
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              searchRange: true,
              searchValue:[this.getStartTime(),this.getEndTime()],
              searchSpan: 5,
              hide: true,
              addDisplay: false,
@@ -119,7 +139,7 @@
            {
              label: '省份',
              prop: 'province',
              search: true,
              //search: true,
              searchSpan: 3,
              type: 'select',
              props: {
@@ -135,7 +155,7 @@
              prop: 'city',
              type: 'select',
              searchSpan: 3,
              search: true,
              //search: true,
              props: {
                label: 'name',
                value: 'name'
@@ -146,7 +166,7 @@
            {
              label: '区县',
              searchSpan: 3,
              search: true,
              //search: true,
              prop: 'district',
              type: 'select',
              props: {
@@ -159,9 +179,10 @@
            {
              label: "健康码颜色",
              search: true,
              searchLabelWidth:100,
              searchLabelWidth:120,
              prop: "type",
              searchSpan: 3,
              searchSpan: 4,
              searchValue: this.getHealthcodeType(),
              width:210,
              type: "select",
              dicData: [
@@ -181,8 +202,13 @@
            }
          ]
        },
        data: []
        data: [],
        isActive: false,
        recorder: null,
      };
    },
    mounted(){
    },
    computed: {
      ...mapGetters(["permission"]),
@@ -202,12 +228,14 @@
        return ids.join(",");
      }
    },
    methods: {
      beforeOpen(done, type) {
      },
      searchReset() {
        //清空搜索框中的内容
        this.query = {};
        //清空this.$route.query
        this.$router.push({ query: {} });
        this.onLoad(this.page);
      },
      searchChange(params, done) {
@@ -232,8 +260,35 @@
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      rowStyle({row, column, rowIndex}){
         if(row.type=="3"){
           return {
             color:"#fe1515"
           }
         }
      },
      getStartTime(){
           if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
             return this.$route.query.startTime
           }
           return '';
      },
      getEndTime(){
           if (this.$route.query.endTime != undefined && this.$route.query.endTime != null && this.$route.query.endTime != "" ) {
             return this.$route.query.endTime
           }
           return '';
      },
      getHealthcodeType(){
          if (this.$route.query.type != undefined) {
              var type = this.$route.query.type+"";
              //this.$route.query = {};
              return type;
          }
      },
      getHealthcodeData(e) {
        this.activeClass = e;
        var that = this;
        that.activeClass = e;
        //status 0:本日  1:本月  2:本年   type: 1:绿色   2:黄色  3:红色
        var params = {
          status: e
@@ -242,14 +297,33 @@
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      //数据导出
      handleExport() {
        this.$confirm("是否导出健康码数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          window.open(`/api/blade-jfpts/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;
          //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}`);
      },
      onLoad(page, params = {}) {
        const { dateTime } = this.query;
        let values = {
          ...params,
        };
        if (this.$route.query.status && this.$route.query != undefined && this.$route.query != null && this.$route.query != "" ) {
            if (this.$route.query.type != undefined && this.$route.query.type != null && this.$route.query.type != "" ) {
        if (this.$route.query.status!=undefined && this.$route.query != undefined && this.$route.query != null && this.$route.query != "" ) {
            if (this.$route.query.type != undefined) {
              this.activeClass = this.$route.query.status;
              this.page.currentPage = 1;
              params = {
@@ -263,10 +337,10 @@
                type:this.$route.query.status
              };
            }
        }else if(this.$route.query.type != undefined && this.$route.query.type != null && this.$route.query.type != "" ){
        }else if(this.$route.query.type != undefined){
          params = {
            type: this.$route.query.type,
            beginTime: this.$route.query.startTime,
            begTime: this.$route.query.startTime,
            endTime: this.$route.query.endTime
          }
        }else{
@@ -274,6 +348,7 @@
                status:this.$route.query.status,
                type:this.$route.query.type
            }
        }
        if (dateTime) {
@@ -291,6 +366,14 @@
          };
        }
        if (this.$route.query.timeDesc) {
          values = {
            ...params,
            timeDesc: this.$route.query.timeDesc,
            ...this.query,
          };
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize,values).then(res => {
          const data = res.data.data;
@@ -303,3 +386,10 @@
    }
  };
</script>
<style scoped>
  .el-button.btn-color {
    color: rgb(255, 255, 255);
    background-color: rgb(64, 158, 255);
    border-color: rgb(64, 158, 255);
  }
</style>