项目中心
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { AfterSales } from '@/types/business/project'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { FileList } from '@/components'
|
||||
import type { FileInfo } from '@/types/api'
|
||||
import type { AfterSales, ProjectStatus } from '@/types/business/project'
|
||||
|
||||
interface Props {
|
||||
/** 售后工单;`undefined` 或 `status === '无'` 表示没有进行中的工单 */
|
||||
afterSales?: AfterSales
|
||||
projectId: string
|
||||
/** 项目状态 —— 决定售后区的三态展示(见下方模板注释) */
|
||||
projectStatus: ProjectStatus
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
@@ -14,47 +19,131 @@ const emit = defineEmits<{
|
||||
cancel: []
|
||||
}>()
|
||||
|
||||
const isProcessing = computed(() => props.afterSales?.status === '处理中')
|
||||
/**
|
||||
* 售后页签的三态(设计稿便签原文):
|
||||
* 1. 项目**未完成** → 不展示售后信息;
|
||||
* 2. 已完成 + **未提交**售后 → 内容为空,只给「申请售后」;
|
||||
* 3. 已完成 + **已提交**售后 → 展示售后信息 + 「取消售后」。
|
||||
*
|
||||
* <p>「已完成」按详情页状态口径判定(后端 `COMPLETED` 经 projectVo 映射成「已完成」)。
|
||||
* 后端 `requestAfterSale` 也会校验这一点,前端只是提前把入口藏掉。</p>
|
||||
*/
|
||||
const isCompleted = computed(() => props.projectStatus === '已完成')
|
||||
/** 存在进行中的售后工单(撤回后的记录在映射层已归为「无」) */
|
||||
const hasTicket = computed(() => props.afterSales?.status === '处理中')
|
||||
|
||||
/**
|
||||
* 预览 / 下载直接走附件自身的 OSS 地址(后端下发的 `url` 就是可访问地址);
|
||||
* 删除没有接口 —— 售后附件只在「申请 / 完成售后」时整体写入,不支持单独删。
|
||||
*/
|
||||
function previewFile(file: FileInfo): void {
|
||||
if (!file.url) {
|
||||
ElMessage.info('该附件没有可访问的地址')
|
||||
return
|
||||
}
|
||||
window.open(file.url, '_blank', 'noopener')
|
||||
}
|
||||
|
||||
function downloadFile(file: FileInfo): void {
|
||||
if (!file.url) {
|
||||
ElMessage.info('该附件没有可访问的地址')
|
||||
return
|
||||
}
|
||||
const link = document.createElement('a')
|
||||
link.href = file.url
|
||||
link.download = file.name
|
||||
link.target = '_blank'
|
||||
link.rel = 'noopener'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
}
|
||||
|
||||
function onDeleteFile(): void {
|
||||
// TODO(api): 售后工单附件无单独删除接口(后端只在申请 / 完成售后时整体写入)
|
||||
ElMessage.info('售后附件暂不支持单独删除')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="project-after-sales">
|
||||
<!-- 处理中状态卡片 -->
|
||||
<div
|
||||
v-if="isProcessing && afterSales"
|
||||
class="project-after-sales__card project-after-sales__card--active"
|
||||
>
|
||||
<div class="project-after-sales__card-head">
|
||||
<span class="project-after-sales__badge">处理中</span>
|
||||
<h3 class="project-after-sales__card-title">
|
||||
售后工单处理中
|
||||
</h3>
|
||||
</div>
|
||||
<p class="project-after-sales__desc">
|
||||
工程师正在处理您的修改需求,请耐心等待
|
||||
<!-- 规则 1:项目未完成 → 不展示售后信息 -->
|
||||
<div v-if="!isCompleted" class="project-after-sales__blank">
|
||||
<p class="project-after-sales__blank-text text-secondary">
|
||||
项目完成后可申请售后
|
||||
</p>
|
||||
<div class="project-after-sales__meta text-secondary">
|
||||
<span v-if="afterSales.type">类型:{{ afterSales.type }}</span>
|
||||
<span v-if="afterSales.createTime">提交时间:{{ afterSales.createTime }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 规则 3:已完成 + 已提交售后 → 工单横幅 + 售后信息 + 取消售后 -->
|
||||
<template v-else-if="hasTicket && afterSales">
|
||||
<div class="project-after-sales__banner">
|
||||
<span class="project-after-sales__banner-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
|
||||
<path d="M6 2h7l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm7 1.6V8h4.4L13 3.6ZM8 12.2h8v1.6H8v-1.6Zm0 3.6h8v1.6H8v-1.6Z" />
|
||||
</svg>
|
||||
</span>
|
||||
<div class="project-after-sales__banner-text">
|
||||
<h3 class="project-after-sales__banner-title">
|
||||
售后工单处理中
|
||||
</h3>
|
||||
<p class="project-after-sales__banner-desc">
|
||||
工程师正在处理您的修改需求,请耐心等待
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="afterSales.description" class="project-after-sales__desc">
|
||||
{{ afterSales.description }}
|
||||
</p>
|
||||
|
||||
<h2 class="project-after-sales__title">
|
||||
售后信息
|
||||
</h2>
|
||||
|
||||
<div class="project-after-sales__field">
|
||||
<span class="project-after-sales__label">售后类型</span>
|
||||
<div class="project-after-sales__readonly">
|
||||
{{ afterSales.type || '—' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="project-after-sales__field">
|
||||
<span class="project-after-sales__label">问题描述</span>
|
||||
<div class="project-after-sales__readonly project-after-sales__readonly--block">
|
||||
{{ afterSales.description || '—' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="project-after-sales__field">
|
||||
<div class="project-after-sales__field-head">
|
||||
<span class="project-after-sales__label">附件上传</span>
|
||||
<span class="project-after-sales__field-hint text-secondary">支持图片/文档/压缩包,大小不超过1G</span>
|
||||
</div>
|
||||
<FileList
|
||||
v-if="afterSales.attachments.length > 0"
|
||||
:files="afterSales.attachments"
|
||||
@preview="previewFile"
|
||||
@download="downloadFile"
|
||||
@delete="onDeleteFile"
|
||||
/>
|
||||
<p v-else class="project-after-sales__none text-secondary">
|
||||
暂无附件
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="project-after-sales__actions">
|
||||
<button
|
||||
class="project-after-sales__btn project-after-sales__btn--default"
|
||||
class="project-after-sales__btn project-after-sales__btn--primary"
|
||||
@click="emit('cancel')"
|
||||
>
|
||||
取消售后
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<div v-else class="project-after-sales__card project-after-sales__card--empty">
|
||||
<p class="project-after-sales__empty text-secondary">
|
||||
暂无售后工单
|
||||
</p>
|
||||
<!-- 规则 2:已完成 + 未提交售后 → 内容为空 + 申请售后 -->
|
||||
<template v-else>
|
||||
<div class="project-after-sales__blank">
|
||||
<p class="project-after-sales__blank-text text-secondary">
|
||||
暂无售后工单
|
||||
</p>
|
||||
</div>
|
||||
<div class="project-after-sales__actions">
|
||||
<button
|
||||
class="project-after-sales__btn project-after-sales__btn--primary"
|
||||
@@ -63,79 +152,125 @@ const isProcessing = computed(() => props.afterSales?.status === '处理中')
|
||||
申请售后
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.project-after-sales {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: @spacing-base;
|
||||
gap: @spacing-lg;
|
||||
padding: @spacing-lg @spacing-xl;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
|
||||
&__card {
|
||||
// ── 顶部工单横幅:浅红底 + 红色图标块(设计稿) ──
|
||||
&__banner {
|
||||
.flex(row, flex-start, center);
|
||||
gap: @spacing-base;
|
||||
padding: @spacing-base @spacing-lg;
|
||||
border-radius: @radius-base;
|
||||
background: fade(@danger-color, 8%);
|
||||
}
|
||||
|
||||
&__banner-icon {
|
||||
.flex(row, center);
|
||||
flex-shrink: 0;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: @radius-base;
|
||||
background: @danger-color;
|
||||
color: @white;
|
||||
}
|
||||
|
||||
&__banner-text {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__banner-title {
|
||||
font-size: @font-size-lg;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
&__banner-desc {
|
||||
font-size: @font-size-sm;
|
||||
color: @text-color-secondary;
|
||||
}
|
||||
|
||||
// ── 「售后信息」区块标题:竖条 + 15px 缩进(与其它页签一致) ──
|
||||
&__title {
|
||||
.section-title();
|
||||
|
||||
margin-top: @spacing-xs;
|
||||
}
|
||||
|
||||
&__field {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: @spacing-sm;
|
||||
padding: @spacing-base;
|
||||
border: 1px solid @border-color;
|
||||
border-radius: @radius-base;
|
||||
background: @bg-color-light;
|
||||
|
||||
&--active {
|
||||
border-color: fade(@warning-color, 40%);
|
||||
background: fade(@warning-color, 6%);
|
||||
}
|
||||
}
|
||||
|
||||
&__card-head {
|
||||
.flex(row, center);
|
||||
&__field-head {
|
||||
.flex(row, flex-start, baseline);
|
||||
gap: @spacing-sm;
|
||||
}
|
||||
|
||||
&__badge {
|
||||
padding: 2px @spacing-sm;
|
||||
border-radius: @radius-sm;
|
||||
background: fade(@warning-color, 12%);
|
||||
color: @warning-color;
|
||||
&__field-hint {
|
||||
font-size: @font-size-sm;
|
||||
}
|
||||
|
||||
&__card-title {
|
||||
font-size: @font-size-lg;
|
||||
&__label {
|
||||
font-size: @font-size-base;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
}
|
||||
|
||||
&__desc {
|
||||
font-size: @font-size-base;
|
||||
// 只读展示(设计稿里是灰底带边框的框,不是输入控件)
|
||||
&__readonly {
|
||||
min-height: 40px;
|
||||
padding: 0 @spacing-base;
|
||||
border: 1px solid @border-color;
|
||||
border-radius: @radius-base;
|
||||
background: @bg-color-light;
|
||||
color: @text-color;
|
||||
line-height: 1.6;
|
||||
font-size: @font-size-base;
|
||||
line-height: 40px;
|
||||
|
||||
&--block {
|
||||
min-height: 96px;
|
||||
padding: @spacing-sm @spacing-base;
|
||||
line-height: 1.7;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
&__meta {
|
||||
.flex(row, flex-start);
|
||||
flex-wrap: wrap;
|
||||
gap: @spacing-base;
|
||||
&__none {
|
||||
padding: @spacing-sm 0;
|
||||
font-size: @font-size-sm;
|
||||
}
|
||||
|
||||
&__empty {
|
||||
padding: @spacing-lg 0;
|
||||
text-align: center;
|
||||
&__blank {
|
||||
.flex(row, center);
|
||||
padding: @spacing-xl 0;
|
||||
}
|
||||
|
||||
&__blank-text {
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
.flex(row, flex-end);
|
||||
.flex(row, flex-end, center);
|
||||
gap: @spacing-sm;
|
||||
}
|
||||
|
||||
&__btn {
|
||||
height: 34px;
|
||||
padding: 0 @spacing-base;
|
||||
height: 36px;
|
||||
padding: 0 @spacing-lg;
|
||||
border-radius: @radius-base;
|
||||
font-size: @font-size-base;
|
||||
transition: all 0.2s;
|
||||
@@ -149,18 +284,6 @@ const isProcessing = computed(() => props.afterSales?.status === '处理中')
|
||||
background: @primary-hover;
|
||||
}
|
||||
}
|
||||
|
||||
&--default {
|
||||
border: 1px solid @border-color-dark;
|
||||
background: @white;
|
||||
color: @text-color;
|
||||
|
||||
&:hover {
|
||||
border-color: @primary-color;
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { UploadArea } from '@/components'
|
||||
import type { FileInfo } from '@/types/api'
|
||||
import { formatFileSize } from '@/utils/format'
|
||||
|
||||
@@ -9,8 +8,8 @@ interface Props {
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
// ⚠️ 详情页只「展示」文件,不提供上传入口(上传在需求提报页)。
|
||||
const emit = defineEmits<{
|
||||
upload: [file: File]
|
||||
delete: [index: number]
|
||||
preview: [index: number]
|
||||
download: [index: number]
|
||||
@@ -23,11 +22,6 @@ const emit = defineEmits<{
|
||||
项目文件
|
||||
</h2>
|
||||
|
||||
<UploadArea
|
||||
hint="支持图片/文档/压缩包,大小不超过1G"
|
||||
@upload="emit('upload', $event)"
|
||||
/>
|
||||
|
||||
<ul class="project-files__list">
|
||||
<li
|
||||
v-for="(file, index) in files"
|
||||
@@ -72,9 +66,7 @@ const emit = defineEmits<{
|
||||
box-shadow: @shadow-base;
|
||||
|
||||
&__title {
|
||||
font-size: @font-size-lg;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
.section-title();
|
||||
}
|
||||
|
||||
&__list {
|
||||
|
||||
@@ -10,8 +10,8 @@ import type { ProjectQuery, ProjectTypeCount } from '@/types/business/project'
|
||||
* 的 `businessTypeCounts`,全量口径),组件内不定义业务值域;
|
||||
* 只有后端未下发的组(项目状态 / 提交时间)才用 `utils/projectMeta.ts` 里的前端常量。</p>
|
||||
*
|
||||
* <p>「不限」统一用**空串**表示(不是 'all'):空串不会出现在 querystring 里,
|
||||
* 正好对上后端 `eqIfText` 的「有值才等值匹配」。</p>
|
||||
* <p>「不限」统一用**空值**表示(不是 'all'):业务类型用空数组、其余用空串,
|
||||
* 都不会出现在 querystring 里,正好对上后端「有值才匹配」的语义。</p>
|
||||
*/
|
||||
|
||||
interface Props {
|
||||
@@ -45,10 +45,11 @@ const rangeLabel = computed(() => {
|
||||
|
||||
const chips = computed<Chip[]>(() => {
|
||||
const list: Chip[] = []
|
||||
if (props.query.businessType) {
|
||||
const found = props.typeCounts.find((item) => item.value === props.query.businessType)
|
||||
list.push({ key: 'businessType', label: found?.label ?? props.query.businessType })
|
||||
}
|
||||
// 业务类型是**多选**:每个已选类型各出一个 chip,key 带 id 以便单独移除
|
||||
props.query.businessTypes.forEach((value) => {
|
||||
const found = props.typeCounts.find((item) => item.value === value)
|
||||
list.push({ key: `businessType:${value}`, label: found?.label ?? value })
|
||||
})
|
||||
if (props.query.status) {
|
||||
list.push({ key: 'status', label: PROJECT_STATUS_LABEL[props.query.status] ?? props.query.status })
|
||||
}
|
||||
@@ -66,6 +67,27 @@ function patch(partial: Partial<ProjectQuery>): void {
|
||||
emit('update:query', { ...props.query, ...partial })
|
||||
}
|
||||
|
||||
/** 业务类型行是否处于选中态(「全部」= 一个都没勾) */
|
||||
function isTypeSelected(value: string): boolean {
|
||||
return value === 'all'
|
||||
? props.query.businessTypes.length === 0
|
||||
: props.query.businessTypes.includes(value)
|
||||
}
|
||||
|
||||
/** 业务类型多选切换:点「全部」清空,点具体行按勾选状态增删(后端口径是 IN,多选即并集) */
|
||||
function onToggleType(value: string): void {
|
||||
if (value === 'all') {
|
||||
patch({ businessTypes: [] })
|
||||
return
|
||||
}
|
||||
const selected = props.query.businessTypes
|
||||
patch({
|
||||
businessTypes: selected.includes(value)
|
||||
? selected.filter((item) => item !== value)
|
||||
: [...selected, value],
|
||||
})
|
||||
}
|
||||
|
||||
/** 快捷区间与自选区间互斥:点快捷区间会清掉自选日期 */
|
||||
function onPickShortcut(value: ProjectQuery['timeShortcut']): void {
|
||||
rangeOpen.value = false
|
||||
@@ -78,7 +100,10 @@ function onPickDate(partial: { startDate?: string; endDate?: string }): void {
|
||||
}
|
||||
|
||||
function onRemoveChip(key: string): void {
|
||||
if (key === 'businessType') patch({ businessType: '' })
|
||||
if (key.startsWith('businessType:')) {
|
||||
const value = key.slice('businessType:'.length)
|
||||
patch({ businessTypes: props.query.businessTypes.filter((item) => item !== value) })
|
||||
}
|
||||
else if (key === 'status') patch({ status: '' })
|
||||
else if (key === 'time') patch({ timeShortcut: 'all' })
|
||||
else if (key === 'range') patch({ startDate: '', endDate: '' })
|
||||
@@ -87,7 +112,7 @@ function onRemoveChip(key: string): void {
|
||||
function onClearChips(): void {
|
||||
emit('update:query', {
|
||||
...props.query,
|
||||
businessType: '',
|
||||
businessTypes: [],
|
||||
status: '',
|
||||
timeShortcut: 'all',
|
||||
startDate: '',
|
||||
@@ -102,7 +127,7 @@ function onClearChips(): void {
|
||||
筛选条件
|
||||
</h2>
|
||||
|
||||
<!-- 业务类型:复选外观的单选列表(值域 / 件数均来自后端统计) -->
|
||||
<!-- 业务类型:**多选**(值域 / 件数均来自后端统计;「全部」= 清空选择,可单选或多选) -->
|
||||
<section class="project-filter__group">
|
||||
<h3 class="project-filter__group-title">
|
||||
业务类型
|
||||
@@ -112,8 +137,8 @@ function onClearChips(): void {
|
||||
<button
|
||||
type="button"
|
||||
class="project-filter__row"
|
||||
:class="{ 'is-active': query.businessType === item.value }"
|
||||
@click="patch({ businessType: item.value === 'all' ? '' : item.value })"
|
||||
:class="{ 'is-active': isTypeSelected(item.value) }"
|
||||
@click="onToggleType(item.value)"
|
||||
>
|
||||
<span class="project-filter__box" aria-hidden="true" />
|
||||
<span class="project-filter__row-label">{{ item.label }}</span>
|
||||
@@ -289,6 +314,7 @@ function onClearChips(): void {
|
||||
}
|
||||
|
||||
&__box {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
@@ -296,6 +322,31 @@ function onClearChips(): void {
|
||||
border: 1px solid @border-color-dark;
|
||||
border-radius: 2px;
|
||||
background: @white;
|
||||
transition: background-color 0.2s, border-color 0.2s;
|
||||
|
||||
// 勾:用两条边框旋转 45° 画出来,不引额外图标
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 4px;
|
||||
width: 3px;
|
||||
height: 6px;
|
||||
border: solid @white;
|
||||
border-width: 0 1.5px 1.5px 0;
|
||||
transform: rotate(45deg) scale(0);
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
}
|
||||
|
||||
// 选中行:方框实心主色 + 白色勾(多选下每行独立显隐)
|
||||
&__row.is-active &__box {
|
||||
border-color: @primary-color;
|
||||
background: @primary-color;
|
||||
|
||||
&::after {
|
||||
transform: rotate(45deg) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
&__row-label {
|
||||
|
||||
@@ -85,7 +85,7 @@ const BILL_VARIANTS: Record<ProjectBill['status'], 'primary' | 'success' | 'warn
|
||||
<div class="project-finance__file-info">
|
||||
<span class="project-finance__file-name" :title="file.name">{{ file.name }}</span>
|
||||
<span class="project-finance__file-meta text-secondary">
|
||||
{{ formatFileSize(file.size) }} · {{ file.uploadTime }}
|
||||
{{ file.size ? formatFileSize(file.size) + ' · ' : '' }}{{ file.uploadTime }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="project-finance__file-actions">
|
||||
@@ -110,7 +110,7 @@ const BILL_VARIANTS: Record<ProjectBill['status'], 'primary' | 'success' | 'warn
|
||||
<div class="project-finance__file-info">
|
||||
<span class="project-finance__file-name" :title="contractFile.name">{{ contractFile.name }}</span>
|
||||
<span class="project-finance__file-meta text-secondary">
|
||||
{{ formatFileSize(contractFile.size) }} · {{ contractFile.uploadTime }}
|
||||
{{ contractFile.size ? formatFileSize(contractFile.size) + ' · ' : '' }}{{ contractFile.uploadTime }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="project-finance__file-actions">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { StatusTag } from '@/components'
|
||||
import { formatBusinessType } from '@/utils/format'
|
||||
import type { Project, ProjectStatus } from '@/types/business/project'
|
||||
|
||||
@@ -9,79 +8,148 @@ interface Props {
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const STATUS_VARIANTS: Record<ProjectStatus, 'primary' | 'success' | 'warning' | 'danger' | 'info'> = {
|
||||
'待立项': 'info',
|
||||
'进行中': 'primary',
|
||||
'待验收': 'warning',
|
||||
'待内部验收': 'warning',
|
||||
'已完成': 'success',
|
||||
'售后中': 'warning',
|
||||
'已取消': 'info',
|
||||
/**
|
||||
* 状态文字配色(项目详情设计稿:状态是**卡片右侧的纯文字**,不是胶囊标签)。
|
||||
*
|
||||
* <p>设计稿只画了「进行中」= @project-accent,其余状态按语义就近归组;
|
||||
* 颜色一律走 `styles/variables.less`,组件内不写魔法色值。</p>
|
||||
*/
|
||||
const STATUS_CLASS: Record<ProjectStatus, string> = {
|
||||
'待立项': 'is-idle',
|
||||
'进行中': 'is-active',
|
||||
'待验收': 'is-warning',
|
||||
'待内部验收': 'is-warning',
|
||||
'已完成': 'is-done',
|
||||
'售后中': 'is-warning',
|
||||
'已取消': 'is-idle',
|
||||
}
|
||||
|
||||
/** 业务类型:优先用后端原样下发的名称(它来自提报表,接口能下发就照显),兜底才查前端枚举 */
|
||||
function businessTypeText(project: Project): string {
|
||||
return project.businessTypeName || formatBusinessType(project.businessType)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="project-info-card">
|
||||
<div class="project-info-card__head">
|
||||
<StatusTag :label="project.status" :variant="STATUS_VARIANTS[project.status]" />
|
||||
<section class="project-info-card">
|
||||
<!--
|
||||
项目标识:设计稿是「白底圆角方块 + 蓝色描边徽标(内含 </>)」。
|
||||
⚠️ 接口没有 logo 字段(ProjectRequirementBaseVo 只下发名称/编号/类型/状态/时间),
|
||||
所以这里按设计稿渲染占位徽标,不是真实项目图标。
|
||||
-->
|
||||
<span class="project-info-card__logo" aria-hidden="true">
|
||||
<span class="project-info-card__logo-badge"></></span>
|
||||
</span>
|
||||
|
||||
<div class="project-info-card__main">
|
||||
<h1 class="project-info-card__name">
|
||||
{{ project.projectName }}
|
||||
{{ project.projectName || '—' }}
|
||||
</h1>
|
||||
<p class="project-info-card__meta">
|
||||
<span class="project-info-card__meta-item">
|
||||
<em class="project-info-card__label">项目编号:</em>{{ project.projectNo || '—' }}
|
||||
</span>
|
||||
<span class="project-info-card__meta-item">
|
||||
<em class="project-info-card__label">业务类型:</em>{{ businessTypeText(project) }}
|
||||
</span>
|
||||
<span class="project-info-card__meta-item">
|
||||
<em class="project-info-card__label">提交时间:</em>{{ project.submitTime || '—' }}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="project-info-card__meta">
|
||||
<div class="project-info-card__meta-item">
|
||||
<span class="project-info-card__label text-secondary">项目编号</span>
|
||||
<span class="project-info-card__value">{{ project.projectNo }}</span>
|
||||
</div>
|
||||
<div class="project-info-card__meta-item">
|
||||
<span class="project-info-card__label text-secondary">业务类型</span>
|
||||
<span class="project-info-card__value">{{ formatBusinessType(project.businessType) }}</span>
|
||||
</div>
|
||||
<div class="project-info-card__meta-item">
|
||||
<span class="project-info-card__label text-secondary">提交时间</span>
|
||||
<span class="project-info-card__value">{{ project.submitTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="project-info-card__status" :class="STATUS_CLASS[project.status]">
|
||||
{{ project.status }}
|
||||
</span>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.project-info-card {
|
||||
padding: @spacing-lg @spacing-xl;
|
||||
.flex(row, flex-start, center);
|
||||
gap: @spacing-base;
|
||||
padding: @spacing-lg;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
|
||||
&__head {
|
||||
.flex(row, flex-start, center);
|
||||
gap: @spacing-base;
|
||||
&__logo {
|
||||
.flex(row, center, center);
|
||||
flex-shrink: 0;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 14px;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
}
|
||||
|
||||
&__logo-badge {
|
||||
.flex(row, center, center);
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 2px solid @project-accent;
|
||||
border-radius: 10px;
|
||||
color: @project-accent;
|
||||
font-family: Consolas, Menlo, 'Courier New', monospace;
|
||||
font-size: @font-size-base;
|
||||
font-weight: 700;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
&__main {
|
||||
.flex(column, flex-start, stretch);
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
gap: @spacing-sm;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: @font-size-xxl;
|
||||
font-size: @font-size-title;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
color: @heading-color;
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
// 设计稿:三个字段是**单行**「标签:值」,等距排布
|
||||
&__meta {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: @spacing-base;
|
||||
margin-top: @spacing-base;
|
||||
.flex(row, flex-start, center);
|
||||
flex-wrap: wrap;
|
||||
gap: @spacing-lg;
|
||||
font-size: @font-size-sm;
|
||||
color: @heading-color;
|
||||
}
|
||||
|
||||
&__meta-item {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: @spacing-xs;
|
||||
.flex(row, flex-start, center);
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
&__label {
|
||||
font-size: @font-size-sm;
|
||||
color: @text-color-secondary;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
&__value {
|
||||
font-size: @font-size-base;
|
||||
color: @heading-color;
|
||||
&__status {
|
||||
flex-shrink: 0;
|
||||
font-size: @font-size-title;
|
||||
font-weight: 600;
|
||||
|
||||
&.is-active {
|
||||
color: @project-accent;
|
||||
}
|
||||
|
||||
&.is-done {
|
||||
color: @success-color;
|
||||
}
|
||||
|
||||
&.is-warning {
|
||||
color: @warning-color;
|
||||
}
|
||||
|
||||
&.is-idle {
|
||||
color: @text-color-secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,185 +2,168 @@
|
||||
import type { Milestone } from '@/types/business/project'
|
||||
|
||||
interface Props {
|
||||
progress: number
|
||||
milestones: Milestone[]
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
const props = defineProps<Props>()
|
||||
|
||||
/** 三态 → 修饰类(设计稿:已完成=绿实心+白勾 / 进行中=白底粗蓝环 / 待开始=白底灰环) */
|
||||
function stateClass(status: Milestone['status']): string {
|
||||
if (status === '已完成') return 'is-done'
|
||||
if (status === '进行中') return 'is-active'
|
||||
return 'is-pending'
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接线是否走「已完成」的绿色。
|
||||
*
|
||||
* <p>设计稿实测:只有<b>下一个节点已完成</b>时该段才是绿色(第二个节点已完成 → 第 1 段绿;
|
||||
* 第三个节点进行中 → 第 2 段仍是灰色,不随「进行中」变蓝)。</p>
|
||||
*/
|
||||
function linkDone(index: number): boolean {
|
||||
return props.milestones[index + 1]?.status === '已完成'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="project-milestones">
|
||||
<div class="project-milestones__head">
|
||||
<h2 class="project-milestones__title">
|
||||
总体进度
|
||||
</h2>
|
||||
<span class="project-milestones__percent">{{ progress }}%</span>
|
||||
</div>
|
||||
<div class="project-milestones__track">
|
||||
<div
|
||||
class="project-milestones__bar"
|
||||
:style="{ width: `${progress}%` }"
|
||||
/>
|
||||
</div>
|
||||
<h2 class="project-milestones__title">
|
||||
项目进度(里程碑)
|
||||
</h2>
|
||||
|
||||
<ol class="project-milestones__timeline">
|
||||
<ol v-if="props.milestones.length > 0" class="project-milestones__track">
|
||||
<li
|
||||
v-for="node in milestones"
|
||||
:key="node.name"
|
||||
v-for="(node, index) in props.milestones"
|
||||
:key="`${node.name}-${index}`"
|
||||
class="project-milestones__node"
|
||||
:class="`is-${node.status === '已完成' ? 'done' : node.status === '进行中' ? 'active' : 'pending'}`"
|
||||
:class="[stateClass(node.status), { 'is-link-done': linkDone(index) }]"
|
||||
>
|
||||
<span class="project-milestones__dot" />
|
||||
<div class="project-milestones__body">
|
||||
<div class="project-milestones__row">
|
||||
<span class="project-milestones__name">{{ node.name }}</span>
|
||||
<span class="project-milestones__status">{{ node.status }}</span>
|
||||
</div>
|
||||
<span v-if="node.time" class="project-milestones__time text-secondary">{{ node.time }}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="milestones.length === 0" class="project-milestones__empty text-secondary">
|
||||
暂无里程碑数据
|
||||
<span class="project-milestones__dot">
|
||||
<svg
|
||||
v-if="node.status === '已完成'"
|
||||
class="project-milestones__check"
|
||||
viewBox="0 0 16 16"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M3.5 8.4 6.6 11.5 12.5 4.8" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg>
|
||||
</span>
|
||||
<span class="project-milestones__name">{{ node.name }}</span>
|
||||
<!-- 设计稿:已完成节点显示完成时间,其余显示状态文案 -->
|
||||
<span class="project-milestones__sub text-secondary">{{ node.time || node.status }}</span>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<div class="project-milestones__range">
|
||||
<span v-if="startTime" class="text-secondary">开始时间:{{ startTime }}</span>
|
||||
<span v-if="endTime" class="text-secondary">结束时间:{{ endTime }}</span>
|
||||
</div>
|
||||
<p v-else class="project-milestones__empty text-secondary">
|
||||
暂无里程碑数据
|
||||
</p>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
// 节点列宽 = 设计稿相邻节点中心距(237 设计px × 0.77 ≈ 182px)
|
||||
@milestone-node-width: 182px;
|
||||
@milestone-dot-size: 32px;
|
||||
|
||||
.project-milestones {
|
||||
padding: @spacing-lg @spacing-xl;
|
||||
.flex(column, flex-start, stretch);
|
||||
padding: @spacing-lg;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
|
||||
&__head {
|
||||
.flex(row, space-between, center);
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: @font-size-lg;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
}
|
||||
|
||||
&__percent {
|
||||
font-size: @font-size-xl;
|
||||
font-weight: 600;
|
||||
color: @primary-color;
|
||||
.section-title();
|
||||
}
|
||||
|
||||
// 设计稿:轨迹从卡片左侧正文位起、**固定节距**左对齐(不铺满整宽)
|
||||
&__track {
|
||||
height: 8px;
|
||||
margin-top: @spacing-base;
|
||||
border-radius: @radius-round;
|
||||
background: @bg-color;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__bar {
|
||||
height: 100%;
|
||||
border-radius: @radius-round;
|
||||
background: @primary-color;
|
||||
transition: width 0.3s;
|
||||
}
|
||||
|
||||
&__timeline {
|
||||
.flex(row, flex-start, flex-start);
|
||||
margin-top: @spacing-lg;
|
||||
padding-left: @spacing-xs;
|
||||
padding-bottom: @spacing-xs;
|
||||
overflow-x: auto;
|
||||
.scrollbar();
|
||||
}
|
||||
|
||||
&__node {
|
||||
position: relative;
|
||||
padding: 0 0 @spacing-base @spacing-lg;
|
||||
border-left: 2px solid @border-color;
|
||||
.flex(column, flex-start, center);
|
||||
flex: 0 0 @milestone-node-width;
|
||||
min-width: 0;
|
||||
|
||||
&:last-of-type {
|
||||
border-left-color: transparent;
|
||||
padding-bottom: 0;
|
||||
// 圆点之间的连接线:从本节点圆点右缘连到下一节点圆点左缘
|
||||
&:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: (@milestone-dot-size / 2 - 1px);
|
||||
left: calc(50% + @milestone-dot-size / 2);
|
||||
width: calc(100% - @milestone-dot-size);
|
||||
height: 2px;
|
||||
background: @milestone-idle;
|
||||
}
|
||||
|
||||
&.is-done {
|
||||
border-left-color: @success-color;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
border-left-color: @primary-color;
|
||||
&.is-link-done:not(:last-child)::after {
|
||||
background: @milestone-done;
|
||||
}
|
||||
}
|
||||
|
||||
&__dot {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: -7px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 2px solid @border-color-dark;
|
||||
.flex(row, center, center);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: @milestone-dot-size;
|
||||
height: @milestone-dot-size;
|
||||
border: 2px solid @milestone-idle;
|
||||
border-radius: @radius-round;
|
||||
background: @white;
|
||||
box-sizing: border-box;
|
||||
|
||||
.is-done & {
|
||||
border-color: @success-color;
|
||||
background: @success-color;
|
||||
border-color: @milestone-done;
|
||||
background: @milestone-done;
|
||||
}
|
||||
|
||||
.is-active & {
|
||||
border-color: @primary-color;
|
||||
background: @primary-color;
|
||||
border-width: 3px;
|
||||
border-color: @project-accent;
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&__row {
|
||||
.flex(row, center);
|
||||
gap: @spacing-sm;
|
||||
&__check {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&__name {
|
||||
margin-top: @spacing-sm;
|
||||
max-width: 100%;
|
||||
font-size: @font-size-base;
|
||||
color: @heading-color;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__status {
|
||||
font-size: @font-size-sm;
|
||||
text-align: center;
|
||||
color: @text-color-secondary;
|
||||
.multi-ellipsis(2);
|
||||
|
||||
.is-done & {
|
||||
color: @success-color;
|
||||
color: @milestone-done;
|
||||
}
|
||||
|
||||
.is-active & {
|
||||
color: @primary-color;
|
||||
color: @project-accent;
|
||||
}
|
||||
}
|
||||
|
||||
&__time {
|
||||
&__sub {
|
||||
margin-top: @spacing-xs;
|
||||
max-width: 100%;
|
||||
font-size: @font-size-sm;
|
||||
text-align: center;
|
||||
.multi-ellipsis(2);
|
||||
}
|
||||
|
||||
&__empty {
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
|
||||
&__range {
|
||||
.flex(row, flex-start, center);
|
||||
gap: @spacing-lg;
|
||||
margin-top: @spacing-base;
|
||||
padding-top: @spacing-base;
|
||||
border-top: 1px solid @border-color;
|
||||
font-size: @font-size-sm;
|
||||
padding-left: 21px;
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -48,9 +48,20 @@ function typeLabel(value: string | null | undefined): string {
|
||||
|
||||
function statusLabel(value: string | null | undefined): string {
|
||||
if (!value) return '—'
|
||||
// 后端已用字典翻成中文(「进行中」…);码值也能认,认不出就原样显示
|
||||
return PROJECT_STATUS_LABEL[value] ?? value
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已完成(决定是否给「申请售后」入口)。
|
||||
*
|
||||
* <p>⚠️ 后端状态自字典翻译后下发的是**中文**「已完成」,码值 `COMPLETED` 也可能出现
|
||||
* (字典缺项 / 直连子表)⇒ 两种都认。只比码值会让售后按钮永远不出现。</p>
|
||||
*/
|
||||
function isCompleted(value: string | null | undefined): boolean {
|
||||
return value === 'COMPLETED' || value === '已完成'
|
||||
}
|
||||
|
||||
function progressLabel(value: number | null | undefined): string {
|
||||
return value == null ? '—' : `${value}%`
|
||||
}
|
||||
@@ -82,7 +93,7 @@ function progressLabel(value: number | null | undefined): string {
|
||||
<td>{{ statusLabel(item.status) }}</td>
|
||||
<td class="project-table__ops">
|
||||
<button
|
||||
v-if="item.status === 'COMPLETED'"
|
||||
v-if="isCompleted(item.status)"
|
||||
type="button"
|
||||
class="project-table__link"
|
||||
@click="emit('afterSales', item.id)"
|
||||
|
||||
@@ -13,80 +13,86 @@ defineProps<Props>()
|
||||
<h2 class="project-team__title">
|
||||
项目团队
|
||||
</h2>
|
||||
<div class="project-team__list">
|
||||
<div
|
||||
|
||||
<ul v-if="team.length > 0" class="project-team__list">
|
||||
<li
|
||||
v-for="(member, index) in team"
|
||||
:key="`${member.name}-${index}`"
|
||||
class="project-team__card"
|
||||
class="project-team__item"
|
||||
>
|
||||
<span class="project-team__avatar">{{ member.avatarChar }}</span>
|
||||
<div class="project-team__info">
|
||||
<span class="project-team__role text-secondary">{{ member.role }}</span>
|
||||
<span class="project-team__name">{{ member.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="team.length === 0" class="project-team__empty text-secondary">
|
||||
暂无团队成员
|
||||
</p>
|
||||
</div>
|
||||
<span class="project-team__name">{{ member.name || '—' }}</span>
|
||||
<span class="project-team__role text-secondary">{{ member.role }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p v-else class="project-team__empty text-secondary">
|
||||
暂无团队成员
|
||||
</p>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
// 设计稿实测:头像直径 90 设计px、相邻头像中心距 183 设计px → ×0.77 得 69px / 141px
|
||||
@team-avatar-size: 68px;
|
||||
@team-avatar-gap: 72px;
|
||||
|
||||
.project-team {
|
||||
padding: @spacing-lg @spacing-xl;
|
||||
.flex(column, flex-start, stretch);
|
||||
padding: @spacing-lg;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
|
||||
&__title {
|
||||
margin-bottom: @spacing-base;
|
||||
font-size: @font-size-lg;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
.section-title();
|
||||
}
|
||||
|
||||
&__list {
|
||||
.flex(row, flex-start, center);
|
||||
.flex(row, flex-start, flex-start);
|
||||
flex-wrap: wrap;
|
||||
gap: @spacing-base;
|
||||
gap: @spacing-base @team-avatar-gap;
|
||||
margin-top: @spacing-lg;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
&__card {
|
||||
.flex(row, center);
|
||||
gap: @spacing-sm;
|
||||
padding: @spacing-sm @spacing-base;
|
||||
border: 1px solid @border-color;
|
||||
border-radius: @radius-base;
|
||||
background: @bg-color-light;
|
||||
&__item {
|
||||
.flex(column, flex-start, center);
|
||||
width: @team-avatar-size;
|
||||
}
|
||||
|
||||
&__avatar {
|
||||
.flex(row, center);
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
.flex(row, center, center);
|
||||
width: @team-avatar-size;
|
||||
height: @team-avatar-size;
|
||||
border-radius: @radius-round;
|
||||
background: @primary-light;
|
||||
color: @primary-color;
|
||||
font-size: @font-size-lg;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__info {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&__role {
|
||||
font-size: @font-size-sm;
|
||||
background: @team-avatar-bg;
|
||||
color: @white;
|
||||
font-size: @font-size-title;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: @font-size-base;
|
||||
margin-top: @spacing-sm;
|
||||
max-width: 100%;
|
||||
font-size: @font-size-lg;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
text-align: center;
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
&__role {
|
||||
margin-top: @spacing-xs;
|
||||
max-width: 100%;
|
||||
font-size: @font-size-sm;
|
||||
text-align: center;
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
&__empty {
|
||||
margin-top: @spacing-base;
|
||||
padding-left: 18px;
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user