feat: 同步报销流程与工作台改动
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
width var(--sidebar-motion),
|
||||
flex-basis var(--sidebar-motion),
|
||||
box-shadow 160ms var(--ease);
|
||||
animation: loginEntrySidebarIn 520ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
|
||||
}
|
||||
|
||||
.app.sidebar-collapsed .app-sidebar {
|
||||
@@ -151,7 +152,13 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.main { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
|
||||
.main {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-rows: auto auto minmax(0, 1fr);
|
||||
animation: loginEntryMainIn 620ms 90ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
|
||||
}
|
||||
.main.overview-main {
|
||||
height: var(--desktop-stage-height, 100dvh);
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
@@ -201,6 +208,14 @@
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding: 20px 24px;
|
||||
background-color: var(--workbench-surface-soft, #f9fbff);
|
||||
background-image:
|
||||
radial-gradient(ellipse at 0% 0%, rgba(58, 124, 165, 0.05) 0%, transparent 40%),
|
||||
radial-gradient(ellipse at 100% 0%, rgba(110, 127, 166, 0.05) 0%, transparent 40%),
|
||||
linear-gradient(rgba(58, 124, 165, 0.03) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(58, 124, 165, 0.03) 1px, transparent 1px);
|
||||
background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
|
||||
background-attachment: local;
|
||||
}
|
||||
.workarea.settings-workarea {
|
||||
padding: 0;
|
||||
|
||||
574
web/src/assets/styles/components/personal-workbench-progress.css
Normal file
574
web/src/assets/styles/components/personal-workbench-progress.css
Normal file
@@ -0,0 +1,574 @@
|
||||
.progress-panel {
|
||||
display: grid;
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.progress-panel :where(button) {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.progress-panel :where(button:disabled) {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-height: 24px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.section-head h2 {
|
||||
margin: 0;
|
||||
color: var(--workbench-ink);
|
||||
font-size: 16px;
|
||||
line-height: 1.25;
|
||||
font-weight: 850;
|
||||
}
|
||||
|
||||
.progress-section-head {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.progress-range-select {
|
||||
width: 124px;
|
||||
flex: 0 0 124px;
|
||||
}
|
||||
|
||||
.progress-range-control {
|
||||
position: relative;
|
||||
z-index: 6;
|
||||
flex: 0 0 124px;
|
||||
}
|
||||
|
||||
.progress-range-select:deep(.el-select__wrapper) {
|
||||
min-height: 32px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 0 1px var(--workbench-line) inset;
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
}
|
||||
|
||||
.progress-range-select:deep(.el-select__wrapper.is-focused),
|
||||
.progress-range-select:deep(.el-select__wrapper:hover) {
|
||||
box-shadow: 0 0 0 1px rgba(var(--theme-primary-rgb, 58, 124, 165), 0.38) inset;
|
||||
}
|
||||
|
||||
.progress-table-shell {
|
||||
position: relative;
|
||||
display: grid;
|
||||
--progress-table-columns: minmax(92px, 0.4fr) minmax(76px, 0.3fr) minmax(138px, 0.72fr) minmax(84px, 0.42fr) minmax(238px, 1.16fr) minmax(96px, 0.44fr);
|
||||
grid-template-rows: 36px minmax(0, 1fr);
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-table-header {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
display: grid;
|
||||
grid-template-columns: var(--progress-table-columns);
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
min-height: 36px;
|
||||
max-height: 36px;
|
||||
padding: 0 4px 0 0;
|
||||
overflow: hidden;
|
||||
border-radius: 4px;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94)),
|
||||
rgba(var(--theme-primary-rgb, 58, 124, 165), 0.04);
|
||||
border: 1px solid rgba(var(--theme-primary-rgb, 58, 124, 165), 0.08);
|
||||
box-shadow: 0 1px 0 rgba(var(--theme-primary-rgb, 58, 124, 165), 0.08);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.header-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
color: var(--workbench-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 850;
|
||||
line-height: 1;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.header-time {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.header-applicant,
|
||||
.header-type {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header-steps {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.header-result {
|
||||
text-align: center;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.progress-list {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
align-content: start;
|
||||
grid-auto-rows: minmax(76px, auto);
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding: 4px 4px 0 0;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.28) transparent;
|
||||
}
|
||||
|
||||
.progress-list::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.progress-list::-webkit-scrollbar-thumb {
|
||||
border-radius: 999px;
|
||||
background: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.24);
|
||||
}
|
||||
|
||||
.progress-empty-state {
|
||||
min-height: 220px;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
align-content: center;
|
||||
gap: 8px;
|
||||
padding: 28px 18px;
|
||||
border: 1px dashed rgba(var(--theme-primary-rgb, 58, 124, 165), 0.22);
|
||||
border-radius: 4px;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42)),
|
||||
rgba(var(--theme-primary-rgb, 58, 124, 165), 0.025);
|
||||
color: var(--workbench-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-empty-icon {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid rgba(var(--theme-primary-rgb, 58, 124, 165), 0.18);
|
||||
border-radius: 4px;
|
||||
background: var(--workbench-primary-soft);
|
||||
color: var(--workbench-primary-active);
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.progress-empty-state strong {
|
||||
color: var(--workbench-ink);
|
||||
font-size: 14px;
|
||||
font-weight: 850;
|
||||
}
|
||||
|
||||
.progress-empty-state p {
|
||||
max-width: 260px;
|
||||
margin: 0;
|
||||
color: var(--workbench-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.progress-row {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: var(--progress-table-columns);
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
min-height: 76px;
|
||||
padding: 10px 0;
|
||||
border-top: 0;
|
||||
background: transparent;
|
||||
box-shadow: inset 0 1px 0 rgba(var(--theme-primary-rgb, 58, 124, 165), 0.1);
|
||||
color: inherit;
|
||||
text-align: center;
|
||||
animation: workbenchItemIn 480ms var(--ease, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
|
||||
animation-delay: calc(300ms + var(--item-index, 0) * 80ms);
|
||||
}
|
||||
|
||||
.progress-row:first-child {
|
||||
padding-top: 2px;
|
||||
border-top: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.progress-row:hover {
|
||||
border-color: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.24);
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.18)),
|
||||
rgba(var(--theme-primary-rgb, 58, 124, 165), 0.035);
|
||||
box-shadow: inset 0 1px 0 rgba(var(--theme-primary-rgb, 58, 124, 165), 0.14);
|
||||
color: var(--workbench-primary-active);
|
||||
}
|
||||
|
||||
.progress-time-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.expense-type-icon {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 12px;
|
||||
font-size: 22px;
|
||||
box-shadow:
|
||||
0 4px 10px rgba(0, 0, 0, 0.04),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.9),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.expense-type-icon::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
|
||||
.expense-type-icon i {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12));
|
||||
}
|
||||
|
||||
.expense-type-icon--blue {
|
||||
border: 1px solid color-mix(in srgb, var(--workbench-primary, #3a7ca5) 20%, #ffffff);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, var(--workbench-primary, #3a7ca5) 12%, #ffffff) 0%, color-mix(in srgb, var(--workbench-primary, #3a7ca5) 3%, #ffffff) 100%);
|
||||
color: var(--workbench-primary, #3a7ca5);
|
||||
}
|
||||
|
||||
.expense-type-icon--amber {
|
||||
border: 1px solid color-mix(in srgb, var(--workbench-chart-amber, #b58b4c) 20%, #ffffff);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, var(--workbench-chart-amber, #b58b4c) 12%, #ffffff) 0%, color-mix(in srgb, var(--workbench-chart-amber, #b58b4c) 3%, #ffffff) 100%);
|
||||
color: var(--workbench-chart-amber, #b58b4c);
|
||||
}
|
||||
|
||||
.expense-type-icon--emerald {
|
||||
border: 1px solid color-mix(in srgb, #0f8f68 20%, #ffffff);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, #0f8f68 12%, #ffffff) 0%, color-mix(in srgb, #0f8f68 3%, #ffffff) 100%);
|
||||
color: #0f8f68;
|
||||
}
|
||||
|
||||
.expense-type-icon--violet {
|
||||
border: 1px solid color-mix(in srgb, #6d5bd0 20%, #ffffff);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, #6d5bd0 12%, #ffffff) 0%, color-mix(in srgb, #6d5bd0 3%, #ffffff) 100%);
|
||||
color: #6d5bd0;
|
||||
}
|
||||
|
||||
.expense-type-icon--cyan {
|
||||
border: 1px solid color-mix(in srgb, #0788a2 20%, #ffffff);
|
||||
background: linear-gradient(135deg, color-mix(in srgb, #0788a2 12%, #ffffff) 0%, color-mix(in srgb, #0788a2 3%, #ffffff) 100%);
|
||||
color: #0788a2;
|
||||
}
|
||||
|
||||
.expense-type-icon--muted {
|
||||
border: 1px solid var(--workbench-line);
|
||||
background: linear-gradient(135deg, var(--info-soft, #f1f5f9) 0%, #ffffff 100%);
|
||||
color: var(--workbench-muted, #64748b);
|
||||
}
|
||||
|
||||
.progress-time,
|
||||
.progress-applicant,
|
||||
.progress-identity,
|
||||
.progress-type,
|
||||
.progress-result {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.progress-time {
|
||||
justify-items: center;
|
||||
color: var(--workbench-muted);
|
||||
}
|
||||
|
||||
.progress-applicant {
|
||||
justify-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-applicant strong {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
color: var(--workbench-ink);
|
||||
font-size: 12.5px;
|
||||
font-weight: 850;
|
||||
line-height: 1.25;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-time time {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: var(--workbench-ink);
|
||||
font-size: 12px;
|
||||
font-weight: 850;
|
||||
line-height: 1.2;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-identity {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-identity strong {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.progress-identity strong,
|
||||
.progress-result strong {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
color: var(--workbench-ink);
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-identity small {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
color: var(--workbench-muted);
|
||||
font-size: 11.5px;
|
||||
line-height: 1.25;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-type {
|
||||
justify-self: stretch;
|
||||
justify-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-type strong {
|
||||
max-width: 100%;
|
||||
min-height: 22px;
|
||||
overflow: hidden;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 8px;
|
||||
border: 1px solid rgba(var(--theme-primary-rgb, 58, 124, 165), 0.18);
|
||||
border-radius: 4px;
|
||||
background: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.08);
|
||||
color: var(--workbench-primary-active);
|
||||
font-size: 11.5px;
|
||||
font-weight: 850;
|
||||
line-height: 1.2;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-result {
|
||||
justify-self: stretch;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-items: center;
|
||||
padding-right: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-result strong {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-steps {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
align-items: start;
|
||||
justify-items: stretch;
|
||||
}
|
||||
|
||||
.progress-step {
|
||||
position: relative;
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
gap: 1px;
|
||||
color: color-mix(in srgb, var(--workbench-muted) 64%, #ffffff);
|
||||
}
|
||||
|
||||
.progress-step::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: calc(-50% + 12px);
|
||||
right: calc(50% + 12px);
|
||||
height: 2px;
|
||||
background: var(--workbench-line);
|
||||
}
|
||||
|
||||
.progress-step:first-child::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-step.is-done::before,
|
||||
.progress-step.is-current::before {
|
||||
background: var(--workbench-primary);
|
||||
}
|
||||
|
||||
.progress-step i {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 2px solid var(--workbench-line);
|
||||
border-radius: 999px;
|
||||
background: var(--workbench-surface);
|
||||
color: var(--workbench-line-strong, #cbd5e1);
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.progress-step.is-done i {
|
||||
border-color: var(--workbench-primary);
|
||||
background: var(--workbench-primary-soft);
|
||||
color: var(--workbench-primary-active);
|
||||
}
|
||||
|
||||
.progress-step.is-current i {
|
||||
border-color: var(--workbench-primary-active);
|
||||
background: var(--theme-primary-light-9);
|
||||
color: var(--workbench-primary-active);
|
||||
}
|
||||
|
||||
.progress-step small {
|
||||
color: currentColor;
|
||||
font-size: 10px;
|
||||
font-weight: 750;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-step.is-done,
|
||||
.progress-step.is-current {
|
||||
color: var(--workbench-ink);
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.progress-table-shell {
|
||||
grid-template-rows: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.progress-table-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-row {
|
||||
grid-template-columns: minmax(70px, auto) minmax(62px, auto) 1fr minmax(74px, auto);
|
||||
grid-template-areas:
|
||||
"time applicant identity result"
|
||||
"type type type type"
|
||||
"steps steps steps steps";
|
||||
justify-items: center;
|
||||
}
|
||||
|
||||
.progress-section-head {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.progress-range-select {
|
||||
width: 120px;
|
||||
flex-basis: 120px;
|
||||
}
|
||||
|
||||
.progress-range-control {
|
||||
flex-basis: 120px;
|
||||
}
|
||||
|
||||
.progress-empty-state {
|
||||
min-height: 180px;
|
||||
}
|
||||
|
||||
.progress-time-wrapper {
|
||||
grid-area: time;
|
||||
}
|
||||
|
||||
.progress-applicant {
|
||||
grid-area: applicant;
|
||||
}
|
||||
|
||||
.progress-identity {
|
||||
grid-area: identity;
|
||||
}
|
||||
|
||||
.progress-type {
|
||||
grid-area: type;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.progress-result {
|
||||
grid-area: result;
|
||||
width: 100%;
|
||||
justify-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.progress-steps {
|
||||
grid-area: steps;
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.progress-step i {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.progress-step small {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.progress-step::before {
|
||||
top: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.progress-row {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
@@ -334,6 +334,19 @@
|
||||
justify-items: start;
|
||||
}
|
||||
|
||||
.progress-section-head {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.progress-range-select {
|
||||
width: 120px;
|
||||
flex-basis: 120px;
|
||||
}
|
||||
|
||||
.progress-empty-state {
|
||||
min-height: 180px;
|
||||
}
|
||||
|
||||
.progress-result {
|
||||
justify-items: start;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
--workbench-chart-amber: var(--chart-amber, #b58b4c);
|
||||
|
||||
width: 100%;
|
||||
max-width: 1680px;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
@@ -581,6 +583,27 @@
|
||||
font-weight: 850;
|
||||
}
|
||||
|
||||
.progress-section-head {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.progress-range-select {
|
||||
width: 124px;
|
||||
flex: 0 0 124px;
|
||||
}
|
||||
|
||||
.progress-range-select .el-select__wrapper {
|
||||
min-height: 32px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 0 1px var(--workbench-line) inset;
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
}
|
||||
|
||||
.progress-range-select .el-select__wrapper.is-focused,
|
||||
.progress-range-select .el-select__wrapper:hover {
|
||||
box-shadow: 0 0 0 1px rgba(var(--theme-primary-rgb, 58, 124, 165), 0.38) inset;
|
||||
}
|
||||
|
||||
.title-with-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -632,7 +655,65 @@
|
||||
display: grid;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
grid-auto-rows: minmax(0, 1fr);
|
||||
align-content: start;
|
||||
grid-auto-rows: minmax(56px, auto);
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.28) transparent;
|
||||
}
|
||||
|
||||
.progress-list::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.progress-list::-webkit-scrollbar-thumb {
|
||||
border-radius: 999px;
|
||||
background: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.24);
|
||||
}
|
||||
|
||||
.progress-empty-state {
|
||||
min-height: 220px;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
align-content: center;
|
||||
gap: 8px;
|
||||
padding: 28px 18px;
|
||||
border: 1px dashed rgba(var(--theme-primary-rgb, 58, 124, 165), 0.22);
|
||||
border-radius: 4px;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42)),
|
||||
rgba(var(--theme-primary-rgb, 58, 124, 165), 0.025);
|
||||
color: var(--workbench-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-empty-icon {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid rgba(var(--theme-primary-rgb, 58, 124, 165), 0.18);
|
||||
border-radius: 4px;
|
||||
background: var(--workbench-primary-soft);
|
||||
color: var(--workbench-primary-active);
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.progress-empty-state strong {
|
||||
color: var(--workbench-ink);
|
||||
font-size: 14px;
|
||||
font-weight: 850;
|
||||
}
|
||||
|
||||
.progress-empty-state p {
|
||||
max-width: 260px;
|
||||
margin: 0;
|
||||
color: var(--workbench-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.progress-row:first-child {
|
||||
@@ -645,15 +726,25 @@
|
||||
animation-delay: calc(300ms + var(--item-index, 0) * 80ms);
|
||||
}
|
||||
|
||||
.progress-identity,
|
||||
.progress-identity {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.progress-result {
|
||||
gap: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
.progress-identity strong {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.progress-identity strong,
|
||||
.progress-result strong {
|
||||
margin-bottom: 2px;
|
||||
|
||||
overflow: hidden;
|
||||
color: var(--workbench-ink);
|
||||
font-size: 13px;
|
||||
@@ -751,45 +842,6 @@
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.progress-row.has-long-duration-divider {
|
||||
margin-top: 13px;
|
||||
padding-top: 13px;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.progress-row.has-long-duration-divider::before {
|
||||
content: "10日以上";
|
||||
position: absolute;
|
||||
top: -9px;
|
||||
left: 50%;
|
||||
z-index: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 18px;
|
||||
padding: 0 10px;
|
||||
transform: translateX(-50%);
|
||||
border: 1px solid rgba(var(--theme-primary-rgb, 58, 124, 165), 0.28);
|
||||
border-radius: 4px;
|
||||
background: color-mix(in srgb, var(--theme-primary) 11%, #ffffff);
|
||||
box-shadow: 0 4px 10px rgba(var(--theme-primary-rgb, 58, 124, 165), 0.12);
|
||||
color: var(--theme-primary-active);
|
||||
font-size: 11px;
|
||||
font-weight: 850;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.progress-row.has-long-duration-divider::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.26);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.progress-time-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -173,8 +173,32 @@
|
||||
border-color 180ms var(--ease),
|
||||
color 180ms var(--ease);
|
||||
will-change: gap;
|
||||
animation: navItemEntrance 500ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
|
||||
}
|
||||
|
||||
@keyframes navItemEntrance {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-16px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.nav-btn:nth-child(1) { animation-delay: 60ms; }
|
||||
.nav-btn:nth-child(2) { animation-delay: 110ms; }
|
||||
.nav-btn:nth-child(3) { animation-delay: 160ms; }
|
||||
.nav-btn:nth-child(4) { animation-delay: 210ms; }
|
||||
.nav-btn:nth-child(5) { animation-delay: 260ms; }
|
||||
.nav-btn:nth-child(6) { animation-delay: 310ms; }
|
||||
.nav-btn:nth-child(7) { animation-delay: 360ms; }
|
||||
.nav-btn:nth-child(8) { animation-delay: 410ms; }
|
||||
.nav-btn:nth-child(9) { animation-delay: 460ms; }
|
||||
.nav-btn:nth-child(10) { animation-delay: 510ms; }
|
||||
.nav-btn:nth-child(11) { animation-delay: 560ms; }
|
||||
|
||||
.nav-btn:hover {
|
||||
background: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.08);
|
||||
color: var(--theme-primary-active);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
:model-value="visible"
|
||||
append-to-body
|
||||
align-center
|
||||
width="min(1040px, calc(100vw - 48px))"
|
||||
width="min(960px, calc(100vw - 64px))"
|
||||
:show-close="false"
|
||||
:lock-scroll="true"
|
||||
destroy-on-close
|
||||
@@ -277,6 +277,8 @@ watch(
|
||||
}
|
||||
|
||||
:global(.expense-profile-dialog.el-dialog) {
|
||||
max-height: calc(100vh - 56px);
|
||||
max-height: calc(100dvh - 56px);
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(148, 163, 184, 0.34);
|
||||
border-radius: 4px;
|
||||
@@ -380,7 +382,8 @@ watch(
|
||||
}
|
||||
|
||||
.profile-dialog-content {
|
||||
max-height: min(660px, calc(100vh - 190px));
|
||||
max-height: min(580px, calc(100vh - 176px));
|
||||
max-height: min(580px, calc(100dvh - 176px));
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
@@ -469,7 +472,7 @@ watch(
|
||||
|
||||
.profile-analysis-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
|
||||
grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@@ -483,13 +486,13 @@ watch(
|
||||
.profile-tags-panel {
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
align-content: stretch;
|
||||
min-height: 352px;
|
||||
min-height: 312px;
|
||||
}
|
||||
|
||||
.profile-radar-panel {
|
||||
grid-template-rows: auto minmax(0, 1fr) auto;
|
||||
align-content: stretch;
|
||||
min-height: 352px;
|
||||
min-height: 312px;
|
||||
}
|
||||
|
||||
.profile-section-title {
|
||||
@@ -554,11 +557,11 @@ watch(
|
||||
}
|
||||
|
||||
.profile-tags-panel > .profile-panel-empty {
|
||||
min-height: 284px;
|
||||
min-height: 244px;
|
||||
}
|
||||
|
||||
.profile-radar-empty {
|
||||
min-height: 308px;
|
||||
min-height: 268px;
|
||||
}
|
||||
|
||||
.profile-operation-copy strong {
|
||||
@@ -580,13 +583,13 @@ watch(
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: center;
|
||||
justify-items: stretch;
|
||||
min-height: 360px;
|
||||
min-height: 300px;
|
||||
animation: profileRadarEnter 360ms cubic-bezier(0.2, 0, 0, 1) both;
|
||||
}
|
||||
|
||||
.profile-radar-chart {
|
||||
width: 100%;
|
||||
height: 360px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.profile-behavior-tags {
|
||||
@@ -703,6 +706,97 @@ watch(
|
||||
justify-self: end;
|
||||
}
|
||||
|
||||
@media (min-width: 861px) and (max-width: 1440px),
|
||||
(min-width: 861px) and (max-height: 820px) {
|
||||
:global(.expense-profile-dialog.el-dialog) {
|
||||
width: min(900px, calc(100vw - 96px)) !important;
|
||||
max-height: calc(100vh - 64px);
|
||||
max-height: calc(100dvh - 64px);
|
||||
}
|
||||
|
||||
.profile-dialog-header,
|
||||
.profile-dialog-footer {
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
.profile-dialog-header h2 {
|
||||
margin: 2px 0 3px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.profile-dialog-header p,
|
||||
.profile-dialog-footer span {
|
||||
font-size: 11.5px;
|
||||
}
|
||||
|
||||
.profile-dialog-content {
|
||||
max-height: min(520px, calc(100vh - 152px));
|
||||
max-height: min(520px, calc(100dvh - 152px));
|
||||
gap: 10px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.profile-summary-grid,
|
||||
.profile-analysis-grid {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.profile-summary-item {
|
||||
gap: 3px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.profile-summary-item strong {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.profile-panel {
|
||||
gap: 8px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.profile-analysis-grid {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(300px, 0.82fr);
|
||||
}
|
||||
|
||||
.profile-tags-panel,
|
||||
.profile-radar-panel {
|
||||
min-height: 272px;
|
||||
}
|
||||
|
||||
.profile-tags-panel > .profile-panel-empty {
|
||||
min-height: 210px;
|
||||
}
|
||||
|
||||
.profile-radar-empty {
|
||||
min-height: 220px;
|
||||
}
|
||||
|
||||
.profile-radar-layout {
|
||||
min-height: 248px;
|
||||
}
|
||||
|
||||
.profile-radar-chart {
|
||||
height: 248px;
|
||||
}
|
||||
|
||||
.profile-behavior-tags {
|
||||
gap: 6px;
|
||||
min-height: 50px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.profile-operation-list {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.profile-operation-row {
|
||||
gap: 8px;
|
||||
padding: 7px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes expenseProfileDialogIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
:model-value="visible"
|
||||
append-to-body
|
||||
align-center
|
||||
width="min(980px, calc(100vw - 48px))"
|
||||
width="min(900px, calc(100vw - 64px))"
|
||||
:show-close="false"
|
||||
:lock-scroll="true"
|
||||
destroy-on-close
|
||||
@@ -256,6 +256,8 @@ function resolveTagType(tone) {
|
||||
}
|
||||
|
||||
:global(.expense-stats-detail-dialog.el-dialog) {
|
||||
max-height: calc(100vh - 56px);
|
||||
max-height: calc(100dvh - 56px);
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(148, 163, 184, 0.34);
|
||||
border-radius: 4px;
|
||||
@@ -353,7 +355,9 @@ function resolveTagType(tone) {
|
||||
}
|
||||
|
||||
.expense-stats-detail-content {
|
||||
max-height: min(660px, calc(100vh - 190px));
|
||||
max-height: min(580px, calc(100vh - 176px));
|
||||
max-height: min(580px, calc(100dvh - 176px));
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
@@ -372,7 +376,7 @@ function resolveTagType(tone) {
|
||||
}
|
||||
|
||||
.expense-stats-analysis-grid {
|
||||
grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
|
||||
grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
|
||||
}
|
||||
|
||||
.expense-stats-summary-item,
|
||||
@@ -432,7 +436,7 @@ function resolveTagType(tone) {
|
||||
|
||||
.expense-stats-distribution-panel,
|
||||
.expense-stats-processing-panel {
|
||||
min-height: 336px;
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.expense-stats-section-title {
|
||||
@@ -483,17 +487,17 @@ function resolveTagType(tone) {
|
||||
}
|
||||
|
||||
.expense-distribution-chart {
|
||||
min-height: 286px;
|
||||
min-height: 250px;
|
||||
display: grid;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.expense-distribution-chart-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(170px, 0.86fr) minmax(0, 1.14fr);
|
||||
grid-template-columns: minmax(160px, 0.86fr) minmax(0, 1.14fr);
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-height: 286px;
|
||||
min-height: 250px;
|
||||
}
|
||||
|
||||
.expense-distribution-donut {
|
||||
@@ -501,7 +505,7 @@ function resolveTagType(tone) {
|
||||
}
|
||||
|
||||
.expense-distribution-donut :deep(.donut-body) {
|
||||
height: 220px;
|
||||
height: 192px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
@@ -619,7 +623,7 @@ function resolveTagType(tone) {
|
||||
|
||||
.expense-stats-empty {
|
||||
margin: 0;
|
||||
min-height: 180px;
|
||||
min-height: 150px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -632,6 +636,97 @@ function resolveTagType(tone) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (min-width: 861px) and (max-width: 1440px),
|
||||
(min-width: 861px) and (max-height: 820px) {
|
||||
:global(.expense-stats-detail-dialog.el-dialog) {
|
||||
width: min(860px, calc(100vw - 96px)) !important;
|
||||
max-height: calc(100vh - 64px);
|
||||
max-height: calc(100dvh - 64px);
|
||||
}
|
||||
|
||||
.expense-stats-detail-header,
|
||||
.expense-stats-detail-footer {
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
.expense-stats-detail-header h2 {
|
||||
margin: 2px 0 3px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.expense-stats-detail-header p,
|
||||
.expense-stats-detail-footer span {
|
||||
font-size: 11.5px;
|
||||
}
|
||||
|
||||
.expense-stats-detail-content {
|
||||
max-height: min(520px, calc(100vh - 152px));
|
||||
max-height: min(520px, calc(100dvh - 152px));
|
||||
gap: 10px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.expense-stats-summary-grid,
|
||||
.expense-stats-analysis-grid {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.expense-stats-summary-item {
|
||||
gap: 3px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.expense-stats-summary-item strong {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.expense-stats-panel {
|
||||
gap: 8px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.expense-stats-analysis-grid {
|
||||
grid-template-columns: minmax(0, 0.86fr) minmax(300px, 1.14fr);
|
||||
}
|
||||
|
||||
.expense-stats-distribution-panel,
|
||||
.expense-stats-processing-panel {
|
||||
min-height: 272px;
|
||||
}
|
||||
|
||||
.expense-distribution-chart,
|
||||
.expense-distribution-chart-layout {
|
||||
min-height: 222px;
|
||||
}
|
||||
|
||||
.expense-distribution-chart-layout {
|
||||
grid-template-columns: minmax(140px, 0.8fr) minmax(0, 1.2fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.expense-distribution-donut :deep(.donut-body) {
|
||||
height: 170px;
|
||||
}
|
||||
|
||||
.expense-distribution-summary-list,
|
||||
.expense-processing-list,
|
||||
.expense-operation-list {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.expense-distribution-summary-row,
|
||||
.expense-processing-row,
|
||||
.expense-operation-row {
|
||||
gap: 8px;
|
||||
padding: 7px 0;
|
||||
}
|
||||
|
||||
.expense-processing-row {
|
||||
grid-template-columns: minmax(112px, 0.78fr) minmax(148px, 1fr) auto 54px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes expenseStatsDialogIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
|
||||
@@ -199,65 +199,10 @@
|
||||
</div>
|
||||
|
||||
<div class="workbench-content-grid">
|
||||
<article class="panel workbench-card progress-panel" style="--delay: 200ms;">
|
||||
<div class="section-head">
|
||||
<h2>费用进度</h2>
|
||||
</div>
|
||||
|
||||
<div class="progress-list">
|
||||
<button
|
||||
v-for="(item, index) in visibleProgressItems"
|
||||
:key="item.id"
|
||||
type="button"
|
||||
class="progress-row"
|
||||
:class="{ 'has-long-duration-divider': item.hasLongDurationDivider }"
|
||||
:style="{ '--item-index': index }"
|
||||
@click="openWorkbenchTarget(item)"
|
||||
>
|
||||
<span class="progress-time-wrapper">
|
||||
<span class="expense-type-icon" :class="`expense-type-icon--${item.expenseTypeTone}`">
|
||||
<i :class="item.expenseTypeIcon"></i>
|
||||
</span>
|
||||
<span class="progress-time">
|
||||
<time :datetime="item.updatedAt || ''">{{ item.displayTime }}</time>
|
||||
<small v-if="item.showTimeCapsule" class="time-capsule">更新时间</small>
|
||||
<small v-if="item.showUpdateText">更新</small>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="progress-identity">
|
||||
<strong>{{ item.title }}</strong>
|
||||
<small>{{ item.id }}</small>
|
||||
</span>
|
||||
|
||||
<span class="progress-type" :title="`${item.documentTypeLabel} · ${item.expenseTypeLabel || '其他费用'}`">
|
||||
<strong>{{ item.documentTypeLabel }} · {{ item.expenseTypeLabel || '其他费用' }}</strong>
|
||||
</span>
|
||||
|
||||
<span class="progress-steps" aria-hidden="true">
|
||||
<span
|
||||
v-for="step in item.steps"
|
||||
:key="step.label"
|
||||
class="progress-step"
|
||||
:class="{
|
||||
'is-done': step.done,
|
||||
'is-current': step.current,
|
||||
'is-future': !step.done && !step.current
|
||||
}"
|
||||
>
|
||||
<i :class="step.done || step.current ? 'mdi mdi-check' : 'mdi mdi-minus'"></i>
|
||||
<small>{{ step.label }}</small>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="progress-result">
|
||||
<strong>{{ item.amount }}</strong>
|
||||
<span class="progress-status" :class="`progress-status--${item.statusTone}`">{{ item.status }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
<PersonalWorkbenchProgressPanel
|
||||
:progress-items="workbenchSummary.progressItems || []"
|
||||
@open-target="openWorkbenchTarget"
|
||||
/>
|
||||
|
||||
<aside class="side-column">
|
||||
<article class="panel workbench-card side-panel expense-stats-panel" style="--delay: 300ms;">
|
||||
@@ -363,6 +308,7 @@ import PanelHead from '../shared/PanelHead.vue'
|
||||
import WorkbenchListIcon from '../shared/WorkbenchListIcon.vue'
|
||||
import ExpenseStatsDetailModal from './ExpenseStatsDetailModal.vue'
|
||||
import ExpenseProfileDetailModal from './ExpenseProfileDetailModal.vue'
|
||||
import PersonalWorkbenchProgressPanel from './PersonalWorkbenchProgressPanel.vue'
|
||||
import workbenchHeroBackground from '../../assets/images/hero-3d-banner.png'
|
||||
import { useSystemState } from '../../composables/useSystemState.js'
|
||||
import { useToast } from '../../composables/useToast.js'
|
||||
@@ -520,92 +466,8 @@ const expenseProfileEmptyReason = computed(() => String(employeeProfile.value?.e
|
||||
const expenseStatsDetail = computed(() => props.workbenchSummary.expenseStatsDetail || {})
|
||||
const currentUserProfileKey = computed(() => {
|
||||
const user = currentUser.value || {}
|
||||
return [
|
||||
user.username,
|
||||
user.email,
|
||||
user.name,
|
||||
user.employeeNo,
|
||||
user.employee_no
|
||||
].map((item) => String(item || '').trim()).filter(Boolean).join('|')
|
||||
return [user.username, user.email, user.name, user.employeeNo, user.employee_no].map((item) => String(item || '').trim()).filter(Boolean).join('|')
|
||||
})
|
||||
function resolveExpenseTypeStyle(label) {
|
||||
if (label === '差旅交通') return { icon: 'mdi mdi-airplane', tone: 'blue' }
|
||||
if (label === '业务招待') return { icon: 'mdi mdi-silverware-fork-knife', tone: 'amber' }
|
||||
if (label === '办公采购') return { icon: 'mdi mdi-cart-outline', tone: 'emerald' }
|
||||
if (label === '培训会议') return { icon: 'mdi mdi-projector', tone: 'violet' }
|
||||
if (label === '市场活动') return { icon: 'mdi mdi-bullhorn-outline', tone: 'cyan' }
|
||||
return { icon: 'mdi mdi-receipt-text-outline', tone: 'muted' }
|
||||
}
|
||||
|
||||
const visibleProgressItems = computed(() => {
|
||||
const rows = Array.isArray(props.workbenchSummary.progressItems)
|
||||
? props.workbenchSummary.progressItems
|
||||
: []
|
||||
const progressRows = rows.slice(0, 5).map((item) => ({
|
||||
...item,
|
||||
displayTime: formatProgressTime(item?.updatedAt),
|
||||
isLongDuration: isLongDurationProgress(item?.updatedAt)
|
||||
}))
|
||||
|
||||
return progressRows.map((item, index) => {
|
||||
const isCompleted = item.statusTone === 'muted';
|
||||
const expenseStyle = resolveExpenseTypeStyle(item.expenseTypeLabel);
|
||||
return {
|
||||
...item,
|
||||
expenseTypeIcon: expenseStyle.icon,
|
||||
expenseTypeTone: expenseStyle.tone,
|
||||
showTimeCapsule: !item.isLongDuration,
|
||||
showUpdateText: item.isLongDuration && !isCompleted,
|
||||
hasLongDurationDivider: item.isLongDuration && !progressRows[index - 1]?.isLongDuration
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const LONG_DURATION_DAYS = 10
|
||||
const DAY_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
function formatProgressTime(value) {
|
||||
const text = String(value || '').trim()
|
||||
if (!text) {
|
||||
return '最近更新'
|
||||
}
|
||||
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2}))?/.exec(text)
|
||||
if (match) {
|
||||
return match[4] ? `${match[2]}-${match[3]} ${match[4]}:${match[5]}` : `${match[2]}-${match[3]}`
|
||||
}
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
function parseProgressDate(value) {
|
||||
const text = String(value || '').trim()
|
||||
if (!text) {
|
||||
return null
|
||||
}
|
||||
|
||||
const localDateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text)
|
||||
if (localDateMatch) {
|
||||
return new Date(
|
||||
Number(localDateMatch[1]),
|
||||
Number(localDateMatch[2]) - 1,
|
||||
Number(localDateMatch[3])
|
||||
)
|
||||
}
|
||||
|
||||
const date = new Date(text)
|
||||
return Number.isNaN(date.getTime()) ? null : date
|
||||
}
|
||||
|
||||
function isLongDurationProgress(value) {
|
||||
const date = parseProgressDate(value)
|
||||
if (!date) {
|
||||
return false
|
||||
}
|
||||
|
||||
return (Date.now() - date.getTime()) / DAY_MS >= LONG_DURATION_DAYS
|
||||
}
|
||||
|
||||
function buildSelectedFileKey(file) {
|
||||
return [file?.name, file?.size, file?.lastModified, file?.type].join('__')
|
||||
}
|
||||
@@ -748,7 +610,7 @@ function openWorkbenchTarget(item) {
|
||||
return
|
||||
}
|
||||
|
||||
openPromptAssistant(item?.prompt || `查询 ${item?.id || ''} 的费用进度`, SESSION_TYPE_EXPENSE)
|
||||
openPromptAssistant(item?.prompt || `查询 ${item?.id || ''} 的单据进度`, SESSION_TYPE_EXPENSE)
|
||||
}
|
||||
|
||||
function openCapabilityAssistant(item) {
|
||||
|
||||
211
web/src/components/business/PersonalWorkbenchProgressPanel.vue
Normal file
211
web/src/components/business/PersonalWorkbenchProgressPanel.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<article class="panel workbench-card progress-panel" style="--delay: 200ms;">
|
||||
<div class="section-head progress-section-head">
|
||||
<h2>单据进度</h2>
|
||||
<div
|
||||
class="progress-range-control"
|
||||
@click.stop
|
||||
@mousedown.stop
|
||||
@pointerdown.stop
|
||||
>
|
||||
<EnterpriseSelect
|
||||
v-model="selectedProgressRange"
|
||||
class="progress-range-select"
|
||||
:options="PROGRESS_RANGE_OPTIONS"
|
||||
size="small"
|
||||
:teleported="true"
|
||||
aria-label="单据进度时间范围"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="visibleProgressItems.length" class="progress-table-shell">
|
||||
<div class="progress-table-header" aria-hidden="true">
|
||||
<span class="header-cell header-time">更新时间</span>
|
||||
<span class="header-cell header-applicant">提单人</span>
|
||||
<span class="header-cell header-identity">单据信息</span>
|
||||
<span class="header-cell header-type">类型归属</span>
|
||||
<span class="header-cell header-steps">办理进度</span>
|
||||
<span class="header-cell header-result">涉及金额</span>
|
||||
</div>
|
||||
|
||||
<div class="progress-list">
|
||||
<button
|
||||
v-for="(item, index) in visibleProgressItems"
|
||||
:key="`${item.id}-${index}`"
|
||||
type="button"
|
||||
class="progress-row"
|
||||
:style="{ '--item-index': index }"
|
||||
@click="handleProgressItemClick($event, item)"
|
||||
>
|
||||
<span class="progress-time-wrapper">
|
||||
<span class="expense-type-icon" :class="`expense-type-icon--${item.expenseTypeTone}`">
|
||||
<i :class="item.expenseTypeIcon"></i>
|
||||
</span>
|
||||
<span class="progress-time">
|
||||
<time :datetime="item.updatedAt || ''">{{ item.displayTime }}</time>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="progress-applicant" title="申请人">
|
||||
<strong>{{ item.applicantLabel || '待补充' }}</strong>
|
||||
</span>
|
||||
|
||||
<span class="progress-identity">
|
||||
<strong>{{ item.title }}</strong>
|
||||
<small>{{ item.id }}</small>
|
||||
</span>
|
||||
|
||||
<span class="progress-type" :title="`${item.documentTypeLabel} · ${item.expenseTypeLabel || '其他费用'}`">
|
||||
<strong>{{ item.documentTypeLabel }} · {{ item.expenseTypeLabel || '其他费用' }}</strong>
|
||||
</span>
|
||||
|
||||
<span class="progress-steps" aria-hidden="true">
|
||||
<span
|
||||
v-for="step in item.steps"
|
||||
:key="step.label"
|
||||
class="progress-step"
|
||||
:class="{
|
||||
'is-done': step.done,
|
||||
'is-current': step.current,
|
||||
'is-future': !step.done && !step.current
|
||||
}"
|
||||
>
|
||||
<i :class="step.done || step.current ? 'mdi mdi-check' : 'mdi mdi-minus'"></i>
|
||||
<small>{{ step.label }}</small>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="progress-result">
|
||||
<strong>{{ item.amount }}</strong>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="progress-empty-state" role="status">
|
||||
<span class="progress-empty-icon" aria-hidden="true">
|
||||
<i class="mdi mdi-file-document-search-outline"></i>
|
||||
</span>
|
||||
<strong>当前范围暂无单据</strong>
|
||||
<p>{{ progressRangeLabel }}内没有申请单或报销单进度。</p>
|
||||
</div>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import EnterpriseSelect from '../shared/EnterpriseSelect.vue'
|
||||
|
||||
const PROGRESS_RANGE_OPTIONS = Object.freeze([
|
||||
{ value: '10d', label: '近10日' },
|
||||
{ value: '30d', label: '近30日' },
|
||||
{ value: '3m', label: '近3个月' }
|
||||
])
|
||||
const DAY_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
const props = defineProps({
|
||||
progressItems: { type: Array, default: () => [] }
|
||||
})
|
||||
|
||||
const emit = defineEmits(['open-target'])
|
||||
const selectedProgressRange = ref('30d')
|
||||
|
||||
const progressRangeLabel = computed(() =>
|
||||
PROGRESS_RANGE_OPTIONS.find((item) => item.value === selectedProgressRange.value)?.label || '近30日'
|
||||
)
|
||||
|
||||
const visibleProgressItems = computed(() => {
|
||||
const rows = Array.isArray(props.progressItems) ? props.progressItems : []
|
||||
return rows
|
||||
.filter((item) => isInSelectedProgressRange(item?.updatedAt))
|
||||
.map((item) => {
|
||||
const expenseStyle = resolveExpenseTypeStyle(item.expenseTypeLabel)
|
||||
return {
|
||||
...item,
|
||||
displayTime: formatProgressTime(item?.updatedAt),
|
||||
expenseTypeIcon: expenseStyle.icon,
|
||||
expenseTypeTone: expenseStyle.tone
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function resolveExpenseTypeStyle(label) {
|
||||
if (label === '差旅交通') return { icon: 'mdi mdi-airplane', tone: 'blue' }
|
||||
if (label === '业务招待') return { icon: 'mdi mdi-silverware-fork-knife', tone: 'amber' }
|
||||
if (label === '办公采购') return { icon: 'mdi mdi-cart-outline', tone: 'emerald' }
|
||||
if (label === '培训会议') return { icon: 'mdi mdi-projector', tone: 'violet' }
|
||||
if (label === '市场活动') return { icon: 'mdi mdi-bullhorn-outline', tone: 'cyan' }
|
||||
return { icon: 'mdi mdi-receipt-text-outline', tone: 'muted' }
|
||||
}
|
||||
|
||||
function formatProgressTime(value) {
|
||||
const text = String(value || '').trim()
|
||||
if (!text) {
|
||||
return '最近更新'
|
||||
}
|
||||
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2}))?/.exec(text)
|
||||
if (match) {
|
||||
return match[4] ? `${match[2]}-${match[3]} ${match[4]}:${match[5]}` : `${match[2]}-${match[3]}`
|
||||
}
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
function parseProgressDate(value) {
|
||||
const text = String(value || '').trim()
|
||||
if (!text) {
|
||||
return null
|
||||
}
|
||||
|
||||
const localDateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text)
|
||||
if (localDateMatch) {
|
||||
return new Date(
|
||||
Number(localDateMatch[1]),
|
||||
Number(localDateMatch[2]) - 1,
|
||||
Number(localDateMatch[3])
|
||||
)
|
||||
}
|
||||
|
||||
const date = new Date(text)
|
||||
return Number.isNaN(date.getTime()) ? null : date
|
||||
}
|
||||
|
||||
function resolveProgressRangeStart() {
|
||||
const start = new Date()
|
||||
start.setHours(0, 0, 0, 0)
|
||||
|
||||
if (selectedProgressRange.value === '10d') {
|
||||
start.setDate(start.getDate() - 10)
|
||||
return start
|
||||
}
|
||||
|
||||
if (selectedProgressRange.value === '3m') {
|
||||
start.setMonth(start.getMonth() - 3)
|
||||
return start
|
||||
}
|
||||
|
||||
start.setDate(start.getDate() - 30)
|
||||
return start
|
||||
}
|
||||
|
||||
function isInSelectedProgressRange(value) {
|
||||
const date = parseProgressDate(value)
|
||||
if (!date) {
|
||||
return true
|
||||
}
|
||||
|
||||
return date.getTime() >= resolveProgressRangeStart().getTime()
|
||||
}
|
||||
|
||||
function handleProgressItemClick(event, item) {
|
||||
const target = event?.target
|
||||
if (target?.closest?.('.progress-range-control, .enterprise-select-popper, .el-select-dropdown, .el-popper')) {
|
||||
return
|
||||
}
|
||||
emit('open-target', item)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped src="../../assets/styles/components/personal-workbench-progress.css"></style>
|
||||
@@ -32,7 +32,7 @@ const chartColors = computed(() => ({
|
||||
|
||||
const ariaLabel = computed(() =>
|
||||
props.labels.map((label, index) => (
|
||||
`${label}登录${props.loginUsers[index] || 0}人,互动${props.interactions[index] || 0}次`
|
||||
`${label}在线${props.loginUsers[index] || 0}人,互动${props.interactions[index] || 0}次`
|
||||
)).join(';')
|
||||
)
|
||||
|
||||
@@ -84,13 +84,15 @@ const chartOptions = computed(() => ({
|
||||
axisLabel: {
|
||||
color: '#64748b',
|
||||
fontSize: 11,
|
||||
fontWeight: 700
|
||||
fontWeight: 700,
|
||||
interval: props.compact ? 2 : 1,
|
||||
hideOverlap: true
|
||||
}
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: '登录',
|
||||
name: '在线',
|
||||
min: 0,
|
||||
axisLabel: {
|
||||
color: '#64748b',
|
||||
@@ -115,7 +117,7 @@ const chartOptions = computed(() => ({
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '登录人数',
|
||||
name: '在线人数',
|
||||
type: 'line',
|
||||
smooth: 0.42,
|
||||
symbol: 'circle',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useNavigation, navItems } from './useNavigation.js'
|
||||
import { mapExpenseClaimToRequest, useRequests } from './useRequests.js'
|
||||
import { useSystemState } from './useSystemState.js'
|
||||
import { useToast } from './useToast.js'
|
||||
import { fetchExpenseClaimDetail } from '../services/reimbursements.js'
|
||||
import { fetchAllApprovalExpenseClaims, fetchExpenseClaimDetail } from '../services/reimbursements.js'
|
||||
import { fetchOntologyParse } from '../services/ontology.js'
|
||||
import { fetchLatestConversation } from '../services/orchestrator.js'
|
||||
import { clearAssistantSessionSnapshotForDraftClaim } from '../utils/assistantSessionSnapshot.js'
|
||||
@@ -18,20 +18,20 @@ import {
|
||||
} from '../utils/workbenchAssistantIntent.js'
|
||||
import { buildWorkbenchSummary } from '../utils/workbenchSummary.js'
|
||||
import { createCurrentYearDateRange } from '../utils/dateRangeDefaults.js'
|
||||
|
||||
|
||||
const SESSION_TYPE_EXPENSE = 'expense'
|
||||
const SMART_ENTRY_SOURCE_APPLICATION = 'application'
|
||||
const SMART_ENTRY_SOURCE_REIMBURSEMENT = 'topbar'
|
||||
|
||||
export function useAppShell() {
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const smartEntryOpen = ref(false)
|
||||
const smartEntryContext = ref({
|
||||
prompt: '',
|
||||
|
||||
export function useAppShell() {
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const smartEntryOpen = ref(false)
|
||||
const smartEntryContext = ref({
|
||||
prompt: '',
|
||||
source: 'documents',
|
||||
request: null,
|
||||
request: null,
|
||||
files: [],
|
||||
conversation: null,
|
||||
scope: null,
|
||||
@@ -45,16 +45,17 @@ export function useAppShell() {
|
||||
const smartEntryInvalidatedDraftClaimId = ref('')
|
||||
const selectedRequestSnapshot = ref(null)
|
||||
const documentCenterRefreshToken = ref(0)
|
||||
|
||||
const { activeView, currentView, setView } = useNavigation()
|
||||
const {
|
||||
requests,
|
||||
loading: requestsLoading,
|
||||
error: requestsError,
|
||||
search,
|
||||
filters,
|
||||
ranges,
|
||||
activeRange,
|
||||
const workbenchApprovalRequests = ref([])
|
||||
|
||||
const { activeView, currentView, setView } = useNavigation()
|
||||
const {
|
||||
requests,
|
||||
loading: requestsLoading,
|
||||
error: requestsError,
|
||||
search,
|
||||
filters,
|
||||
ranges,
|
||||
activeRange,
|
||||
filteredRequests,
|
||||
approveRequest,
|
||||
rejectRequest,
|
||||
@@ -65,7 +66,7 @@ export function useAppShell() {
|
||||
const { toast } = useToast()
|
||||
|
||||
const customRange = ref(createCurrentYearDateRange())
|
||||
|
||||
|
||||
const selectedRequest = computed(() => {
|
||||
const requestId = String(route.params.requestId || '')
|
||||
|
||||
@@ -105,6 +106,40 @@ export function useAppShell() {
|
||||
return reloadRequests()
|
||||
}
|
||||
|
||||
async function reloadWorkbenchApprovalRequests() {
|
||||
try {
|
||||
const payload = await fetchAllApprovalExpenseClaims()
|
||||
workbenchApprovalRequests.value = Array.isArray(payload)
|
||||
? payload.map((item) => mapExpenseClaimToRequest(item))
|
||||
: []
|
||||
} catch {
|
||||
workbenchApprovalRequests.value = []
|
||||
}
|
||||
}
|
||||
|
||||
async function reloadWorkbenchRequests() {
|
||||
const [payload] = await Promise.all([
|
||||
reloadRequests({ silent: true }),
|
||||
reloadWorkbenchApprovalRequests()
|
||||
])
|
||||
return payload
|
||||
}
|
||||
|
||||
function resolveWorkbenchRequestKey(request) {
|
||||
return String(request?.claimId || request?.id || request?.claimNo || '').trim()
|
||||
}
|
||||
|
||||
function mergeWorkbenchRequests(primaryRequests = [], approvalRequests = []) {
|
||||
const merged = new Map()
|
||||
for (const request of [...primaryRequests, ...approvalRequests]) {
|
||||
const key = resolveWorkbenchRequestKey(request)
|
||||
if (key) {
|
||||
merged.set(key, request)
|
||||
}
|
||||
}
|
||||
return Array.from(merged.values())
|
||||
}
|
||||
|
||||
function isSameRequestIdentity(request, requestId) {
|
||||
const normalizedId = String(requestId || '').trim()
|
||||
if (!request || !normalizedId) {
|
||||
@@ -185,16 +220,20 @@ export function useAppShell() {
|
||||
return
|
||||
}
|
||||
if (view === 'workbench') {
|
||||
void ensureRequestsLoaded()
|
||||
void reloadWorkbenchRequests()
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const workbenchSummary = computed(() =>
|
||||
buildWorkbenchSummary(requests.value, currentUser.value)
|
||||
)
|
||||
|
||||
|
||||
const workbenchRequests = computed(() =>
|
||||
mergeWorkbenchRequests(requests.value, workbenchApprovalRequests.value)
|
||||
)
|
||||
|
||||
const workbenchSummary = computed(() =>
|
||||
buildWorkbenchSummary(workbenchRequests.value, currentUser.value)
|
||||
)
|
||||
|
||||
const topBarView = computed(() => {
|
||||
if (detailMode.value) {
|
||||
const request = selectedRequest.value || {}
|
||||
@@ -207,46 +246,46 @@ export function useAppShell() {
|
||||
: '查看报销明细、票据材料、审批进度与风险提示。'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currentView.value
|
||||
})
|
||||
|
||||
const requestSummary = computed(() =>
|
||||
filteredRequests.value.reduce(
|
||||
(summary, item) => {
|
||||
const request = normalizeRequestForUi(item)
|
||||
if (!request) {
|
||||
return summary
|
||||
}
|
||||
|
||||
summary.total += 1
|
||||
|
||||
if (request.approvalKey === 'draft') {
|
||||
summary.draft += 1
|
||||
} else if (request.approvalKey === 'in_progress') {
|
||||
summary.inProgress += 1
|
||||
} else if (request.approvalKey === 'supplement') {
|
||||
summary.supplement += 1
|
||||
} else if (request.approvalKey === 'completed') {
|
||||
summary.completed += 1
|
||||
}
|
||||
|
||||
return summary
|
||||
},
|
||||
{ total: 0, draft: 0, inProgress: 0, supplement: 0, completed: 0 }
|
||||
)
|
||||
)
|
||||
|
||||
function handleApprove(request) {
|
||||
const message = approveRequest(request)
|
||||
toast(message)
|
||||
}
|
||||
|
||||
function handleReject(request) {
|
||||
const message = rejectRequest(request)
|
||||
toast(message)
|
||||
}
|
||||
|
||||
|
||||
const requestSummary = computed(() =>
|
||||
filteredRequests.value.reduce(
|
||||
(summary, item) => {
|
||||
const request = normalizeRequestForUi(item)
|
||||
if (!request) {
|
||||
return summary
|
||||
}
|
||||
|
||||
summary.total += 1
|
||||
|
||||
if (request.approvalKey === 'draft') {
|
||||
summary.draft += 1
|
||||
} else if (request.approvalKey === 'in_progress') {
|
||||
summary.inProgress += 1
|
||||
} else if (request.approvalKey === 'supplement') {
|
||||
summary.supplement += 1
|
||||
} else if (request.approvalKey === 'completed') {
|
||||
summary.completed += 1
|
||||
}
|
||||
|
||||
return summary
|
||||
},
|
||||
{ total: 0, draft: 0, inProgress: 0, supplement: 0, completed: 0 }
|
||||
)
|
||||
)
|
||||
|
||||
function handleApprove(request) {
|
||||
const message = approveRequest(request)
|
||||
toast(message)
|
||||
}
|
||||
|
||||
function handleReject(request) {
|
||||
const message = rejectRequest(request)
|
||||
toast(message)
|
||||
}
|
||||
|
||||
function handleNavigate(view) {
|
||||
smartEntryOpen.value = false
|
||||
const shouldRefreshCurrentDocumentCenter =
|
||||
@@ -258,7 +297,7 @@ export function useAppShell() {
|
||||
void reloadDocumentCenterRequests()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function openFinancialAssistantCreate(source) {
|
||||
if (smartEntryOpen.value) {
|
||||
smartEntryRevealToken.value += 1
|
||||
@@ -287,28 +326,28 @@ export function useAppShell() {
|
||||
function openExpenseApplicationCreate() {
|
||||
openFinancialAssistantCreate(SMART_ENTRY_SOURCE_APPLICATION)
|
||||
}
|
||||
|
||||
function resolveCurrentUserId() {
|
||||
const user = currentUser.value || {}
|
||||
return String(user.username || user.name || 'anonymous').trim() || 'anonymous'
|
||||
}
|
||||
|
||||
function resolveSmartEntryClaimScope(payload = {}) {
|
||||
const request = payload.request && typeof payload.request === 'object' ? payload.request : null
|
||||
const payloadScope = payload.scope && typeof payload.scope === 'object' ? payload.scope : null
|
||||
const claimId = String(
|
||||
payloadScope?.claimId ||
|
||||
payloadScope?.claim_id ||
|
||||
request?.claimId ||
|
||||
request?.claim_id ||
|
||||
''
|
||||
).trim()
|
||||
if (!claimId) {
|
||||
return null
|
||||
}
|
||||
return { type: 'claim', claimId }
|
||||
}
|
||||
|
||||
|
||||
function resolveCurrentUserId() {
|
||||
const user = currentUser.value || {}
|
||||
return String(user.username || user.name || 'anonymous').trim() || 'anonymous'
|
||||
}
|
||||
|
||||
function resolveSmartEntryClaimScope(payload = {}) {
|
||||
const request = payload.request && typeof payload.request === 'object' ? payload.request : null
|
||||
const payloadScope = payload.scope && typeof payload.scope === 'object' ? payload.scope : null
|
||||
const claimId = String(
|
||||
payloadScope?.claimId ||
|
||||
payloadScope?.claim_id ||
|
||||
request?.claimId ||
|
||||
request?.claim_id ||
|
||||
''
|
||||
).trim()
|
||||
if (!claimId) {
|
||||
return null
|
||||
}
|
||||
return { type: 'claim', claimId }
|
||||
}
|
||||
|
||||
function isDetailClaimScopedPayload(payload = {}) {
|
||||
return String(payload.source || '').trim() === 'detail' && Boolean(resolveSmartEntryClaimScope(payload))
|
||||
}
|
||||
@@ -451,7 +490,7 @@ export function useAppShell() {
|
||||
const status = String(payload.status || payload.claimStatus || '').trim()
|
||||
const approvalStage = String(payload.approvalStage || payload.approval_stage || '').trim()
|
||||
const isApplicationDocument = isApplicationDocumentPayload(payload, claimNo)
|
||||
await reloadRequests()
|
||||
await reloadWorkbenchRequests()
|
||||
if (status === 'submitted') {
|
||||
if (isApplicationDocument) {
|
||||
toast(`${claimNo || '该'}申请单已提交${approvalStage ? `,当前节点:${approvalStage}` : ',等待直属领导审批'}。`)
|
||||
@@ -505,7 +544,7 @@ export function useAppShell() {
|
||||
}
|
||||
|
||||
async function handleRequestUpdated() {
|
||||
await reloadRequests()
|
||||
await reloadWorkbenchRequests()
|
||||
await refreshSelectedRequestDetail(String(route.params.requestId || ''))
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@ import {
|
||||
import {
|
||||
metricBlueprints,
|
||||
systemMetricBlueprints,
|
||||
systemDashboardTotals as fallbackSystemDashboardTotals,
|
||||
systemAgentDailyRatio as fallbackSystemAgentDailyRatio,
|
||||
systemLoginWave as fallbackSystemLoginWave,
|
||||
systemTokenDailyWave as fallbackSystemTokenDailyWave,
|
||||
systemUsageDurationSummary as fallbackSystemUsageDurationSummary,
|
||||
systemUserTokenUsage as fallbackSystemUserTokenUsage,
|
||||
@@ -78,6 +76,25 @@ const emptyFinanceBudgetMetrics = [
|
||||
{ label: '预警预算池', value: '0 个', detail: '超支 0 个', tone: 'success', icon: 'mdi mdi-alert-outline' }
|
||||
]
|
||||
|
||||
const emptySystemDashboardTotals = {
|
||||
toolCalls: 0,
|
||||
modelTokens: 0,
|
||||
onlineUsers: 0,
|
||||
avgOnlineMinutes: 0,
|
||||
executionSuccessRate: 0,
|
||||
positiveFeedback: 0,
|
||||
negativeFeedback: 0,
|
||||
failedRuns: 0,
|
||||
toolCallsChange: 0,
|
||||
modelTokensChange: 0
|
||||
}
|
||||
|
||||
const emptySystemLoginWave = {
|
||||
labels: Array.from({ length: 24 }, (_, hour) => `${String(hour).padStart(2, '0')}:00`),
|
||||
loginUsers: Array.from({ length: 24 }, () => 0),
|
||||
interactions: Array.from({ length: 24 }, () => 0)
|
||||
}
|
||||
|
||||
function parseLocalDate(value) {
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(value || '').trim())
|
||||
if (!match) {
|
||||
@@ -439,13 +456,13 @@ export function useOverviewView(options = {}) {
|
||||
})
|
||||
|
||||
const systemDashboardTotals = computed(() => (
|
||||
systemDashboardPayload.value?.totals || fallbackSystemDashboardTotals
|
||||
systemDashboardPayload.value?.totals || emptySystemDashboardTotals
|
||||
))
|
||||
const systemAgentDailyRatio = computed(() => (
|
||||
systemDashboardPayload.value?.agentDailyRatio || fallbackSystemAgentDailyRatio
|
||||
))
|
||||
const systemLoginWave = computed(() => (
|
||||
systemDashboardPayload.value?.loginWave || fallbackSystemLoginWave
|
||||
systemDashboardPayload.value?.loginWave || emptySystemLoginWave
|
||||
))
|
||||
const systemTokenDailyWave = computed(() => (
|
||||
systemDashboardPayload.value?.tokenDailyWave || fallbackSystemTokenDailyWave
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
|
||||
import { fetchExpenseClaims } from '../services/reimbursements.js'
|
||||
import { fetchAllExpenseClaims } from '../services/reimbursements.js'
|
||||
import { filterActionableRiskFlags, normalizeRiskFlagTone } from '../utils/riskFlags.js'
|
||||
|
||||
const EXPENSE_TYPE_LABELS = {
|
||||
@@ -72,7 +72,6 @@ const APPLICATION_PROGRESS_LABELS = [
|
||||
'创建申请',
|
||||
'直属领导审批',
|
||||
'预算管理者审批',
|
||||
'审批完成',
|
||||
APPLICATION_LINK_STATUS_STEP_LABEL,
|
||||
ARCHIVED_STEP_LABEL
|
||||
]
|
||||
@@ -80,7 +79,6 @@ const APPLICATION_PROGRESS_LABELS = [
|
||||
const APPLICATION_PROGRESS_LABELS_WITHOUT_BUDGET = [
|
||||
'创建申请',
|
||||
'直属领导审批',
|
||||
'审批完成',
|
||||
APPLICATION_LINK_STATUS_STEP_LABEL,
|
||||
ARCHIVED_STEP_LABEL
|
||||
]
|
||||
@@ -595,17 +593,17 @@ function resolveApplicationProgressCurrentIndex(approvalMeta, workflowNode) {
|
||||
const normalizedNode = String(workflowNode || '').trim()
|
||||
|
||||
if (approvalMeta.key === 'completed') {
|
||||
return normalizedNode.includes(APPLICATION_ARCHIVE_STAGE_LABEL) ? 4 : 3
|
||||
return normalizedNode.includes(APPLICATION_ARCHIVE_STAGE_LABEL) ? 3 : 2
|
||||
}
|
||||
|
||||
if (normalizedNode.includes(APPLICATION_ARCHIVE_STAGE_LABEL) || normalizedNode.includes(ARCHIVED_STEP_LABEL)) {
|
||||
return 4
|
||||
return 3
|
||||
}
|
||||
if (normalizedNode.includes(APPLICATION_LINK_STATUS_STEP_LABEL)) {
|
||||
return 3
|
||||
return 2
|
||||
}
|
||||
if (normalizedNode.includes('审批完成') || normalizedNode.includes('申请完成')) {
|
||||
return 3
|
||||
return 2
|
||||
}
|
||||
if (normalizedNode.includes('预算')) {
|
||||
return 2
|
||||
@@ -693,6 +691,36 @@ function resolveApplicationApproverName(claim) {
|
||||
) || '直属领导'
|
||||
}
|
||||
|
||||
function resolveReimbursementApproverName(claim, label) {
|
||||
const stepLabel = normalizeText(label)
|
||||
if (stepLabel === '直属领导审批') {
|
||||
return resolveDisplayName(
|
||||
claim?.manager_name,
|
||||
claim?.managerName,
|
||||
claim?.profile_manager,
|
||||
claim?.profileManager,
|
||||
claim?.direct_manager_name,
|
||||
claim?.directManagerName
|
||||
) || '直属领导'
|
||||
}
|
||||
|
||||
if (stepLabel === '财务审批') {
|
||||
const routeEvent = findReimbursementFinanceRouteEvent(claim)
|
||||
return resolveDisplayName(
|
||||
claim?.finance_approver_name,
|
||||
claim?.financeApproverName,
|
||||
routeEvent?.next_approver_name,
|
||||
routeEvent?.nextApproverName,
|
||||
routeEvent?.finance_approver_name,
|
||||
routeEvent?.financeApproverName,
|
||||
claim?.finance_owner_name,
|
||||
claim?.financeOwnerName
|
||||
) || '财务'
|
||||
}
|
||||
|
||||
return stepLabel.replace(/审批$/, '') || '审批人'
|
||||
}
|
||||
|
||||
function resolveApplicationBudgetApproverName(claim) {
|
||||
const routeEvent = findApprovalEventForStep(claim, '直属领导审批')
|
||||
return resolveDisplayName(
|
||||
@@ -708,6 +736,15 @@ function resolveApplicationBudgetApproverName(claim) {
|
||||
function resolveProgressDisplayLabel(label, documentTypeCode, claim, approvalMeta) {
|
||||
const normalizedLabel = normalizeText(label)
|
||||
const workflowNode = normalizeText(claim?.approval_stage || claim?.workflowNode)
|
||||
if (
|
||||
documentTypeCode !== DOCUMENT_TYPE_APPLICATION
|
||||
&& approvalMeta.key !== 'completed'
|
||||
&& (normalizedLabel === '直属领导审批' || normalizedLabel === '财务审批')
|
||||
&& workflowNode.includes(normalizedLabel.replace(/审批$/, ''))
|
||||
) {
|
||||
return `等待 ${resolveReimbursementApproverName(claim, normalizedLabel)} 批复`
|
||||
}
|
||||
|
||||
if (
|
||||
documentTypeCode === DOCUMENT_TYPE_APPLICATION
|
||||
&& approvalMeta.key !== 'completed'
|
||||
@@ -796,6 +833,24 @@ function findApprovalEventForStep(claim, label) {
|
||||
return getLatestEvent(events)
|
||||
}
|
||||
|
||||
function findReimbursementFinanceRouteEvent(claim) {
|
||||
return getLatestEvent(
|
||||
getRiskFlags(claim).filter((flag) => {
|
||||
if (!flag || typeof flag !== 'object') {
|
||||
return false
|
||||
}
|
||||
|
||||
const source = normalizeText(flag.source)
|
||||
if (!['manual_approval', 'budget_approval'].includes(source)) {
|
||||
return false
|
||||
}
|
||||
|
||||
const nextStage = normalizeText(flag.next_approval_stage || flag.nextApprovalStage)
|
||||
return nextStage.includes('财务')
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
function findLatestReturnEvent(claim) {
|
||||
return getLatestEvent(
|
||||
getRiskFlags(claim).filter((flag) => (
|
||||
@@ -1066,13 +1121,39 @@ function findMergedApplicationBudgetApprovalEvent(claim) {
|
||||
source === 'manual_approval'
|
||||
&& eventType === 'expense_application_approval'
|
||||
&& previousStage.includes('直属领导')
|
||||
&& nextStage.includes('审批完成')
|
||||
&& (
|
||||
nextStage.includes('审批完成')
|
||||
|| nextStage.includes(APPLICATION_LINK_STATUS_STEP_LABEL)
|
||||
|| nextStage.includes('申请完成')
|
||||
)
|
||||
&& mergedFlag
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
function resolveBudgetRouteResult(flag, routeDecision = {}) {
|
||||
if (routeDecision && typeof routeDecision === 'object') {
|
||||
const routeBudgetResult = routeDecision.budget_result || routeDecision.budgetResult
|
||||
if (routeBudgetResult && typeof routeBudgetResult === 'object') {
|
||||
return routeBudgetResult
|
||||
}
|
||||
}
|
||||
|
||||
const flagBudgetResult = flag?.budget_result || flag?.budgetResult
|
||||
return flagBudgetResult && typeof flagBudgetResult === 'object' ? flagBudgetResult : {}
|
||||
}
|
||||
|
||||
function applicationBudgetRouteMeetsThreshold(flag, routeDecision = {}) {
|
||||
const budgetResult = resolveBudgetRouteResult(flag, routeDecision)
|
||||
const metrics = budgetResult.metrics && typeof budgetResult.metrics === 'object' ? budgetResult.metrics : {}
|
||||
const overBudgetAmount = parseNumber(metrics.over_budget_amount ?? metrics.overBudgetAmount)
|
||||
const afterUsageRate = parseNumber(metrics.after_usage_rate ?? metrics.afterUsageRate)
|
||||
const claimAmountRatio = parseNumber(metrics.claim_amount_ratio ?? metrics.claimAmountRatio)
|
||||
|
||||
return overBudgetAmount > 0 || Math.max(afterUsageRate, claimAmountRatio) >= 90
|
||||
}
|
||||
|
||||
function applicationRequiresBudgetReviewStep(claim, workflowNode) {
|
||||
const node = normalizeText(workflowNode || claim?.approval_stage || claim?.workflowNode)
|
||||
if (node.includes('预算')) {
|
||||
@@ -1087,24 +1168,22 @@ function applicationRequiresBudgetReviewStep(claim, workflowNode) {
|
||||
const source = normalizeText(flag.source)
|
||||
const eventType = normalizeText(flag.event_type || flag.eventType)
|
||||
const previousStage = normalizeText(flag.previous_approval_stage || flag.previousApprovalStage)
|
||||
const nextStage = normalizeText(flag.next_approval_stage || flag.nextApprovalStage)
|
||||
const routeDecision = flag.route_decision || flag.routeDecision || {}
|
||||
|
||||
if (source === 'approval_routing' && flag.requires_budget_review === true) {
|
||||
return true
|
||||
return applicationBudgetRouteMeetsThreshold(flag, flag)
|
||||
}
|
||||
if (
|
||||
routeDecision
|
||||
&& typeof routeDecision === 'object'
|
||||
&& routeDecision.requires_budget_review === true
|
||||
) {
|
||||
return true
|
||||
return applicationBudgetRouteMeetsThreshold(flag, routeDecision)
|
||||
}
|
||||
return (
|
||||
source === 'budget_approval'
|
||||
|| eventType === 'expense_application_budget_approval'
|
||||
|| previousStage.includes('预算')
|
||||
|| nextStage.includes('预算')
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -1273,7 +1352,7 @@ function buildProgressSteps(approvalMeta, workflowNode, claim = {}, options = {}
|
||||
? hasApplicationReturnStep
|
||||
? ['创建申请', '直属领导审批', '退回', '待提交']
|
||||
: hasMergedApplicationBudgetApproval
|
||||
? ['创建申请', '直属领导审批', '审批完成', APPLICATION_LINK_STATUS_STEP_LABEL, ARCHIVED_STEP_LABEL]
|
||||
? ['创建申请', '直属领导审批', APPLICATION_LINK_STATUS_STEP_LABEL, ARCHIVED_STEP_LABEL]
|
||||
: shouldShowApplicationBudgetStep
|
||||
? APPLICATION_PROGRESS_LABELS
|
||||
: APPLICATION_PROGRESS_LABELS_WITHOUT_BUDGET
|
||||
@@ -1512,6 +1591,8 @@ export function mapExpenseClaimToRequest(claim) {
|
||||
employeePosition: String(claim?.employee_position || '').trim(),
|
||||
employeeGrade: String(claim?.employee_grade || '').trim(),
|
||||
managerName: resolveDisplayName(claim?.manager_name),
|
||||
financeApproverName: resolveDisplayName(claim?.finance_approver_name, claim?.financeApproverName),
|
||||
financeOwnerName: resolveDisplayName(claim?.finance_owner_name, claim?.financeOwnerName),
|
||||
budgetApproverName: resolveDisplayName(claim?.budget_approver_name, claim?.budgetApproverName),
|
||||
budgetApproverGrade: String(claim?.budget_approver_grade || claim?.budgetApproverGrade || '').trim(),
|
||||
budgetApproverRoleCode: String(claim?.budget_approver_role_code || claim?.budgetApproverRoleCode || '').trim(),
|
||||
@@ -1665,19 +1746,26 @@ export function useRequests() {
|
||||
})
|
||||
})
|
||||
|
||||
async function reload() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
async function reload(options = {}) {
|
||||
const silent = Boolean(options?.silent)
|
||||
if (!silent) {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
}
|
||||
|
||||
try {
|
||||
const payload = await fetchExpenseClaims()
|
||||
const payload = await fetchAllExpenseClaims()
|
||||
requests.value = Array.isArray(payload) ? payload.map((item) => mapExpenseClaimToRequest(item)) : []
|
||||
loaded.value = true
|
||||
} catch (nextError) {
|
||||
requests.value = []
|
||||
if (!silent) {
|
||||
requests.value = []
|
||||
}
|
||||
error.value = nextError instanceof Error ? nextError.message : '个人报销列表加载失败。'
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (!silent) {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ const router = createRouter({
|
||||
},
|
||||
{
|
||||
path: '/app',
|
||||
redirect: { name: 'app-overview' }
|
||||
redirect: () => {
|
||||
const { resolveEntryRoute } = useSystemState()
|
||||
return resolveEntryRoute()
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/app/documents',
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { apiRequest } from './api.js'
|
||||
|
||||
export const REIMBURSEMENT_LIST_PREVIEW_PARAMS = Object.freeze({ page: 1, pageSize: 100 })
|
||||
export const REIMBURSEMENT_LIST_FULL_PAGE_SIZE = 100
|
||||
const REIMBURSEMENT_LIST_MAX_PAGES = 200
|
||||
|
||||
function buildListQuery(params = {}) {
|
||||
const search = new URLSearchParams()
|
||||
@@ -27,18 +29,73 @@ export function extractExpenseClaimItems(payload) {
|
||||
return Array.isArray(payload?.items) ? payload.items : []
|
||||
}
|
||||
|
||||
function isPaginatedExpenseClaimPayload(payload) {
|
||||
return Boolean(
|
||||
payload
|
||||
&& typeof payload === 'object'
|
||||
&& Array.isArray(payload.items)
|
||||
&& Number.isFinite(Number(payload.page))
|
||||
&& Number.isFinite(Number(payload.page_size))
|
||||
)
|
||||
}
|
||||
|
||||
async function fetchAllExpenseClaimPages(fetchPage, params = {}) {
|
||||
const pageSize = Number(params.pageSize || params.page_size || REIMBURSEMENT_LIST_FULL_PAGE_SIZE)
|
||||
const normalizedPageSize = Number.isFinite(pageSize) && pageSize > 0
|
||||
? Math.min(REIMBURSEMENT_LIST_FULL_PAGE_SIZE, Math.floor(pageSize))
|
||||
: REIMBURSEMENT_LIST_FULL_PAGE_SIZE
|
||||
let page = Math.max(1, Math.floor(Number(params.page || 1) || 1))
|
||||
const items = []
|
||||
|
||||
for (let index = 0; index < REIMBURSEMENT_LIST_MAX_PAGES; index += 1) {
|
||||
const payload = await fetchPage({
|
||||
...params,
|
||||
page,
|
||||
pageSize: normalizedPageSize
|
||||
})
|
||||
|
||||
if (!isPaginatedExpenseClaimPayload(payload)) {
|
||||
return extractExpenseClaimItems(payload)
|
||||
}
|
||||
|
||||
items.push(...extractExpenseClaimItems(payload))
|
||||
|
||||
const total = Number(payload.total || 0)
|
||||
const totalPages = Number(payload.total_pages || 0)
|
||||
const hasNext = Boolean(payload.has_next)
|
||||
if (!hasNext || (totalPages && page >= totalPages) || (total && items.length >= total)) {
|
||||
break
|
||||
}
|
||||
page += 1
|
||||
}
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
export function fetchExpenseClaims(params = {}) {
|
||||
return apiRequest(`/reimbursements/claims${buildListQuery(params)}`)
|
||||
}
|
||||
|
||||
export function fetchAllExpenseClaims(params = {}) {
|
||||
return fetchAllExpenseClaimPages(fetchExpenseClaims, params)
|
||||
}
|
||||
|
||||
export function fetchApprovalExpenseClaims(params = {}) {
|
||||
return apiRequest(`/reimbursements/claims/approvals${buildListQuery(params)}`)
|
||||
}
|
||||
|
||||
export function fetchAllApprovalExpenseClaims(params = {}) {
|
||||
return fetchAllExpenseClaimPages(fetchApprovalExpenseClaims, params)
|
||||
}
|
||||
|
||||
export function fetchArchivedExpenseClaims(params = {}) {
|
||||
return apiRequest(`/reimbursements/claims/archives${buildListQuery(params)}`)
|
||||
}
|
||||
|
||||
export function fetchAllArchivedExpenseClaims(params = {}) {
|
||||
return fetchAllExpenseClaimPages(fetchArchivedExpenseClaims, params)
|
||||
}
|
||||
|
||||
export function fetchExpenseClaimDetail(claimId) {
|
||||
return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}`)
|
||||
}
|
||||
|
||||
@@ -1,156 +1,156 @@
|
||||
export const DEFAULT_APP_VIEW_ORDER = [
|
||||
export const DEFAULT_APP_VIEW_ORDER = [
|
||||
'workbench',
|
||||
'documents',
|
||||
'receiptFolder',
|
||||
'budget',
|
||||
'audit',
|
||||
'audit',
|
||||
'overview',
|
||||
'policies',
|
||||
'digitalEmployees',
|
||||
'employees',
|
||||
'settings'
|
||||
]
|
||||
|
||||
|
||||
const ALWAYS_VISIBLE_VIEWS = new Set(['workbench', 'documents', 'receiptFolder', 'policies'])
|
||||
const VIEW_ROLE_RULES = {
|
||||
overview: ['finance', 'executive'],
|
||||
const VIEW_ROLE_RULES = {
|
||||
overview: ['finance', 'executive'],
|
||||
budget: ['budget_monitor', 'executive'],
|
||||
audit: ['finance'],
|
||||
digitalEmployees: ['finance'],
|
||||
employees: ['manager'],
|
||||
settings: ['manager']
|
||||
}
|
||||
const CLAIM_MANAGER_ROLE_CODES = new Set(['executive'])
|
||||
const CLAIM_RETURN_ROLE_CODES = new Set(['finance', 'executive', 'manager', 'approver', 'budget_monitor'])
|
||||
const CLAIM_LEADER_APPROVAL_ROLE_CODES = new Set(['manager', 'approver'])
|
||||
const CLAIM_BUDGET_APPROVAL_GRADE = 'P8'
|
||||
|
||||
function normalizedRoleCodes(user) {
|
||||
if (!user) {
|
||||
return []
|
||||
}
|
||||
|
||||
return Array.isArray(user.roleCodes)
|
||||
? user.roleCodes
|
||||
.map((item) => normalizeRoleCode(item))
|
||||
.filter(Boolean)
|
||||
: []
|
||||
}
|
||||
|
||||
function normalizeRoleCode(value) {
|
||||
const roleCode = String(value || '').trim().toLowerCase()
|
||||
return roleCode === 'auditor' ? 'budget_monitor' : roleCode
|
||||
}
|
||||
|
||||
function normalizeComparableText(value) {
|
||||
return String(value || '').trim()
|
||||
}
|
||||
|
||||
function collectIdentityNames(...values) {
|
||||
return values
|
||||
.map((value) => normalizeComparableText(value))
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function identityIntersects(leftValues, rightValues) {
|
||||
const rightSet = new Set(rightValues)
|
||||
return leftValues.some((item) => rightSet.has(item))
|
||||
}
|
||||
|
||||
function normalizedGrade(user) {
|
||||
return String(user?.grade || user?.employeeGrade || '').trim().toUpperCase()
|
||||
}
|
||||
|
||||
function departmentIntersects(request, user) {
|
||||
const requestDepartments = collectIdentityNames(
|
||||
request?.dept,
|
||||
request?.departmentName,
|
||||
request?.department_name
|
||||
)
|
||||
const currentDepartments = collectIdentityNames(
|
||||
user?.department,
|
||||
user?.departmentName,
|
||||
user?.department_name
|
||||
)
|
||||
|
||||
return requestDepartments.length > 0 && identityIntersects(requestDepartments, currentDepartments)
|
||||
}
|
||||
|
||||
function hasPlatformAdminIdentity(user) {
|
||||
if (!user) {
|
||||
return false
|
||||
}
|
||||
|
||||
const username = String(user.username || user.account || '').trim().toLowerCase()
|
||||
const role = String(user.role || '').trim().toLowerCase()
|
||||
const roleCodes = normalizedRoleCodes(user)
|
||||
|
||||
return (
|
||||
Boolean(user.isAdmin)
|
||||
|| username === 'admin'
|
||||
|| role === 'admin'
|
||||
|| role === '管理员'
|
||||
|| role === '系统管理员'
|
||||
|| roleCodes.includes('admin')
|
||||
)
|
||||
}
|
||||
|
||||
export function isManagerUser(user) {
|
||||
return hasPlatformAdminIdentity(user) || normalizedRoleCodes(user).includes('manager')
|
||||
}
|
||||
|
||||
export function isPlatformAdminUser(user) {
|
||||
return hasPlatformAdminIdentity(user)
|
||||
}
|
||||
|
||||
export function isFinanceUser(user) {
|
||||
return normalizedRoleCodes(user).includes('finance')
|
||||
}
|
||||
|
||||
export function isExecutiveUser(user) {
|
||||
return normalizedRoleCodes(user).includes('executive')
|
||||
}
|
||||
|
||||
export function isBudgetMonitorUser(user) {
|
||||
return normalizedRoleCodes(user).includes('budget_monitor')
|
||||
}
|
||||
|
||||
export function canEditBudgetCenter(user) {
|
||||
return isPlatformAdminUser(user) || isExecutiveUser(user)
|
||||
}
|
||||
|
||||
export function canSwitchBudgetDepartments(user) {
|
||||
return isPlatformAdminUser(user) || isExecutiveUser(user)
|
||||
}
|
||||
|
||||
export function canManageExpenseClaims(user) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizedRoleCodes(user).some((roleCode) => CLAIM_MANAGER_ROLE_CODES.has(roleCode))
|
||||
}
|
||||
|
||||
export function canDeleteArchivedExpenseClaims(user) {
|
||||
return isPlatformAdminUser(user)
|
||||
}
|
||||
|
||||
export function canReturnExpenseClaims(user) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizedRoleCodes(user).some((roleCode) => CLAIM_RETURN_ROLE_CODES.has(roleCode))
|
||||
}
|
||||
|
||||
export function canApproveLeaderExpenseClaims(user) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizedRoleCodes(user).some((roleCode) => CLAIM_LEADER_APPROVAL_ROLE_CODES.has(roleCode))
|
||||
}
|
||||
|
||||
const CLAIM_MANAGER_ROLE_CODES = new Set(['executive'])
|
||||
const CLAIM_RETURN_ROLE_CODES = new Set(['finance', 'executive', 'manager', 'approver', 'budget_monitor'])
|
||||
const CLAIM_LEADER_APPROVAL_ROLE_CODES = new Set(['manager', 'approver'])
|
||||
const CLAIM_BUDGET_APPROVAL_GRADE = 'P8'
|
||||
|
||||
function normalizedRoleCodes(user) {
|
||||
if (!user) {
|
||||
return []
|
||||
}
|
||||
|
||||
return Array.isArray(user.roleCodes)
|
||||
? user.roleCodes
|
||||
.map((item) => normalizeRoleCode(item))
|
||||
.filter(Boolean)
|
||||
: []
|
||||
}
|
||||
|
||||
function normalizeRoleCode(value) {
|
||||
const roleCode = String(value || '').trim().toLowerCase()
|
||||
return roleCode === 'auditor' ? 'budget_monitor' : roleCode
|
||||
}
|
||||
|
||||
function normalizeComparableText(value) {
|
||||
return String(value || '').trim()
|
||||
}
|
||||
|
||||
function collectIdentityNames(...values) {
|
||||
return values
|
||||
.map((value) => normalizeComparableText(value))
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function identityIntersects(leftValues, rightValues) {
|
||||
const rightSet = new Set(rightValues)
|
||||
return leftValues.some((item) => rightSet.has(item))
|
||||
}
|
||||
|
||||
function normalizedGrade(user) {
|
||||
return String(user?.grade || user?.employeeGrade || '').trim().toUpperCase()
|
||||
}
|
||||
|
||||
function departmentIntersects(request, user) {
|
||||
const requestDepartments = collectIdentityNames(
|
||||
request?.dept,
|
||||
request?.departmentName,
|
||||
request?.department_name
|
||||
)
|
||||
const currentDepartments = collectIdentityNames(
|
||||
user?.department,
|
||||
user?.departmentName,
|
||||
user?.department_name
|
||||
)
|
||||
|
||||
return requestDepartments.length > 0 && identityIntersects(requestDepartments, currentDepartments)
|
||||
}
|
||||
|
||||
function hasPlatformAdminIdentity(user) {
|
||||
if (!user) {
|
||||
return false
|
||||
}
|
||||
|
||||
const username = String(user.username || user.account || '').trim().toLowerCase()
|
||||
const role = String(user.role || '').trim().toLowerCase()
|
||||
const roleCodes = normalizedRoleCodes(user)
|
||||
|
||||
return (
|
||||
Boolean(user.isAdmin)
|
||||
|| username === 'admin'
|
||||
|| role === 'admin'
|
||||
|| role === '管理员'
|
||||
|| role === '系统管理员'
|
||||
|| roleCodes.includes('admin')
|
||||
)
|
||||
}
|
||||
|
||||
export function isManagerUser(user) {
|
||||
return hasPlatformAdminIdentity(user) || normalizedRoleCodes(user).includes('manager')
|
||||
}
|
||||
|
||||
export function isPlatformAdminUser(user) {
|
||||
return hasPlatformAdminIdentity(user)
|
||||
}
|
||||
|
||||
export function isFinanceUser(user) {
|
||||
return normalizedRoleCodes(user).includes('finance')
|
||||
}
|
||||
|
||||
export function isExecutiveUser(user) {
|
||||
return normalizedRoleCodes(user).includes('executive')
|
||||
}
|
||||
|
||||
export function isBudgetMonitorUser(user) {
|
||||
return normalizedRoleCodes(user).includes('budget_monitor')
|
||||
}
|
||||
|
||||
export function canEditBudgetCenter(user) {
|
||||
return isPlatformAdminUser(user) || isExecutiveUser(user)
|
||||
}
|
||||
|
||||
export function canSwitchBudgetDepartments(user) {
|
||||
return isPlatformAdminUser(user) || isExecutiveUser(user)
|
||||
}
|
||||
|
||||
export function canManageExpenseClaims(user) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizedRoleCodes(user).some((roleCode) => CLAIM_MANAGER_ROLE_CODES.has(roleCode))
|
||||
}
|
||||
|
||||
export function canDeleteArchivedExpenseClaims(user) {
|
||||
return isPlatformAdminUser(user)
|
||||
}
|
||||
|
||||
export function canReturnExpenseClaims(user) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizedRoleCodes(user).some((roleCode) => CLAIM_RETURN_ROLE_CODES.has(roleCode))
|
||||
}
|
||||
|
||||
export function canApproveLeaderExpenseClaims(user) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizedRoleCodes(user).some((roleCode) => CLAIM_LEADER_APPROVAL_ROLE_CODES.has(roleCode))
|
||||
}
|
||||
|
||||
export function canApproveBudgetExpenseApplications(user, request = null) {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
@@ -163,10 +163,10 @@ export function canApproveBudgetExpenseApplications(user, request = null) {
|
||||
if (normalizedGrade(user) !== CLAIM_BUDGET_APPROVAL_GRADE) {
|
||||
return false
|
||||
}
|
||||
|
||||
return request ? departmentIntersects(request, user) : true
|
||||
}
|
||||
|
||||
|
||||
return request ? departmentIntersects(request, user) : true
|
||||
}
|
||||
|
||||
export function isCurrentRequestApplicant(request, user) {
|
||||
const applicantIds = collectIdentityNames(
|
||||
request?.employeeId,
|
||||
@@ -191,45 +191,45 @@ export function isCurrentRequestApplicant(request, user) {
|
||||
const applicantNames = collectIdentityNames(
|
||||
request?.person,
|
||||
request?.employeeName,
|
||||
request?.employee_name,
|
||||
request?.profileName,
|
||||
request?.applicant
|
||||
)
|
||||
const currentNames = collectIdentityNames(
|
||||
user?.name,
|
||||
user?.username,
|
||||
user?.email,
|
||||
user?.employeeNo,
|
||||
user?.employee_no
|
||||
)
|
||||
|
||||
return applicantNames.length > 0 && identityIntersects(applicantNames, currentNames)
|
||||
}
|
||||
|
||||
export function isCurrentDirectManagerForRequest(request, user) {
|
||||
if (isCurrentRequestApplicant(request, user)) {
|
||||
return false
|
||||
}
|
||||
|
||||
const managerNames = collectIdentityNames(
|
||||
request?.profileManager,
|
||||
request?.managerName,
|
||||
request?.manager_name,
|
||||
request?.directManagerName,
|
||||
request?.direct_manager_name,
|
||||
request?.manager
|
||||
)
|
||||
const currentNames = collectIdentityNames(
|
||||
user?.name,
|
||||
user?.username,
|
||||
user?.email,
|
||||
user?.employeeNo,
|
||||
user?.employee_no
|
||||
)
|
||||
|
||||
return managerNames.length > 0 && identityIntersects(managerNames, currentNames)
|
||||
}
|
||||
|
||||
request?.employee_name,
|
||||
request?.profileName,
|
||||
request?.applicant
|
||||
)
|
||||
const currentNames = collectIdentityNames(
|
||||
user?.name,
|
||||
user?.username,
|
||||
user?.email,
|
||||
user?.employeeNo,
|
||||
user?.employee_no
|
||||
)
|
||||
|
||||
return applicantNames.length > 0 && identityIntersects(applicantNames, currentNames)
|
||||
}
|
||||
|
||||
export function isCurrentDirectManagerForRequest(request, user) {
|
||||
if (isCurrentRequestApplicant(request, user)) {
|
||||
return false
|
||||
}
|
||||
|
||||
const managerNames = collectIdentityNames(
|
||||
request?.profileManager,
|
||||
request?.managerName,
|
||||
request?.manager_name,
|
||||
request?.directManagerName,
|
||||
request?.direct_manager_name,
|
||||
request?.manager
|
||||
)
|
||||
const currentNames = collectIdentityNames(
|
||||
user?.name,
|
||||
user?.username,
|
||||
user?.email,
|
||||
user?.employeeNo,
|
||||
user?.employee_no
|
||||
)
|
||||
|
||||
return managerNames.length > 0 && identityIntersects(managerNames, currentNames)
|
||||
}
|
||||
|
||||
export function canAccessAppView(user, viewId) {
|
||||
if (!viewId || !user) {
|
||||
return false
|
||||
@@ -246,35 +246,35 @@ export function canAccessAppView(user, viewId) {
|
||||
if (viewId === 'budget') {
|
||||
if (isPlatformAdminUser(user)) {
|
||||
return true
|
||||
}
|
||||
const roleCodes = normalizedRoleCodes(user)
|
||||
return VIEW_ROLE_RULES.budget.some((roleCode) => roleCodes.includes(roleCode))
|
||||
}
|
||||
|
||||
if (isManagerUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (ALWAYS_VISIBLE_VIEWS.has(viewId)) {
|
||||
return true
|
||||
}
|
||||
|
||||
const requiredRoles = VIEW_ROLE_RULES[viewId] || []
|
||||
const roleCodes = normalizedRoleCodes(user)
|
||||
return requiredRoles.some((roleCode) => roleCodes.includes(roleCode))
|
||||
}
|
||||
|
||||
export function getAccessibleViewIds(user) {
|
||||
return DEFAULT_APP_VIEW_ORDER.filter((viewId) => canAccessAppView(user, viewId))
|
||||
}
|
||||
|
||||
export function filterNavItemsByAccess(navItems, user) {
|
||||
return navItems.filter((item) => canAccessAppView(user, item.id))
|
||||
}
|
||||
|
||||
}
|
||||
const roleCodes = normalizedRoleCodes(user)
|
||||
return VIEW_ROLE_RULES.budget.some((roleCode) => roleCodes.includes(roleCode))
|
||||
}
|
||||
|
||||
if (isManagerUser(user)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (ALWAYS_VISIBLE_VIEWS.has(viewId)) {
|
||||
return true
|
||||
}
|
||||
|
||||
const requiredRoles = VIEW_ROLE_RULES[viewId] || []
|
||||
const roleCodes = normalizedRoleCodes(user)
|
||||
return requiredRoles.some((roleCode) => roleCodes.includes(roleCode))
|
||||
}
|
||||
|
||||
export function getAccessibleViewIds(user) {
|
||||
return DEFAULT_APP_VIEW_ORDER.filter((viewId) => canAccessAppView(user, viewId))
|
||||
}
|
||||
|
||||
export function filterNavItemsByAccess(navItems, user) {
|
||||
return navItems.filter((item) => canAccessAppView(user, item.id))
|
||||
}
|
||||
|
||||
export function resolveDefaultAuthorizedRoute(user) {
|
||||
if (isPlatformAdminUser(user) && canAccessAppView(user, 'overview')) {
|
||||
return { name: 'app-overview' }
|
||||
if (isPlatformAdminUser(user) && canAccessAppView(user, 'documents')) {
|
||||
return { name: 'app-documents' }
|
||||
}
|
||||
|
||||
const firstVisibleView = getAccessibleViewIds(user)[0]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isApplicationRequestLike } from './documentClassification.js'
|
||||
import { canProcessApprovalRequest } from './approvalInbox.js'
|
||||
|
||||
function parseNumber(value) {
|
||||
const nextValue = Number(value)
|
||||
@@ -46,6 +47,15 @@ export function belongsToCurrentUser(request, currentUser) {
|
||||
return names.some((name) => name === person)
|
||||
}
|
||||
|
||||
function belongsToWorkbenchProgressScope(request, currentUser) {
|
||||
if (belongsToCurrentUser(request, currentUser)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return normalizeText(request?.approvalKey) === 'in_progress'
|
||||
&& canProcessApprovalRequest(request, currentUser)
|
||||
}
|
||||
|
||||
export function hasHighRiskFlag(request) {
|
||||
const riskFlags = Array.isArray(request?.riskFlags) ? request.riskFlags : []
|
||||
|
||||
@@ -133,6 +143,16 @@ function resolveRequestTarget(request) {
|
||||
}
|
||||
}
|
||||
|
||||
function resolveApplicantLabel(request) {
|
||||
return normalizeText(
|
||||
request?.person
|
||||
|| request?.employeeName
|
||||
|| request?.employee_name
|
||||
|| request?.applicant
|
||||
|| request?.profileName
|
||||
) || '待补充'
|
||||
}
|
||||
|
||||
function resolveStatusTone(approvalKey) {
|
||||
if (approvalKey === 'supplement' || approvalKey === 'rejected') return 'danger'
|
||||
if (approvalKey === 'draft') return 'success'
|
||||
@@ -254,31 +274,84 @@ export function buildAdjacentProgressSteps(steps = [], windowSize = 4) {
|
||||
}))
|
||||
}
|
||||
|
||||
const FALLBACK_APPLICATION_PROGRESS_LABELS = Object.freeze([
|
||||
'创建申请',
|
||||
'直属领导审批',
|
||||
'关联单据状态',
|
||||
'已归档'
|
||||
])
|
||||
const FALLBACK_REIMBURSEMENT_PROGRESS_LABELS = Object.freeze([
|
||||
'关联单据',
|
||||
'待提交',
|
||||
'直属领导审批',
|
||||
'财务审批',
|
||||
'待付款',
|
||||
'已付款',
|
||||
'已归档'
|
||||
])
|
||||
|
||||
function resolveFallbackProgressCurrentIndex(labels, request, documentTypeLabel) {
|
||||
const approvalKey = normalizeText(request?.approvalKey)
|
||||
const status = normalizeText(request?.approvalStatus || request?.status || request?.workflowNode)
|
||||
|
||||
if (documentTypeLabel === '申请单') {
|
||||
if (/归档/.test(status)) return labels.indexOf('已归档')
|
||||
if (approvalKey === 'completed' || /完成|通过/.test(status)) return labels.indexOf('关联单据状态')
|
||||
if (/直属领导|领导审批|负责人/.test(status)) return labels.indexOf('直属领导审批')
|
||||
return 0
|
||||
}
|
||||
|
||||
if (approvalKey === 'completed' || /归档|已付款|完成/.test(status)) return labels.indexOf('已归档')
|
||||
if (approvalKey === 'pending_payment' || /待付款|待支付/.test(status)) return labels.indexOf('待付款')
|
||||
if (/财务/.test(status)) return labels.indexOf('财务审批')
|
||||
if (/直属领导|领导审批|负责人/.test(status)) return labels.indexOf('直属领导审批')
|
||||
return labels.indexOf('待提交')
|
||||
}
|
||||
|
||||
function buildFallbackProgressSteps(request, documentTypeLabel) {
|
||||
const labels = documentTypeLabel === '申请单'
|
||||
? FALLBACK_APPLICATION_PROGRESS_LABELS
|
||||
: FALLBACK_REIMBURSEMENT_PROGRESS_LABELS
|
||||
const currentIndex = Math.max(0, resolveFallbackProgressCurrentIndex(labels, request, documentTypeLabel))
|
||||
|
||||
return labels.map((label, index) => ({
|
||||
label,
|
||||
rawLabel: label,
|
||||
done: index < currentIndex,
|
||||
active: index <= currentIndex,
|
||||
current: index === currentIndex,
|
||||
title: index === currentIndex ? '进行中' : index < currentIndex ? '已完成' : '待处理'
|
||||
}))
|
||||
}
|
||||
|
||||
function buildProgressItems(ownedRequests) {
|
||||
return ownedRequests
|
||||
.filter((request) => Array.isArray(request?.progressSteps) && request.progressSteps.length)
|
||||
.map((request) => {
|
||||
const requestId = resolveRequestIdentity(request)
|
||||
const steps = buildAdjacentProgressSteps(request.progressSteps, 4)
|
||||
const currentStep = steps.find((step) => step.current)
|
||||
const title = normalizeText(request?.title || request?.note || request?.sceneLabel) || '费用单据'
|
||||
const documentTypeLabel = resolveDocumentTypeLabel(request, requestId, title)
|
||||
const sourceSteps = Array.isArray(request?.progressSteps) && request.progressSteps.length
|
||||
? request.progressSteps
|
||||
: buildFallbackProgressSteps(request, documentTypeLabel)
|
||||
const steps = buildAdjacentProgressSteps(sourceSteps, 4)
|
||||
const currentStep = steps.find((step) => step.current)
|
||||
|
||||
const status = normalizeText(request?.approvalStatus || currentStep?.label) || '处理中'
|
||||
const documentTypeLabel = resolveDocumentTypeLabel(request, requestId, title)
|
||||
|
||||
return {
|
||||
id: requestId,
|
||||
requestId,
|
||||
title,
|
||||
documentTypeLabel,
|
||||
applicantLabel: resolveApplicantLabel(request),
|
||||
expenseTypeLabel: resolveExpenseCategory(request),
|
||||
amount: formatCurrency(request?.amount),
|
||||
status,
|
||||
statusTone: resolveProgressStatusTone(normalizeText(request?.approvalKey), status),
|
||||
updatedAt: normalizeText(request?.updatedAt || request?.submittedAt || request?.createdAt),
|
||||
updatedAt: normalizeText(request?.updatedAt || request?.submittedAt || request?.createdAt || request?.applyTime),
|
||||
steps,
|
||||
target: resolveRequestTarget(request),
|
||||
prompt: `查询 ${requestId || title} 的费用进度`
|
||||
prompt: `查询 ${requestId || title} 的单据进度`
|
||||
}
|
||||
})
|
||||
.sort((left, right) => normalizeText(right.updatedAt).localeCompare(normalizeText(left.updatedAt)))
|
||||
@@ -486,9 +559,11 @@ function buildExpenseOperationRows(todoItems, notifications, progressItems) {
|
||||
}
|
||||
|
||||
export function buildWorkbenchSummary(requests, currentUser) {
|
||||
const ownedRequests = Array.isArray(requests)
|
||||
? requests.filter((item) => belongsToCurrentUser(item, currentUser))
|
||||
const allRequests = Array.isArray(requests)
|
||||
? requests
|
||||
: []
|
||||
const ownedRequests = allRequests.filter((item) => belongsToCurrentUser(item, currentUser))
|
||||
const progressRequests = allRequests.filter((item) => belongsToWorkbenchProgressScope(item, currentUser))
|
||||
|
||||
const monthlyClaims = ownedRequests.filter((item) => isCurrentMonth(resolveClaimDate(item)))
|
||||
|
||||
@@ -505,7 +580,7 @@ export function buildWorkbenchSummary(requests, currentUser) {
|
||||
const returnCount = ownedRequests.filter((item) => item.approvalKey === 'rejected').length
|
||||
const highRiskCount = monthlyClaims.filter((item) => hasHighRiskFlag(item)).length
|
||||
const todoItems = buildTodoItems(ownedRequests)
|
||||
const progressItems = buildProgressItems(ownedRequests)
|
||||
const progressItems = buildProgressItems(progressRequests)
|
||||
const notifications = buildNotifications(todoItems, progressItems)
|
||||
const expenseStatsDetail = {
|
||||
distributionRows: buildExpenseDistributionRows(ownedRequests),
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
<DocumentsCenterView
|
||||
v-else-if="activeView === 'documents'"
|
||||
:filtered-requests="filteredRequests"
|
||||
:filtered-requests="requests"
|
||||
:has-data="requests.length > 0"
|
||||
:loading="requestsLoading"
|
||||
:error="requestsError"
|
||||
|
||||
@@ -249,10 +249,9 @@ import TableLoadingState from '../components/shared/TableLoadingState.vue'
|
||||
import { useMinimumVisibleState } from '../composables/useMinimumVisibleState.js'
|
||||
import { mapExpenseClaimToRequest } from '../composables/useRequests.js'
|
||||
import {
|
||||
REIMBURSEMENT_LIST_PREVIEW_PARAMS,
|
||||
extractExpenseClaimItems,
|
||||
fetchApprovalExpenseClaims,
|
||||
fetchArchivedExpenseClaims
|
||||
fetchAllApprovalExpenseClaims,
|
||||
fetchAllArchivedExpenseClaims
|
||||
} from '../services/reimbursements.js'
|
||||
import { fetchNotificationStates, patchNotificationStates } from '../services/notificationStates.js'
|
||||
import {
|
||||
@@ -925,8 +924,8 @@ async function loadSupportingRows() {
|
||||
supportingError.value = ''
|
||||
|
||||
const [approvalResult, archiveResult] = await Promise.allSettled([
|
||||
fetchApprovalExpenseClaims(REIMBURSEMENT_LIST_PREVIEW_PARAMS),
|
||||
fetchArchivedExpenseClaims(REIMBURSEMENT_LIST_PREVIEW_PARAMS)
|
||||
fetchAllApprovalExpenseClaims(),
|
||||
fetchAllArchivedExpenseClaims()
|
||||
])
|
||||
|
||||
if (approvalResult.status === 'fulfilled') {
|
||||
|
||||
@@ -257,7 +257,7 @@
|
||||
<div class="card-head">
|
||||
<h3>用户在线波动 <i class="mdi mdi-information-outline"></i></h3>
|
||||
</div>
|
||||
<p class="card-subtitle">登录人数与互动次数的时段波动。</p>
|
||||
<p class="card-subtitle">在线人数与互动次数的时段波动。</p>
|
||||
|
||||
<SystemLoginWaveChart
|
||||
compact
|
||||
|
||||
@@ -755,10 +755,7 @@ export default {
|
||||
&& canApproveBudgetExpenseApplications(currentUser.value, request.value)
|
||||
&& !isCurrentApplicant.value
|
||||
))
|
||||
const canReturnRequest = computed(() => {
|
||||
if (request.value.approvalKey !== 'in_progress' || !request.value.claimId || !canReturnExpenseClaims(currentUser.value)) {
|
||||
return false
|
||||
}
|
||||
const canProcessCurrentApprovalStage = computed(() => {
|
||||
if (isDirectManagerApprovalStage.value) {
|
||||
return isCurrentDirectManagerApprover.value
|
||||
}
|
||||
@@ -767,18 +764,16 @@ export default {
|
||||
}
|
||||
return canProcessFinanceApprovalStage.value
|
||||
})
|
||||
const canReturnRequest = computed(() => {
|
||||
if (request.value.approvalKey !== 'in_progress' || !request.value.claimId || !canReturnExpenseClaims(currentUser.value)) {
|
||||
return false
|
||||
}
|
||||
return canProcessCurrentApprovalStage.value
|
||||
})
|
||||
const canApproveRequest = computed(() =>
|
||||
(Boolean(props.approvalMode) || isApplicationDocument.value)
|
||||
&& request.value.approvalKey === 'in_progress'
|
||||
request.value.approvalKey === 'in_progress'
|
||||
&& Boolean(request.value.claimId)
|
||||
&& (
|
||||
(
|
||||
isDirectManagerApprovalStage.value
|
||||
&& isCurrentDirectManagerApprover.value
|
||||
)
|
||||
|| canProcessFinanceApprovalStage.value
|
||||
|| canProcessBudgetApprovalStage.value
|
||||
)
|
||||
&& canProcessCurrentApprovalStage.value
|
||||
)
|
||||
const canViewApprovalRiskAdvice = computed(() => (
|
||||
Boolean(request.value.claimId)
|
||||
|
||||
@@ -183,6 +183,7 @@ export function buildFallbackProgressSteps(requestModel = {}) {
|
||||
const pendingPayment = approvalKey === 'pending_payment' || /待付款/.test(node)
|
||||
const paid = /已付款/.test(node)
|
||||
const completed = approvalKey === 'completed' || paid || /审批完成|申请完成|已完成/.test(node)
|
||||
const archived = /申请归档|已归档/.test(node)
|
||||
const hasRelatedApplication = Boolean(requestModel?.relatedApplication?.claimNo)
|
||||
|
||||
if (isApplicationDocumentRequest(requestModel)) {
|
||||
@@ -207,11 +208,19 @@ export function buildFallbackProgressSteps(requestModel = {}) {
|
||||
},
|
||||
{
|
||||
index: 3,
|
||||
label: '审批完成',
|
||||
time: completed ? '已完成' : '待处理',
|
||||
done: completed,
|
||||
active: completed,
|
||||
current: false
|
||||
label: '关联单据状态',
|
||||
time: hasRelatedApplication ? '已关联' : completed ? '未关联' : '待处理',
|
||||
done: archived,
|
||||
active: completed || archived,
|
||||
current: completed && !archived
|
||||
},
|
||||
{
|
||||
index: 4,
|
||||
label: '已归档',
|
||||
time: archived ? '已完成' : '待处理',
|
||||
done: archived,
|
||||
active: archived,
|
||||
current: archived
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -597,6 +606,7 @@ export function buildExpenseDraftIssues(item) {
|
||||
|
||||
export function buildDraftBlockingIssues(request, expenseItems) {
|
||||
const issues = []
|
||||
const isApplication = isApplicationDocumentRequest(request)
|
||||
const locationRequired = isLocationRequiredExpenseType(request.typeCode)
|
||||
const normalizedItems = Array.isArray(expenseItems) ? expenseItems : []
|
||||
const itemAmountTotal = normalizedItems.reduce((sum, item) => {
|
||||
@@ -611,6 +621,25 @@ export function buildDraftBlockingIssues(request, expenseItems) {
|
||||
if (isPlaceholderValue(request.profileName)) {
|
||||
issues.push('申请人未完善')
|
||||
}
|
||||
if (isApplication) {
|
||||
if (isPlaceholderValue(request.typeLabel)) {
|
||||
issues.push('申请类型未完善')
|
||||
}
|
||||
if (isPlaceholderValue(request.reason)) {
|
||||
issues.push('申请事由未完善')
|
||||
}
|
||||
if (isPlaceholderValue(request.location)) {
|
||||
issues.push('业务地点未完善')
|
||||
}
|
||||
if (isPlaceholderValue(request.occurredDisplay)) {
|
||||
issues.push('申请时间未完善')
|
||||
}
|
||||
if (!Number.isFinite(Number(request.amountValue)) || Number(request.amountValue) <= 0) {
|
||||
issues.push('预计总费用未完善')
|
||||
}
|
||||
return [...new Set(issues)]
|
||||
}
|
||||
|
||||
if (isPlaceholderValue(request.typeLabel) && !hasValidItemType) {
|
||||
issues.push('报销类型未完善')
|
||||
}
|
||||
@@ -657,18 +686,30 @@ export function mapIssueToAdvice(issue) {
|
||||
if (text === '报销类型未完善') {
|
||||
return '选择报销类型,明确本次费用归类。'
|
||||
}
|
||||
if (text === '申请类型未完善') {
|
||||
return '补充申请类型,明确本次申请的费用或业务场景。'
|
||||
}
|
||||
if (text === '报销事由未完善') {
|
||||
return '补充报销事由,说明本次费用用途。'
|
||||
}
|
||||
if (text === '申请事由未完善') {
|
||||
return '补充申请事由,说明本次申请的业务背景。'
|
||||
}
|
||||
if (text === '业务地点未完善') {
|
||||
return '补充业务地点,方便审核业务发生场景。'
|
||||
}
|
||||
if (text === '发生时间未完善') {
|
||||
return '补充费用发生时间,确保单据时间完整。'
|
||||
}
|
||||
if (text === '申请时间未完善') {
|
||||
return '补充申请时间或行程时间,确保申请周期完整。'
|
||||
}
|
||||
if (text === '报销金额未完善') {
|
||||
return '补充报销金额,并与费用明细金额保持一致。'
|
||||
}
|
||||
if (text === '预计总费用未完善') {
|
||||
return '补充预计总费用,供审批人判断预算占用和申请额度。'
|
||||
}
|
||||
|
||||
const itemMatch = text.match(/^费用明细第\s*(\d+)\s*条(.+)$/)
|
||||
if (!itemMatch) {
|
||||
|
||||
@@ -87,7 +87,7 @@ test('platform admin users do not enter the personal workbench', () => {
|
||||
assert.equal(canAccessAppView(adminUser, 'workbench'), false)
|
||||
assert.equal(canAccessAppView(employeeUser, 'workbench'), true)
|
||||
assert.equal(getAccessibleViewIds(adminUser).includes('workbench'), false)
|
||||
assert.deepEqual(resolveDefaultAuthorizedRoute(adminUser), { name: 'app-overview' })
|
||||
assert.deepEqual(resolveDefaultAuthorizedRoute(adminUser), { name: 'app-documents' })
|
||||
assert.deepEqual(
|
||||
filterNavItemsByAccess(navItems, adminUser).map((item) => item.id),
|
||||
['documents', 'overview', 'settings']
|
||||
@@ -201,6 +201,30 @@ test('direct-manager approval helpers only match claims pushed to the current us
|
||||
assert.equal(isCurrentDirectManagerForRequest({ person: '张三', managerName: '王总' }, managerUser), false)
|
||||
})
|
||||
|
||||
test('approver executive users can process claims routed to their direct-manager identity', () => {
|
||||
const leaderUser = {
|
||||
roleCodes: ['approver', 'executive'],
|
||||
name: 'Xiang Wanhong',
|
||||
username: 'xiangwanhong@xf.com'
|
||||
}
|
||||
|
||||
assert.equal(canApproveLeaderExpenseClaims(leaderUser), true)
|
||||
assert.equal(
|
||||
isCurrentDirectManagerForRequest(
|
||||
{ person: 'Shen Zhiyuan', managerName: 'Xiang Wanhong' },
|
||||
leaderUser
|
||||
),
|
||||
true
|
||||
)
|
||||
assert.equal(
|
||||
isCurrentDirectManagerForRequest(
|
||||
{ person: 'Xiang Wanhong', managerName: 'Li Wenjing' },
|
||||
leaderUser
|
||||
),
|
||||
false
|
||||
)
|
||||
})
|
||||
|
||||
test('applicant helper matches generated draft owner by employee identifiers', () => {
|
||||
const currentUser = {
|
||||
username: 'caoxiaozhu@xf.com',
|
||||
|
||||
@@ -27,6 +27,10 @@ const appShellComposable = readFileSync(
|
||||
fileURLToPath(new URL('../src/composables/useAppShell.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const requestsComposable = readFileSync(
|
||||
fileURLToPath(new URL('../src/composables/useRequests.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const assistantScript = readFileSync(
|
||||
fileURLToPath(new URL('../src/views/scripts/TravelReimbursementCreateView.js', import.meta.url)),
|
||||
'utf8'
|
||||
@@ -70,6 +74,47 @@ test('documents center reloads immediately when entered or clicked again', () =>
|
||||
assert.match(appShellComposable, /reloadDocumentCenterRequests,/)
|
||||
})
|
||||
|
||||
test('documents center uses the full request list instead of the global date-filtered list', () => {
|
||||
assert.match(
|
||||
appShellRouteView,
|
||||
/<DocumentsCenterView[\s\S]*:filtered-requests="requests"[\s\S]*:has-data="requests\.length > 0"/
|
||||
)
|
||||
assert.doesNotMatch(
|
||||
appShellRouteView,
|
||||
/<DocumentsCenterView[\s\S]*:filtered-requests="filteredRequests"/
|
||||
)
|
||||
})
|
||||
|
||||
test('workbench summary merges approval inbox requests without polluting document center rows', () => {
|
||||
assert.match(appShellComposable, /import \{ fetchAllApprovalExpenseClaims, fetchExpenseClaimDetail \} from '\.\.\/services\/reimbursements\.js'/)
|
||||
assert.match(appShellComposable, /const workbenchApprovalRequests = ref\(\[\]\)/)
|
||||
assert.match(appShellComposable, /async function reloadWorkbenchApprovalRequests\(\)/)
|
||||
assert.match(appShellComposable, /async function reloadWorkbenchRequests\(\)/)
|
||||
assert.match(appShellComposable, /fetchAllApprovalExpenseClaims\(\)/)
|
||||
assert.match(appShellComposable, /payload\.map\(\(item\) => mapExpenseClaimToRequest\(item\)\)/)
|
||||
assert.match(appShellComposable, /Promise\.all\(\[[\s\S]*reloadRequests\(\{ silent: true \}\),[\s\S]*reloadWorkbenchApprovalRequests\(\)[\s\S]*\]\)/)
|
||||
assert.match(appShellComposable, /if \(view === 'workbench'\) \{[\s\S]*void reloadWorkbenchRequests\(\)/)
|
||||
assert.match(appShellComposable, /const workbenchRequests = computed\(\(\) =>[\s\S]*mergeWorkbenchRequests\(requests\.value, workbenchApprovalRequests\.value\)/)
|
||||
assert.match(appShellComposable, /buildWorkbenchSummary\(workbenchRequests\.value, currentUser\.value\)/)
|
||||
assert.match(appShellRouteView, /<DocumentsCenterView[\s\S]*:filtered-requests="requests"/)
|
||||
assert.doesNotMatch(appShellRouteView, /<DocumentsCenterView[\s\S]*workbenchRequests/)
|
||||
})
|
||||
|
||||
test('workbench progress refreshes after homepage create or detail updates', () => {
|
||||
assert.match(appShellComposable, /async function handleDraftSaved\(payload = \{\}\) \{[\s\S]*await reloadWorkbenchRequests\(\)/)
|
||||
assert.match(appShellComposable, /async function handleRequestUpdated\(\) \{[\s\S]*await reloadWorkbenchRequests\(\)[\s\S]*await refreshSelectedRequestDetail\(String\(route\.params\.requestId \|\| ''\)\)/)
|
||||
assert.doesNotMatch(appShellComposable, /async function handleRequestUpdated\(\) \{[\s\S]*await reloadRequests\(\)[\s\S]*await refreshSelectedRequestDetail/)
|
||||
})
|
||||
|
||||
test('workbench progress refresh is silent to avoid homepage flashing', () => {
|
||||
assert.match(requestsComposable, /async function reload\(options = \{\}\) \{[\s\S]*const silent = Boolean\(options\?\.silent\)/)
|
||||
assert.match(requestsComposable, /if \(!silent\) \{[\s\S]*loading\.value = true[\s\S]*error\.value = ''[\s\S]*\}/)
|
||||
assert.match(requestsComposable, /catch \(nextError\) \{[\s\S]*if \(!silent\) \{[\s\S]*requests\.value = \[\][\s\S]*\}/)
|
||||
assert.match(requestsComposable, /finally \{[\s\S]*if \(!silent\) \{[\s\S]*loading\.value = false[\s\S]*\}/)
|
||||
assert.match(appShellComposable, /async function reloadWorkbenchRequests\(\) \{[\s\S]*reloadRequests\(\{ silent: true \}\)/)
|
||||
assert.match(appShellComposable, /async function reloadDocumentCenterRequests\(\) \{[\s\S]*return reloadRequests\(\)/)
|
||||
})
|
||||
|
||||
test('document detail navigation preserves document center list query', () => {
|
||||
assert.match(
|
||||
appShellComposable,
|
||||
@@ -86,12 +131,12 @@ test('document detail navigation preserves document center list query', () => {
|
||||
})
|
||||
|
||||
test('document detail refreshes claim detail instead of relying on stale list cache', () => {
|
||||
assert.match(appShellComposable, /import \{ fetchExpenseClaimDetail \} from '\.\.\/services\/reimbursements\.js'/)
|
||||
assert.match(appShellComposable, /import \{ fetchAllApprovalExpenseClaims, fetchExpenseClaimDetail \} from '\.\.\/services\/reimbursements\.js'/)
|
||||
assert.match(appShellComposable, /import \{ mapExpenseClaimToRequest, useRequests \} from '\.\/useRequests\.js'/)
|
||||
assert.match(appShellComposable, /const snapshot = normalizeRequestForUi\(selectedRequestSnapshot\.value\)[\s\S]*if \(isSameRequestIdentity\(snapshot, requestId\)\) \{[\s\S]*return snapshot/)
|
||||
assert.match(appShellComposable, /async function refreshSelectedRequestDetail\(requestOrId = selectedRequestSnapshot\.value\) \{[\s\S]*fetchExpenseClaimDetail\(lookupId\)[\s\S]*mapExpenseClaimToRequest\(payload\)[\s\S]*upsertRequestSnapshot\(mappedRequest\)/)
|
||||
assert.match(appShellComposable, /function openRequestDetail\(request, options = \{\}\) \{[\s\S]*void refreshSelectedRequestDetail\(request\)/)
|
||||
assert.match(appShellComposable, /async function handleRequestUpdated\(\) \{[\s\S]*await reloadRequests\(\)[\s\S]*await refreshSelectedRequestDetail\(String\(route\.params\.requestId \|\| ''\)\)/)
|
||||
assert.match(appShellComposable, /async function handleRequestUpdated\(\) \{[\s\S]*await reloadWorkbenchRequests\(\)[\s\S]*await refreshSelectedRequestDetail\(String\(route\.params\.requestId \|\| ''\)\)/)
|
||||
assert.match(appShellComposable, /route\.name === 'app-document-detail'[\s\S]*void refreshSelectedRequestDetail\(String\(route\.params\.requestId \|\| ''\)\)/)
|
||||
})
|
||||
|
||||
|
||||
@@ -16,6 +16,14 @@ const documentListSharedStyles = readFileSync(
|
||||
fileURLToPath(new URL('../src/assets/styles/components/document-list-shared.css', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const reimbursementService = readFileSync(
|
||||
fileURLToPath(new URL('../src/services/reimbursements.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const requestsComposable = readFileSync(
|
||||
fileURLToPath(new URL('../src/composables/useRequests.js', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
test('documents center keeps only the top scope tabs and renders status as a dropdown filter', () => {
|
||||
assert.match(documentsCenterView, /<nav class="status-tabs document-scope-tabs"/)
|
||||
@@ -134,6 +142,17 @@ test('documents center refresh token reloads supporting approval and archive row
|
||||
assert.match(documentsCenterView, /function reloadAll\(\) \{[\s\S]*emit\('reload'\)[\s\S]*void loadSupportingRows\(\)/)
|
||||
})
|
||||
|
||||
test('documents center fetches every paginated claim page for admin-scale lists', () => {
|
||||
assert.match(reimbursementService, /export function fetchAllExpenseClaims/)
|
||||
assert.match(reimbursementService, /async function fetchAllExpenseClaimPages/)
|
||||
assert.match(reimbursementService, /payload\.has_next/)
|
||||
assert.match(requestsComposable, /import \{ fetchAllExpenseClaims \} from '\.\.\/services\/reimbursements\.js'/)
|
||||
assert.match(requestsComposable, /const payload = await fetchAllExpenseClaims\(\)/)
|
||||
assert.match(documentsCenterView, /fetchAllApprovalExpenseClaims/)
|
||||
assert.match(documentsCenterView, /fetchAllArchivedExpenseClaims/)
|
||||
assert.doesNotMatch(documentsCenterView, /REIMBURSEMENT_LIST_PREVIEW_PARAMS/)
|
||||
})
|
||||
|
||||
test('documents center list shows created time and conditional stay time columns', () => {
|
||||
assert.match(documentsCenterView, /import \{[\s\S]*formatDocumentListTime[\s\S]*resolveDocumentStayTimeDisplay[\s\S]*\} from '..\/utils\/documentCenterTime\.js'/)
|
||||
assert.match(documentsCenterView, /<col class="col-created">/)
|
||||
@@ -326,10 +345,9 @@ test('documents center status dropdown uses compact filter styling', () => {
|
||||
assert.match(documentsCenterStyles, /\.col-created\s*\{\s*width:\s*10%;\s*\}/)
|
||||
assert.match(documentsCenterStyles, /\.col-stay\s*\{\s*width:\s*9%;\s*\}/)
|
||||
assert.match(documentsCenterStyles, /\.col-initiator\s*\{\s*width:\s*8%;\s*\}/)
|
||||
assert.match(documentsCenterStyles, /\.document-status-filter\s*\{[\s\S]*display:\s*inline-flex;/)
|
||||
assert.match(documentsCenterStyles, /\.document-status-filter\s*\{[\s\S]*min-height:\s*38px;/)
|
||||
assert.match(documentsCenterStyles, /\.status-filter-trigger\s*\{[\s\S]*min-width:\s*154px;/)
|
||||
assert.match(documentsCenterStyles, /\.status-filter-menu\s*\{[\s\S]*min-width:\s*154px;/)
|
||||
assert.match(documentListSharedStyles, /\.document-status-filter\s*\{[\s\S]*display:\s*inline-flex;/)
|
||||
assert.match(documentListSharedStyles, /\.document-status-filter\s*\{[\s\S]*min-height:\s*38px;/)
|
||||
assert.match(documentListSharedStyles, /\.status-dropdown-filter,\s*\.status-filter-trigger,\s*\.status-filter-menu\s*\{[\s\S]*min-width:\s*154px;/)
|
||||
assert.doesNotMatch(documentsCenterStyles, /\.document-state-tabs\s*\{/)
|
||||
assert.doesNotMatch(documentsCenterStyles, /\.document-status-filter\s*\{[^}]*margin-top:/)
|
||||
})
|
||||
|
||||
@@ -22,6 +22,18 @@ test('expense profile modal remounts the behavior radar when opened', () => {
|
||||
assert.match(modal, /scheduleRadarFrame/)
|
||||
})
|
||||
|
||||
test('expense profile modal uses compact laptop dialog sizing', () => {
|
||||
assert.match(modal, /width="min\(960px, calc\(100vw - 64px\)\)"/)
|
||||
assert.match(modal, /max-height:\s*min\(580px, calc\(100dvh - 176px\)\)/)
|
||||
assert.match(
|
||||
modal,
|
||||
/@media \(min-width: 861px\) and \(max-width: 1440px\),\s*\n\s*\(min-width: 861px\) and \(max-height: 820px\)/
|
||||
)
|
||||
assert.match(modal, /width:\s*min\(900px, calc\(100vw - 96px\)\) !important;/)
|
||||
assert.match(modal, /max-height:\s*min\(520px, calc\(100dvh - 152px\)\)/)
|
||||
assert.match(modal, /\.profile-radar-chart \{[\s\S]*height:\s*248px;/)
|
||||
})
|
||||
|
||||
test('radar chart uses the shared echarts lifecycle and enables entrance animation', () => {
|
||||
assert.match(radarChart, /import \{ useEcharts \} from '\.\.\/\.\.\/composables\/useEcharts\.js'/)
|
||||
assert.match(radarChart, /useEcharts\(chartElement, chartOptions\)/)
|
||||
|
||||
@@ -30,6 +30,15 @@ test('expense stats detail modal exposes distribution, processing time and opera
|
||||
assert.match(modal, /resolveDistributionColor/)
|
||||
assert.match(modal, /processingRows/)
|
||||
assert.match(modal, /operationRows/)
|
||||
assert.match(modal, /width="min\(900px, calc\(100vw - 64px\)\)"/)
|
||||
assert.match(modal, /max-height:\s*min\(580px, calc\(100dvh - 176px\)\)/)
|
||||
assert.match(
|
||||
modal,
|
||||
/@media \(min-width: 861px\) and \(max-width: 1440px\),\s*\n\s*\(min-width: 861px\) and \(max-height: 820px\)/
|
||||
)
|
||||
assert.match(modal, /width:\s*min\(860px, calc\(100vw - 96px\)\) !important;/)
|
||||
assert.match(modal, /max-height:\s*min\(520px, calc\(100dvh - 152px\)\)/)
|
||||
assert.match(modal, /\.expense-distribution-donut :deep\(\.donut-body\) \{[\s\S]*height:\s*170px;/)
|
||||
assert.doesNotMatch(modal, /--expense-detail-percent/)
|
||||
assert.doesNotMatch(modal, /expense-distribution-track/)
|
||||
assert.match(modal, /统计口径来自当前工作台已加载的个人单据/)
|
||||
|
||||
@@ -13,6 +13,14 @@ const workbench = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/business/PersonalWorkbench.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const workbenchProgressPanel = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/business/PersonalWorkbenchProgressPanel.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const workbenchProgressStyles = readFileSync(
|
||||
fileURLToPath(new URL('../src/assets/styles/components/personal-workbench-progress.css', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const workbenchStyles = readFileSync(
|
||||
fileURLToPath(new URL('../src/assets/styles/components/personal-workbench.css', import.meta.url)),
|
||||
'utf8'
|
||||
@@ -31,7 +39,7 @@ const workbenchInsightStyles = readFileSync(
|
||||
'utf8'
|
||||
)
|
||||
const heroBackgroundAsset = fileURLToPath(
|
||||
new URL('../src/assets/personal-workbench-hero-bg-theme-base.webp', import.meta.url)
|
||||
new URL('../src/assets/images/hero-3d-banner.png', import.meta.url)
|
||||
)
|
||||
const capabilityGlassAsset = fileURLToPath(
|
||||
new URL('../src/assets/personal-workbench-card-glass-capability.webp', import.meta.url)
|
||||
@@ -43,8 +51,9 @@ const panelGlassAsset = fileURLToPath(
|
||||
test('workbench assistant greets the current employee without the old helper tag', () => {
|
||||
assert.doesNotMatch(workbench, /assistant-tag/)
|
||||
assert.doesNotMatch(workbench, /AI 报销助手/)
|
||||
assert.match(workbench, /嗨,\{\{ displayUserName \}\},我是您的 <span>AI 费用助手<\/span>/)
|
||||
assert.match(workbench, /placeholder="请输入费用申请、报销问题、预算查询或制度问答\.\.\."/)
|
||||
assert.match(workbench, /\{\{ typedTitlePrefix \}\}<span v-if="titleTypingDone">小财管家<\/span>/)
|
||||
assert.match(workbench, /const heroTitleText = computed\(\(\) => `嗨,\$\{displayUserName\.value\},我是您的 `\)/)
|
||||
assert.match(workbench, /placeholder="一次性描述申请、报销和附件处理事项,小财管家会先拆解再执行\.\.\."/)
|
||||
assert.match(workbench, /const displayUserName = computed/)
|
||||
assert.match(workbench, /user\.name/)
|
||||
})
|
||||
@@ -83,16 +92,16 @@ test('workbench capability cards keep user-entered context only', () => {
|
||||
})
|
||||
|
||||
test('workbench hero uses theme-tintable background image', () => {
|
||||
assert.match(workbench, /personal-workbench-hero-bg-theme-base\.webp/)
|
||||
assert.doesNotMatch(workbench, /personal-workbench-hero-bg-theme-base\.png/)
|
||||
assert.match(workbench, /hero-3d-banner\.png/)
|
||||
assert.doesNotMatch(workbench, /personal-workbench-hero-bg-theme-base\.(webp|png)/)
|
||||
assert.match(workbench, /--assistant-bg-image.*workbenchHeroBackground/)
|
||||
assert.match(workbenchStyles, /--assistant-theme-tint:[\s\S]*--theme-primary-rgb/)
|
||||
assert.match(workbenchStyles, /var\(--assistant-bg-image\) var\(--assistant-bg-position\) \/ var\(--assistant-bg-size\) no-repeat/)
|
||||
assert.match(workbenchStyles, /background-blend-mode:\s*normal,\s*color,\s*luminosity;/)
|
||||
assert.match(workbenchStyles, /\.assistant-hero::after\s*\{[\s\S]*content:\s*none;/)
|
||||
assert.match(workbenchResponsiveStyles, /--assistant-bg-position:\s*68% center;/)
|
||||
assert.match(workbenchStyles, /url\("\.\.\/\.\.\/images\/workbench-hero-right-bg\.png"\) var\(--assistant-bg-position\) \/ var\(--assistant-decor-width\) auto no-repeat/)
|
||||
assert.match(workbenchStyles, /\.assistant-hero::after\s*\{[\s\S]*content:\s*"";/)
|
||||
assert.match(workbenchResponsiveStyles, /--assistant-bg-position:\s*right center;/)
|
||||
assert.doesNotMatch(workbenchResponsiveStyles, /homepage_backgraound/)
|
||||
assert.ok(statSync(heroBackgroundAsset).size < 120 * 1024)
|
||||
assert.ok(statSync(heroBackgroundAsset).size > 1024)
|
||||
assert.ok(statSync(heroBackgroundAsset).size < 600 * 1024)
|
||||
})
|
||||
|
||||
test('workbench cards use layered glass material instead of texture-led cards', () => {
|
||||
@@ -103,13 +112,11 @@ test('workbench cards use layered glass material instead of texture-led cards',
|
||||
assert.match(workbenchGlassStyles, /--workbench-glass-highlight:/)
|
||||
assert.match(workbenchGlassStyles, /--workbench-glass-noise-opacity:\s*0\.012;/)
|
||||
assert.match(workbenchGlassStyles, /--workbench-glass-blur:\s*blur\(18px\) saturate\(1\.28\);/)
|
||||
assert.match(workbenchGlassStyles, /\.capability-card\s*\{[\s\S]*background-color:\s*rgba\(255,\s*255,\s*255,\s*0\.64\);[\s\S]*backdrop-filter:\s*var\(--workbench-glass-blur\)/)
|
||||
assert.match(workbenchGlassStyles, /\.workbench-card\s*\{[\s\S]*background-color:\s*rgba\(255,\s*255,\s*255,\s*0\.66\);[\s\S]*backdrop-filter:\s*var\(--workbench-glass-blur\)/)
|
||||
assert.match(workbenchGlassStyles, /\.capability-card\s*\{[\s\S]*background:\s*rgba\(255,\s*255,\s*255,\s*0\.96\);[\s\S]*backdrop-filter:\s*blur\(12px\) saturate\(150%\)/)
|
||||
assert.match(workbenchGlassStyles, /\.workbench-card\s*\{[\s\S]*background:\s*rgba\(255,\s*255,\s*255,\s*0\.96\);[\s\S]*backdrop-filter:\s*blur\(12px\) saturate\(150%\)/)
|
||||
assert.match(workbenchGlassStyles, /\.capability-card::before,[\s\S]*\.capability-card::after/)
|
||||
assert.match(workbenchGlassStyles, /\.capability-card::before\s*\{[\s\S]*var\(--workbench-capability-bg-image\) 0 0 \/ var\(--workbench-capability-tile-size\) repeat;[\s\S]*opacity:\s*var\(--workbench-glass-noise-opacity\);/)
|
||||
assert.match(workbenchGlassStyles, /\.workbench-card::before\s*\{[\s\S]*var\(--workbench-panel-bg-image\) 0 0 \/ var\(--workbench-panel-tile-size\) repeat;[\s\S]*opacity:\s*calc\(var\(--workbench-glass-noise-opacity\) \* 0\.8\);/)
|
||||
assert.match(workbenchGlassStyles, /\.capability-card::after\s*\{[\s\S]*var\(--workbench-glass-highlight\)/)
|
||||
assert.match(workbenchGlassStyles, /\.workbench-card::after\s*\{[\s\S]*var\(--workbench-glass-highlight\)/)
|
||||
assert.match(workbenchGlassStyles, /\.workbench-card::before,[\s\S]*\.workbench-card::after\s*\{[\s\S]*display:\s*none !important;/)
|
||||
assert.doesNotMatch(workbenchGlassStyles, /\.capability-card::after\s*\{[^}]*radial-gradient/)
|
||||
assert.doesNotMatch(workbenchGlassStyles, /\.workbench-card::after\s*\{[^}]*radial-gradient/)
|
||||
assert.match(workbenchGlassStyles, /\.workbench-card > \*\s*\{[\s\S]*z-index:\s*1;/)
|
||||
@@ -143,29 +150,67 @@ test('workbench submit shows intent recognition feedback before assistant opens'
|
||||
assert.match(workbench, /:readonly="isComposerPending"/)
|
||||
})
|
||||
|
||||
test('workbench progress rows show update time first', () => {
|
||||
assert.match(workbench, /class="progress-time"/)
|
||||
assert.match(workbench, /class="progress-type"/)
|
||||
assert.match(workbench, /费用类型/)
|
||||
assert.match(workbench, /\{\{ item\.expenseTypeLabel \|\| '其他费用' \}\}/)
|
||||
test('workbench document progress has range filter, document types and empty state', () => {
|
||||
assert.match(workbench, /import PersonalWorkbenchProgressPanel from '\.\/PersonalWorkbenchProgressPanel\.vue'/)
|
||||
assert.match(workbench, /<PersonalWorkbenchProgressPanel[\s\S]*:progress-items="workbenchSummary\.progressItems \|\| \[\]"[\s\S]*@open-target="openWorkbenchTarget"/)
|
||||
assert.match(workbenchProgressPanel, /<h2>单据进度<\/h2>/)
|
||||
assert.match(workbenchProgressPanel, /personal-workbench-progress\.css/)
|
||||
assert.match(workbenchProgressPanel, /EnterpriseSelect/)
|
||||
assert.match(workbenchProgressPanel, /近10日/)
|
||||
assert.match(workbenchProgressPanel, /近30日/)
|
||||
assert.match(workbenchProgressPanel, /近3个月/)
|
||||
assert.match(workbenchProgressPanel, /class="progress-range-control"[\s\S]*@click\.stop[\s\S]*@mousedown\.stop[\s\S]*@pointerdown\.stop/)
|
||||
assert.match(workbenchProgressPanel, /:teleported="true"/)
|
||||
assert.match(workbenchProgressPanel, /@click="handleProgressItemClick\(\$event, item\)"/)
|
||||
assert.match(workbenchProgressPanel, /function handleProgressItemClick\(event, item\)/)
|
||||
assert.match(workbenchProgressPanel, /return true/)
|
||||
assert.match(workbenchProgressPanel, /class="progress-time"/)
|
||||
assert.match(workbenchProgressPanel, /class="progress-applicant"/)
|
||||
assert.match(workbenchProgressPanel, /class="progress-table-shell"/)
|
||||
assert.match(workbenchProgressPanel, />\u66f4\u65b0\u65f6\u95f4<\/span>/)
|
||||
assert.doesNotMatch(workbenchProgressPanel, /\u5355\u636e\u52a8\u6001/)
|
||||
assert.doesNotMatch(workbenchProgressPanel, /time-capsule/)
|
||||
assert.doesNotMatch(workbenchProgressPanel, /<small>\u7533\u8bf7\u4eba<\/small>/)
|
||||
assert.match(workbenchProgressPanel, /\{\{ item\.applicantLabel \|\| '待补充' \}\}/)
|
||||
assert.match(workbenchProgressPanel, /class="progress-type"/)
|
||||
assert.match(workbenchProgressPanel, /\{\{ item\.documentTypeLabel \}\} · \{\{ item\.expenseTypeLabel \|\| '其他费用' \}\}/)
|
||||
assert.match(workbenchProgressPanel, /当前范围暂无单据/)
|
||||
assert.match(workbenchProgressPanel, /没有申请单或报销单进度/)
|
||||
assert.match(workbench, /source:\s*'workbench'/)
|
||||
assert.match(workbench, /returnTo:\s*'workbench'/)
|
||||
assert.match(workbench, /has-long-duration-divider/)
|
||||
assert.match(workbench, /hasLongDurationDivider/)
|
||||
assert.match(workbench, /const LONG_DURATION_DAYS = 10/)
|
||||
assert.match(workbench, /isLongDurationProgress\(item\?\.updatedAt\)/)
|
||||
assert.match(workbench, /<time :datetime="item\.updatedAt \|\| ''">\{\{ item\.displayTime \}\}<\/time>/)
|
||||
assert.match(workbench, /displayTime: formatProgressTime\(item\?\.updatedAt\)/)
|
||||
assert.match(workbench, /function formatProgressTime\(value\)/)
|
||||
assert.doesNotMatch(workbench, />全部进度/)
|
||||
assert.match(workbenchStyles, /\.progress-row\s*\{[\s\S]*grid-template-columns:\s*minmax\(78px,\s*0\.42fr\)[\s\S]*minmax\(84px,\s*0\.42fr\)/)
|
||||
assert.doesNotMatch(workbenchProgressPanel, /has-long-duration-divider/)
|
||||
assert.doesNotMatch(workbenchProgressPanel, /LONG_DURATION_DAYS/)
|
||||
assert.doesNotMatch(workbenchProgressPanel, /10日以上/)
|
||||
assert.doesNotMatch(workbenchStyles, /10日以上/)
|
||||
assert.doesNotMatch(workbenchStyles, /has-long-duration-divider/)
|
||||
assert.doesNotMatch(workbench, />费用进度</)
|
||||
assert.match(workbenchProgressPanel, /<time :datetime="item\.updatedAt \|\| ''">\{\{ item\.displayTime \}\}<\/time>/)
|
||||
assert.match(workbenchProgressPanel, /function formatProgressTime\(value\)/)
|
||||
assert.match(workbenchStyles, /\.progress-row\s*\{[\s\S]*grid-template-columns:\s*minmax\(118px,\s*0\.58fr\)[\s\S]*minmax\(84px,\s*0\.42fr\)/)
|
||||
assert.match(workbenchStyles, /\.progress-type\s*\{[\s\S]*justify-self:\s*stretch;[\s\S]*justify-items:\s*center;[\s\S]*text-align:\s*center;/)
|
||||
assert.match(workbenchStyles, /\.progress-type strong\s*\{[\s\S]*justify-content:\s*center;/)
|
||||
assert.match(workbenchStyles, /\.progress-type strong\s*\{[\s\S]*var\(--workbench-primary-active\)/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::before\s*\{[\s\S]*content:\s*"10日以上"/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::before\s*\{[\s\S]*left:\s*50%;[\s\S]*transform:\s*translateX\(-50%\);/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::before\s*\{[\s\S]*color:\s*var\(--theme-primary-active\);/)
|
||||
assert.match(workbenchStyles, /\.progress-row\.has-long-duration-divider::after\s*\{[\s\S]*rgba\(var\(--theme-primary-rgb/)
|
||||
assert.match(workbenchStyles, /\.progress-list\s*\{[\s\S]*overflow-y:\s*auto;/)
|
||||
assert.match(workbenchStyles, /\.progress-empty-state\s*\{[\s\S]*border:\s*1px dashed/)
|
||||
assert.match(workbenchStyles, /\.progress-range-select\s*\{[\s\S]*width:\s*124px;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-panel\s*\{[\s\S]*grid-template-rows:\s*auto minmax\(0,\s*1fr\);/)
|
||||
assert.match(workbenchProgressStyles, /--progress-table-columns:[\s\S]*minmax\(96px,\s*0\.44fr\);/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-table-shell\s*\{[\s\S]*grid-template-rows:\s*36px minmax\(0,\s*1fr\);[\s\S]*overflow:\s*hidden;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-table-header\s*\{[\s\S]*grid-template-columns:\s*var\(--progress-table-columns\);/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-table-header\s*\{[\s\S]*height:\s*36px;[\s\S]*max-height:\s*36px;[\s\S]*overflow:\s*hidden;/)
|
||||
assert.match(workbenchProgressStyles, /\.header-cell\s*\{[\s\S]*justify-content:\s*center;[\s\S]*white-space:\s*nowrap;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-list\s*\{[\s\S]*grid-auto-rows:\s*minmax\(76px,\s*auto\)/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-row\s*\{[\s\S]*grid-template-columns:\s*var\(--progress-table-columns\);[\s\S]*gap:\s*8px;[\s\S]*min-height:\s*76px;[\s\S]*text-align:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-time-wrapper\s*\{[\s\S]*justify-content:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-identity\s*\{[\s\S]*align-items:\s*center;[\s\S]*text-align:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-applicant\s*\{[\s\S]*justify-items:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-result\s*\{[\s\S]*justify-self:\s*stretch;[\s\S]*justify-content:\s*center;[\s\S]*justify-items:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-result strong\s*\{[\s\S]*width:\s*100%;[\s\S]*text-align:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-steps\s*\{[\s\S]*justify-items:\s*stretch;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-step\s*\{[\s\S]*justify-items:\s*center;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-range-control\s*\{[\s\S]*z-index:\s*6;/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-range-select:deep\(\.el-select__wrapper\)/)
|
||||
assert.match(workbenchProgressStyles, /\.progress-empty-state\s*\{[\s\S]*border:\s*1px dashed/)
|
||||
assert.match(workbenchStyles, /\.progress-time\s*\{[\s\S]*color:\s*var\(--workbench-muted\);/)
|
||||
assert.match(workbenchResponsiveStyles, /grid-template-areas:[\s\S]*"time identity result"[\s\S]*"type type type"[\s\S]*"steps steps steps"/)
|
||||
assert.match(workbenchResponsiveStyles, /\.progress-type\s*\{[\s\S]*grid-area:\s*type;/)
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
const CREATE_APPLICATION = '\u521b\u5efa\u7533\u8bf7'
|
||||
const DIRECT_MANAGER_APPROVAL = '\u76f4\u5c5e\u9886\u5bfc\u5ba1\u6279'
|
||||
const BUDGET_MANAGER_APPROVAL = '\u9884\u7b97\u7ba1\u7406\u8005\u5ba1\u6279'
|
||||
const FINANCE_APPROVAL = '\u8d22\u52a1\u5ba1\u6279'
|
||||
const APPROVAL_COMPLETED = '\u5ba1\u6279\u5b8c\u6210'
|
||||
const APPLICATION_LINK_STATUS = '\u5173\u8054\u5355\u636e\u72b6\u6001'
|
||||
const APPLICATION_ARCHIVE = '\u7533\u8bf7\u5f52\u6863'
|
||||
@@ -21,6 +22,7 @@ const ARCHIVED = '\u5df2\u5f52\u6863'
|
||||
const WAIT_LEADER_LI_APPROVAL = '\u7b49\u5f85 Leader Li \u6279\u590d'
|
||||
const WAIT_BUDGET_ZHAO_APPROVAL = '\u7b49\u5f85 \u8d75\u9884\u7b97 \u6279\u590d'
|
||||
const WAIT_BUDGET_P8_EXECUTIVE_APPROVAL = '\u7b49\u5f85 P8 Executive \u6279\u590d'
|
||||
const WAIT_FINANCE_FIONA_APPROVAL = '\u7b49\u5f85 Fiona Finance \u6279\u590d'
|
||||
const LEADER_RETURNED_STATUS = '\u9886\u5bfc\u5df2\u9000\u56de\uff0c\u5f85\u91cd\u65b0\u63d0\u4ea4'
|
||||
|
||||
test('claim mapper exposes employee identifier for reviewer risk profile lookup', () => {
|
||||
@@ -158,7 +160,7 @@ test('application claims are mapped as application documents', () => {
|
||||
assert.equal(request.expenseTableSummary, '预计金额已随申请提交')
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, WAIT_LEADER_LI_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, WAIT_LEADER_LI_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.some((step) => step.label === 'AI预审'), false)
|
||||
assert.equal(request.progressSteps.some((step) => step.label === '财务审批'), false)
|
||||
@@ -252,7 +254,7 @@ test('application claims wait for department P8 budget monitor after leader appr
|
||||
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, WAIT_BUDGET_ZHAO_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, WAIT_BUDGET_ZHAO_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === WAIT_BUDGET_ZHAO_APPROVAL)?.current, true)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === DIRECT_MANAGER_APPROVAL)?.time, 'Leader Li通过')
|
||||
@@ -295,7 +297,7 @@ test('application budget wait label uses claim-level budget approver snapshot',
|
||||
assert.equal(request.budgetApproverName, 'P8 Executive')
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, WAIT_BUDGET_P8_EXECUTIVE_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, WAIT_BUDGET_P8_EXECUTIVE_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === WAIT_BUDGET_P8_EXECUTIVE_APPROVAL)?.current, true)
|
||||
})
|
||||
@@ -391,7 +393,7 @@ test('approved application claims complete after budget approval', () => {
|
||||
assert.equal(request.workflowNode, APPLICATION_LINK_STATUS)
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, BUDGET_MANAGER_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, BUDGET_MANAGER_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === APPLICATION_LINK_STATUS)?.current, true)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === APPLICATION_LINK_STATUS)?.time, '未关联')
|
||||
@@ -417,15 +419,40 @@ test('application claims hide budget step when leader approval also covers budge
|
||||
created_at: '2026-05-25T01:30:00.000Z',
|
||||
updated_at: '2026-05-25T03:00:00.000Z',
|
||||
status: 'approved',
|
||||
approval_stage: APPROVAL_COMPLETED,
|
||||
approval_stage: APPLICATION_LINK_STATUS,
|
||||
risk_flags_json: [
|
||||
{
|
||||
source: 'approval_routing',
|
||||
event_type: 'expense_application_route_decision',
|
||||
requires_budget_review: true,
|
||||
route: 'budget_manager',
|
||||
budget_result: {
|
||||
metrics: {
|
||||
after_usage_rate: '99.27',
|
||||
claim_amount_ratio: '1.27',
|
||||
over_budget_amount: '0.00'
|
||||
}
|
||||
},
|
||||
created_at: '2026-05-25T03:00:00.000Z'
|
||||
},
|
||||
{
|
||||
source: 'manual_approval',
|
||||
event_type: 'expense_application_approval',
|
||||
operator: '李预算经理',
|
||||
previous_approval_stage: DIRECT_MANAGER_APPROVAL,
|
||||
next_approval_stage: APPROVAL_COMPLETED,
|
||||
next_approval_stage: APPLICATION_LINK_STATUS,
|
||||
budget_approval_merged: true,
|
||||
route_decision: {
|
||||
requires_budget_review: true,
|
||||
route: 'budget_manager',
|
||||
budget_result: {
|
||||
metrics: {
|
||||
after_usage_rate: '99.27',
|
||||
claim_amount_ratio: '1.27',
|
||||
over_budget_amount: '0.00'
|
||||
}
|
||||
}
|
||||
},
|
||||
created_at: '2026-05-25T03:00:00.000Z'
|
||||
}
|
||||
],
|
||||
@@ -434,7 +461,7 @@ test('application claims hide budget step when leader approval also covers budge
|
||||
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === APPLICATION_LINK_STATUS)?.current, true)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === ARCHIVED)?.done, false)
|
||||
@@ -486,7 +513,7 @@ test('approved application claims hide budget step when dynamic route skipped bu
|
||||
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === APPLICATION_LINK_STATUS)?.current, true)
|
||||
assert.equal(request.progressSteps.find((step) => step.label === ARCHIVED)?.done, false)
|
||||
@@ -494,6 +521,69 @@ test('approved application claims hide budget step when dynamic route skipped bu
|
||||
assert.equal(request.progressSteps.find((step) => step.label === DIRECT_MANAGER_APPROVAL)?.time, 'Leader Li通过')
|
||||
})
|
||||
|
||||
test('approved application claims hide stale budget route below 90 percent threshold', () => {
|
||||
const request = mapExpenseClaimToRequest({
|
||||
id: 'claim-application-stale-budget-route',
|
||||
claim_no: 'APP-20260525-STALE-BUDGET',
|
||||
employee_name: '张三',
|
||||
department_name: '交付部',
|
||||
manager_name: 'Leader Li',
|
||||
expense_type: 'travel_application',
|
||||
reason: 'Project onsite support',
|
||||
location: 'Shanghai',
|
||||
amount: 8500,
|
||||
invoice_count: 0,
|
||||
occurred_at: '2026-05-25T00:00:00.000Z',
|
||||
submitted_at: '2026-05-25T02:00:00.000Z',
|
||||
created_at: '2026-05-25T01:30:00.000Z',
|
||||
updated_at: '2026-05-25T03:00:00.000Z',
|
||||
status: 'approved',
|
||||
approval_stage: APPROVAL_COMPLETED,
|
||||
risk_flags_json: [
|
||||
{
|
||||
source: 'approval_routing',
|
||||
event_type: 'expense_application_route_decision',
|
||||
requires_budget_review: true,
|
||||
route: 'budget_manager',
|
||||
budget_result: {
|
||||
metrics: {
|
||||
after_usage_rate: '85.00',
|
||||
claim_amount_ratio: '85.00',
|
||||
over_budget_amount: '0.00'
|
||||
}
|
||||
},
|
||||
created_at: '2026-05-25T03:00:00.000Z'
|
||||
},
|
||||
{
|
||||
source: 'manual_approval',
|
||||
event_type: 'expense_application_approval',
|
||||
operator: 'Leader Li',
|
||||
previous_approval_stage: DIRECT_MANAGER_APPROVAL,
|
||||
next_approval_stage: BUDGET_MANAGER_APPROVAL,
|
||||
route_decision: {
|
||||
requires_budget_review: true,
|
||||
route: 'budget_manager',
|
||||
budget_result: {
|
||||
metrics: {
|
||||
after_usage_rate: '85.00',
|
||||
claim_amount_ratio: '85.00',
|
||||
over_budget_amount: '0.00'
|
||||
}
|
||||
}
|
||||
},
|
||||
created_at: '2026-05-25T03:00:00.000Z'
|
||||
}
|
||||
],
|
||||
items: []
|
||||
})
|
||||
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.some((step) => step.label === BUDGET_MANAGER_APPROVAL), false)
|
||||
})
|
||||
|
||||
test('approved application claims show linked reimbursement status before archive', () => {
|
||||
const request = mapExpenseClaimToRequest({
|
||||
id: 'claim-application-linked-draft',
|
||||
@@ -566,7 +656,7 @@ test('application claims are archived only after linked reimbursement is paid',
|
||||
assert.equal(request.workflowNode, APPLICATION_ARCHIVE)
|
||||
assert.deepEqual(
|
||||
request.progressSteps.map((step) => step.label),
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPROVAL_COMPLETED, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
[CREATE_APPLICATION, DIRECT_MANAGER_APPROVAL, APPLICATION_LINK_STATUS, ARCHIVED]
|
||||
)
|
||||
assert.equal(request.progressSteps.every((step) => step.done), true)
|
||||
assert.equal(request.secondaryStatusValue, '已归档')
|
||||
@@ -582,6 +672,8 @@ test('progress steps show approval operator time and current stay duration', ()
|
||||
claim_no: 'EXP-202605-001',
|
||||
employee_name: '张三',
|
||||
department_name: '市场部',
|
||||
finance_owner_name: 'Wang Finance Group',
|
||||
finance_approver_name: 'Fiona Finance',
|
||||
expense_type: 'transport',
|
||||
reason: '交通报销',
|
||||
location: '上海',
|
||||
@@ -592,21 +684,21 @@ test('progress steps show approval operator time and current stay duration', ()
|
||||
created_at: '2026-05-20T01:30:00.000Z',
|
||||
updated_at: '2026-05-20T03:30:00.000Z',
|
||||
status: 'submitted',
|
||||
approval_stage: '财务审批',
|
||||
approval_stage: FINANCE_APPROVAL,
|
||||
risk_flags_json: [
|
||||
{
|
||||
source: 'manual_approval',
|
||||
operator: '李经理',
|
||||
previous_approval_stage: '直属领导审批',
|
||||
next_approval_stage: '财务审批',
|
||||
previous_approval_stage: DIRECT_MANAGER_APPROVAL,
|
||||
next_approval_stage: FINANCE_APPROVAL,
|
||||
created_at: '2026-05-20T03:30:00.000Z'
|
||||
}
|
||||
],
|
||||
items: []
|
||||
})
|
||||
|
||||
const leaderStep = request.progressSteps.find((step) => step.label === '直属领导审批')
|
||||
const financeStep = request.progressSteps.find((step) => step.label === '财务审批')
|
||||
const leaderStep = request.progressSteps.find((step) => step.label === DIRECT_MANAGER_APPROVAL)
|
||||
const financeStep = request.progressSteps.find((step) => step.rawLabel === FINANCE_APPROVAL)
|
||||
const firstStep = request.progressSteps[0]
|
||||
|
||||
assert.equal(request.riskSummary, '无')
|
||||
@@ -615,6 +707,10 @@ test('progress steps show approval operator time and current stay duration', ()
|
||||
assert.match(leaderStep.detail, /2026-05-20/)
|
||||
assert.match(leaderStep.title, /李经理审批通过/)
|
||||
assert.equal(request.progressSteps.some((step) => step.label === 'AI预审'), false)
|
||||
assert.equal(request.financeOwnerName, 'Wang Finance Group')
|
||||
assert.equal(request.financeApproverName, 'Fiona Finance')
|
||||
assert.equal(financeStep.label, WAIT_FINANCE_FIONA_APPROVAL)
|
||||
assert.equal(financeStep.rawLabel, FINANCE_APPROVAL)
|
||||
assert.equal(financeStep.current, true)
|
||||
assert.equal(financeStep.time, '停留 1小时30分钟')
|
||||
} finally {
|
||||
@@ -1124,6 +1220,7 @@ test('current direct manager step shows how long the claim has stayed there', ()
|
||||
claim_no: 'EXP-202605-002',
|
||||
employee_name: '王五',
|
||||
department_name: '市场部',
|
||||
manager_name: '李经理',
|
||||
expense_type: 'office',
|
||||
reason: '办公用品',
|
||||
location: '上海',
|
||||
@@ -1139,11 +1236,13 @@ test('current direct manager step shows how long the claim has stayed there', ()
|
||||
items: []
|
||||
})
|
||||
|
||||
const leaderStep = request.progressSteps.find((step) => step.label === '直属领导审批')
|
||||
const leaderStep = request.progressSteps.find((step) => step.rawLabel === '直属领导审批')
|
||||
const submitStep = request.progressSteps.find((step) => step.label === '待提交')
|
||||
|
||||
assert.equal(submitStep.time, '王五提交')
|
||||
assert.match(submitStep.detail, /2026-05-20/)
|
||||
assert.equal(leaderStep.label, '等待 李经理 批复')
|
||||
assert.equal(leaderStep.rawLabel, '直属领导审批')
|
||||
assert.equal(leaderStep.current, true)
|
||||
assert.equal(leaderStep.time, '停留 3小时15分钟')
|
||||
} finally {
|
||||
|
||||
@@ -67,6 +67,7 @@ test('approval-mode detail collects leader opinion inside confirm dialog before
|
||||
assert.match(detailScript, /const isCurrentDirectManagerApprover = computed/)
|
||||
assert.match(detailScript, /const canProcessFinanceApprovalStage = computed/)
|
||||
assert.match(detailScript, /const canProcessBudgetApprovalStage = computed/)
|
||||
assert.match(detailScript, /const canProcessCurrentApprovalStage = computed/)
|
||||
assert.match(detailScript, /approvalOpinionTitle/)
|
||||
assert.match(detailScript, /approvalConfirmDescription/)
|
||||
assert.doesNotMatch(detailScript, /approvalNextStage/)
|
||||
@@ -84,9 +85,14 @@ test('approval-mode detail collects leader opinion inside confirm dialog before
|
||||
/const showApplicationLeaderOpinion = computed\(\(\) => \(\s*isApplicationDocument\.value\s*&& hasLeaderApprovalEvents\.value\s*\)\)/
|
||||
)
|
||||
assert.match(detailScript, /isDirectManagerApprovalStage\.value\)[\s\S]*return isCurrentDirectManagerApprover\.value/)
|
||||
assert.match(detailScript, /isDirectManagerApprovalStage\.value[\s\S]*&& isCurrentDirectManagerApprover\.value/)
|
||||
assert.match(detailScript, /if \(isDirectManagerApprovalStage\.value\) \{[\s\S]*return isCurrentDirectManagerApprover\.value/)
|
||||
assert.match(detailScript, /canProcessFinanceApprovalStage\.value/)
|
||||
assert.match(detailScript, /canProcessBudgetApprovalStage\.value/)
|
||||
assert.match(detailScript, /const canApproveRequest = computed\(\(\) =>\s*request\.value\.approvalKey === 'in_progress'[\s\S]*&& canProcessCurrentApprovalStage\.value\s*\)/)
|
||||
assert.doesNotMatch(
|
||||
detailScript,
|
||||
/const canApproveRequest = computed\(\(\) =>\s*\(Boolean\(props\.approvalMode\) \|\| isApplicationDocument\.value\)/
|
||||
)
|
||||
assert.doesNotMatch(detailScript, /leaderApprovalReadonlyText/)
|
||||
assert.match(detailScript, /resolveGeneratedDraftClaimNo/)
|
||||
assert.match(detailScript, /resolveApproveErrorMessage/)
|
||||
|
||||
@@ -1169,6 +1169,28 @@ test('draft submit validation uses expense detail date and amount when claim sum
|
||||
assert.ok(!issues.some((issue) => issue.includes('报销事由未完善')))
|
||||
})
|
||||
|
||||
test('returned application submit validation does not require expense detail rows', () => {
|
||||
const issues = buildDraftBlockingIssues(
|
||||
{
|
||||
id: 'AP-202606060001-RETURNED',
|
||||
claimNo: 'AP-202606060001-RETURNED',
|
||||
documentTypeCode: 'application',
|
||||
approvalKey: 'rejected',
|
||||
profileName: '曹笑竹',
|
||||
typeLabel: '差旅费用申请',
|
||||
typeCode: 'travel_application',
|
||||
reason: '支撑国网仿生产环境部署',
|
||||
location: '上海',
|
||||
occurredDisplay: '2026-02-20 至 2026-02-23',
|
||||
amountValue: 1880
|
||||
},
|
||||
[]
|
||||
)
|
||||
|
||||
assert.deepEqual(issues, [])
|
||||
assert.equal(issues.includes('费用明细不能为空'), false)
|
||||
})
|
||||
|
||||
test('transport ticket descriptions use route format and invalid format becomes risk advice', () => {
|
||||
const routeItem = buildExpenseItemViewModel(
|
||||
{
|
||||
|
||||
@@ -71,6 +71,9 @@ test('workbench summary builds real user notifications and progress from request
|
||||
assert.equal(summary.todoItems.length, 1)
|
||||
assert.equal(summary.todoItems[0].target.id, 'claim-1')
|
||||
assert.equal(summary.progressItems.length, 1)
|
||||
assert.match(summary.progressItems[0].prompt, /单据进度/)
|
||||
assert.doesNotMatch(summary.progressItems[0].prompt, /费用进度/)
|
||||
assert.equal(summary.progressItems[0].applicantLabel, '张三')
|
||||
assert.deepEqual(
|
||||
summary.progressItems[0].steps.map((step) => step.label),
|
||||
['创建单据', '待提交', '直属领导审批', '财务审批']
|
||||
@@ -136,3 +139,65 @@ test('workbench progress keeps application document type for AP claims', () => {
|
||||
['申请单', '申请单']
|
||||
)
|
||||
})
|
||||
|
||||
test('workbench progress includes application rows without backend progress steps', () => {
|
||||
const summary = buildWorkbenchSummary(
|
||||
[
|
||||
{
|
||||
id: 'AP-202606060001-NOSTEPS',
|
||||
claimId: 'application-without-steps',
|
||||
claimNo: 'AP-202606060001-NOSTEPS',
|
||||
documentTypeCode: 'application',
|
||||
person: currentUser.name,
|
||||
title: '上海出差申请',
|
||||
approvalKey: 'in_progress',
|
||||
approvalStatus: '直属领导审批',
|
||||
amount: 1880,
|
||||
updatedAt: '2026-06-06T09:00:00+08:00'
|
||||
}
|
||||
],
|
||||
currentUser
|
||||
)
|
||||
|
||||
assert.equal(summary.progressItems.length, 1)
|
||||
assert.equal(summary.progressItems[0].documentTypeLabel, '申请单')
|
||||
assert.equal(summary.progressItems[0].applicantLabel, currentUser.name)
|
||||
assert.deepEqual(
|
||||
summary.progressItems[0].steps.map((step) => step.label),
|
||||
['创建申请', '直属领导审批', '关联单据状态', '已归档']
|
||||
)
|
||||
assert.equal(summary.progressItems[0].steps[1].current, true)
|
||||
})
|
||||
|
||||
test('workbench progress includes application documents assigned to current approver', () => {
|
||||
const approverUser = {
|
||||
name: '李经理',
|
||||
username: 'manager@example.com',
|
||||
roleCodes: ['approver']
|
||||
}
|
||||
const summary = buildWorkbenchSummary(
|
||||
[
|
||||
{
|
||||
id: 'AP-202606060002-APPROVAL',
|
||||
claimId: 'application-for-approver',
|
||||
claimNo: 'AP-202606060002-APPROVAL',
|
||||
documentTypeCode: 'application',
|
||||
person: '张三',
|
||||
managerName: '李经理',
|
||||
title: '北京出差申请',
|
||||
approvalKey: 'in_progress',
|
||||
approvalStatus: '直属领导审批',
|
||||
workflowNode: '直属领导审批',
|
||||
amount: 2600,
|
||||
updatedAt: '2026-06-06T11:00:00+08:00'
|
||||
}
|
||||
],
|
||||
approverUser
|
||||
)
|
||||
|
||||
assert.equal(summary.totalCount, 0)
|
||||
assert.equal(summary.progressItems.length, 1)
|
||||
assert.equal(summary.progressItems[0].documentTypeLabel, '申请单')
|
||||
assert.equal(summary.progressItems[0].applicantLabel, '张三')
|
||||
assert.equal(summary.progressItems[0].requestId, 'AP-202606060002-APPROVAL')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user