Files
cz-web/src/views/contract/detail.vue
2026-10-01 10:53:13 +08:00

127 lines
3.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { computed, onMounted, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { AppButton } from '@/components'
import type { FileInfo } from '@/types/api'
// 页面容器:数据只经 store,不直接 import api
import { useContractStore } from '@/stores/modules/contract'
import ContractInfoCard from './cpns/ContractInfoCard.vue'
const route = useRoute()
const router = useRouter()
const contractStore = useContractStore()
const { current } = storeToRefs(contractStore)
const contractId = computed(() => String(route.params.id))
function load(): void {
void contractStore.fetchDetail(contractId.value)
}
function onBack(): void {
void router.push('/contract')
}
function onViewProject(): void {
// TODO: 关联项目 id 由接口返回后跳转项目详情
ElMessage.info('项目详情跳转待接口接入')
}
function onPreview(file: FileInfo): void {
// TODO(api): 合同文件预览接口
ElMessage.info(`「${file.name}」预览待接口接入`)
}
function onDownload(file: FileInfo): void {
// TODO(api): 合同文件下载接口
ElMessage.info(`「${file.name}」下载待接口接入`)
}
watch(contractId, load)
onMounted(load)
</script>
<template>
<div class="contract-detail">
<div class="container">
<nav class="contract-detail__breadcrumb text-secondary">
<RouterLink to="/contract" class="link">
合同中心
</RouterLink>
<span> &gt; </span>
<span>合同详情</span>
</nav>
<ContractInfoCard
v-if="current"
:contract="current"
@view-project="onViewProject"
@preview="onPreview"
@download="onDownload"
/>
<p v-else class="contract-detail__empty text-secondary">
合同不存在或已下线
</p>
<div class="contract-detail__footer">
<AppButton @click="onBack">
返回
</AppButton>
</div>
</div>
</div>
</template>
<style lang="less" scoped>
.contract-detail {
padding-bottom: @spacing-xxl;
// 内容列(面包屑 → 信息卡):卡自带 80 上距,这里不再叠加 gap
.container {
.flex(column, flex-start, stretch);
gap: 0;
}
// 面包屑(设计 e6c3a361:(70,104) 24/500 #666666;顶栏 72 → 行盒顶 104)
&__breadcrumb {
padding-top: 32px;
font-size: 24px;
font-weight: 500;
line-height: 27px;
color: @contract-muted;
}
&__footer {
.flex(row, flex-end);
width: 100%;
margin-top: 30px;
// 「返回」按钮
:deep(.app-button) {
height: 40px;
padding: 0 32px;
border: none;
border-radius: @radius-base;
background: @primary-strong;
color: @white;
font-size: 16px;
}
:deep(.app-button:hover) {
border-color: transparent;
background: @primary-color;
color: @white;
}
}
&__empty {
padding: @spacing-xxl 0;
text-align: center;
font-size: @font-size-base;
}
}
</style>