<!--
|
协同审批 / 审批流程节点(详情、审核共用)
|
steps 由 _utils/approveFlowSteps.js 的 mapApprovalSteps 生成:
|
[{ title, approverName, status, statusText, approveTime, opinion, urlTem, isShen }]
|
-->
|
<template>
|
<view class="approval-process">
|
<view class="process-header">
|
<text class="process-title">审批流程</text>
|
</view>
|
<view class="process-steps">
|
<view v-for="(step, index) in steps"
|
:key="index"
|
class="process-step"
|
:class="{
|
completed: step.status === 'completed',
|
current: step.status === 'current',
|
pending: step.status === 'pending',
|
rejected: step.status === 'rejected'
|
}">
|
<view class="step-indicator">
|
<view class="step-dot">
|
<text v-if="step.status === 'completed'"
|
class="step-icon">✓</text>
|
<text v-else-if="step.status === 'rejected'"
|
class="step-icon">✗</text>
|
<text v-else
|
class="step-number">{{ index + 1 }}</text>
|
</view>
|
<view v-if="index < steps.length - 1"
|
class="step-line"></view>
|
</view>
|
<view class="step-content">
|
<view class="step-info">
|
<text class="step-title">{{ step.title }}</text>
|
<text class="step-approver">{{ approverLabel(step) }}</text>
|
<text v-if="step.approveTime"
|
class="step-time">{{ step.approveTime }}</text>
|
</view>
|
<view v-if="step.opinion"
|
class="step-opinion">
|
<text class="opinion-label">审批意见:</text>
|
<text class="opinion-content">{{ step.opinion }}</text>
|
</view>
|
<!-- 待审节点:与 Web 一致,详情模式渲染禁用的意见框 -->
|
<view v-else-if="showPendingOpinion && step.isShen"
|
class="step-opinion step-opinion--pending">
|
<text class="opinion-label">审批意见:</text>
|
<u-textarea :model-value="step.opinion"
|
disabled
|
height="60"
|
border="surround"
|
placeholder="待审批" />
|
</view>
|
<!-- 签名展示 -->
|
<view v-if="step.urlTem"
|
class="step-sign">
|
<text class="opinion-label">签名:</text>
|
<image :src="step.urlTem"
|
mode="widthFix"
|
class="sign-image" />
|
</view>
|
</view>
|
</view>
|
<view v-if="!steps.length"
|
class="process-empty">暂无审批节点</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
defineProps({
|
steps: { type: Array, default: () => [] },
|
/** 详情模式:待审节点渲染一个禁用的意见框(与 Web 一致) */
|
showPendingOpinion: { type: Boolean, default: false },
|
});
|
|
/** 审批人-已同意/已驳回/未审批(与 Web 展示一致) */
|
const approverLabel = step =>
|
step?.statusText
|
? `${step.approverName}-${step.statusText}`
|
: step?.approverName || "";
|
</script>
|
|
<style scoped lang="scss">
|
.approval-process {
|
background: #fff;
|
margin: 16px;
|
border-radius: 12px;
|
overflow: hidden;
|
}
|
|
.process-header {
|
padding: 16px;
|
border-bottom: 1px solid #f0f0f0;
|
background: #f8f9fa;
|
}
|
|
.process-title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #333;
|
}
|
|
.process-steps {
|
padding: 20px;
|
}
|
|
.process-empty {
|
font-size: 14px;
|
color: #999;
|
text-align: center;
|
}
|
|
.process-step {
|
display: flex;
|
position: relative;
|
margin-bottom: 24px;
|
|
&:last-child {
|
margin-bottom: 0;
|
|
.step-line {
|
display: none;
|
}
|
}
|
}
|
|
.step-indicator {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
margin-right: 16px;
|
}
|
|
.step-dot {
|
width: 32px;
|
height: 32px;
|
border-radius: 50%;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 14px;
|
font-weight: 600;
|
position: relative;
|
z-index: 2;
|
}
|
|
.process-step.completed .step-dot {
|
background: #52c41a;
|
color: #fff;
|
}
|
|
.process-step.current .step-dot {
|
background: #1890ff;
|
color: #fff;
|
animation: pulse 2s infinite;
|
}
|
|
.process-step.pending .step-dot {
|
background: #d9d9d9;
|
color: #999;
|
}
|
|
.step-line {
|
width: 2px;
|
height: 40px;
|
background: #d9d9d9;
|
margin-top: 8px;
|
}
|
|
.process-step.completed .step-line {
|
background: #52c41a;
|
}
|
|
.process-step.rejected .step-dot {
|
background: #ff4d4f;
|
color: #fff;
|
}
|
|
.process-step.rejected .step-line {
|
background: #ff4d4f;
|
}
|
|
.step-content {
|
flex: 1;
|
padding-top: 4px;
|
}
|
|
.step-info {
|
margin-bottom: 8px;
|
}
|
|
.step-title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #333;
|
display: block;
|
margin-bottom: 4px;
|
}
|
|
.step-approver {
|
font-size: 14px;
|
color: #666;
|
display: block;
|
margin-bottom: 4px;
|
}
|
|
.step-time {
|
font-size: 12px;
|
color: #999;
|
display: block;
|
}
|
|
.step-opinion {
|
background: #f8f9fa;
|
padding: 12px;
|
border-radius: 8px;
|
border-left: 4px solid #52c41a;
|
}
|
|
.step-opinion--pending {
|
background: #fafbfc;
|
border-left-color: #d9d9d9;
|
}
|
|
.step-sign {
|
margin-top: 8px;
|
}
|
|
.sign-image {
|
width: 180px;
|
border-radius: 6px;
|
border: 1px solid #eee;
|
}
|
|
.opinion-label {
|
font-size: 12px;
|
color: #666;
|
display: block;
|
margin-bottom: 4px;
|
}
|
|
.opinion-content {
|
font-size: 14px;
|
color: #333;
|
line-height: 1.5;
|
}
|
|
@keyframes pulse {
|
0% {
|
box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.7);
|
}
|
70% {
|
box-shadow: 0 0 0 10px rgba(24, 144, 255, 0);
|
}
|
100% {
|
box-shadow: 0 0 0 0 rgba(24, 144, 255, 0);
|
}
|
}
|
</style>
|