Files
pgserver3.0/pgweb/src/views/home/home.vue
2026-04-27 10:10:35 +08:00

96 lines
2.8 KiB
Vue

<style lang="less" scoped="scoped">
.mainHomeFrame {
position: relative;
}
.content {
text-align: center;
position: absolute;
top: 400px;
width: 100%;
font-size: 24px;
font-weight: 600;
letter-spacing: 4px;
color: #ccc;
p {
margin-bottom: 4px;
}
}
</style>
<template>
<div class="mainHomeFrame">
<!-- <inquiryPage :initialType=1 ></inquiryPage>-->
<homePage/>
</div>
</template>
<script>
import homePage from './components/message'
import { connectSocket } from '@/libs/socket'
import { EventBus } from '@/libs/eventBus'
import { getUnreturnedPriceCount, getEstimatePendingCount, getSurveyFollowCount } from '@/api/businessManage/inquiry'
export default {
components: { homePage },
mounted() {
// 进入首页时启动websocket连接
connectSocket()
// 获取未回价数量
this.getUnreturnedPriceCountData()
// 获取预估制作数量
this.getEstimatePendingCountData()
// 获取查勘跟进中数量
this.getSurveyFollowCountData()
},
methods: {
// 获取未回价数量
async getUnreturnedPriceCountData() {
try {
const response = await getUnreturnedPriceCount()
if (response && response.code === 1) {
const count = response.data.count || 0
console.log('未回价数量:', count)
// 通过事件总线传递数量给菜单组件
EventBus.$emit('updateUnreturnedCount', count)
}
} catch (error) {
console.error('获取未回价数量失败:', error)
}
},
// 获取预估制作数量
async getEstimatePendingCountData() {
try {
const response = await getEstimatePendingCount()
if (response && response.code === 1) {
const data = response.data || {}
const counts = {
pending: data.pending || 0,
secondReview: data.secondReview || 0,
thirdReview: data.thirdReview || 0,
sign: data.sign || 0,
total: data.total || 0
}
console.log('预估制作数量:', counts)
// 通过事件总线传递数量给菜单组件
EventBus.$emit('updateEstimatePendingCount', counts)
}
} catch (error) {
console.error('获取预估制作数量失败:', error)
}
},
// 获取查勘跟进中数量
async getSurveyFollowCountData() {
try {
const response = await getSurveyFollowCount()
if (response && response.code === 1) {
const count = response.data.count || 0
console.log('查勘跟进中数量:', count)
// 通过事件总线传递数量给菜单组件
EventBus.$emit('updateSurveyFollowCount', count)
}
} catch (error) {
console.error('获取查勘跟进中数量失败:', error)
}
}
}
}
</script>