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'
};