89 lines
2.1 KiB
Vue
89 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
import { computed, onMounted, watch } from 'vue'
|
|
import { storeToRefs } from 'pinia'
|
|
import { useRoute } from 'vue-router'
|
|
import { ElMessage } from 'element-plus'
|
|
import type { FileInfo } from '@/types/api'
|
|
import { useContractStore } from '@/stores/modules/contract'
|
|
import ContractInfoCard from './cpns/ContractInfoCard.vue'
|
|
|
|
const route = useRoute()
|
|
const contractStore = useContractStore()
|
|
const { current } = storeToRefs(contractStore)
|
|
|
|
const contractId = computed(() => String(route.params.id))
|
|
|
|
function load(): void {
|
|
void contractStore.fetchDetail(contractId.value)
|
|
}
|
|
|
|
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> > </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>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="less" scoped>
|
|
.contract-detail {
|
|
padding-bottom: @spacing-xxl;
|
|
|
|
.container {
|
|
.flex(column, flex-start, stretch);
|
|
gap: 0;
|
|
}
|
|
&__breadcrumb {
|
|
padding-top: 32px;
|
|
font-size: 24px;
|
|
font-weight: 500;
|
|
line-height: 27px;
|
|
color: @contract-muted;
|
|
}
|
|
|
|
&__empty {
|
|
padding: @spacing-xxl 0;
|
|
text-align: center;
|
|
font-size: @font-size-base;
|
|
}
|
|
}
|
|
</style>
|