全:前端数据筛选

allTagChange(checked) {
      //'全部'被选中
      if (this.selectedTags.length == 0 || checked) {
        this.allTagStatus = true;
        this.selectedTags = [];
        this.getIndexInfo();
        this.noData = false;
      } else {
        this.allTagStatus = checked;
      }
    },
    handleChange(tag, checked) {
      const { selectedTags } = this;
      const nextSelectedTags = checked ? [...selectedTags, tag] : selectedTags.filter(t => t !== tag);
      this.selectedTags = nextSelectedTags;
      this.noData = false;
      if (checked) {
        //其他被选中,‘全部’为空
        this.allTagStatus = false;
      }
      if (this.selectedTags.length == 0) {
        //其他为空,获取所有数据
        this.getIndexInfo();
        this.allTagStatus = true;
      } else {
        let data = { Size: this.size };
        searchReportSet(data)
          .then(res => {
            if (res && res.data) {
              this.listData = res.data.result;
            }
          })
          .then(() => {
            let that = this;
            let filterList = that.listData.filter(item => {
              // 英文
              let category = item.category;
              //转换为中文
              let dictionary = that.typesJsonChBox;
              for (let i in dictionary) {
                if (dictionary.hasOwnProperty(i) && category == dictionary[i]) {
                  return that.selectedTags.indexOf(i) > -1;
                }
              }
            });
            if (filterList.length == 0) {
              this.noData = true;
            }
            this.listData = filterList;
          });
      }
    },
const tags = ['数据产品', '课题', '公司点评', '公司深度', '公司调研', '行业点评', '行业深度', '行业周报', '行业月报'];
const typesJsonCh = {
  数据产品: 'dataProducts',
  课题: 'subject',
  公司点评: 'companyReviews',
  公司深度: 'companyDepth',
  公司调研: 'companyResearch',
  行业点评: 'industryReviews',
  行业深度: 'industryDepth',
  行业周报: 'industryWeekly',
  行业月报: 'industryMonthly'
};
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值