Merge branch 'dev' into order-delivery-reply

# Conflicts:
#	.env.shared
#	backend/app/api/chat.py
#	backend/app/core/config/settings.py
#	backend/app/models/user.py
#	backend/app/services/admin/permission_service.py
#	docs/demand.md
#	frontend/src/app/router/routes/workspace.routes.ts
#	frontend/src/features/admin/modules/users/components/UserFormModal.vue
#	frontend/src/features/admin/modules/users/composables/useUsersAdmin.ts
#	frontend/src/features/admin/types/user.types.ts
#	frontend/src/features/auth/stores/auth.store.ts
#	frontend/src/features/user/views/UserProfilePage.vue
#	frontend/src/locales/en/admin.json
#	frontend/src/locales/en/errors.json
#	frontend/src/locales/th/admin.json
#	frontend/src/locales/th/errors.json
#	frontend/src/locales/zh-CN/admin.json
#	frontend/src/locales/zh-CN/errors.json
#	frontend/src/locales/zh-TW/admin.json
#	frontend/src/locales/zh-TW/errors.json
#	frontend/src/shared/utils/auth.ts
This commit is contained in:
HTEWJ\26070045 committed 2026-09-22 10:37:59 +08:00
commit 616034a4cd
541 files changed
+43805 -14767

No files matched your search

@@ -9,7 +9,7 @@
* 业务员(部门副文案) → 客户订单 → 规格 → 单位;独立的部门列/品名列已并入合并展示。
* 浏览体验:页面高度收敛至视口(滚动全部发生在表格容器内 → 列头 sticky 固定、横向滚动条
* 常驻表格底缘);左侧冻结前四列标识区(勾选/客户编号/订单日期/订单单号:项次,
* 冻结单元格用实色背景防透出);筛选区与工具栏字号与表格统一(text-xs)并压缩高度。
* 冻结单元格用实色背景防透出);筛选区与工具栏字号与表格统一(text-sm 14px)并压缩高度。
*/
<script setup lang="ts">
@@ -318,14 +318,15 @@ onMounted(() => {
</script>
<template>
<!-- 全页统一字号:与表头一致(text-xs 12px),根容器设定基准,子元素不再覆写 -->
<!-- 全页统一字号:与表头一致(text-sm 14px),根容器设定基准,子元素不再覆写;
唯一例外:交期回复状态/交期已锁定徽标保持 text-xs(12px)加粗 -->
<!-- 高度收敛至视口(h-screen + overflow-hidden):页面自身不滚动,滚动全部在表格容器内,
列头 sticky 固定、横向滚动条常驻表格底缘;聊天壳 iframe 与独立路由均适用 -->
<div class="flex h-screen flex-col gap-4 overflow-hidden p-6 text-xs">
<div class="flex h-screen flex-col gap-4 overflow-hidden p-6 text-sm">
<!-- 页头:标题 + 最近同步 + 手动刷新 -->
<div class="flex flex-wrap items-center gap-3">
<h1 class="font-bold text-primary">{{ t('workspace.nav.orderDeliveryReply') }}</h1>
<span class="rounded-full px-3 py-1 text-xs" :class="latestSyncFailed ? 'bg-rose-50 text-rose-600' : 'bg-blue-50 text-blue-600'">
<span class="rounded-full px-3 py-1" :class="latestSyncFailed ? 'bg-rose-50 text-rose-600' : 'bg-blue-50 text-blue-600'">
{{ latestSyncText }}
</span>
<div class="flex-1" />
@@ -334,20 +335,20 @@ onMounted(() => {
</button>
</div>
<!-- 搜索区:合并关键词搜索(订单/产品/客户命中任一字段),字号与表格统一(text-xs),shrink-0 防压缩 -->
<!-- 搜索区:合并关键词搜索(订单/产品/客户命中任一字段),字号与表格统一(text-sm),shrink-0 防压缩 -->
<div class="flex shrink-0 flex-wrap items-end gap-3 rounded-2xl border border-default bg-surface px-4 py-2.5">
<label class="flex flex-col gap-1 text-xs text-muted">
<label class="flex flex-col gap-1 text-muted">
{{ t('workspace.orderDeliveryReply.filterKeyword') }}
<input v-model="filters.keyword" class="h-8 min-w-[340px] rounded-lg border border-default px-3 text-xs text-primary outline-none focus:border-blue-500" :placeholder="t('workspace.orderDeliveryReply.filterKeywordPh')" @keyup.enter="doSearch" />
<input v-model="filters.keyword" class="h-8 min-w-[340px] rounded-lg border border-default px-3 text-primary outline-none focus:border-blue-500" :placeholder="t('workspace.orderDeliveryReply.filterKeywordPh')" @keyup.enter="doSearch" />
</label>
<label class="flex flex-col gap-1 text-xs text-muted">
<label class="flex flex-col gap-1 text-muted">
{{ t('workspace.orderDeliveryReply.filterOrderDate') }}
<input v-model="filters.order_date" type="date" class="h-8 rounded-lg border border-default px-3 text-xs text-primary outline-none focus:border-blue-500" />
<input v-model="filters.order_date" type="date" class="h-8 rounded-lg border border-default px-3 text-primary outline-none focus:border-blue-500" />
</label>
<label class="flex flex-col gap-1 text-xs text-muted">
<label class="flex flex-col gap-1 text-muted">
{{ t('workspace.orderDeliveryReply.filterStatus') }}
<!-- 状态筛选选择即生效(无需再点查询);其余条件仍由「查询」统一提交 -->
<select v-model="filters.status" class="h-8 min-w-[140px] rounded-lg border border-default bg-white px-3 text-xs text-primary outline-none focus:border-blue-500" @change="doSearch">
<select v-model="filters.status" class="min-w-[140px] rounded-lg border border-default bg-white px-3 py-[5px] text-sm leading-5 text-primary outline-none focus:border-blue-500" @change="doSearch">
<option value="">{{ t('workspace.orderDeliveryReply.statusAll') }}</option>
<option value="replied">{{ t('workspace.orderDeliveryReply.statusReplied') }}</option>
<option value="not_fully_replied">{{ t('workspace.orderDeliveryReply.statusNotFully') }}</option>
@@ -356,7 +357,7 @@ onMounted(() => {
<button type="button" class="btn-primary h-8" @click="doSearch">{{ t('workspace.orderDeliveryReply.search') }}</button>
<button type="button" class="btn-ghost h-8" @click="doReset">{{ t('workspace.orderDeliveryReply.reset') }}</button>
<div class="flex-1" />
<span class="text-xs text-muted">{{ t('workspace.orderDeliveryReply.totalCount', { count: total }) }}</span>
<span class="text-muted">{{ t('workspace.orderDeliveryReply.totalCount', { count: total }) }}</span>
</div>
<!-- 工具栏:全选 + 联合回复 + 批量通知(shrink-0 防压缩,py-2 紧凑高度) -->
@@ -375,14 +376,14 @@ onMounted(() => {
</button>
</template>
<div class="flex-1" />
<span class="whitespace-nowrap rounded-full bg-slate-100 px-3 py-1 text-xs text-muted">{{ t('workspace.orderDeliveryReply.toolbarHint') }}</span>
<span class="whitespace-nowrap rounded-full bg-slate-100 px-3 py-1 text-muted">{{ t('workspace.orderDeliveryReply.toolbarHint') }}</span>
</div>
<!-- 列表 -->
<div class="min-h-0 flex-1 overflow-auto rounded-2xl border border-default bg-surface">
<table class="w-full border-collapse">
<!-- z-30 高于表体冻结单元格(z-20):纵向滚动时冻结列不会盖住表头 -->
<thead class="sticky top-0 z-30 bg-slate-50 text-xs text-muted [&_th]:whitespace-nowrap">
<thead class="sticky top-0 z-30 bg-slate-50 text-muted [&_th]:whitespace-nowrap">
<tr>
<!-- 左侧冻结标识区(前四列):勾选/客户编号/订单日期/订单单号:项次,宽度固定保证偏移对齐 -->
<th class="sticky left-0 z-30 w-8 bg-slate-50 px-2 py-2" />
@@ -422,21 +423,21 @@ onMounted(() => {
:title="line.customer_full_name || line.customer_short_name || ''"
>
<div>{{ line.customer_no || '—' }}</div>
<div class="truncate text-xs text-muted">{{ line.customer_short_name || '' }}</div>
<div class="truncate text-muted">{{ line.customer_short_name || '' }}</div>
</td>
<td
class="sticky left-[10rem] z-20 w-24 min-w-[6rem] max-w-[6rem] overflow-hidden px-2 py-1.5"
:class="selected.includes(lineKey(line)) ? 'bg-blue-100 group-hover:bg-blue-200' : 'bg-white group-hover:bg-slate-100'"
>{{ line.order_date || '—' }}</td>
<td
class="sticky left-[16rem] z-20 w-40 min-w-[10rem] max-w-[10rem] overflow-hidden whitespace-nowrap border-r border-default px-2 py-1.5 font-mono text-xs shadow-[2px_0_6px_-2px_rgba(15,23,42,0.12)]"
class="sticky left-[16rem] z-20 w-40 min-w-[10rem] max-w-[10rem] overflow-hidden whitespace-nowrap border-r border-default px-2 py-1.5 font-mono shadow-[2px_0_6px_-2px_rgba(15,23,42,0.12)]"
:class="selected.includes(lineKey(line)) ? 'bg-blue-100 group-hover:bg-blue-200' : 'bg-white group-hover:bg-slate-100'"
>{{ line.order_no }}:{{ line.line_no }}</td>
<td class="px-2 py-1.5" :title="line.part_name || ''">
<div class="max-w-[10rem] truncate font-mono text-xs">{{ line.part_no || '—' }}</div>
<div class="max-w-[14rem] truncate text-xs text-muted">{{ line.part_name || '' }}</div>
<div class="max-w-[10rem] truncate font-mono">{{ line.part_no || '—' }}</div>
<div class="max-w-[14rem] truncate text-muted">{{ line.part_name || '' }}</div>
</td>
<td class="whitespace-nowrap px-2 py-1.5 font-mono text-xs">{{ line.customer_part_no || '—' }}</td>
<td class="whitespace-nowrap px-2 py-1.5 font-mono">{{ line.customer_part_no || '—' }}</td>
<td class="px-2 py-2 text-right tabular-nums">{{ line.qty ?? '—' }}</td>
<td class="whitespace-nowrap px-2 py-1.5">{{ line.agreed_date || '—' }}</td>
<td class="px-2 py-1.5">
@@ -449,19 +450,19 @@ onMounted(() => {
<template v-if="line.batches.length === 0">
<span class="text-muted">{{ t('workspace.orderDeliveryReply.statusNotReplied') }}</span>
<div v-if="canManage" class="mt-0.5">
<button type="button" class="rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-xs text-blue-600" @click="openSingleReply(line)">
<button type="button" class="rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-blue-600" @click="openSingleReply(line)">
{{ t('workspace.orderDeliveryReply.replyAction') }}
</button>
</div>
</template>
<template v-else>
<div class="flex items-center gap-2">
<span class="whitespace-nowrap rounded-full border border-default bg-slate-50 px-2 py-0.5 text-xs text-muted">
<span class="whitespace-nowrap rounded-full border border-default bg-slate-50 px-2 py-0.5 text-muted">
{{ t('workspace.orderDeliveryReply.batchCount', { count: line.batches.length }) }} ·
{{ t('workspace.orderDeliveryReply.repliedOf', { replied: repliedQty(line), remain: undelivered(line) }) }}
<span v-if="repliedQty(line) > undelivered(line)" class="ml-1 font-semibold text-orange-500">{{ t('workspace.orderDeliveryReply.overTag') }}</span>
</span>
<button v-if="line.batches.length > 1" type="button" class="rounded-full border border-default px-2 py-0.5 text-xs text-blue-600" @click="toggleExpand(lineKey(line))">
<button v-if="line.batches.length > 1" type="button" class="rounded-full border border-default px-2 py-0.5 text-blue-600" @click="toggleExpand(lineKey(line))">
{{ expanded.includes(lineKey(line)) ? t('workspace.orderDeliveryReply.collapse') : t('workspace.orderDeliveryReply.expand', { count: line.batches.length - 1 }) }}
</button>
</div>
@@ -470,7 +471,7 @@ onMounted(() => {
v-for="(batch, idx) in line.batches"
:key="batch.seq ?? idx"
v-show="expanded.includes(lineKey(line)) || idx === 0"
class="max-w-[230px] truncate rounded border-l-[3px] border-blue-500 bg-blue-50/50 px-2 py-0.5 text-xs text-secondary"
class="max-w-[230px] truncate rounded border-l-[3px] border-blue-500 bg-blue-50/50 px-2 py-0.5 text-secondary"
>
{{ batch.planned_date }} · <b class="text-blue-600">{{ batch.qty }}</b> {{ line.unit }}
<i v-if="batch.remark" class="ml-1 not-italic text-muted">{{ batch.remark }}</i>
@@ -478,7 +479,7 @@ onMounted(() => {
</div>
<div class="mt-0.5">
<span v-if="line.locked" class="rounded-full bg-emerald-50 px-2.5 py-0.5 text-xs font-semibold text-emerald-600">{{ t('workspace.orderDeliveryReply.lockedTag') }}</span>
<button v-else-if="canManage" type="button" class="rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-xs text-blue-600" @click="openSingleReply(line)">
<button v-else-if="canManage" type="button" class="rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-blue-600" @click="openSingleReply(line)">
{{ t('workspace.orderDeliveryReply.editReplyAction') }}
</button>
</div>
@@ -487,9 +488,9 @@ onMounted(() => {
<!-- 交期回复人员:锁定行附带已通知对象与时间(原「通知业务部门」列已取消,信息并入此处) -->
<td class="px-2 py-1.5">
<template v-if="line.notified_employee_id || line.notified_user_name">
<div class="font-mono text-xs">{{ line.notified_employee_id || '' }}</div>
<div class="text-xs text-muted">{{ line.notified_user_name || '' }}</div>
<div v-if="line.locked" class="text-xs text-emerald-600">
<div class="font-mono">{{ line.notified_employee_id || '' }}</div>
<div class="text-muted">{{ line.notified_user_name || '' }}</div>
<div v-if="line.locked" class="text-emerald-600">
{{ t('workspace.orderDeliveryReply.notifiedTag', { name: line.salesperson_name || line.salesperson_code || '' }) }}
<span class="text-muted">{{ line.notified_at || '' }}</span>
</div>
@@ -499,9 +500,9 @@ onMounted(() => {
<!-- 业务员(副文案部门):与客户编号/简称同款合并展示,独立部门列已取消 -->
<td class="px-2 py-1.5" :title="line.salesperson_code || ''">
<div class="whitespace-nowrap">{{ line.salesperson_name || line.salesperson_code || '—' }}</div>
<div class="text-xs text-muted">{{ line.dept_name || line.dept_code || '' }}</div>
<div class="text-muted">{{ line.dept_name || line.dept_code || '' }}</div>
</td>
<td class="px-2 py-1.5 font-mono text-xs" :title="line.customer_po || ''"><span class="block max-w-[10rem] truncate">{{ line.customer_po || '—' }}</span></td>
<td class="px-2 py-1.5 font-mono" :title="line.customer_po || ''"><span class="block max-w-[10rem] truncate">{{ line.customer_po || '—' }}</span></td>
<td class="px-2 py-1.5" :title="line.spec || ''"><span class="block max-w-[10rem] truncate">{{ line.spec || '—' }}</span></td>
<td class="px-2 py-1.5">{{ line.unit || '—' }}</td>
</tr>
@@ -514,7 +515,7 @@ onMounted(() => {
<!-- 分页:复用管理控制台-数据报表的 PaginationBar(摘要 + 每页条数 + 页码按钮) -->
<PaginationBar
class="[&_*]:!text-xs"
class="[&_*]:!text-sm"
:page="page"
:page-size="pageSize"
:total="total"
@@ -534,18 +535,18 @@ onMounted(() => {
<div class="flex-1 overflow-auto px-5 py-4">
<!-- 快速统一交期 -->
<div class="mb-4 flex flex-wrap items-end gap-3 rounded-xl border border-default bg-blue-50/40 px-4 py-3">
<label class="flex flex-col gap-1 text-xs text-muted">
<label class="flex flex-col gap-1 text-muted">
{{ t('workspace.orderDeliveryReply.quickDate') }}
<input v-model="quickDate" type="date" class="h-9 rounded-lg border border-default px-3 text-primary" />
</label>
<button type="button" class="h-9 rounded-lg border border-default px-3 text-primary" @click="applyQuickDate">
{{ t('workspace.orderDeliveryReply.applyQuickDate') }}
</button>
<span class="text-xs text-muted">{{ t('workspace.orderDeliveryReply.modalHint') }}</span>
<span class="text-muted">{{ t('workspace.orderDeliveryReply.modalHint') }}</span>
</div>
<!-- 每行批次编辑器 -->
<div v-for="entry in modalLines" :key="lineKey(entry.line)" class="mb-4 overflow-hidden rounded-xl border border-default">
<div class="flex flex-wrap items-center gap-2 bg-slate-50 px-3 py-2 text-xs">
<div class="flex flex-wrap items-center gap-2 bg-slate-50 px-3 py-2">
<span class="rounded bg-indigo-50 px-2 py-0.5 font-semibold text-indigo-600">{{ entry.line.order_no }}</span>
<span>{{ t('workspace.orderDeliveryReply.itemLabel', { item: entry.line.line_no }) }}</span>
<span class="text-muted">{{ entry.line.customer_no }} · {{ entry.line.customer_short_name }}</span>
@@ -566,7 +567,7 @@ onMounted(() => {
</button>
</div>
</div>
<p v-if="overQtyEntries.length" class="text-xs text-orange-500">
<p v-if="overQtyEntries.length" class="text-orange-500">
{{ t('workspace.orderDeliveryReply.overWarning', { detail: overQtyEntries.map(({ entry, total }) => `${entry.line.order_no}:${entry.line.line_no} ${total} > ${undelivered(entry.line)}`).join(';') }) }}
</p>
</div>