|
|
@ -86,25 +86,9 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import { ref, reactive, onMounted, onUnmounted } from "vue"; |
|
|
|
import { useRoute, useRouter } from "vue-router"; |
|
|
|
import { gePolicytList, getPolicyInfo } from "@/api/policy"; |
|
|
|
import { gePolicytList, getPolicyInfo, getPolicyType } from "@/api/policy"; |
|
|
|
// tabList |
|
|
|
const tabList = reactive([ |
|
|
|
{ |
|
|
|
dictLabel: "最新", |
|
|
|
dictValue: "0", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictLabel: "住房政策", |
|
|
|
dictValue: "1", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictLabel: "人才政策", |
|
|
|
dictValue: "2", |
|
|
|
}, |
|
|
|
{ |
|
|
|
dictLabel: "就业政策", |
|
|
|
dictValue: "3", |
|
|
|
}, |
|
|
|
const tabList = ref([ |
|
|
|
]); |
|
|
|
const active = ref("0"); |
|
|
|
// 定义政策项接口 |
|
|
@ -151,7 +135,7 @@ const getList = async () => { |
|
|
|
return false; |
|
|
|
}; |
|
|
|
// 显式指定响应类型 |
|
|
|
const res = (await gePolicytList(joinIn)) as unknown as ApiResponse<PolicyItem[]>; |
|
|
|
const res = (await gePolicytList(joinIn)) as unknown as ApiResponse<{rows: PolicyItem[]}>; |
|
|
|
const data = res.data || []; |
|
|
|
list.value = [...list.value, ...data]; |
|
|
|
if (data.length < joinIn.pageSize) { |
|
|
@ -188,6 +172,11 @@ const handleBack = () => { |
|
|
|
router.push('/policy'); |
|
|
|
getList(); |
|
|
|
} |
|
|
|
const getPolicyTypeList = async () => { |
|
|
|
const res = (await getPolicyType()) as unknown as ApiResponse<{rows: any[]}>; |
|
|
|
tabList.value = [{dictLabel: '最新', dictValue: '0'}, ...(res.rows || [])]; |
|
|
|
console.log(tabList.value); |
|
|
|
} |
|
|
|
// 生命周期钩子 |
|
|
|
onMounted(() => { |
|
|
|
// 初始化加载 |
|
|
@ -197,6 +186,7 @@ onMounted(() => { |
|
|
|
if (id) { |
|
|
|
toPolicyDetail(id); |
|
|
|
} else { |
|
|
|
getPolicyTypeList(); |
|
|
|
getList(); |
|
|
|
} |
|
|
|
}); |
|
|
|