feat: 完善报销单审批流程及退回原因追踪

新增直属领导审批通过接口和审批待办列表查询,报销单退回
支持原因码分类和审批环节标记,优化票据附件去重和路径
回退查找,前端新增退回原因对话框、审批收件箱和工作台
图标组件,补充工具函数和单元测试覆盖。
This commit is contained in:
caoxiaozhu
2026-05-20 21:00:47 +08:00
parent f8b25a7ccc
commit 002bf4f756
62 changed files with 5331 additions and 2101 deletions

View File

@@ -0,0 +1,222 @@
<template>
<ConfirmDialog
:open="open"
badge="退回单据"
badge-tone="warning"
:title="title"
:description="description"
cancel-text="取消"
confirm-text="确认退回"
busy-text="退回中..."
confirm-tone="primary"
confirm-icon="mdi mdi-undo"
:busy="busy"
:close-on-mask="false"
@close="handleClose"
@confirm="handleConfirm"
>
<div class="return-reason-dialog">
<div class="return-reason-section">
<span>默认风险点</span>
<div class="return-reason-options" role="group" aria-label="默认退回风险点">
<label
v-for="option in options"
:key="option.code"
:class="['return-reason-option', { active: selectedCodes.includes(option.code) }]"
>
<input
v-model="selectedCodes"
type="checkbox"
:value="option.code"
:disabled="busy"
/>
<i :class="option.icon"></i>
<strong>{{ option.label }}</strong>
</label>
</div>
</div>
<label class="return-reason-section">
<span>退单理由</span>
<textarea
v-model="reasonText"
rows="4"
:disabled="busy"
placeholder="请写清楚需要申请人补充或修改的内容,例如:发票金额与明细金额不一致,请重新上传正确票据。"
@input="touched = true"
></textarea>
<small :class="{ error: reasonError }">
{{ reasonError || '会同步记录到退单埋点,并展示给申请人。' }}
</small>
</label>
</div>
</ConfirmDialog>
</template>
<script setup>
import { computed, ref, watch } from 'vue'
import ConfirmDialog from './ConfirmDialog.vue'
const RETURN_REASON_OPTIONS = [
{ code: 'missing_attachment', label: '附件缺失或不清晰', icon: 'mdi mdi-paperclip-alert' },
{ code: 'invoice_mismatch', label: '票据类型/金额与明细不一致', icon: 'mdi mdi-file-compare' },
{ code: 'over_policy', label: '超出制度标准或缺少超标说明', icon: 'mdi mdi-scale-unbalanced' },
{ code: 'business_explanation', label: '业务事由/地点/人员信息不完整', icon: 'mdi mdi-text-box-alert-outline' },
{ code: 'duplicate_or_abnormal', label: '疑似重复或异常票据', icon: 'mdi mdi-alert-octagon-outline' },
{ code: 'approval_question', label: '审批人需要补充说明', icon: 'mdi mdi-comment-question-outline' }
]
const props = defineProps({
open: { type: Boolean, default: false },
busy: { type: Boolean, default: false },
claimNo: { type: String, default: '' },
title: { type: String, default: '确认退回该单据吗?' },
description: {
type: String,
default: '退回后单据会回到待提交状态,申请人可按退回原因修改后重新提交。'
}
})
const emit = defineEmits(['close', 'confirm'])
const selectedCodes = ref([])
const reasonText = ref('')
const touched = ref(false)
const options = computed(() => RETURN_REASON_OPTIONS)
const trimmedReason = computed(() => reasonText.value.trim())
const reasonError = computed(() => {
if (!touched.value || trimmedReason.value.length >= 6) {
return ''
}
return '请至少填写 6 个字的明确退单理由。'
})
watch(
() => props.open,
(open) => {
if (open) {
selectedCodes.value = []
reasonText.value = ''
touched.value = false
}
}
)
function handleClose() {
if (!props.busy) {
emit('close')
}
}
function handleConfirm() {
touched.value = true
if (trimmedReason.value.length < 6 || props.busy) {
return
}
emit('confirm', {
reason: trimmedReason.value,
reason_codes: [...selectedCodes.value]
})
}
</script>
<style scoped>
.return-reason-dialog {
display: grid;
gap: 14px;
}
.return-reason-section {
display: grid;
gap: 8px;
}
.return-reason-section > span {
color: #334155;
font-size: 12px;
font-weight: 850;
}
.return-reason-options {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
}
.return-reason-option {
min-width: 0;
display: grid;
grid-template-columns: auto auto minmax(0, 1fr);
align-items: center;
gap: 8px;
padding: 10px;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #fff;
color: #334155;
cursor: pointer;
transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.return-reason-option.active {
border-color: rgba(234, 88, 12, .34);
background: #fff7ed;
color: #c2410c;
}
.return-reason-option input {
width: 16px;
height: 16px;
accent-color: #ea580c;
}
.return-reason-option i {
grid-column: 2;
color: inherit;
}
.return-reason-option strong {
min-width: 0;
grid-column: 3;
font-size: 12px;
line-height: 1.35;
overflow-wrap: anywhere;
}
.return-reason-section textarea {
width: 100%;
resize: vertical;
min-height: 104px;
padding: 12px;
border: 1px solid #d7e0ea;
border-radius: 8px;
color: #0f172a;
font-size: 13px;
line-height: 1.6;
outline: none;
}
.return-reason-section textarea:focus {
border-color: rgba(234, 88, 12, .5);
box-shadow: 0 0 0 3px rgba(234, 88, 12, .1);
}
.return-reason-section small {
color: #64748b;
font-size: 12px;
line-height: 1.5;
}
.return-reason-section small.error {
color: #dc2626;
}
@media (max-width: 640px) {
.return-reason-options {
grid-template-columns: minmax(0, 1fr);
}
}
</style>

View File

@@ -0,0 +1,107 @@
<template>
<div
class="workbench-list-icon"
:class="[`workbench-list-icon--${iconKey}`, `workbench-list-icon--${iconStyle}`]"
:style="{ '--icon-color': color, '--icon-accent': accent || color }"
>
<span class="workbench-list-icon__halo" aria-hidden="true"></span>
<span class="workbench-list-icon__panel" aria-hidden="true">
<span class="workbench-list-icon__shine" aria-hidden="true"></span>
<span class="workbench-list-icon__art" aria-hidden="true" v-html="iconMarkup"></span>
</span>
</div>
</template>
<script setup>
import { computed } from 'vue'
import { workbenchIconMap } from '../../utils/workbenchIconAssets.js'
const props = defineProps({
iconKey: { type: String, required: true },
color: { type: String, default: '#10b981' },
accent: { type: String, default: '' }
})
const iconMeta = computed(() => workbenchIconMap[props.iconKey] || workbenchIconMap.hospitality)
const iconMarkup = computed(() => iconMeta.value.markup)
const iconStyle = computed(() => iconMeta.value.style)
</script>
<style scoped>
.workbench-list-icon {
position: relative;
width: 56px;
height: 56px;
flex-shrink: 0;
color: var(--icon-color);
}
.workbench-list-icon__halo {
position: absolute;
inset: -3px;
border-radius: 20px;
background: radial-gradient(
circle at 50% 40%,
color-mix(in srgb, var(--icon-accent, var(--icon-color)) 42%, transparent) 0%,
transparent 72%
);
opacity: 0.9;
}
.workbench-list-icon__panel {
position: relative;
z-index: 1;
width: 100%;
height: 100%;
display: grid;
place-items: center;
overflow: hidden;
border-radius: 18px;
border: 1px solid color-mix(in srgb, var(--icon-color) 20%, #e2e8f0);
background:
radial-gradient(circle at 24% 16%, rgba(255, 255, 255, 0.98), transparent 46%),
linear-gradient(
160deg,
color-mix(in srgb, var(--icon-accent, var(--icon-color)) 24%, #fff) 0%,
#fff 42%,
color-mix(in srgb, var(--icon-color) 6%, #f8fafc) 100%
);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.98),
0 1px 2px rgba(15, 23, 42, 0.04),
0 12px 24px color-mix(in srgb, var(--icon-color) 14%, transparent);
}
.workbench-list-icon__shine {
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 38%);
pointer-events: none;
}
.workbench-list-icon__art {
position: relative;
z-index: 1;
display: grid;
place-items: center;
width: 30px;
height: 30px;
}
.workbench-list-icon__art :deep(.workbench-heroicon) {
width: 30px;
height: 30px;
display: block;
color: var(--icon-color);
filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--icon-color) 22%, transparent));
}
.workbench-list-icon--outline .workbench-list-icon__art :deep(.workbench-heroicon) {
stroke-width: 1.65;
}
.workbench-list-icon--solid .workbench-list-icon__art :deep(.workbench-heroicon path) {
opacity: 0.96;
}
</style>