feat:财务和合同

This commit is contained in:
李伊帆
2026-11-05 13:50:25 +08:00
parent b0a711f70a
commit 31fcd273f1
173 changed files with 11040 additions and 1067 deletions

View File

@@ -1,14 +1,16 @@
<script setup lang="ts">
import { onShow } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { computed, ref } from 'vue'
import { getBannerList } from '@/api/banner'
import { getProjectSubmissionList } from '@/api/project-submission'
import { getRequirementOngoing } from '@/api/requirement'
import AppTabBar from '@/components/AppTabBar.vue'
import { useGreeting } from '@/hooks/use-greeting'
import { useQuickEntries } from '@/hooks/use-quick-entries'
import type { BannerItem } from '@/types/banner'
import type { ProjectItem, QuickEntryItem, ServiceItem } from '@/types/home'
import { ensureLoggedIn } from '@/utils/auth-guard'
import { mapOngoingOverviewToHome } from '@/utils/map-ongoing-overview'
import { mapProjectSubmissionsToServices } from '@/utils/map-project-submission'
import { navigateQuickEntry } from '@/utils/quick-entry-navigate'
import headerBg from '@/static/icons/1.png'
@@ -31,6 +33,9 @@ const {
const banners = ref<BannerItem[]>([])
const services = ref<ServiceItem[]>([])
const ongoingCount = ref(0)
const todoCount = ref(0)
const ongoingProjects = ref<ProjectItem[]>([])
async function loadBanners() {
try {
@@ -54,11 +59,27 @@ async function loadProjectSubmissions() {
}
}
async function loadOngoingProjects() {
try {
const overview = await getRequirementOngoing({ limit: 5 })
const mapped = mapOngoingOverviewToHome(overview)
ongoingCount.value = mapped.ongoingCount
todoCount.value = mapped.todoCount
ongoingProjects.value = mapped.projects
}
catch {
ongoingCount.value = 0
todoCount.value = 0
ongoingProjects.value = []
}
}
onShow(() => {
if (!ensureLoggedIn())
return
loadBanners()
loadProjectSubmissions()
loadOngoingProjects()
})
function handleQuickEntryTap(entry: QuickEntryItem) {
@@ -69,28 +90,21 @@ function handleViewAllProjects() {
navigateQuickEntry('project', '项目中心')
}
const projects: ProjectItem[] = [
{
id: '1',
title: '社区康养智能服务系统',
category: '互联网软件',
projectNo: '20260813RJ251545',
progress: 65,
status: '进行中',
updateTime: '2026-8-13 11:04:12',
tagTheme: 'orange',
},
{
id: '2',
title: '社区康养智能服务系统',
category: '生产制造',
projectNo: '20260813RJ251545',
progress: 65,
status: '进行中',
updateTime: '2026-8-13 11:04:12',
tagTheme: 'orange',
},
]
function handleOngoingProjectDetail(id: string) {
uni.navigateTo({
url: `/pages/project-center/detail/index?id=${encodeURIComponent(id)}`,
})
}
function handleOpenMessageCenter() {
uni.redirectTo({ url: '/pages/message-center/index' })
}
const ongoingSubtitle = computed(() => {
if (ongoingCount.value <= 0)
return '暂无进行中的项目'
return `今天有${ongoingCount.value}个项目正在进行`
})
</script>
<template>
@@ -113,7 +127,10 @@ const projects: ProjectItem[] = [
虫子智造研发一体化平台
</text>
</view>
<view class="home__message-btn">
<view
class="home__message-btn"
@tap="handleOpenMessageCenter"
>
<image
class="home__message-icon"
src="/static/icons/icon-message.png"
@@ -135,7 +152,7 @@ const projects: ProjectItem[] = [
</view>
</view>
<text class="home__subtitle">
今天有2个项目正在进行
{{ ongoingSubtitle }}
</text>
</view>
</view>
@@ -218,7 +235,7 @@ const projects: ProjectItem[] = [
<view class="home__stat-card home__stat-card--blue">
<view class="home__stat-value">
<text class="home__stat-num">
3
{{ ongoingCount }}
</text>
<text class="home__stat-unit">
个项目
@@ -231,7 +248,7 @@ const projects: ProjectItem[] = [
<view class="home__stat-card home__stat-card--orange">
<view class="home__stat-value">
<text class="home__stat-num">
3
{{ todoCount }}
</text>
<text class="home__stat-unit">
项待办
@@ -248,10 +265,17 @@ const projects: ProjectItem[] = [
</text>
<ProjectCard
v-for="item in projects"
v-for="item in ongoingProjects"
:key="item.id"
:item="item"
@detail="handleOngoingProjectDetail"
/>
<text
v-if="!ongoingProjects.length"
class="home__service-empty"
>
暂无最近更新项目
</text>
</view>
</view>
</scroll-view>