南昌市物联网技防平台-前端
Administrator
2021-03-21 253d5c40069c42a271d72e0f0294a00889562046
src/views/healthcode/healthcode.vue
@@ -18,6 +18,26 @@
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
        <template slot="menuLeft">
          <el-button
            v-bind:class="activeClass == 0 ? 'btn-color' : ''"
            size="medium "
            @click="getHealthcodeData(0)"
            >本日
          </el-button>
          <el-button
            v-bind:class="activeClass == 1 ? 'btn-color' : ''"
            size="medium "
            @click="getHealthcodeData(1)"
            >本周
          </el-button>
          <el-button
            v-bind:class="activeClass == 2 ? 'btn-color' : ''"
            size="medium "
            @click="getHealthcodeData(2)"
            >本月
          </el-button>
        </template>
      
    </avue-crud>
  </basic-container>
@@ -46,6 +66,7 @@
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          activeClass: 3,
          border: true,
          index: true,
          viewBtn: true,
@@ -210,14 +231,40 @@
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      getHealthcodeData(e) {
        this.activeClass = e;
        //status 0:本日  1:本月  2:本年   type: 1:绿色   2:黄色  3:红色
        var params = {
          status: e
        };
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        console.log("status="+this.$route.query.status);
        params ={
          status:this.$route.query.status,
          type:this.$route.query.type
        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 == "" ) {
              this.activeClass = this.$route.query.status;
              this.page.currentPage = 1;
              params = {
                status:this.$route.query.status,
                type:this.$route.query.type
              }
            } else {
              this.activeClass = 0;
              this.page.currentPage = 1;
              params = {
                type:this.$route.query.status
              };
            }
        }else{
            params = {
                status:this.$route.query.status,
                type:this.$route.query.type
            }
        }
        console.log("params="+params);
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;