2025-06-16 14:42:26 +08:00
|
|
|
<template>
|
|
|
|
|
<view>
|
|
|
|
|
<!-- 头部 -->
|
|
|
|
|
<a-space
|
|
|
|
|
direction="vertical"
|
|
|
|
|
style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0; color: #737478; font-size: 14px"
|
|
|
|
|
>
|
2025-06-21 11:39:35 +08:00
|
|
|
<a-space align="start" style="width: 100%; margin-top: 20px; align-items: flex-start">
|
|
|
|
|
<span style="width: 60px; flex-shrink: 0; line-height: 28px">行业大类</span>
|
|
|
|
|
<div style="display: flex; flex-wrap: wrap; gap: 8px; width: 100%; align-items: flex-start">
|
2025-06-16 14:42:26 +08:00
|
|
|
<a-tag
|
|
|
|
|
size="Medium"
|
|
|
|
|
v-for="item in industriesTree"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:checkable="true"
|
|
|
|
|
:checked="selectedIndustry == item.id"
|
|
|
|
|
@check="handleIndustryCheck(item.id)"
|
|
|
|
|
style="padding: 4px 16px; border-radius: 30px; height: 28px"
|
|
|
|
|
:style="
|
|
|
|
|
selectedIndustry == item.id
|
|
|
|
|
? 'color: #6d4cfe; background-color: #f0edff'
|
|
|
|
|
: 'color: #3C4043; background-color: #F7F8FA'
|
|
|
|
|
"
|
|
|
|
|
>{{ item.name }}</a-tag
|
|
|
|
|
>
|
2025-06-21 11:39:35 +08:00
|
|
|
</div>
|
2025-06-16 14:42:26 +08:00
|
|
|
</a-space>
|
2025-06-21 11:39:35 +08:00
|
|
|
<!-- 二级类目 -->
|
|
|
|
|
<a-space align="start" style="width: 100%; margin-top: 20px; align-items: flex-start">
|
|
|
|
|
<span style="width: 60px; flex-shrink: 0; line-height: 28px">二级类目</span>
|
|
|
|
|
<div style="display: flex; flex-wrap: wrap; gap: 8px; width: 100%; align-items: flex-start">
|
2025-06-16 14:42:26 +08:00
|
|
|
<a-tag
|
|
|
|
|
size="Medium"
|
|
|
|
|
v-for="item in subCategories"
|
2025-06-17 11:18:39 +08:00
|
|
|
:key="item.id"
|
2025-06-16 14:42:26 +08:00
|
|
|
:checkable="true"
|
2025-06-17 11:18:39 +08:00
|
|
|
:checked="selectedSubCategory == item.id"
|
|
|
|
|
@check="handleSubCategoryCheck(item.id)"
|
2025-06-16 14:42:26 +08:00
|
|
|
style="padding: 4px 16px; border-radius: 30px; height: 28px"
|
|
|
|
|
:style="
|
2025-06-17 11:18:39 +08:00
|
|
|
selectedSubCategory == item.id
|
2025-06-16 14:42:26 +08:00
|
|
|
? 'color: #6d4cfe; background-color: #f0edff'
|
|
|
|
|
: 'color: #3C4043; background-color: #F7F8FA'
|
|
|
|
|
"
|
2025-06-17 11:18:39 +08:00
|
|
|
>{{ item.name }}</a-tag
|
2025-06-16 14:42:26 +08:00
|
|
|
>
|
2025-06-21 11:39:35 +08:00
|
|
|
</div>
|
2025-06-16 14:42:26 +08:00
|
|
|
</a-space>
|
2025-06-21 11:39:35 +08:00
|
|
|
<!-- </a-space> -->
|
|
|
|
|
<a-space align="start" style="width: 100%; margin-top: 20px; align-items: flex-start">
|
|
|
|
|
<span style="width: 60px; flex-shrink: 0; line-height: 28px">时间筛选</span>
|
|
|
|
|
<div style="display: flex; flex-wrap: wrap; gap: 8px; width: 100%; align-items: flex-start">
|
2025-06-16 14:42:26 +08:00
|
|
|
<a-tag
|
|
|
|
|
size="Medium"
|
|
|
|
|
v-for="item in timePeriods"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:checkable="true"
|
|
|
|
|
:checked="selectedTimePeriod == item.value"
|
|
|
|
|
@check="handleTimePeriodCheck(item.value)"
|
|
|
|
|
style="padding: 4px 16px; border-radius: 30px; height: 28px"
|
|
|
|
|
:style="
|
|
|
|
|
selectedTimePeriod == item.value
|
|
|
|
|
? 'color: #6d4cfe; background-color: #f0edff'
|
|
|
|
|
: 'color: #3C4043; background-color: #F7F8FA'
|
|
|
|
|
"
|
|
|
|
|
>{{ item.label }}
|
|
|
|
|
</a-tag>
|
2025-06-21 11:39:35 +08:00
|
|
|
</div>
|
2025-06-16 14:42:26 +08:00
|
|
|
</a-space>
|
|
|
|
|
<!-- 搜索区域 -->
|
|
|
|
|
<a-space style="margin-left: 'auto'; margin-top: 20px">
|
|
|
|
|
<a-button type="primary" @click="handleSearch">
|
|
|
|
|
<template #icon>
|
|
|
|
|
<icon-search />
|
|
|
|
|
</template>
|
|
|
|
|
<!-- Use the default slot to avoid extra spaces -->
|
|
|
|
|
<template #default>搜索</template>
|
|
|
|
|
</a-button>
|
2025-06-17 11:18:39 +08:00
|
|
|
<div
|
|
|
|
|
@click="handleReset"
|
|
|
|
|
style="
|
|
|
|
|
width: 92px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #3c4043;
|
|
|
|
|
border: 1px solid #d7d7d9;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<icon-refresh></icon-refresh>
|
|
|
|
|
<span>重置</span>
|
|
|
|
|
</div>
|
2025-06-16 14:42:26 +08:00
|
|
|
</a-space>
|
|
|
|
|
</a-space>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
2025-06-17 11:18:39 +08:00
|
|
|
<script setup lang="ts">
|
2025-06-16 14:42:26 +08:00
|
|
|
import { ref, computed } from 'vue';
|
2025-06-17 11:18:39 +08:00
|
|
|
import { fetchIndustriesTree } from '@/api/all/index';
|
|
|
|
|
|
2025-06-16 14:42:26 +08:00
|
|
|
// 行业大类
|
|
|
|
|
const industriesTree = ref([]);
|
|
|
|
|
// 数据状态
|
|
|
|
|
const selectedIndustry = ref();
|
2025-06-17 11:18:39 +08:00
|
|
|
const selectedSubCategory = ref(0);
|
2025-06-16 14:42:26 +08:00
|
|
|
const selectedTimePeriod = ref('7');
|
|
|
|
|
|
|
|
|
|
// 暴露这些状态给父组件
|
|
|
|
|
defineExpose({
|
|
|
|
|
selectedIndustry,
|
|
|
|
|
selectedSubCategory,
|
|
|
|
|
selectedTimePeriod,
|
|
|
|
|
});
|
|
|
|
|
// 二级类目选项
|
2025-06-17 11:18:39 +08:00
|
|
|
const subCategories = ref([]);
|
2025-06-16 14:42:26 +08:00
|
|
|
// 时间周期选项
|
|
|
|
|
const timePeriods = [
|
|
|
|
|
{
|
|
|
|
|
value: '7',
|
|
|
|
|
label: '近7天',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '15',
|
|
|
|
|
label: '近15天',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '30',
|
|
|
|
|
label: '近30天',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2025-06-17 11:18:39 +08:00
|
|
|
const handleIndustryCheck = (id) => {
|
|
|
|
|
selectedIndustry.value = id;
|
|
|
|
|
console.log(industriesTree.value);
|
|
|
|
|
for (let i = 0; i < industriesTree.value.length; i++) {
|
|
|
|
|
if (industriesTree.value[i].id == id) {
|
|
|
|
|
subCategories.value = [];
|
|
|
|
|
subCategories.value = [...industriesTree.value[i].children];
|
|
|
|
|
subCategories.value.unshift({ id: 0, name: '全部' });
|
|
|
|
|
selectedSubCategory.value = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-16 14:42:26 +08:00
|
|
|
};
|
|
|
|
|
|
2025-06-17 11:18:39 +08:00
|
|
|
const handleSubCategoryCheck = (id) => {
|
|
|
|
|
selectedSubCategory.value = id;
|
2025-06-16 14:42:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleTimePeriodCheck = (value) => {
|
|
|
|
|
selectedTimePeriod.value = value;
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-17 11:18:39 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
getIndustriesTree();
|
|
|
|
|
});
|
|
|
|
|
// 获取行业大类数据
|
|
|
|
|
const getIndustriesTree = async () => {
|
|
|
|
|
const res = await fetchIndustriesTree();
|
2025-06-21 16:57:01 +08:00
|
|
|
if (res.code == 200) {
|
|
|
|
|
let data = res['data'];
|
|
|
|
|
industriesTree.value = data;
|
|
|
|
|
selectedIndustry.value = data[0].id;
|
|
|
|
|
selectedSubCategory.value = 0;
|
|
|
|
|
subCategories.value = [...industriesTree.value[0].children];
|
|
|
|
|
subCategories.value.unshift({ id: 0, name: '全部' });
|
|
|
|
|
}
|
2025-06-16 14:42:26 +08:00
|
|
|
};
|
2025-06-17 11:18:39 +08:00
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(e: 'search'): void;
|
|
|
|
|
}>();
|
2025-06-16 14:42:26 +08:00
|
|
|
// 搜索
|
|
|
|
|
const handleSearch = () => {
|
2025-06-17 11:18:39 +08:00
|
|
|
emit('search');
|
2025-06-16 14:42:26 +08:00
|
|
|
};
|
2025-06-17 11:18:39 +08:00
|
|
|
const handleReset = () => {
|
|
|
|
|
selectedIndustry.value = industriesTree.value[0].id;
|
|
|
|
|
selectedSubCategory.value = 0;
|
|
|
|
|
selectedTimePeriod.value = '7';
|
2025-06-16 14:42:26 +08:00
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
/* 自定义样式 */
|
|
|
|
|
:deep(.arco-table-th) {
|
|
|
|
|
background-color: var(--color-fill-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.arco-table-tr):hover {
|
|
|
|
|
background-color: var(--color-fill-1);
|
|
|
|
|
}
|
|
|
|
|
:deep(.arco-btn-outline) {
|
|
|
|
|
color: #6d4cfe !important;
|
|
|
|
|
border-color: #6d4cfe !important;
|
|
|
|
|
}
|
|
|
|
|
:deep(.arco-modal-body) {
|
|
|
|
|
padding: 0px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|