Merge pull request 'feat: 工作台操作/运营体验改版,代发进度去掉待绑定' (#25) from test into master
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m3s
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m3s
Reviewed-on: https://git.ideship.com/ideship/front/pulls/25
This commit is contained in:
commit
8653f9a84a
@ -5,6 +5,7 @@
|
||||
"ComponentPublicInstance": true,
|
||||
"ComputedRef": true,
|
||||
"DirectiveBinding": true,
|
||||
"EdiAdvisorAudience": true,
|
||||
"EdiAdvisorOpenOptions": true,
|
||||
"EdiBatchOpenOptions": true,
|
||||
"EffectScope": true,
|
||||
@ -134,6 +135,7 @@
|
||||
"refThrottled": true,
|
||||
"refWithControl": true,
|
||||
"resolveComponent": true,
|
||||
"resolveIsOpsAudience": true,
|
||||
"resolveRef": true,
|
||||
"resolveUnref": true,
|
||||
"setActivePinia": true,
|
||||
|
||||
@ -87,12 +87,15 @@
|
||||
|
||||
&__avatar {
|
||||
flex-shrink: 0;
|
||||
// 这些 KPI 是方形插画,不是头像;圆形 overflow 会裁掉包裹盒右下角
|
||||
border-radius: 8px !important;
|
||||
overflow: visible;
|
||||
background-color: transparent;
|
||||
filter: none;
|
||||
|
||||
:deep(img) {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
5
src/auto-imports.d.ts
vendored
5
src/auto-imports.d.ts
vendored
@ -109,6 +109,7 @@ declare global {
|
||||
const refThrottled: typeof import('@vueuse/core')['refThrottled']
|
||||
const refWithControl: typeof import('@vueuse/core')['refWithControl']
|
||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||
const resolveIsOpsAudience: typeof import('./composables/ediAdvisorAudience')['resolveIsOpsAudience']
|
||||
const resolveRef: typeof import('@vueuse/core')['resolveRef']
|
||||
const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
|
||||
const setActivePinia: typeof import('pinia')['setActivePinia']
|
||||
@ -343,6 +344,9 @@ declare global {
|
||||
export type { McpCapabilityId, McpFieldHint, McpCapabilityGuide } from './composables/assistantMcpGuide'
|
||||
import('./composables/assistantMcpGuide')
|
||||
// @ts-ignore
|
||||
export type { EdiAdvisorAudience } from './composables/ediAdvisorAudience'
|
||||
import('./composables/ediAdvisorAudience')
|
||||
// @ts-ignore
|
||||
export type { OpsGuideModuleId, OpsGuideModule, OpsGuideContext } from './composables/opsGuideKnowledge'
|
||||
import('./composables/opsGuideKnowledge')
|
||||
// @ts-ignore
|
||||
@ -476,6 +480,7 @@ declare module 'vue' {
|
||||
readonly refThrottled: UnwrapRef<typeof import('@vueuse/core')['refThrottled']>
|
||||
readonly refWithControl: UnwrapRef<typeof import('@vueuse/core')['refWithControl']>
|
||||
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||
readonly resolveIsOpsAudience: UnwrapRef<typeof import('./composables/ediAdvisorAudience')['resolveIsOpsAudience']>
|
||||
readonly resolveRef: UnwrapRef<typeof import('@vueuse/core')['resolveRef']>
|
||||
readonly resolveUnref: UnwrapRef<typeof import('@vueuse/core')['resolveUnref']>
|
||||
readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
/** 代发订单列表 Tab:按代发进度分轨,而非订单状态。 */
|
||||
export const FULFILL_PROGRESS_ALL = 'all';
|
||||
|
||||
/**
|
||||
* 创建代发即已绑库存/包裹,列表不再提供「待绑定」分轨。
|
||||
* pendingBind 仍可能出现在历史/异常单的行字段文案中。
|
||||
*/
|
||||
export type FulfillProgressTabCode =
|
||||
| typeof FULFILL_PROGRESS_ALL
|
||||
| 'pendingBind'
|
||||
| 'domesticInTransit'
|
||||
| 'arrivedPendingPick'
|
||||
| 'outboundDone';
|
||||
@ -16,7 +19,6 @@ export interface FulfillProgressTabMeta {
|
||||
|
||||
export const FULFILL_PROGRESS_TABS: FulfillProgressTabMeta[] = [
|
||||
{ value: FULFILL_PROGRESS_ALL, labelKey: 'order.fulfillOrders.filter.progressAll', showTabCount: true },
|
||||
{ value: 'pendingBind', labelKey: 'order.fulfillOrders.progress.pendingBind', showTabCount: true },
|
||||
{ value: 'domesticInTransit', labelKey: 'order.fulfillOrders.progress.domesticInTransit', showTabCount: true },
|
||||
{ value: 'arrivedPendingPick', labelKey: 'order.fulfillOrders.progress.arrivedPendingPick', showTabCount: true },
|
||||
{ value: 'outboundDone', labelKey: 'order.fulfillOrders.progress.outboundDone', showTabCount: true },
|
||||
|
||||
@ -2389,7 +2389,7 @@ export default {
|
||||
'order.myOrders.stockBind.convertedHint':
|
||||
'Converted to fulfillment order. View bind status under Fulfillment Orders.',
|
||||
'order.myOrders.stockBind.warehouseClearHint':
|
||||
'After clearing binds the order stays fulfillment type; it will not revert to direct shipping.',
|
||||
'Clearing binds reverts the order to direct shipping (warehouse fulfill requires stock/parcel binds).',
|
||||
'order.myOrders.table.stockBindStatus': 'Bind status',
|
||||
'order.myOrders.table.domesticTrackingNos': 'Domestic tracking no.',
|
||||
'order.myOrders.table.stockBindQtyTotal': 'Bind qty',
|
||||
|
||||
@ -1987,7 +1987,7 @@ export default {
|
||||
'绑定包裹或库存后,该订单将按仓内代发处理,需等待仓库拣货打包,并可能产生代打包费。是否继续?',
|
||||
'order.myOrders.stockBind.convertedHint': '已转为代发订单,可在「代发订单」查看绑定与打包进度。',
|
||||
'order.myOrders.stockBind.warehouseClearHint':
|
||||
'清空绑定后订单仍为「代发」类型,不会恢复为直发物流,需继续完成绑定与拣货流程。',
|
||||
'清空绑定后订单将恢复为直发物流(创建代发必须绑定库存/包裹,不允许无绑定的代发单)。',
|
||||
'order.myOrders.table.stockBindStatus': '绑定状态',
|
||||
'order.myOrders.table.domesticTrackingNos': '国内快递单号',
|
||||
'order.myOrders.table.stockBindQtyTotal': '绑定件数',
|
||||
|
||||
@ -159,7 +159,7 @@ function onWarehouseChange() {
|
||||
}
|
||||
|
||||
function progressLabel(code: string) {
|
||||
const key = `order.fulfillOrders.progress.${code || 'pendingBind'}`;
|
||||
const key = `order.fulfillOrders.progress.${code || 'arrivedPendingPick'}`;
|
||||
const text = t(key);
|
||||
return text === key ? code : text;
|
||||
}
|
||||
|
||||
@ -47,11 +47,17 @@
|
||||
:class="{ 'is-active': opsDimension === dim }"
|
||||
@click="setOpsDimension(dim)"
|
||||
>
|
||||
{{ t(`workplace.orderAnalysis.${dim}`) }}
|
||||
{{
|
||||
dim === 'day'
|
||||
? t('workplace.admin.period.today')
|
||||
: dim === 'week'
|
||||
? t('workplace.admin.period.week')
|
||||
: t('workplace.admin.period.month')
|
||||
}}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="opsClearHint" class="h5-wp__clear">{{ opsClearHint }}</p>
|
||||
<WorkplaceKpiGrid :items="opsKpis" :loading="loading" :columns="2" @select="onKpi" />
|
||||
<WorkplaceKpiGrid :items="opsKpis" :loading="opsPanelLoading" :columns="2" @select="onKpi" />
|
||||
<div class="h5-wp__chips h5-wp__chips--end">
|
||||
<button
|
||||
type="button"
|
||||
@ -79,7 +85,7 @@
|
||||
"
|
||||
:labels="opsTrend.labels"
|
||||
:series="opsTrend.series"
|
||||
:loading="loading"
|
||||
:loading="opsPanelLoading"
|
||||
:empty-text="t('workplace.admin.role.chartEmpty')"
|
||||
/>
|
||||
</div>
|
||||
@ -164,7 +170,11 @@
|
||||
:class="{ 'is-active': regionPeriod === period }"
|
||||
@click="regionPeriod = period"
|
||||
>
|
||||
{{ t(`workplace.orderAnalysis.${period}`) }}
|
||||
{{
|
||||
period === 'week'
|
||||
? t('workplace.admin.period.byWeek')
|
||||
: t('workplace.admin.period.byMonth')
|
||||
}}
|
||||
</button>
|
||||
</div>
|
||||
<WorkplaceKpiGrid :items="customerKpis" :loading="loading" :columns="2" @select="onKpi" />
|
||||
@ -246,10 +256,12 @@ const router = useRouter();
|
||||
|
||||
const {
|
||||
loading,
|
||||
opsLoading,
|
||||
stats,
|
||||
businessTrend,
|
||||
orderTrend,
|
||||
monitor,
|
||||
monitorOps,
|
||||
monitorAvailable,
|
||||
opsDimension,
|
||||
updatedAt,
|
||||
@ -301,8 +313,9 @@ const pullHint = computed(() => {
|
||||
return t('h5Admin.workplace.pull.hint');
|
||||
});
|
||||
|
||||
const opsPanelLoading = computed(() => loading.value || opsLoading.value);
|
||||
const opsKpis = computed(() =>
|
||||
buildOpsKpis(t, stats.value, monitor.value, monitorAvailable.value),
|
||||
buildOpsKpis(t, stats.value, monitorOps.value, monitorAvailable.value),
|
||||
);
|
||||
const opsAlertCount = computed(() => kpiAlertSum(opsKpis.value));
|
||||
const opsClearHint = computed(() => clearHintFor(t, opsKpis.value));
|
||||
@ -312,7 +325,7 @@ const opsTrend = computed(() =>
|
||||
trendMode.value,
|
||||
orderTrend.value,
|
||||
businessTrend.value,
|
||||
monitor.value,
|
||||
monitorOps.value,
|
||||
monitorAvailable.value,
|
||||
),
|
||||
);
|
||||
@ -623,10 +636,6 @@ async function onTouchEnd() {
|
||||
color: rgba(26, 46, 56, 0.45);
|
||||
}
|
||||
|
||||
:deep(.wk-funnel__track) {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
:deep(.wk-inbox__nav) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -22,11 +22,11 @@
|
||||
|
||||
<div class="aw-roles">
|
||||
<RoleOpsPanel
|
||||
:loading="loading"
|
||||
:loading="loading || opsLoading"
|
||||
:stats="stats"
|
||||
:business-trend="businessTrend"
|
||||
:order-trend="orderTrend"
|
||||
:monitor="monitor"
|
||||
:monitor="monitorOps"
|
||||
:monitor-available="monitorAvailable"
|
||||
:ops-dimension="opsDimension"
|
||||
@update:ops-dimension="setOpsDimension"
|
||||
@ -68,10 +68,12 @@ const { t, locale } = useI18n()
|
||||
|
||||
const {
|
||||
loading,
|
||||
opsLoading,
|
||||
stats,
|
||||
businessTrend,
|
||||
orderTrend,
|
||||
monitor,
|
||||
monitorOps,
|
||||
monitorAvailable,
|
||||
opsDimension,
|
||||
updatedAt,
|
||||
|
||||
@ -1,23 +1,33 @@
|
||||
<template>
|
||||
<div class="wk-funnel">
|
||||
<p v-if="title" class="wk-funnel__title">{{ title }}</p>
|
||||
<div v-if="title || $slots.extra" class="wk-funnel__head">
|
||||
<p v-if="title" class="wk-funnel__title">{{ title }}</p>
|
||||
<div v-if="$slots.extra" class="wk-funnel__extra">
|
||||
<slot name="extra" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="wk-funnel__track" role="list">
|
||||
<button
|
||||
v-for="seg in segments"
|
||||
:key="seg.key"
|
||||
type="button"
|
||||
class="wk-funnel__seg"
|
||||
:class="{
|
||||
'is-hot': seg.key === hotKey && seg.value > 0,
|
||||
'is-done': seg.done,
|
||||
'is-zero': seg.value <= 0,
|
||||
}"
|
||||
role="listitem"
|
||||
@click="emit('select', seg)"
|
||||
>
|
||||
<span class="wk-funnel__label">{{ seg.label }}</span>
|
||||
<span class="wk-funnel__value">{{ formatInt(seg.value) }}</span>
|
||||
</button>
|
||||
<template v-for="(seg, index) in segments" :key="seg.key">
|
||||
<button
|
||||
type="button"
|
||||
class="wk-funnel__seg"
|
||||
:class="{
|
||||
'is-hot': seg.key === hotKey && seg.value > 0,
|
||||
'is-done': seg.done,
|
||||
'is-zero': seg.value <= 0,
|
||||
}"
|
||||
role="listitem"
|
||||
@click="emit('select', seg)"
|
||||
>
|
||||
<span class="wk-funnel__label">{{ seg.label }}</span>
|
||||
<span class="wk-funnel__value">{{ formatInt(seg.value) }}</span>
|
||||
</button>
|
||||
<span
|
||||
v-if="index < segments.length - 1"
|
||||
class="wk-funnel__arrow"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -62,23 +72,44 @@ function formatInt(n: number) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.wk-funnel {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-funnel__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.wk-funnel__title {
|
||||
margin: 0 0 8px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
}
|
||||
|
||||
.wk-funnel__extra {
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.wk-funnel__track {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-funnel__seg {
|
||||
display: flex;
|
||||
flex: 1 1 0;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
min-height: 54px;
|
||||
padding: 8px 10px;
|
||||
border: none;
|
||||
@ -112,10 +143,44 @@ function formatInt(n: number) {
|
||||
}
|
||||
}
|
||||
|
||||
.wk-funnel__arrow {
|
||||
flex: 0 0 16px;
|
||||
align-self: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 2px;
|
||||
width: 8px;
|
||||
height: 1.5px;
|
||||
background: rgba(26, 46, 56, 0.22);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 2px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-top: 1.5px solid rgba(26, 46, 56, 0.22);
|
||||
border-right: 1.5px solid rgba(26, 46, 56, 0.22);
|
||||
transform: translateY(-50%) rotate(45deg);
|
||||
}
|
||||
}
|
||||
|
||||
.wk-funnel__label {
|
||||
font-size: 11px;
|
||||
color: rgba(26, 46, 56, 0.55);
|
||||
line-height: 1.2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.wk-funnel__value {
|
||||
@ -123,11 +188,21 @@ function formatInt(n: number) {
|
||||
font-weight: 700;
|
||||
color: #1a2e38;
|
||||
line-height: 1.1;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.wk-funnel__track {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.wk-funnel__seg {
|
||||
flex: 1 1 calc(50% - 6px);
|
||||
}
|
||||
|
||||
.wk-funnel__arrow {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
299
src/views/home/workplace/components/WorkplaceQueueList.vue
Normal file
299
src/views/home/workplace/components/WorkplaceQueueList.vue
Normal file
@ -0,0 +1,299 @@
|
||||
<template>
|
||||
<div class="wk-queue">
|
||||
<div v-if="title || moreText || $slots.extra" class="wk-queue__head">
|
||||
<p v-if="title" class="wk-queue__title">{{ title }}</p>
|
||||
<div class="wk-queue__extra">
|
||||
<slot name="extra" />
|
||||
<button
|
||||
v-if="moreText"
|
||||
type="button"
|
||||
class="wk-queue__more"
|
||||
@click="emit('more')"
|
||||
>
|
||||
{{ moreText }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="stages?.length" class="wk-queue__stages" role="tablist">
|
||||
<button
|
||||
v-for="stage in stages"
|
||||
:key="stage.key"
|
||||
type="button"
|
||||
class="wk-queue__stage"
|
||||
:class="{
|
||||
'is-active': stage.key === activeStage,
|
||||
'is-zero': stage.value <= 0,
|
||||
}"
|
||||
role="tab"
|
||||
:aria-selected="stage.key === activeStage"
|
||||
@click="emit('update:activeStage', stage.key)"
|
||||
>
|
||||
<span>{{ stage.label }}</span>
|
||||
<em>{{ formatInt(stage.value) }}</em>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="wk-queue__state">
|
||||
<a-spin :size="18" />
|
||||
</div>
|
||||
<p v-else-if="!items.length" class="wk-queue__state">{{ emptyText }}</p>
|
||||
<ul v-else class="wk-queue__list">
|
||||
<li v-for="item in items" :key="item.key">
|
||||
<button type="button" class="wk-queue__row" @click="emit('select', item)">
|
||||
<AvatarDisplay :src="item.avatar" :size="32" class="wk-queue__avatar" />
|
||||
<div class="wk-queue__main">
|
||||
<div class="wk-queue__top">
|
||||
<span class="wk-queue__no">{{ item.orderNo || '—' }}</span>
|
||||
<span v-if="item.stageLabel" class="wk-queue__tag">{{ item.stageLabel }}</span>
|
||||
</div>
|
||||
<div class="wk-queue__meta">
|
||||
<span class="wk-queue__customer">{{ item.customerName || '—' }}</span>
|
||||
<span class="wk-queue__time">{{ item.createTimeText || '—' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import AvatarDisplay from '@/components/AvatarDisplay/index.vue'
|
||||
|
||||
export type WorkplaceQueueStage = {
|
||||
key: string
|
||||
label: string
|
||||
value: number
|
||||
}
|
||||
|
||||
export type WorkplaceQueueItem = {
|
||||
key: string
|
||||
orderNo: string
|
||||
customerName?: string
|
||||
avatar?: string
|
||||
createTimeText?: string
|
||||
stageLabel?: string
|
||||
path?: string
|
||||
query?: Record<string, string>
|
||||
raw?: unknown
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string
|
||||
stages?: WorkplaceQueueStage[]
|
||||
activeStage?: string
|
||||
items: WorkplaceQueueItem[]
|
||||
loading?: boolean
|
||||
emptyText?: string
|
||||
moreText?: string
|
||||
}>(),
|
||||
{
|
||||
title: '',
|
||||
stages: () => [],
|
||||
activeStage: '',
|
||||
loading: false,
|
||||
emptyText: '—',
|
||||
moreText: '',
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:activeStage': [key: string]
|
||||
select: [item: WorkplaceQueueItem]
|
||||
more: []
|
||||
}>()
|
||||
|
||||
function formatInt(n: number) {
|
||||
return Math.round(Number(n) || 0).toLocaleString('zh-CN')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.wk-queue {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-queue__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.wk-queue__title {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
}
|
||||
|
||||
.wk-queue__extra {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.wk-queue__stages {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wk-queue__stage {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px;
|
||||
border: none;
|
||||
border-radius: 999px;
|
||||
background: rgba(15, 23, 42, 0.04);
|
||||
color: rgba(26, 46, 56, 0.62);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 0.15s ease,
|
||||
color 0.15s ease;
|
||||
|
||||
em {
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1a2e38;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff);
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
|
||||
em {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
}
|
||||
}
|
||||
|
||||
&.is-zero {
|
||||
opacity: 0.55;
|
||||
}
|
||||
}
|
||||
|
||||
.wk-queue__state {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 96px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: rgba(26, 46, 56, 0.45);
|
||||
}
|
||||
|
||||
.wk-queue__list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.wk-queue__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 52px;
|
||||
padding: 8px 10px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(15, 23, 42, 0.06),
|
||||
inset 0 1px 4px rgba(15, 23, 42, 0.05);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(15, 23, 42, 0.08),
|
||||
inset 0 2px 6px rgba(15, 23, 42, 0.07);
|
||||
}
|
||||
}
|
||||
|
||||
.wk-queue__avatar {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wk-queue__main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.wk-queue__top,
|
||||
.wk-queue__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-queue__no {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: #1a2e38;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.wk-queue__tag {
|
||||
flex-shrink: 0;
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
background: rgba(15, 23, 42, 0.05);
|
||||
color: rgba(26, 46, 56, 0.55);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.wk-queue__customer {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
color: rgba(26, 46, 56, 0.62);
|
||||
}
|
||||
|
||||
.wk-queue__time {
|
||||
flex-shrink: 0;
|
||||
font-size: 11px;
|
||||
color: rgba(26, 46, 56, 0.42);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.wk-queue__more {
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
361
src/views/home/workplace/components/WorkplaceRankBars.vue
Normal file
361
src/views/home/workplace/components/WorkplaceRankBars.vue
Normal file
@ -0,0 +1,361 @@
|
||||
<template>
|
||||
<div class="wk-rank" :class="{ 'wk-rank--compare': isCompare }">
|
||||
<div v-if="title || $slots.extra" class="wk-rank__head">
|
||||
<p v-if="title" class="wk-rank__title">{{ title }}</p>
|
||||
<div v-if="$slots.extra" class="wk-rank__extra">
|
||||
<slot name="extra" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loading" class="wk-rank__state">
|
||||
<a-spin :size="18" />
|
||||
</div>
|
||||
<p v-else-if="!rows.length" class="wk-rank__state">{{ emptyText }}</p>
|
||||
|
||||
<!-- 双指标对比:单量 + 应收同屏,条长相对该指标最大值,旁注占总计占比 -->
|
||||
<div v-else-if="isCompare" class="wk-rank__list wk-rank__list--compare">
|
||||
<div
|
||||
v-for="(item, index) in rows"
|
||||
:key="item.key"
|
||||
class="wk-rank__row wk-rank__row--compare"
|
||||
:class="{ 'is-muted': item.order <= 0 && item.receivable <= 0 }"
|
||||
>
|
||||
<div class="wk-rank__name">
|
||||
<em>{{ index + 1 }}</em>
|
||||
<span>{{ item.label }}</span>
|
||||
</div>
|
||||
<div class="wk-rank__metrics">
|
||||
<div class="wk-rank__metric">
|
||||
<div class="wk-rank__metric-meta">
|
||||
<span class="wk-rank__metric-label">{{ orderLabel }}</span>
|
||||
<span class="wk-rank__metric-value">{{ formatNumber(item.order) }}</span>
|
||||
<span class="wk-rank__metric-share">{{ formatShare(item.orderShare) }}</span>
|
||||
</div>
|
||||
<div class="wk-rank__track" aria-hidden="true">
|
||||
<div
|
||||
class="wk-rank__fill"
|
||||
:style="{
|
||||
width: `${item.orderBar}%`,
|
||||
background: palette[0],
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wk-rank__metric">
|
||||
<div class="wk-rank__metric-meta">
|
||||
<span class="wk-rank__metric-label">{{ receivableLabel }}</span>
|
||||
<span class="wk-rank__metric-value">{{ formatCurrency(item.receivable) }}</span>
|
||||
<span class="wk-rank__metric-share">{{ formatShare(item.receivableShare) }}</span>
|
||||
</div>
|
||||
<div class="wk-rank__track" aria-hidden="true">
|
||||
<div
|
||||
class="wk-rank__fill"
|
||||
:style="{
|
||||
width: `${item.receivableBar}%`,
|
||||
background: palette[1],
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 单指标排行(兼容旧用法) -->
|
||||
<div v-else class="wk-rank__list">
|
||||
<div
|
||||
v-for="(item, index) in rows"
|
||||
:key="item.key"
|
||||
class="wk-rank__row"
|
||||
:class="{ 'is-muted': item.value <= 0 }"
|
||||
>
|
||||
<div class="wk-rank__meta">
|
||||
<span class="wk-rank__label">
|
||||
<em>{{ index + 1 }}</em>
|
||||
{{ item.label }}
|
||||
</span>
|
||||
<span class="wk-rank__value">{{ formatValue(item.value) }}</span>
|
||||
</div>
|
||||
<div class="wk-rank__track" aria-hidden="true">
|
||||
<div
|
||||
class="wk-rank__fill"
|
||||
:style="{
|
||||
width: `${item.pct}%`,
|
||||
background: item.color || palette[index % palette.length],
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
export type WorkplaceRankItem = {
|
||||
key: string
|
||||
label: string
|
||||
value: number
|
||||
color?: string
|
||||
}
|
||||
|
||||
export type WorkplaceCompareItem = {
|
||||
key: string
|
||||
label: string
|
||||
order: number
|
||||
receivable: number
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string
|
||||
items?: WorkplaceRankItem[]
|
||||
compareItems?: WorkplaceCompareItem[]
|
||||
/** 对比模式按哪列排序 */
|
||||
sortBy?: 'order' | 'receivable'
|
||||
orderLabel?: string
|
||||
receivableLabel?: string
|
||||
loading?: boolean
|
||||
emptyText?: string
|
||||
/** currency | number(单指标模式) */
|
||||
format?: 'number' | 'currency'
|
||||
limit?: number
|
||||
}>(),
|
||||
{
|
||||
title: '',
|
||||
items: () => [],
|
||||
compareItems: () => [],
|
||||
sortBy: 'order',
|
||||
orderLabel: '单量',
|
||||
receivableLabel: '应收',
|
||||
loading: false,
|
||||
emptyText: '—',
|
||||
format: 'number',
|
||||
limit: 6,
|
||||
},
|
||||
)
|
||||
|
||||
const palette = ['#054f74', '#D9924A', '#14B8A6', '#c45a3a', '#7c6cf0', '#2f9e44']
|
||||
|
||||
const isCompare = computed(() => (props.compareItems?.length ?? 0) > 0)
|
||||
|
||||
const rows = computed(() => {
|
||||
if (isCompare.value) {
|
||||
const sorted = [...props.compareItems]
|
||||
.map((item) => ({
|
||||
...item,
|
||||
order: Math.round(Number(item.order) || 0),
|
||||
receivable: Math.round(Number(item.receivable) || 0),
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
const key = props.sortBy === 'receivable' ? 'receivable' : 'order'
|
||||
return b[key] - a[key]
|
||||
})
|
||||
const visible = sorted
|
||||
.filter((item) => item.order > 0 || item.receivable > 0)
|
||||
.slice(0, props.limit)
|
||||
const orderTotal = visible.reduce((s, i) => s + i.order, 0) || 1
|
||||
const receivableTotal = visible.reduce((s, i) => s + i.receivable, 0) || 1
|
||||
const orderMax = Math.max(...visible.map((i) => i.order), 1)
|
||||
const receivableMax = Math.max(...visible.map((i) => i.receivable), 1)
|
||||
return visible.map((item) => ({
|
||||
...item,
|
||||
orderShare: Math.round((item.order / orderTotal) * 100),
|
||||
receivableShare: Math.round((item.receivable / receivableTotal) * 100),
|
||||
orderBar: barPct(item.order, orderMax),
|
||||
receivableBar: barPct(item.receivable, receivableMax),
|
||||
}))
|
||||
}
|
||||
|
||||
const sorted = [...props.items]
|
||||
.map((item) => ({ ...item, value: Number(item.value) || 0 }))
|
||||
.sort((a, b) => b.value - a.value)
|
||||
const visible = sorted.filter((item) => item.value > 0).slice(0, props.limit)
|
||||
const max = Math.max(...visible.map((item) => item.value), 1)
|
||||
return visible.map((item) => ({
|
||||
...item,
|
||||
pct: barPct(item.value, max),
|
||||
}))
|
||||
})
|
||||
|
||||
function barPct(value: number, max: number) {
|
||||
if (value <= 0) return 0
|
||||
return Math.max(4, Math.round((value / max) * 100))
|
||||
}
|
||||
|
||||
function formatNumber(n: number) {
|
||||
return Math.round(Number(n) || 0).toLocaleString('zh-CN')
|
||||
}
|
||||
|
||||
function formatCurrency(n: number) {
|
||||
return `¥${formatNumber(n)}`
|
||||
}
|
||||
|
||||
function formatValue(n: number) {
|
||||
return props.format === 'currency' ? formatCurrency(n) : formatNumber(n)
|
||||
}
|
||||
|
||||
/** 必须在 t() 时传入 n,否则 vue-i18n 会把 {n} 清成空串变成「占 %」 */
|
||||
function formatShare(pct: number) {
|
||||
return t('workplace.admin.role.customerShare', { n: pct })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.wk-rank {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-rank__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wk-rank__title {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
}
|
||||
|
||||
.wk-rank__extra {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wk-rank__state {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 88px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: rgba(26, 46, 56, 0.45);
|
||||
}
|
||||
|
||||
.wk-rank__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wk-rank__list--compare {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.wk-rank__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.wk-rank__label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
|
||||
em {
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.36);
|
||||
min-width: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.wk-rank__value {
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1a2e38;
|
||||
}
|
||||
|
||||
.wk-rank__name {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #1a2e38;
|
||||
|
||||
em {
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.36);
|
||||
min-width: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.wk-rank__metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px 14px;
|
||||
}
|
||||
|
||||
.wk-rank__metric-meta {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
margin-bottom: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-rank__metric-label {
|
||||
flex-shrink: 0;
|
||||
font-size: 11px;
|
||||
color: rgba(26, 46, 56, 0.48);
|
||||
}
|
||||
|
||||
.wk-rank__metric-value {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1a2e38;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.wk-rank__metric-share {
|
||||
margin-left: auto;
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: rgba(26, 46, 56, 0.42);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.wk-rank__track {
|
||||
height: 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(15, 23, 42, 0.06);
|
||||
box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wk-rank__fill {
|
||||
height: 100%;
|
||||
border-radius: inherit;
|
||||
min-width: 0;
|
||||
transition: width 0.25s ease;
|
||||
}
|
||||
|
||||
.wk-rank__row.is-muted {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.wk-rank__metrics {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,15 +1,22 @@
|
||||
<template>
|
||||
<div class="wk-rates">
|
||||
<p v-if="title" class="wk-rates__title">{{ title }}</p>
|
||||
<div class="wk-rates__list">
|
||||
<div v-for="item in items" :key="item.key" class="wk-rates__row">
|
||||
<div class="wk-rates__meta">
|
||||
<span class="wk-rates__label">{{ item.label }}</span>
|
||||
<div class="wk-rates__grid" role="list">
|
||||
<div
|
||||
v-for="item in items"
|
||||
:key="item.key"
|
||||
class="wk-rates__cell"
|
||||
:class="`is-${toneOf(item.value)}`"
|
||||
role="listitem"
|
||||
>
|
||||
<div
|
||||
class="wk-rates__ring"
|
||||
:style="{ '--pct': String(clampPct(item.value)) }"
|
||||
:aria-label="`${item.label} ${formatPct(item.value)}`"
|
||||
>
|
||||
<span class="wk-rates__value">{{ formatPct(item.value) }}</span>
|
||||
</div>
|
||||
<div class="wk-rates__track" aria-hidden="true">
|
||||
<div class="wk-rates__fill" :style="{ width: `${clampPct(item.value)}%` }" />
|
||||
</div>
|
||||
<span class="wk-rates__label">{{ item.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -37,52 +44,134 @@ function clampPct(n: number) {
|
||||
function formatPct(n: number) {
|
||||
return `${clampPct(n)}%`
|
||||
}
|
||||
|
||||
/** 完整率/OTD:≥90 优,≥75 可,其余预警 */
|
||||
function toneOf(n: number): 'good' | 'warn' | 'bad' {
|
||||
const v = clampPct(n)
|
||||
if (v >= 90) return 'good'
|
||||
if (v >= 75) return 'warn'
|
||||
return 'bad'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.wk-rates__title {
|
||||
margin: 0 0 8px;
|
||||
margin: 0 0 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
}
|
||||
|
||||
.wk-rates__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.wk-rates__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wk-rates__meta {
|
||||
.wk-rates__cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 4px;
|
||||
min-width: 0;
|
||||
padding: 12px 8px 10px;
|
||||
border-radius: 14px;
|
||||
background: #fff;
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(15, 23, 42, 0.06),
|
||||
inset 0 1px 4px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
.wk-rates__ring {
|
||||
--pct: 0;
|
||||
--tone: var(--app-primary-color);
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 50%;
|
||||
background: conic-gradient(var(--tone) calc(var(--pct) * 1%), rgba(15, 23, 42, 0.08) 0);
|
||||
}
|
||||
|
||||
.wk-rates__ring::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 7px;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
.wk-rates__value {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
font-size: 15px;
|
||||
font-weight: 750;
|
||||
letter-spacing: -0.02em;
|
||||
color: #1a2e38;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.wk-rates__label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: rgba(26, 46, 56, 0.62);
|
||||
text-align: center;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.wk-rates__value {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #1a2e38;
|
||||
.wk-rates__cell.is-good {
|
||||
--tone: var(--app-primary-color);
|
||||
|
||||
.wk-rates__ring {
|
||||
--tone: var(--app-primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
.wk-rates__track {
|
||||
height: 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(15, 23, 42, 0.06);
|
||||
overflow: hidden;
|
||||
.wk-rates__cell.is-warn {
|
||||
.wk-rates__ring {
|
||||
--tone: #d9892b;
|
||||
}
|
||||
|
||||
.wk-rates__value {
|
||||
color: #9a5b12;
|
||||
}
|
||||
}
|
||||
|
||||
.wk-rates__fill {
|
||||
height: 100%;
|
||||
border-radius: inherit;
|
||||
background: var(--app-primary-color);
|
||||
transition: width 0.25s ease;
|
||||
.wk-rates__cell.is-bad {
|
||||
.wk-rates__ring {
|
||||
--tone: #c94c4c;
|
||||
}
|
||||
|
||||
.wk-rates__value {
|
||||
color: #a33a3a;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.wk-rates__grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.wk-rates__cell {
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.wk-rates__ring {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.wk-rates__value {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.wk-rates__label {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
207
src/views/home/workplace/components/WorkplaceSegmented.vue
Normal file
207
src/views/home/workplace/components/WorkplaceSegmented.vue
Normal file
@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<div
|
||||
class="wp-seg"
|
||||
:class="[
|
||||
`wp-seg--${variant}`,
|
||||
{ 'wp-seg--compact': compact },
|
||||
]"
|
||||
role="radiogroup"
|
||||
:aria-label="ariaLabel"
|
||||
>
|
||||
<button
|
||||
v-for="opt in options"
|
||||
:key="String(opt.value)"
|
||||
type="button"
|
||||
class="wp-seg__item"
|
||||
:class="{ 'is-active': modelValue === opt.value }"
|
||||
role="radio"
|
||||
:aria-checked="modelValue === opt.value"
|
||||
@click="select(opt.value)"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
export type WorkplaceSegmentOption = {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
/** pill=实心主色;soft=浅底主色字;text=文字+下划线(今天/近7天风格) */
|
||||
export type WorkplaceSegmentVariant = 'pill' | 'soft' | 'text'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: string
|
||||
options: WorkplaceSegmentOption[]
|
||||
ariaLabel?: string
|
||||
variant?: WorkplaceSegmentVariant
|
||||
/** 更紧凑,适合面板标题栏 */
|
||||
compact?: boolean
|
||||
}>(),
|
||||
{
|
||||
variant: 'soft',
|
||||
compact: true,
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
change: [value: string]
|
||||
}>()
|
||||
|
||||
function select(value: string) {
|
||||
if (value === props.modelValue) return
|
||||
emit('update:modelValue', value)
|
||||
emit('change', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.wp-seg {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.wp-seg__item {
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: rgba(26, 46, 56, 0.55);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.01em;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 0.15s ease,
|
||||
color 0.15s ease,
|
||||
box-shadow 0.15s ease,
|
||||
border-color 0.15s ease;
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid color-mix(in srgb, var(--app-primary-color, #1d7281) 45%, transparent);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
/* —— soft:浅灰槽 + 选中浅主色底(默认,贴近 H5 chip) —— */
|
||||
.wp-seg--soft {
|
||||
gap: 2px;
|
||||
padding: 2px;
|
||||
border-radius: 999px;
|
||||
background: rgba(15, 23, 42, 0.04);
|
||||
box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
|
||||
|
||||
.wp-seg__item {
|
||||
border-radius: 999px;
|
||||
|
||||
&:hover:not(.is-active) {
|
||||
color: #1a2e38;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff);
|
||||
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color, #1d7281) 18%, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-seg--soft.wp-seg--compact .wp-seg__item {
|
||||
min-height: 22px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.wp-seg--soft:not(.wp-seg--compact) .wp-seg__item {
|
||||
min-height: 28px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
/* —— pill:实心主色选中 —— */
|
||||
.wp-seg--pill {
|
||||
gap: 2px;
|
||||
padding: 2px;
|
||||
border-radius: 10px;
|
||||
background: #f3f5f7;
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(15, 23, 42, 0.05),
|
||||
inset 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
|
||||
.wp-seg__item {
|
||||
border-radius: 8px;
|
||||
|
||||
&:hover:not(.is-active) {
|
||||
color: #1a2e38;
|
||||
background: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #fff;
|
||||
background: var(--app-primary-color, #1d7281);
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-seg--pill.wp-seg--compact .wp-seg__item {
|
||||
min-height: 22px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.wp-seg--pill:not(.wp-seg--compact) .wp-seg__item {
|
||||
min-height: 28px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
/* —— text:今天 / 近7天 文字预设风格 —— */
|
||||
.wp-seg--text {
|
||||
gap: 2px;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
|
||||
.wp-seg__item {
|
||||
position: relative;
|
||||
border-radius: 6px;
|
||||
color: rgba(26, 46, 56, 0.48);
|
||||
|
||||
&:hover:not(.is-active) {
|
||||
color: #1a2e38;
|
||||
background: rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
background: transparent;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
bottom: 2px;
|
||||
height: 2px;
|
||||
border-radius: 1px;
|
||||
background: var(--app-primary-color, #1d7281);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-seg--text.wp-seg--compact .wp-seg__item {
|
||||
min-height: 24px;
|
||||
padding: 0 8px 4px;
|
||||
}
|
||||
|
||||
.wp-seg--text:not(.wp-seg--compact) .wp-seg__item {
|
||||
min-height: 28px;
|
||||
padding: 0 10px 4px;
|
||||
}
|
||||
</style>
|
||||
@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div class="wk-spark">
|
||||
<p v-if="title" class="wk-spark__title">{{ title }}</p>
|
||||
<div v-if="title || $slots.extra" class="wk-spark__head">
|
||||
<p v-if="title" class="wk-spark__title">{{ title }}</p>
|
||||
<div v-if="$slots.extra" class="wk-spark__extra">
|
||||
<slot name="extra" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loading" class="wk-spark__loading">
|
||||
<a-spin :size="18" />
|
||||
</div>
|
||||
@ -13,6 +18,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import Chart from '@/components/chart/index.vue'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
@ -20,19 +26,32 @@ export type SparkSeries = {
|
||||
name: string
|
||||
data: number[]
|
||||
color?: string
|
||||
type?: 'line' | 'bar'
|
||||
area?: boolean
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string
|
||||
labels: string[]
|
||||
series: SparkSeries[]
|
||||
/**
|
||||
* 系列未指定 type 时的默认形态。
|
||||
* 业务量:系列自带 bar+line;财务:line;也可整图强制 bar。
|
||||
*/
|
||||
chartType?: 'line' | 'bar'
|
||||
/** 柱+线组合时在 tooltip 追加比率(发货/建单) */
|
||||
showComboRate?: boolean
|
||||
loading?: boolean
|
||||
emptyText?: string
|
||||
height?: string
|
||||
}>(),
|
||||
{
|
||||
title: '',
|
||||
chartType: 'line',
|
||||
showComboRate: false,
|
||||
loading: false,
|
||||
emptyText: '—',
|
||||
height: '160px',
|
||||
@ -48,6 +67,10 @@ function hexToRgba(hex: string, alpha: number) {
|
||||
return `rgba(${r}, ${g}, ${b}, ${alpha})`
|
||||
}
|
||||
|
||||
function resolveType(s: SparkSeries): 'line' | 'bar' {
|
||||
return s.type || props.chartType || 'line'
|
||||
}
|
||||
|
||||
const empty = computed(() => {
|
||||
if (!props.labels.length || !props.series.length) return true
|
||||
return props.series.every((s) => s.data.every((n) => !Number(n)))
|
||||
@ -58,6 +81,39 @@ const chartOption = computed(() => {
|
||||
const isDark = appStore.theme === 'dark'
|
||||
const palette = ['#054f74', '#D9924A', '#14B8A6', '#c45a3a', '#7c6cf0', '#2f9e44']
|
||||
const multi = props.series.length > 2
|
||||
const hasBar = props.series.some((s) => resolveType(s) === 'bar')
|
||||
const hasLine = props.series.some((s) => resolveType(s) === 'line')
|
||||
const isCombo = hasBar && hasLine
|
||||
|
||||
type AxisParam = {
|
||||
axisValueLabel?: string
|
||||
axisValue?: string | number
|
||||
marker?: string
|
||||
seriesName?: string
|
||||
seriesType?: string
|
||||
value?: number | string
|
||||
}
|
||||
|
||||
const tooltipFormatter = (params: AxisParam | AxisParam[]) => {
|
||||
const list = Array.isArray(params) ? params : [params]
|
||||
if (!list.length) return ''
|
||||
const head = String(list[0].axisValueLabel ?? list[0].axisValue ?? '')
|
||||
const lines = list.map((p) => {
|
||||
const val = Number(p.value) || 0
|
||||
return `${p.marker || ''}${p.seriesName}: ${val.toLocaleString('zh-CN')}`
|
||||
})
|
||||
if (props.showComboRate && isCombo) {
|
||||
const barItem = list.find((p) => p.seriesType === 'bar')
|
||||
const lineItem = list.find((p) => p.seriesType === 'line')
|
||||
const base = Number(barItem?.value) || 0
|
||||
const follow = Number(lineItem?.value) || 0
|
||||
if (base > 0) {
|
||||
const pct = Math.round((follow / base) * 100)
|
||||
lines.push(t('workplace.admin.role.shipRate', { n: pct }))
|
||||
}
|
||||
}
|
||||
return [head, ...lines].join('<br/>')
|
||||
}
|
||||
|
||||
return {
|
||||
animationDuration: 240,
|
||||
@ -72,8 +128,8 @@ const chartOption = computed(() => {
|
||||
top: multi ? undefined : 0,
|
||||
bottom: multi ? 0 : undefined,
|
||||
left: 'center',
|
||||
icon: 'circle',
|
||||
itemWidth: 8,
|
||||
icon: hasBar && !hasLine ? 'roundRect' : 'circle',
|
||||
itemWidth: hasBar && !hasLine ? 10 : 8,
|
||||
itemHeight: 8,
|
||||
itemGap: 12,
|
||||
type: multi ? ('scroll' as const) : ('plain' as const),
|
||||
@ -85,10 +141,14 @@ const chartOption = computed(() => {
|
||||
tooltip: {
|
||||
trigger: 'axis' as const,
|
||||
confine: true,
|
||||
axisPointer: {
|
||||
type: hasBar ? ('shadow' as const) : ('line' as const),
|
||||
},
|
||||
formatter: tooltipFormatter,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category' as const,
|
||||
boundaryGap: false,
|
||||
boundaryGap: hasBar,
|
||||
data: props.labels.length ? props.labels : ['—'],
|
||||
axisTick: { show: false },
|
||||
axisLine: {
|
||||
@ -115,30 +175,51 @@ const chartOption = computed(() => {
|
||||
},
|
||||
series: props.series.map((s, idx) => {
|
||||
const color = s.color || palette[idx % palette.length]
|
||||
const kind = resolveType(s)
|
||||
if (kind === 'bar') {
|
||||
return {
|
||||
name: s.name,
|
||||
type: 'bar' as const,
|
||||
data: s.data,
|
||||
barMaxWidth: isCombo ? 22 : 18,
|
||||
barGap: '30%',
|
||||
z: 1,
|
||||
itemStyle: {
|
||||
color,
|
||||
borderRadius: [3, 3, 0, 0],
|
||||
},
|
||||
}
|
||||
}
|
||||
const useArea = s.area !== false && (s.area === true || (!isCombo && props.chartType === 'line'))
|
||||
// 组合图中发货线默认不铺面积,避免压住柱;财务双折线铺面积
|
||||
const showArea = isCombo ? Boolean(s.area) : useArea
|
||||
const topAlpha = isDark ? 0.28 : 0.18
|
||||
const bottomAlpha = isDark ? 0.04 : 0.03
|
||||
return {
|
||||
name: s.name,
|
||||
type: 'line',
|
||||
type: 'line' as const,
|
||||
smooth: true,
|
||||
data: s.data,
|
||||
symbol: 'circle',
|
||||
symbolSize: 4,
|
||||
symbolSize: isCombo ? 6 : 4,
|
||||
z: 3,
|
||||
lineStyle: { width: 2, color },
|
||||
itemStyle: { color },
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: hexToRgba(color, topAlpha) },
|
||||
{ offset: 1, color: hexToRgba(color, bottomAlpha) },
|
||||
],
|
||||
},
|
||||
},
|
||||
areaStyle: showArea
|
||||
? {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: hexToRgba(color, topAlpha) },
|
||||
{ offset: 1, color: hexToRgba(color, bottomAlpha) },
|
||||
],
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
}
|
||||
}),
|
||||
}
|
||||
@ -150,13 +231,25 @@ const chartOption = computed(() => {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wk-spark__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.wk-spark__title {
|
||||
margin: 0 0 8px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
}
|
||||
|
||||
.wk-spark__extra {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wk-spark__loading,
|
||||
.wk-spark__empty {
|
||||
display: flex;
|
||||
|
||||
@ -13,29 +13,47 @@
|
||||
allow-clear
|
||||
:placeholder="t('monitor.logistics.filter.allLines')"
|
||||
/>
|
||||
<a-radio-group v-model="regionPeriod" type="button" size="mini">
|
||||
<a-radio value="week">{{ t('workplace.orderAnalysis.week') }}</a-radio>
|
||||
<a-radio value="month">{{ t('workplace.orderAnalysis.month') }}</a-radio>
|
||||
</a-radio-group>
|
||||
<WorkplaceSegmented
|
||||
:model-value="regionPeriod"
|
||||
variant="text"
|
||||
:options="periodOptions"
|
||||
:aria-label="t('workplace.admin.role.customer')"
|
||||
@update:model-value="onPeriodChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="monitorAvailable">
|
||||
<WorkplaceKpiGrid :items="kpiItems" :loading="loading" @select="onSelect" />
|
||||
<WorkplaceSparkline
|
||||
:title="t('monitor.logistics.chart.customerOrdersByLine')"
|
||||
:labels="orderChart.labels"
|
||||
:series="orderChart.series"
|
||||
|
||||
<WorkplaceRankBars
|
||||
:title="rankTitle"
|
||||
:compare-items="rankItems"
|
||||
:sort-by="customerMetric"
|
||||
:order-label="t('workplace.admin.role.customerMetricOrders')"
|
||||
:receivable-label="t('workplace.admin.role.customerMetricReceivable')"
|
||||
:loading="loading"
|
||||
height="140px"
|
||||
:empty-text="t('workplace.admin.role.chartEmpty')"
|
||||
/>
|
||||
>
|
||||
<template #extra>
|
||||
<WorkplaceSegmented
|
||||
:model-value="customerMetric"
|
||||
variant="soft"
|
||||
:options="metricOptions"
|
||||
:aria-label="t('workplace.admin.role.customerRank')"
|
||||
@update:model-value="onMetricChange"
|
||||
/>
|
||||
</template>
|
||||
</WorkplaceRankBars>
|
||||
|
||||
<!-- 选中单线路时补一条时间趋势,避免只剩总量对比 -->
|
||||
<WorkplaceSparkline
|
||||
:title="t('monitor.logistics.chart.customerReceivableByLine')"
|
||||
:labels="receivableChart.labels"
|
||||
:series="receivableChart.series"
|
||||
v-if="lineFilter"
|
||||
:title="sparkTitle"
|
||||
:labels="sparkChart.labels"
|
||||
:series="sparkChart.series"
|
||||
:loading="loading"
|
||||
height="140px"
|
||||
height="120px"
|
||||
:empty-text="t('workplace.admin.role.chartEmpty')"
|
||||
/>
|
||||
</template>
|
||||
@ -48,16 +66,20 @@ import { computed, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { MonitorOverview } from '@/api/monitor'
|
||||
import { buildCustomerKpis } from '../../composables/workplaceRoleModels'
|
||||
import {
|
||||
buildCustomerKpis,
|
||||
buildCustomerLineCompare,
|
||||
} from '../../composables/workplaceRoleModels'
|
||||
import { navigateWorkplaceDrill } from '../../utils/workplaceLinks'
|
||||
import {
|
||||
buildRegionSparkSeries,
|
||||
pickRegionPeriodBundle,
|
||||
resolveActiveLineKeys,
|
||||
WORKPLACE_LINE_KEYS,
|
||||
type RegionPeriod,
|
||||
} from '../../utils/regionTrend'
|
||||
import WorkplaceKpiGrid, { type WorkplaceKpiItem } from '../WorkplaceKpiGrid.vue'
|
||||
import WorkplaceRankBars from '../WorkplaceRankBars.vue'
|
||||
import WorkplaceSegmented from '../WorkplaceSegmented.vue'
|
||||
import WorkplaceSparkline from '../WorkplaceSparkline.vue'
|
||||
import RolePanelShell from './RolePanelShell.vue'
|
||||
|
||||
@ -72,6 +94,17 @@ const router = useRouter()
|
||||
|
||||
const lineFilter = ref<string | undefined>(undefined)
|
||||
const regionPeriod = ref<RegionPeriod>('week')
|
||||
const customerMetric = ref<'order' | 'receivable'>('order')
|
||||
|
||||
const periodOptions = computed(() => [
|
||||
{ label: t('workplace.admin.period.byWeek'), value: 'week' },
|
||||
{ label: t('workplace.admin.period.byMonth'), value: 'month' },
|
||||
])
|
||||
|
||||
const metricOptions = computed(() => [
|
||||
{ label: t('workplace.admin.role.customerSortOrders'), value: 'order' },
|
||||
{ label: t('workplace.admin.role.customerSortReceivable'), value: 'receivable' },
|
||||
])
|
||||
|
||||
const subtitle = computed(() =>
|
||||
props.monitorAvailable
|
||||
@ -88,28 +121,48 @@ const lineOptions = computed(() =>
|
||||
|
||||
const kpiItems = computed(() => buildCustomerKpis(t, props.monitor))
|
||||
|
||||
const activeLineKeys = computed(() => {
|
||||
const orderBundle = pickRegionPeriodBundle(props.monitor, 'order', regionPeriod.value)
|
||||
return resolveActiveLineKeys(lineFilter.value || 'all', orderBundle)
|
||||
const rankTitle = computed(() => t('workplace.admin.role.customerRank'))
|
||||
|
||||
const rankItems = computed(() => {
|
||||
const all = buildCustomerLineCompare(t, props.monitor, regionPeriod.value)
|
||||
if (!lineFilter.value) return all
|
||||
return all.filter((item) => item.key === lineFilter.value)
|
||||
})
|
||||
|
||||
const orderChart = computed(() => {
|
||||
const bundle = pickRegionPeriodBundle(props.monitor, 'order', regionPeriod.value)
|
||||
return buildRegionSparkSeries(bundle, activeLineKeys.value, (key) =>
|
||||
t(`monitor.logistics.line.${key}`),
|
||||
const sparkTitle = computed(() =>
|
||||
customerMetric.value === 'receivable'
|
||||
? t('monitor.logistics.chart.customerReceivableByLine')
|
||||
: t('monitor.logistics.chart.customerOrdersByLine'),
|
||||
)
|
||||
|
||||
const sparkChart = computed(() => {
|
||||
const key = lineFilter.value
|
||||
if (!key) return { labels: [] as string[], series: [] as Array<{ name: string; data: number[] }> }
|
||||
const bundle = pickRegionPeriodBundle(
|
||||
props.monitor,
|
||||
customerMetric.value,
|
||||
regionPeriod.value,
|
||||
)
|
||||
})
|
||||
|
||||
const receivableChart = computed(() => {
|
||||
const bundle = pickRegionPeriodBundle(props.monitor, 'receivable', regionPeriod.value)
|
||||
return buildRegionSparkSeries(bundle, activeLineKeys.value, (key) =>
|
||||
t(`monitor.logistics.line.${key}`),
|
||||
return buildRegionSparkSeries(bundle, [key], (lineKey) =>
|
||||
t(`monitor.logistics.line.${lineKey}`),
|
||||
)
|
||||
})
|
||||
|
||||
function onSelect(item: WorkplaceKpiItem) {
|
||||
navigateWorkplaceDrill(router, item.path, item.query)
|
||||
}
|
||||
|
||||
function onPeriodChange(value: string) {
|
||||
if (value === 'week' || value === 'month') {
|
||||
regionPeriod.value = value
|
||||
}
|
||||
}
|
||||
|
||||
function onMetricChange(value: string) {
|
||||
if (value === 'order' || value === 'receivable') {
|
||||
customerMetric.value = value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
@ -5,33 +5,51 @@
|
||||
:clear-hint="clearHint"
|
||||
>
|
||||
<WorkplaceKpiGrid :items="kpiItems" :loading="loading" @select="onSelect" />
|
||||
<WorkplaceFunnelBar
|
||||
:title="t('workplace.admin.fulfillTitle')"
|
||||
:segments="fulfillSegments"
|
||||
@select="onFunnel"
|
||||
/>
|
||||
<WorkplaceFunnelBar
|
||||
:title="t('workplace.admin.pickupTitle')"
|
||||
:segments="pickupSegments"
|
||||
@select="onFunnel"
|
||||
/>
|
||||
|
||||
<div class="role-fulfill__queues">
|
||||
<WorkplaceQueueList
|
||||
:title="`${t('workplace.admin.fulfillTitle')} · ${fulfillHot}`"
|
||||
:items="fulfillItems"
|
||||
:loading="fulfillLoading"
|
||||
:empty-text="t('workplace.admin.role.queueEmpty')"
|
||||
:more-text="t('workplace.admin.role.queueMore')"
|
||||
@select="onQueueSelect"
|
||||
@more="onFulfillMore"
|
||||
/>
|
||||
<WorkplaceQueueList
|
||||
:title="`${t('workplace.admin.pickupTitle')} · ${pickupHot}`"
|
||||
:items="pickupItems"
|
||||
:loading="pickupLoading"
|
||||
:empty-text="t('workplace.admin.role.queueEmpty')"
|
||||
:more-text="t('workplace.admin.role.queueMore')"
|
||||
@select="onQueueSelect"
|
||||
@more="onPickupMore"
|
||||
/>
|
||||
</div>
|
||||
</RolePanelShell>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import dayjs from 'dayjs'
|
||||
import type { OrderWorkplaceStats } from '@/api/workplace'
|
||||
import { postOrderList } from '@/api/order'
|
||||
import { getPickupOrderList } from '@/api/order/pickupOrder'
|
||||
import {
|
||||
buildFulfillKpis,
|
||||
buildFulfillSegments,
|
||||
buildPickupSegments,
|
||||
clearHintFor,
|
||||
} from '../../composables/workplaceRoleModels'
|
||||
import { navigateWorkplaceDrill } from '../../utils/workplaceLinks'
|
||||
import {
|
||||
FULFILL_PATH,
|
||||
navigateWorkplaceDrill,
|
||||
PICKUP_PATH,
|
||||
} from '../../utils/workplaceLinks'
|
||||
import WorkplaceKpiGrid, { type WorkplaceKpiItem } from '../WorkplaceKpiGrid.vue'
|
||||
import WorkplaceFunnelBar, { type FunnelSegment } from '../WorkplaceFunnelBar.vue'
|
||||
import WorkplaceQueueList, { type WorkplaceQueueItem } from '../WorkplaceQueueList.vue'
|
||||
import RolePanelShell from './RolePanelShell.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@ -42,16 +60,184 @@ const props = defineProps<{
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
|
||||
const fulfillLoading = ref(false)
|
||||
const pickupLoading = ref(false)
|
||||
const fulfillItems = ref<WorkplaceQueueItem[]>([])
|
||||
const pickupItems = ref<WorkplaceQueueItem[]>([])
|
||||
const queueSeq = ref(0)
|
||||
|
||||
const PAGE_SIZE = 5
|
||||
|
||||
const kpiItems = computed(() => buildFulfillKpis(t, props.stats))
|
||||
const clearHint = computed(() => clearHintFor(t, kpiItems.value))
|
||||
const fulfillSegments = computed(() => buildFulfillSegments(t, props.stats))
|
||||
const pickupSegments = computed(() => buildPickupSegments(t, props.stats))
|
||||
|
||||
const fulfillHot = computed(() =>
|
||||
fulfillSegments.value
|
||||
.filter((s) => !s.done)
|
||||
.reduce((sum, s) => sum + (Number(s.value) || 0), 0),
|
||||
)
|
||||
|
||||
const pickupHot = computed(() =>
|
||||
pickupSegments.value.reduce((sum, s) => sum + (Number(s.value) || 0), 0),
|
||||
)
|
||||
|
||||
function pickField(row: Record<string, unknown>, ...keys: string[]) {
|
||||
for (const key of keys) {
|
||||
const val = row[key]
|
||||
if (val != null && String(val).trim() !== '') return val
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
function formatCreateTime(raw: unknown) {
|
||||
if (raw == null || raw === '') return ''
|
||||
const d = dayjs(raw as string | number | Date)
|
||||
if (!d.isValid()) return String(raw)
|
||||
const now = dayjs()
|
||||
if (d.isSame(now, 'day')) return d.format('HH:mm')
|
||||
if (d.isSame(now, 'year')) return d.format('MM-DD HH:mm')
|
||||
return d.format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
function fulfillProgressLabel(code: string) {
|
||||
const map: Record<string, string> = {
|
||||
domesticInTransit: 'workplace.admin.fulfill.domesticInTransit',
|
||||
arrivedPendingPick: 'workplace.admin.fulfill.arrivedPendingPick',
|
||||
outboundDone: 'workplace.admin.fulfill.outboundDone',
|
||||
pendingBind: 'workplace.admin.fulfill.pendingBind',
|
||||
}
|
||||
const key = map[String(code || '').trim()]
|
||||
return key ? t(key) : ''
|
||||
}
|
||||
|
||||
function pickupStatusLabel(status: string, payStatus: string) {
|
||||
if (String(payStatus).toLowerCase() === 'unpaid') {
|
||||
return t('workplace.admin.pickup.pendingPayment')
|
||||
}
|
||||
const map: Record<string, string> = {
|
||||
draft: 'workplace.admin.pickup.pendingSchedule',
|
||||
scheduled: 'workplace.admin.pickup.pendingPickup',
|
||||
picked: 'workplace.admin.pickup.pendingInbound',
|
||||
}
|
||||
const key = map[status]
|
||||
return key ? t(key) : status
|
||||
}
|
||||
|
||||
function mapFulfillRow(raw: Record<string, unknown>): WorkplaceQueueItem {
|
||||
const id = pickField(raw, 'id', 'Id')
|
||||
const orderNo = String(
|
||||
pickField(raw, 'serviceNo', 'ServiceNo', 'waybillNo', 'WaybillNo', 'clientNo', 'ClientNo') || '',
|
||||
)
|
||||
const progress = String(pickField(raw, 'fulfillProgress', 'FulfillProgress') || '')
|
||||
return {
|
||||
key: `fulfill-${id ?? orderNo}`,
|
||||
orderNo: orderNo || '—',
|
||||
customerName: String(pickField(raw, 'customerName', 'CustomerName') || ''),
|
||||
avatar: String(
|
||||
pickField(raw, 'wechatAvatar', 'WechatAvatar', 'wechatAvatarUrl', 'avatar', 'Avatar') || '',
|
||||
),
|
||||
createTimeText: formatCreateTime(pickField(raw, 'createTime', 'CreateTime')),
|
||||
stageLabel: fulfillProgressLabel(progress),
|
||||
path: FULFILL_PATH,
|
||||
raw,
|
||||
}
|
||||
}
|
||||
|
||||
function mapPickupRow(raw: Record<string, unknown>): WorkplaceQueueItem {
|
||||
const id = pickField(raw, 'id', 'Id')
|
||||
const orderNo = String(pickField(raw, 'pickupNo', 'PickupNo', 'serviceNo', 'ServiceNo') || '')
|
||||
const status = String(pickField(raw, 'status', 'Status') || '')
|
||||
const payStatus = String(pickField(raw, 'payStatus', 'PayStatus') || '')
|
||||
return {
|
||||
key: `pickup-${id ?? orderNo}`,
|
||||
orderNo: orderNo || '—',
|
||||
customerName: String(pickField(raw, 'customerName', 'CustomerName') || ''),
|
||||
avatar: String(
|
||||
pickField(raw, 'wechatAvatar', 'WechatAvatar', 'wechatAvatarUrl', 'avatar', 'Avatar') || '',
|
||||
),
|
||||
createTimeText: formatCreateTime(pickField(raw, 'createTime', 'CreateTime')),
|
||||
stageLabel: pickupStatusLabel(status, payStatus),
|
||||
path: PICKUP_PATH,
|
||||
raw,
|
||||
}
|
||||
}
|
||||
|
||||
async function loadQueues() {
|
||||
const seq = ++queueSeq.value
|
||||
fulfillLoading.value = true
|
||||
pickupLoading.value = true
|
||||
try {
|
||||
const [fulfillRes, pickupRes] = await Promise.all([
|
||||
postOrderList({
|
||||
page: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
status: 'all',
|
||||
fulfillmentType: 'warehouse',
|
||||
sortField: 'createTime',
|
||||
sortOrder: 'desc',
|
||||
}),
|
||||
getPickupOrderList({
|
||||
page: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
}),
|
||||
])
|
||||
if (seq !== queueSeq.value) return
|
||||
fulfillItems.value = (fulfillRes.items || []).map((row) =>
|
||||
mapFulfillRow(row as Record<string, unknown>),
|
||||
)
|
||||
pickupItems.value = (pickupRes.items || []).map((row) =>
|
||||
mapPickupRow(row as Record<string, unknown>),
|
||||
)
|
||||
} catch {
|
||||
if (seq !== queueSeq.value) return
|
||||
fulfillItems.value = []
|
||||
pickupItems.value = []
|
||||
} finally {
|
||||
if (seq === queueSeq.value) {
|
||||
fulfillLoading.value = false
|
||||
pickupLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.loading,
|
||||
() => {
|
||||
void loadQueues()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
function onSelect(item: WorkplaceKpiItem) {
|
||||
navigateWorkplaceDrill(router, item.path, item.query)
|
||||
}
|
||||
|
||||
function onFunnel(seg: FunnelSegment) {
|
||||
navigateWorkplaceDrill(router, seg.path, seg.query)
|
||||
function onQueueSelect(item: WorkplaceQueueItem) {
|
||||
navigateWorkplaceDrill(router, item.path, item.query)
|
||||
}
|
||||
|
||||
function onFulfillMore() {
|
||||
navigateWorkplaceDrill(router, FULFILL_PATH)
|
||||
}
|
||||
|
||||
function onPickupMore() {
|
||||
navigateWorkplaceDrill(router, PICKUP_PATH)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.role-fulfill__queues {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.role-fulfill__queues {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -5,28 +5,17 @@
|
||||
:clear-hint="clearHint"
|
||||
>
|
||||
<template v-if="monitorAvailable" #extra>
|
||||
<a-radio-group
|
||||
<WorkplaceSegmented
|
||||
:model-value="opsDimension"
|
||||
type="button"
|
||||
size="mini"
|
||||
variant="text"
|
||||
:options="dimensionOptions"
|
||||
:aria-label="t('workplace.admin.role.ops')"
|
||||
@update:model-value="onDimensionChange"
|
||||
>
|
||||
<a-radio value="day">{{ t('workplace.orderAnalysis.day') }}</a-radio>
|
||||
<a-radio value="week">{{ t('workplace.orderAnalysis.week') }}</a-radio>
|
||||
<a-radio value="month">{{ t('workplace.orderAnalysis.month') }}</a-radio>
|
||||
</a-radio-group>
|
||||
/>
|
||||
</template>
|
||||
|
||||
<WorkplaceKpiGrid :items="kpiItems" :loading="loading" @select="onSelect" />
|
||||
|
||||
<div class="role-ops__trend-head">
|
||||
<a-radio-group v-model="trendMode" type="button" size="mini">
|
||||
<a-radio value="volume">{{ t('workplace.admin.role.opsTrendVolume') }}</a-radio>
|
||||
<a-radio v-if="monitorAvailable" value="finance">
|
||||
{{ t('workplace.admin.role.opsTrendFinance') }}
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<WorkplaceSparkline
|
||||
:title="
|
||||
trendMode === 'finance'
|
||||
@ -35,9 +24,20 @@
|
||||
"
|
||||
:labels="trend.labels"
|
||||
:series="trend.series"
|
||||
:show-combo-rate="trendMode === 'volume'"
|
||||
:loading="loading"
|
||||
:empty-text="t('workplace.admin.role.chartEmpty')"
|
||||
/>
|
||||
>
|
||||
<template #extra>
|
||||
<WorkplaceSegmented
|
||||
:model-value="trendMode"
|
||||
variant="soft"
|
||||
:options="trendModeOptions"
|
||||
:aria-label="t('workplace.admin.role.opsTrend')"
|
||||
@update:model-value="onTrendModeChange"
|
||||
/>
|
||||
</template>
|
||||
</WorkplaceSparkline>
|
||||
</RolePanelShell>
|
||||
</template>
|
||||
|
||||
@ -58,6 +58,7 @@ import {
|
||||
} from '../../composables/workplaceRoleModels'
|
||||
import { navigateWorkplaceDrill } from '../../utils/workplaceLinks'
|
||||
import WorkplaceKpiGrid, { type WorkplaceKpiItem } from '../WorkplaceKpiGrid.vue'
|
||||
import WorkplaceSegmented from '../WorkplaceSegmented.vue'
|
||||
import WorkplaceSparkline from '../WorkplaceSparkline.vue'
|
||||
import RolePanelShell from './RolePanelShell.vue'
|
||||
|
||||
@ -79,6 +80,25 @@ const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const trendMode = ref<'volume' | 'finance'>('volume')
|
||||
|
||||
const dimensionOptions = computed(() => [
|
||||
{ label: t('workplace.admin.period.today'), value: 'day' },
|
||||
{ label: t('workplace.admin.period.week'), value: 'week' },
|
||||
{ label: t('workplace.admin.period.month'), value: 'month' },
|
||||
])
|
||||
|
||||
const trendModeOptions = computed(() => {
|
||||
const options = [
|
||||
{ label: t('workplace.admin.role.opsTrendVolume'), value: 'volume' },
|
||||
]
|
||||
if (props.monitorAvailable) {
|
||||
options.push({
|
||||
label: t('workplace.admin.role.opsTrendFinance'),
|
||||
value: 'finance',
|
||||
})
|
||||
}
|
||||
return options
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.monitorAvailable,
|
||||
(ok) => {
|
||||
@ -107,17 +127,15 @@ function onSelect(item: WorkplaceKpiItem) {
|
||||
navigateWorkplaceDrill(router, item.path, item.query)
|
||||
}
|
||||
|
||||
function onDimensionChange(value: string | number | boolean) {
|
||||
const dim = String(value) as MonitorDimension
|
||||
if (dim === 'day' || dim === 'week' || dim === 'month') {
|
||||
emit('update:opsDimension', dim)
|
||||
function onDimensionChange(value: string) {
|
||||
if (value === 'day' || value === 'week' || value === 'month') {
|
||||
emit('update:opsDimension', value)
|
||||
}
|
||||
}
|
||||
|
||||
function onTrendModeChange(value: string) {
|
||||
if (value === 'volume' || value === 'finance') {
|
||||
trendMode.value = value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.role-ops__trend-head {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import {
|
||||
getOrderWorkplaceBusinessTrend,
|
||||
getOrderWorkplaceStats,
|
||||
@ -42,29 +42,56 @@ const emptyStats = (): OrderWorkplaceStats => ({
|
||||
})
|
||||
|
||||
const AUTO_REFRESH_MS = 45_000
|
||||
/** 客服 / 客户等共享监控数据固定按周拉取(区域趋势内含 week/month) */
|
||||
const SHARED_MONITOR_DIMENSION: MonitorDimension = 'week'
|
||||
|
||||
export function useAdminWorkplaceData() {
|
||||
const loading = ref(false)
|
||||
/** 仅运营卡片切换今天/本周/本月时的局部 loading */
|
||||
const opsLoading = ref(false)
|
||||
const stats = ref<OrderWorkplaceStats>(emptyStats())
|
||||
const businessTrend = ref<OrderWorkplaceBusinessTrend | null>(null)
|
||||
const orderTrend = ref<OrderWorkplaceTrend | null>(null)
|
||||
/** 客服 / 客户面板用,不随运营维度切换 */
|
||||
const monitor = ref<MonitorOverview | null>(null)
|
||||
const monitorOpsByDim = ref<Partial<Record<MonitorDimension, MonitorOverview>>>({})
|
||||
const monitorAvailable = ref(false)
|
||||
/** 运营区经营维度,默认周 */
|
||||
const opsDimension = ref<MonitorDimension>('week')
|
||||
const updatedAt = ref<Date | null>(null)
|
||||
|
||||
const monitorOps = computed(
|
||||
() => monitorOpsByDim.value[opsDimension.value] ?? monitor.value,
|
||||
)
|
||||
|
||||
let autoTimer: number | undefined
|
||||
let refreshing = false
|
||||
|
||||
async function loadMonitor(dimension: MonitorDimension = opsDimension.value) {
|
||||
try {
|
||||
monitor.value = await getMonitorOverview(dimension)
|
||||
monitorAvailable.value = true
|
||||
} catch {
|
||||
monitor.value = null
|
||||
monitorAvailable.value = false
|
||||
async function fetchMonitor(dimension: MonitorDimension) {
|
||||
return getMonitorOverview(dimension)
|
||||
}
|
||||
|
||||
async function loadSharedMonitor() {
|
||||
const data = await fetchMonitor(SHARED_MONITOR_DIMENSION)
|
||||
monitor.value = data
|
||||
monitorOpsByDim.value = {
|
||||
...monitorOpsByDim.value,
|
||||
[SHARED_MONITOR_DIMENSION]: data,
|
||||
}
|
||||
monitorAvailable.value = true
|
||||
}
|
||||
|
||||
async function loadOpsMonitor(dimension: MonitorDimension, options?: { force?: boolean }) {
|
||||
if (!options?.force && monitorOpsByDim.value[dimension]) return
|
||||
const data = await fetchMonitor(dimension)
|
||||
monitorOpsByDim.value = {
|
||||
...monitorOpsByDim.value,
|
||||
[dimension]: data,
|
||||
}
|
||||
if (dimension === SHARED_MONITOR_DIMENSION) {
|
||||
monitor.value = data
|
||||
}
|
||||
monitorAvailable.value = true
|
||||
}
|
||||
|
||||
async function refresh(options?: { silent?: boolean }) {
|
||||
@ -82,7 +109,21 @@ export function useAdminWorkplaceData() {
|
||||
stats.value = statsRes
|
||||
businessTrend.value = businessRes
|
||||
orderTrend.value = orderRes
|
||||
await loadMonitor(opsDimension.value)
|
||||
|
||||
try {
|
||||
const opsDim = opsDimension.value
|
||||
if (opsDim === SHARED_MONITOR_DIMENSION) {
|
||||
await loadOpsMonitor(opsDim, { force: true })
|
||||
} else {
|
||||
await Promise.all([
|
||||
loadSharedMonitor(),
|
||||
loadOpsMonitor(opsDim, { force: true }),
|
||||
])
|
||||
}
|
||||
} catch {
|
||||
monitor.value = null
|
||||
monitorAvailable.value = false
|
||||
}
|
||||
updatedAt.value = new Date()
|
||||
} finally {
|
||||
if (!silent) loading.value = false
|
||||
@ -93,12 +134,18 @@ export function useAdminWorkplaceData() {
|
||||
async function setOpsDimension(dimension: MonitorDimension) {
|
||||
if (opsDimension.value === dimension) return
|
||||
opsDimension.value = dimension
|
||||
loading.value = true
|
||||
try {
|
||||
await loadMonitor(dimension)
|
||||
if (monitorOpsByDim.value[dimension]) {
|
||||
updatedAt.value = new Date()
|
||||
return
|
||||
}
|
||||
opsLoading.value = true
|
||||
try {
|
||||
await loadOpsMonitor(dimension)
|
||||
updatedAt.value = new Date()
|
||||
} catch {
|
||||
/* 保持上一维可用数据 */
|
||||
} finally {
|
||||
loading.value = false
|
||||
opsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,10 +174,12 @@ export function useAdminWorkplaceData() {
|
||||
|
||||
return {
|
||||
loading,
|
||||
opsLoading,
|
||||
stats,
|
||||
businessTrend,
|
||||
orderTrend,
|
||||
monitor,
|
||||
monitorOps,
|
||||
monitorAvailable,
|
||||
opsDimension,
|
||||
updatedAt,
|
||||
|
||||
@ -5,7 +5,6 @@ import {
|
||||
type FulfillWorkplaceStats,
|
||||
type PickupWorkplaceStats,
|
||||
} from '@/api/workplace'
|
||||
import iconBind from '@/assets/icons/workplace/order-bind.svg?url'
|
||||
import iconTransit from '@/assets/icons/workplace/order-transit.svg?url'
|
||||
import iconPick from '@/assets/icons/workplace/order-pick.svg?url'
|
||||
import iconPayment from '@/assets/icons/workplace/order-payment.svg?url'
|
||||
@ -69,17 +68,8 @@ async function loadStats() {
|
||||
export function useWorkplaceFulfillPickupStats() {
|
||||
const router = useRouter()
|
||||
|
||||
// 创建代发即已绑库存/包裹,工作台不再展示「待绑定」
|
||||
const fulfillItems = computed<WorkplaceStatItem[]>(() => [
|
||||
{
|
||||
key: 'pendingBind',
|
||||
titleKey: 'workplace.admin.fulfill.pendingBind',
|
||||
value: fulfill.value.pendingBind,
|
||||
icon: iconBind,
|
||||
tone: 'warning',
|
||||
alert: true,
|
||||
path: FULFILL_PATH,
|
||||
query: { progress: 'pendingBind' },
|
||||
},
|
||||
{
|
||||
key: 'domesticInTransit',
|
||||
titleKey: 'workplace.admin.fulfill.domesticInTransit',
|
||||
|
||||
@ -29,7 +29,6 @@ import iconPendingShip from '@/assets/icons/workplace/order-pending-ship.svg?url
|
||||
import iconPayment from '@/assets/icons/workplace/order-payment.svg?url'
|
||||
import iconGrowth from '@/assets/icons/workplace/order-growth.svg?url'
|
||||
import iconProblematic from '@/assets/icons/workplace/order-problematic.svg?url'
|
||||
import iconBind from '@/assets/icons/workplace/order-bind.svg?url'
|
||||
import iconTransit from '@/assets/icons/workplace/order-transit.svg?url'
|
||||
import iconPick from '@/assets/icons/workplace/order-pick.svg?url'
|
||||
import iconPickup from '@/assets/icons/workplace/order-pickup.svg?url'
|
||||
@ -40,6 +39,10 @@ export type WorkplaceTrendSeries = {
|
||||
name: string
|
||||
data: number[]
|
||||
color?: string
|
||||
/** 缺省 line;业务量用 bar+line 组合 */
|
||||
type?: 'line' | 'bar'
|
||||
/** 折线是否铺面积(财务双面积) */
|
||||
area?: boolean
|
||||
}
|
||||
|
||||
export function buildOpsKpis(
|
||||
@ -140,11 +143,15 @@ export function buildOpsTrend(
|
||||
name: t('workplace.admin.role.revenue'),
|
||||
data: monitor?.revenueTrend?.map((p) => p.revenue) || [],
|
||||
color: '#054f74',
|
||||
type: 'line',
|
||||
area: true,
|
||||
},
|
||||
{
|
||||
name: t('workplace.admin.role.grossProfit'),
|
||||
data: monitor?.revenueTrend?.map((p) => p.grossProfit) || [],
|
||||
color: '#14B8A6',
|
||||
type: 'line',
|
||||
area: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
@ -164,6 +171,7 @@ export function buildOpsTrend(
|
||||
name: t('workplace.orderAnalysis.forecast'),
|
||||
data: waybill,
|
||||
color: '#054f74',
|
||||
type: 'bar',
|
||||
},
|
||||
]
|
||||
if (shipped.length) {
|
||||
@ -171,6 +179,7 @@ export function buildOpsTrend(
|
||||
name: t('workplace.orderAnalysis.shipped'),
|
||||
data: shipped,
|
||||
color: '#D9924A',
|
||||
type: 'line',
|
||||
})
|
||||
}
|
||||
return { labels, series }
|
||||
@ -179,18 +188,8 @@ export function buildOpsTrend(
|
||||
export function buildFulfillKpis(t: TFunc, stats: OrderWorkplaceStats): WorkplaceKpiItem[] {
|
||||
const f = stats.fulfill
|
||||
const p = stats.pickup
|
||||
// 创建代发即已绑库存/包裹,工作台不再展示「待绑定」
|
||||
return prioritizeActiveKpis([
|
||||
{
|
||||
key: 'pendingBind',
|
||||
label: t('workplace.admin.fulfill.pendingBind'),
|
||||
value: f.pendingBind,
|
||||
unit: t('workplace.pecs'),
|
||||
icon: iconBind,
|
||||
tone: 'warning',
|
||||
alert: true,
|
||||
path: fulfillLink.pendingBind.path,
|
||||
query: fulfillLink.pendingBind.query,
|
||||
},
|
||||
{
|
||||
key: 'domesticInTransit',
|
||||
label: t('workplace.admin.fulfill.domesticInTransit'),
|
||||
@ -229,13 +228,6 @@ export function buildFulfillKpis(t: TFunc, stats: OrderWorkplaceStats): Workplac
|
||||
export function buildFulfillSegments(t: TFunc, stats: OrderWorkplaceStats): FunnelSegment[] {
|
||||
const f = stats.fulfill
|
||||
return [
|
||||
{
|
||||
key: 'pendingBind',
|
||||
label: t('workplace.admin.fulfill.pendingBind'),
|
||||
value: f.pendingBind,
|
||||
path: fulfillLink.pendingBind.path,
|
||||
query: fulfillLink.pendingBind.query,
|
||||
},
|
||||
{
|
||||
key: 'domesticInTransit',
|
||||
label: t('workplace.admin.fulfill.domesticInTransit'),
|
||||
@ -299,7 +291,7 @@ export function calcFulfillHotTotal(stats: OrderWorkplaceStats): number {
|
||||
const f = stats.fulfill
|
||||
const p = stats.pickup
|
||||
return (
|
||||
(Number(f.pendingBind) || 0) +
|
||||
(Number(f.domesticInTransit) || 0) +
|
||||
(Number(f.arrivedPendingPick) || 0) +
|
||||
(Number(p.pendingPayment) || 0) +
|
||||
(Number(p.pendingSchedule) || 0) +
|
||||
@ -449,24 +441,44 @@ export function buildCustomerKpis(
|
||||
]
|
||||
}
|
||||
|
||||
function sumRegionSeries(
|
||||
monitor: MonitorOverview | null,
|
||||
metric: 'order' | 'receivable',
|
||||
period: RegionPeriod,
|
||||
lineKey: string,
|
||||
): number {
|
||||
const bundle = pickRegionPeriodBundle(monitor, metric, period)
|
||||
const matched = bundle?.series?.find(
|
||||
(item) => String(item.region).toLowerCase() === lineKey,
|
||||
)
|
||||
return (matched?.values ?? []).reduce((acc, n) => acc + (Number(n) || 0), 0)
|
||||
}
|
||||
|
||||
export function buildCustomerLineRank(
|
||||
t: TFunc,
|
||||
monitor: MonitorOverview | null,
|
||||
metric: 'order' | 'receivable',
|
||||
period: RegionPeriod,
|
||||
): Array<{ key: string; label: string; value: number }> {
|
||||
const bundle = pickRegionPeriodBundle(monitor, metric, period)
|
||||
return WORKPLACE_LINE_KEYS.map((key) => {
|
||||
const matched = bundle?.series?.find(
|
||||
(item) => String(item.region).toLowerCase() === key,
|
||||
)
|
||||
const value = (matched?.values ?? []).reduce((acc, n) => acc + (Number(n) || 0), 0)
|
||||
return {
|
||||
key,
|
||||
label: t(`monitor.logistics.line.${key}`),
|
||||
value,
|
||||
}
|
||||
})
|
||||
return WORKPLACE_LINE_KEYS.map((key) => ({
|
||||
key,
|
||||
label: t(`monitor.logistics.line.${key}`),
|
||||
value: sumRegionSeries(monitor, metric, period, key),
|
||||
}))
|
||||
}
|
||||
|
||||
/** 线路双指标对比:单量 + 应收同屏 */
|
||||
export function buildCustomerLineCompare(
|
||||
t: TFunc,
|
||||
monitor: MonitorOverview | null,
|
||||
period: RegionPeriod,
|
||||
): Array<{ key: string; label: string; order: number; receivable: number }> {
|
||||
return WORKPLACE_LINE_KEYS.map((key) => ({
|
||||
key,
|
||||
label: t(`monitor.logistics.line.${key}`),
|
||||
order: sumRegionSeries(monitor, 'order', period, key),
|
||||
receivable: sumRegionSeries(monitor, 'receivable', period, key),
|
||||
}))
|
||||
}
|
||||
|
||||
export function kpiAlertSum(items: WorkplaceKpiItem[]): number {
|
||||
|
||||
@ -167,18 +167,34 @@ export default {
|
||||
'workplace.admin.inboxOpenHint': 'Click to open',
|
||||
'workplace.admin.role.ops': 'Operations',
|
||||
'workplace.admin.role.opsHint': 'Volume, conversion, and business summary',
|
||||
'workplace.admin.period.today': 'Today',
|
||||
'workplace.admin.period.week': 'This week',
|
||||
'workplace.admin.period.month': 'This month',
|
||||
'workplace.admin.period.byWeek': 'Weekly',
|
||||
'workplace.admin.period.byMonth': 'Monthly',
|
||||
'workplace.admin.role.opsTrend': 'Last 7 days created / shipped',
|
||||
'workplace.admin.role.opsTrendVolume': 'Volume',
|
||||
'workplace.admin.role.opsTrendFinance': 'Revenue / margin',
|
||||
'workplace.admin.role.shipRate': 'Ship rate {n}%',
|
||||
'workplace.admin.role.fulfill': 'Warehouse',
|
||||
'workplace.admin.role.fulfillHint': 'Fulfillment and pickup queues',
|
||||
'workplace.admin.role.queueEmpty': 'No orders in this stage',
|
||||
'workplace.admin.role.queueMore': 'View all',
|
||||
'workplace.admin.role.cs': 'Support',
|
||||
'workplace.admin.role.csHint': 'Exceptions and service quality',
|
||||
'workplace.admin.role.csQuality': 'Service quality',
|
||||
'workplace.admin.role.csNoMonitor': 'Track quality metrics unavailable',
|
||||
'workplace.admin.role.customer': 'Customers',
|
||||
'workplace.admin.role.customerHint': 'Scale, activity, and lane trends',
|
||||
'workplace.admin.role.customerHint': 'Scale, activity, and lane comparison',
|
||||
'workplace.admin.role.customerNoMonitor': 'Customer metrics unavailable',
|
||||
'workplace.admin.role.customerOrders': 'Lane volume',
|
||||
'workplace.admin.role.customerReceivable': 'Lane AR',
|
||||
'workplace.admin.role.customerRank': 'Lane performance',
|
||||
'workplace.admin.role.customerSortOrders': 'By volume',
|
||||
'workplace.admin.role.customerSortReceivable': 'By AR',
|
||||
'workplace.admin.role.customerMetricOrders': 'Orders',
|
||||
'workplace.admin.role.customerMetricReceivable': 'AR',
|
||||
'workplace.admin.role.customerShare': '{n}% share',
|
||||
'workplace.admin.role.clearHint': 'All clear — no backlog right now',
|
||||
'workplace.admin.role.chartEmpty': 'No trend data',
|
||||
'workplace.admin.role.pendingSign': 'Pending delivery',
|
||||
|
||||
@ -167,18 +167,34 @@ export default {
|
||||
'workplace.admin.inboxOpenHint': '点击查看详情',
|
||||
'workplace.admin.role.ops': '运营',
|
||||
'workplace.admin.role.opsHint': '建单量、转化与经营摘要',
|
||||
'workplace.admin.period.today': '今天',
|
||||
'workplace.admin.period.week': '本周',
|
||||
'workplace.admin.period.month': '本月',
|
||||
'workplace.admin.period.byWeek': '近周',
|
||||
'workplace.admin.period.byMonth': '近月',
|
||||
'workplace.admin.role.opsTrend': '近7日建单 / 发货',
|
||||
'workplace.admin.role.opsTrendVolume': '业务量',
|
||||
'workplace.admin.role.opsTrendFinance': '营收 / 毛利',
|
||||
'workplace.admin.role.shipRate': '发货率 {n}%',
|
||||
'workplace.admin.role.fulfill': '操作',
|
||||
'workplace.admin.role.fulfillHint': '代发与揽收队列',
|
||||
'workplace.admin.role.queueEmpty': '该阶段暂无单据',
|
||||
'workplace.admin.role.queueMore': '查看全部',
|
||||
'workplace.admin.role.cs': '客服',
|
||||
'workplace.admin.role.csHint': '异常跟进与服务质量',
|
||||
'workplace.admin.role.csQuality': '服务质量',
|
||||
'workplace.admin.role.csNoMonitor': '暂无轨迹服务指标权限',
|
||||
'workplace.admin.role.customer': '客户',
|
||||
'workplace.admin.role.customerHint': '客户规模、活跃与线路趋势',
|
||||
'workplace.admin.role.customerHint': '客户规模、活跃与线路对比',
|
||||
'workplace.admin.role.customerNoMonitor': '客户经营数据暂无权限',
|
||||
'workplace.admin.role.customerOrders': '线路单量',
|
||||
'workplace.admin.role.customerReceivable': '线路应收',
|
||||
'workplace.admin.role.customerRank': '线路表现',
|
||||
'workplace.admin.role.customerSortOrders': '按单量',
|
||||
'workplace.admin.role.customerSortReceivable': '按应收',
|
||||
'workplace.admin.role.customerMetricOrders': '单量',
|
||||
'workplace.admin.role.customerMetricReceivable': '应收',
|
||||
'workplace.admin.role.customerShare': '占 {n}%',
|
||||
'workplace.admin.role.clearHint': '当前畅通,没有积压待办',
|
||||
'workplace.admin.role.chartEmpty': '暂无趋势数据',
|
||||
'workplace.admin.role.pendingSign': '待签收',
|
||||
|
||||
@ -25,7 +25,6 @@ export const waybillLink = {
|
||||
}
|
||||
|
||||
export const fulfillLink = {
|
||||
pendingBind: { path: FULFILL_PATH, query: { progress: 'pendingBind' } },
|
||||
domesticInTransit: { path: FULFILL_PATH, query: { progress: 'domesticInTransit' } },
|
||||
arrivedPendingPick: { path: FULFILL_PATH, query: { progress: 'arrivedPendingPick' } },
|
||||
outboundDone: { path: FULFILL_PATH, query: { progress: 'outboundDone' } },
|
||||
|
||||
@ -133,7 +133,7 @@ function normalizeRow(raw: any) {
|
||||
}
|
||||
|
||||
function fulfillProgressLabel(code: string) {
|
||||
const key = `order.fulfillOrders.progress.${code || 'pendingBind'}`
|
||||
const key = `order.fulfillOrders.progress.${code || 'arrivedPendingPick'}`
|
||||
const text = t(key)
|
||||
return text === key ? code : text
|
||||
}
|
||||
|
||||
@ -368,7 +368,6 @@
|
||||
/** Tab 下动作优先级(越靠前越优先外露,最4 个) */
|
||||
const FULFILL_TAB_TOOLBAR_ACTION_ORDER: Record<string, ToolbarActionKey[]> = {
|
||||
all: ['stockBind', 'pay', 'predeclare', 'batchPrint', 'modifyOrder', 'delete', 'export'],
|
||||
pendingBind: ['stockBind', 'modifyOrder', 'predeclare', 'delete', 'pay', 'export'],
|
||||
domesticInTransit: ['batchPrint', 'export'],
|
||||
arrivedPendingPick: ['batchPrint', 'export'],
|
||||
outboundDone: ['batchPrint', 'export'],
|
||||
@ -377,12 +376,12 @@
|
||||
/** 按当前状态收敛工具栏,避免客户在无关 Tab 看到一排无效按*/
|
||||
const showPayAction = computed(() =>
|
||||
isFulfillList.value
|
||||
? isFulfillProgressTab('all', 'pendingBind')
|
||||
? isFulfillProgressTab('all')
|
||||
: isActiveTab('all', 'pendingPayment'),
|
||||
);
|
||||
const showPredeclareAction = computed(() =>
|
||||
isFulfillList.value
|
||||
? isFulfillProgressTab('all', 'pendingBind')
|
||||
? isFulfillProgressTab('all')
|
||||
: isActiveTab('all', 'draft', 'predeclared'),
|
||||
);
|
||||
const showPrintAction = computed(() =>
|
||||
@ -401,7 +400,7 @@
|
||||
);
|
||||
const showModifyOrderAction = computed(() =>
|
||||
isFulfillList.value
|
||||
? isFulfillProgressTab('all', 'pendingBind', 'domesticInTransit')
|
||||
? isFulfillProgressTab('all', 'domesticInTransit')
|
||||
: isActiveTab('all', 'draft', 'predeclared', 'pendingAllocation', 'pendingPayment', 'pendingShip'),
|
||||
);
|
||||
const showInterceptActions = computed(() =>
|
||||
@ -410,7 +409,7 @@
|
||||
);
|
||||
const showDeleteAction = computed(() =>
|
||||
isFulfillList.value
|
||||
? isFulfillProgressTab('pendingBind')
|
||||
? isFulfillProgressTab('all')
|
||||
: isActiveTab('all', 'draft', 'predeclared'),
|
||||
);
|
||||
const showCreatePickupAction = computed(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user