feat: 行业标签展示文字
This commit is contained in:
@@ -491,9 +491,29 @@ const UnifiedSearchBox = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 行业标签
|
// 行业标签
|
||||||
if (industryValue && industryValue.length > 0) {
|
if (industryValue && industryValue.length > 0 && industryData) {
|
||||||
const industryLabel = industryValue.slice(1).join(' > ');
|
// 递归查找每个层级的 label
|
||||||
tags.push({ key: 'industry', label: `行业: ${industryLabel}` });
|
const findLabel = (code, data) => {
|
||||||
|
for (const item of data) {
|
||||||
|
if (code.startsWith(item.value)) {
|
||||||
|
if(item.value === code){
|
||||||
|
return item.label;
|
||||||
|
}else {
|
||||||
|
return findLabel(code, item.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 只显示最后一级的 label
|
||||||
|
const lastLevelCode = industryValue[industryValue.length - 1];
|
||||||
|
const lastLevelLabel = findLabel(lastLevelCode, industryData);
|
||||||
|
|
||||||
|
tags.push({
|
||||||
|
key: 'industry',
|
||||||
|
label: `行业: ${lastLevelLabel}`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 日期范围标签
|
// 日期范围标签
|
||||||
|
|||||||
Reference in New Issue
Block a user