|
@@ -88,7 +88,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { ref, onMounted, computed, watch } from 'vue'
|
|
|
|
|
|
|
+import { ref, watch } from 'vue'
|
|
|
import { getIssuingAuthorities } from '@/api/retrieval'
|
|
import { getIssuingAuthorities } from '@/api/retrieval'
|
|
|
|
|
|
|
|
interface Authority {
|
|
interface Authority {
|
|
@@ -99,36 +99,19 @@ interface Authority {
|
|
|
|
|
|
|
|
const docTypes = ['全部', '法规制度', '技术标准', '操作指南', '通知公告', '工作报告']
|
|
const docTypes = ['全部', '法规制度', '技术标准', '操作指南', '通知公告', '工作报告']
|
|
|
|
|
|
|
|
-// 所有发布单位(从后端 API 获取)
|
|
|
|
|
-const allAuthorities = ref<Authority[]>([])
|
|
|
|
|
-const authoritiesLoading = ref(false)
|
|
|
|
|
|
|
+// 写死的常用发布单位(按钮展示)
|
|
|
|
|
+const FIXED_AUTHORITIES: string[] = [
|
|
|
|
|
+ '中华人民共和国住房和城乡建设部',
|
|
|
|
|
+ '中华人民共和国交通运输部',
|
|
|
|
|
+ '中华人民共和国建设部',
|
|
|
|
|
+ '中华人民共和国国家质量监督检验检疫总局',
|
|
|
|
|
+ '中国国家标准化管理委员会',
|
|
|
|
|
+]
|
|
|
|
|
|
|
|
-// 加载全部发布单位(无关键词,取前50个)
|
|
|
|
|
-async function loadAuthorities(keyword = '') {
|
|
|
|
|
- authoritiesLoading.value = true
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await getIssuingAuthorities(keyword)
|
|
|
|
|
- const items = (res.data?.authorities || []) as Array<{ full_name: string; count: number }>
|
|
|
|
|
- allAuthorities.value = items.slice(0, 50).map((a) => ({
|
|
|
|
|
- shortName: a.full_name.length > 12 ? a.full_name.substring(0, 12) + '…' : a.full_name,
|
|
|
|
|
- fullName: a.full_name,
|
|
|
|
|
- count: a.count,
|
|
|
|
|
- }))
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.warn('[FilterPanel] 加载发布单位失败:', e)
|
|
|
|
|
- allAuthorities.value = []
|
|
|
|
|
- } finally {
|
|
|
|
|
- authoritiesLoading.value = false
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 前5发布单位(用于按钮展示)
|
|
|
|
|
-const topAuthorities = computed(() => allAuthorities.value.slice(0, 5))
|
|
|
|
|
-
|
|
|
|
|
-// 页面加载时获取发布单位列表
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
- loadAuthorities('')
|
|
|
|
|
-})
|
|
|
|
|
|
|
+// 按钮展示用:固定5个
|
|
|
|
|
+const topAuthorities = ref<Authority[]>(
|
|
|
|
|
+ FIXED_AUTHORITIES.map((name) => ({ shortName: name, fullName: name, count: 0 }))
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
docType: string
|
|
docType: string
|