feat(ui): 工作台界面全部替换为element plus
This commit is contained in:
1 parent
26d213c05b
commit
d5f988a16c
38 files changed
+4501
-3087
No files matched your search
@@ -2,7 +2,7 @@
|
||||
* features/order-delivery-reply/views/OrderDeliveryReplyPage.vue
|
||||
* 用途:订单交期回复工作台操作页——筛选分页、单行/联合回复批次、单行/批量通知、手动同步。
|
||||
* 依赖:api/orderDeliveryReply.api(统一 requestJson)、useMessage、auth store(manage/access 权限)、
|
||||
* shared DeleteConfirmDialog(批量通知二次确认)、PaginationBar。
|
||||
* element-plus、PaginationBar。
|
||||
* 逻辑:所有数据只读本地快照;保存与通知是两步(联合回复只保存,批量通知才发送并锁定);
|
||||
* 保存/通知成功后即时刷新列表(需求 §9);仅 access 用户隐藏全部写操作。
|
||||
* 回复弹窗数量守恒(2026-09-23 由「超额仅提醒」修订):每行各批次合计必须等于订单数量
|
||||
@@ -32,9 +32,9 @@
|
||||
* 表格对齐(2026-10-09):除交期回复列(批次条按既定左对齐布局)外,全列内容水平居中、
|
||||
* 行内容垂直居中,列头文字全部居中;交期回复状态徽标统一等宽(min-w-68px)。
|
||||
* 设计系统(docs/ui/DESIGN_SYSTEM.md):根节点挂 page-shell;区块容器用 surface-panel;
|
||||
* 弹窗用 dialog-overlay/panel/header/body/footer;输入用 input-field/select-field;
|
||||
* 筛选和回复弹窗用 Element Plus;冻结列和批次条就地编辑保持原表格。
|
||||
* 状态与交互色一律走 --status-* 令牌(badge-*/bg-row-*/frozen-cell-*),品牌强调用 brand-*。
|
||||
* 批量通知确认使用共享 DeleteConfirmDialog(confirmTone=primary),不再用原生 window.confirm。
|
||||
* 批量通知确认使用 ElMessageBox.confirm。
|
||||
*/
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -45,8 +45,21 @@ import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { ChevronDown, ChevronUp, Download, Plus } from 'lucide-vue-next';
|
||||
import { Download } from '@element-plus/icons-vue';
|
||||
import {
|
||||
ElButton,
|
||||
ElCheckbox,
|
||||
ElDatePicker,
|
||||
ElDialog,
|
||||
ElInput,
|
||||
ElMessageBox,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
} from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/shared/styles/element-theme.css';
|
||||
import { ChevronDown, ChevronUp, Plus } from 'lucide-vue-next';
|
||||
import {
|
||||
ORDER_DELIVERY_REPLY_MANAGE_PERMISSION,
|
||||
} from '@/features/order-delivery-reply/constants';
|
||||
@@ -242,6 +255,24 @@ function applyQuickDate() {
|
||||
modalLines.value.forEach((entry) => entry.batches.forEach((batch) => { batch.planned_date = quickDate.value; }));
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期选择器清空后写回空字符串,保持筛选和批次交期的原有字符串。
|
||||
* @param value - 日期选择器回传值
|
||||
* @returns YYYY-MM-DD 或空字符串
|
||||
*/
|
||||
function dateText(value: unknown): string {
|
||||
return typeof value === 'string' ? value : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选状态下拉。清空后回到全部,并立即查询。
|
||||
* @param value - 已回复、未完全回复或空
|
||||
*/
|
||||
function onFilterStatus(value: unknown): void {
|
||||
filters.status = value === 'replied' || value === 'not_fully_replied' ? value : '';
|
||||
doSearch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 行填写问题文案(实时校验,2026-09-23):
|
||||
* [规则 1] 已填数量但未填交期的批次 → 「第 N 批未填交期」;
|
||||
@@ -476,12 +507,26 @@ async function doExportExcel() {
|
||||
|
||||
/* ============ 通知 ============ */
|
||||
const notifying = ref(false);
|
||||
const notifyConfirmVisible = ref(false);
|
||||
|
||||
/** 批量通知入口:先弹共享 DeleteConfirmDialog(primary 语气)二次确认,确认后执行 doNotifyBatch。 */
|
||||
function requestNotifyBatch() {
|
||||
/**
|
||||
* 批量通知入口。确认后执行 doNotifyBatch,取消不发送。
|
||||
*/
|
||||
async function requestNotifyBatch() {
|
||||
if (!notifiableSelected.value.length) return;
|
||||
notifyConfirmVisible.value = true;
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
t('workspace.orderDeliveryReply.notifyBatchConfirm', { count: notifiableSelected.value.length }),
|
||||
t('workspace.orderDeliveryReply.batchNotify'),
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: t('common.deleteDialog.confirm'),
|
||||
cancelButtonText: t('common.deleteDialog.cancel'),
|
||||
},
|
||||
);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await doNotifyBatch();
|
||||
}
|
||||
|
||||
/** 批量通知:部分成功 warning 汇总,全部失败 error;提示后刷新列表让锁定即时生效。 */
|
||||
@@ -608,9 +653,9 @@ onMounted(async () => {
|
||||
{{ latestSyncText }}
|
||||
</span>
|
||||
<div class="flex-1" />
|
||||
<button v-if="canManage" type="button" class="btn-ghost" :disabled="syncing" @click="doSync">
|
||||
<ElButton v-if="canManage" :disabled="syncing" :loading="syncing" @click="doSync">
|
||||
{{ syncing ? t('workspace.orderDeliveryReply.syncing') : t('workspace.orderDeliveryReply.syncNow') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<!-- 搜索区:合并关键词搜索(订单/产品/客户命中任一字段),shrink-0 防压缩;surface-panel 为设计系统 L2 区块容器(无 hover 阴影)。
|
||||
@@ -618,40 +663,55 @@ onMounted(async () => {
|
||||
字段含义由输入框 placeholder / 选项承担,无障碍语义用 aria-label 保留(复用 filterKeyword 等 i18n 键)。
|
||||
输入控件显式 text-sm(14px)+h-9(36px):与 .contract-filter-input(14px/36px/圆角8px)渲染规格逐项一致 -->
|
||||
<div class="surface-panel flex shrink-0 flex-wrap items-center gap-3 px-4 py-2.5">
|
||||
<input v-model="filters.keyword" class="input-field h-9 w-auto min-w-[340px] rounded-lg px-3 py-1 text-sm" :placeholder="t('workspace.orderDeliveryReply.filterKeywordPh')" :aria-label="t('workspace.orderDeliveryReply.filterKeyword')" @keyup.enter="doSearch" />
|
||||
<input v-model="filters.order_date" type="date" class="input-field h-9 w-auto rounded-lg px-3 py-1 text-sm" :aria-label="t('workspace.orderDeliveryReply.filterOrderDate')" />
|
||||
<!-- 状态筛选选择即生效(无需再点查询);其余条件仍由「查询」统一提交 -->
|
||||
<select v-model="filters.status" class="select-field h-9 w-auto min-w-[140px] rounded-lg px-3 py-1 text-sm" :aria-label="t('workspace.orderDeliveryReply.filterStatus')" @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>
|
||||
</select>
|
||||
<!-- 查询/重置:text-sm(14px)+font-semibold(600)+h-9(36px),与合同付款预警 .contract-filter-submit 完全一致 -->
|
||||
<button type="button" class="btn-primary h-9 text-sm font-semibold" @click="doSearch">{{ t('workspace.orderDeliveryReply.search') }}</button>
|
||||
<button type="button" class="btn-ghost h-9 text-sm font-semibold" @click="doReset">{{ t('workspace.orderDeliveryReply.reset') }}</button>
|
||||
<ElInput
|
||||
v-model="filters.keyword"
|
||||
class="order-reply-keyword"
|
||||
clearable
|
||||
:placeholder="t('workspace.orderDeliveryReply.filterKeywordPh')"
|
||||
:aria-label="t('workspace.orderDeliveryReply.filterKeyword')"
|
||||
@keyup.enter="doSearch"
|
||||
/>
|
||||
<ElDatePicker
|
||||
:model-value="filters.order_date || undefined"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
:aria-label="t('workspace.orderDeliveryReply.filterOrderDate')"
|
||||
@update:model-value="filters.order_date = dateText($event)"
|
||||
/>
|
||||
<ElSelect
|
||||
class="order-reply-status"
|
||||
:model-value="filters.status || undefined"
|
||||
clearable
|
||||
:placeholder="t('workspace.orderDeliveryReply.statusAll')"
|
||||
:aria-label="t('workspace.orderDeliveryReply.filterStatus')"
|
||||
@update:model-value="onFilterStatus"
|
||||
>
|
||||
<ElOption value="replied" :label="t('workspace.orderDeliveryReply.statusReplied')" />
|
||||
<ElOption value="not_fully_replied" :label="t('workspace.orderDeliveryReply.statusNotFully')" />
|
||||
</ElSelect>
|
||||
<ElButton type="primary" @click="doSearch">{{ t('workspace.orderDeliveryReply.search') }}</ElButton>
|
||||
<ElButton @click="doReset">{{ t('workspace.orderDeliveryReply.reset') }}</ElButton>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏:全选 + 联合回复 + 批量通知(shrink-0 防压缩,py-2 紧凑高度) -->
|
||||
<div class="surface-panel flex shrink-0 flex-wrap items-center gap-3 px-4 py-2">
|
||||
<label class="flex items-center gap-2 text-primary">
|
||||
<input type="checkbox" class="admin-checkbox" :checked="allChecked" :indeterminate.prop="someChecked" @change="togglePageAll(($event.target as HTMLInputElement).checked)" />
|
||||
<ElCheckbox :model-value="allChecked" :indeterminate="someChecked" @change="togglePageAll(Boolean($event))">
|
||||
{{ t('workspace.orderDeliveryReply.selectAll') }}
|
||||
</label>
|
||||
</ElCheckbox>
|
||||
<span class="text-muted">{{ t('workspace.orderDeliveryReply.selectedCount', { count: selectedLines.length }) }}</span>
|
||||
<template v-if="canManage">
|
||||
<button type="button" class="btn-primary h-9 text-sm font-semibold" :disabled="selectedLines.length === 0" @click="openBatchReply">
|
||||
<ElButton type="primary" :disabled="selectedLines.length === 0" @click="openBatchReply">
|
||||
{{ t('workspace.orderDeliveryReply.batchReply') }}
|
||||
</button>
|
||||
<button type="button" class="btn-primary h-9 text-sm font-semibold" :disabled="notifiableSelected.length === 0 || notifying" @click="requestNotifyBatch">
|
||||
</ElButton>
|
||||
<ElButton type="primary" :disabled="notifiableSelected.length === 0 || notifying" :loading="notifying" @click="requestNotifyBatch">
|
||||
{{ t('workspace.orderDeliveryReply.batchNotify') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</template>
|
||||
<div class="flex-1" />
|
||||
<!-- 导出 Excel(2026-10-09 增补,原提示文字胶囊取消):按当前筛选导出全部行 -->
|
||||
<button type="button" class="btn-primary h-9 text-sm font-semibold" :disabled="exporting" @click="doExportExcel">
|
||||
<Download class="h-4 w-4" aria-hidden="true" />
|
||||
<ElButton type="primary" :icon="Download" :disabled="exporting" :loading="exporting" @click="doExportExcel">
|
||||
{{ t('workspace.orderDeliveryReply.exportExcel') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
@@ -864,67 +924,126 @@ onMounted(async () => {
|
||||
@update:page-size="changePageSize"
|
||||
/>
|
||||
|
||||
<!-- 回复弹窗:dialog-overlay/panel/header/body/footer 设计系统 L2 结构 -->
|
||||
<div v-if="modalVisible" class="dialog-overlay items-center" @click.self="modalVisible = false">
|
||||
<div class="dialog-panel max-h-[88vh] w-[min(960px,94vw)]">
|
||||
<div class="dialog-header">
|
||||
<h3 class="font-bold text-primary">{{ modalTitle }}</h3>
|
||||
<button type="button" class="btn-ghost h-8 w-8 px-0 text-lg leading-none" @click="modalVisible = false">×</button>
|
||||
<ElDialog
|
||||
v-model="modalVisible"
|
||||
:title="modalTitle"
|
||||
width="960px"
|
||||
align-center
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div v-if="modalMode === 'batch'" class="order-reply-quick">
|
||||
<span>{{ t('workspace.orderDeliveryReply.quickDate') }}</span>
|
||||
<ElDatePicker
|
||||
:model-value="quickDate || undefined"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
@update:model-value="quickDate = dateText($event)"
|
||||
/>
|
||||
<ElButton @click="applyQuickDate">{{ t('workspace.orderDeliveryReply.applyQuickDate') }}</ElButton>
|
||||
<span>{{ t('workspace.orderDeliveryReply.modalHint') }}</span>
|
||||
</div>
|
||||
<div v-for="entry in modalLines" :key="lineKey(entry.line)" class="order-reply-line">
|
||||
<div class="order-reply-line__head">
|
||||
<span class="order-reply-line__no">{{ entry.line.order_no }}</span>
|
||||
<span>{{ t('workspace.orderDeliveryReply.itemLabel', { item: entry.line.line_no }) }}</span>
|
||||
<span>{{ entry.line.customer_no }} · {{ entry.line.customer_short_name }}</span>
|
||||
<span>{{ entry.line.part_no }} · {{ entry.line.part_name }}</span>
|
||||
<span class="order-reply-line__qty">
|
||||
{{ t('workspace.orderDeliveryReply.orderQtyLabel', { qty: entry.line.qty ?? 0, unit: entry.line.unit || '' }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="dialog-body">
|
||||
<!-- 快速统一交期:仅联合回复弹窗显示;单行回复/修改回复弹窗已取消该区(2026-10-07),直接逐批次填写 -->
|
||||
<div v-if="modalMode === 'batch'" class="flex flex-wrap items-end gap-3 rounded-xl border border-default bg-surface-soft px-4 py-3">
|
||||
<label class="flex flex-col gap-1 text-muted">
|
||||
{{ t('workspace.orderDeliveryReply.quickDate') }}
|
||||
<input v-model="quickDate" type="date" class="input-field h-9 w-auto rounded-lg px-3 py-1.5" />
|
||||
</label>
|
||||
<button type="button" class="btn-secondary btn-sm h-9" @click="applyQuickDate">
|
||||
{{ t('workspace.orderDeliveryReply.applyQuickDate') }}
|
||||
</button>
|
||||
<span class="text-muted">{{ t('workspace.orderDeliveryReply.modalHint') }}</span>
|
||||
<div class="order-reply-line__body">
|
||||
<div v-for="(batch, idx) in entry.batches" :key="idx" class="order-reply-batch">
|
||||
<ElDatePicker
|
||||
:model-value="batch.planned_date || undefined"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
@update:model-value="batch.planned_date = dateText($event)"
|
||||
/>
|
||||
<ElInput v-model="batch.qty" type="number" :placeholder="t('workspace.orderDeliveryReply.qtyPh')" />
|
||||
<ElInput v-model="batch.remark" :placeholder="t('workspace.orderDeliveryReply.remarkPh')" />
|
||||
<ElButton link type="danger" :title="t('workspace.orderDeliveryReply.removeBatch')" @click="entry.batches.splice(idx, 1)">✕</ElButton>
|
||||
</div>
|
||||
<!-- 每行批次编辑器 -->
|
||||
<div v-for="entry in modalLines" :key="lineKey(entry.line)" class="overflow-hidden rounded-xl border border-default">
|
||||
<div class="flex flex-wrap items-center gap-2 bg-surface-soft px-3 py-2">
|
||||
<span class="rounded bg-surface-strong px-2 py-0.5 font-semibold text-primary">{{ 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>
|
||||
<span class="text-muted">{{ entry.line.part_no }} · {{ entry.line.part_name }}</span>
|
||||
<span class="ml-auto whitespace-nowrap">
|
||||
{{ t('workspace.orderDeliveryReply.orderQtyLabel', { qty: entry.line.qty ?? 0, unit: entry.line.unit || '' }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-3 py-3">
|
||||
<div v-for="(batch, idx) in entry.batches" :key="idx" class="grid grid-cols-[170px_120px_1fr_40px] items-center gap-2">
|
||||
<input v-model="batch.planned_date" type="date" class="input-field h-9 rounded-lg px-2 py-1.5" />
|
||||
<input v-model="batch.qty" type="number" min="0" :placeholder="t('workspace.orderDeliveryReply.qtyPh')" class="input-field h-9 rounded-lg px-2 py-1.5" />
|
||||
<input v-model="batch.remark" :placeholder="t('workspace.orderDeliveryReply.remarkPh')" class="input-field h-9 rounded-lg px-2 py-1.5" />
|
||||
<button type="button" class="btn-danger btn-sm" :title="t('workspace.orderDeliveryReply.removeBatch')" @click="entry.batches.splice(idx, 1)">✕</button>
|
||||
</div>
|
||||
<button type="button" class="w-full rounded-lg border border-dashed border-default py-2 text-brand-600 transition-colors hover-surface-soft" @click="entry.batches.push({ planned_date: '', qty: '', remark: '' })">
|
||||
{{ t('workspace.orderDeliveryReply.addBatch') }}
|
||||
</button>
|
||||
<!-- 行级实时校验提示:缺交期/缺数量按批次序号指出,合计不等给出已填/应填;随填写实时切换 -->
|
||||
<p v-if="lineIssueText(entry)" class="text-status-error">{{ lineIssueText(entry) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" class="btn-secondary" @click="modalVisible = false">{{ t('common.cancel') }}</button>
|
||||
<button type="button" class="btn-primary" :disabled="saving" @click="saveReplies">
|
||||
{{ saving ? t('workspace.orderDeliveryReply.saving') : t('workspace.orderDeliveryReply.saveReply') }}
|
||||
</button>
|
||||
<ElButton class="order-reply-add" @click="entry.batches.push({ planned_date: '', qty: '', remark: '' })">
|
||||
{{ t('workspace.orderDeliveryReply.addBatch') }}
|
||||
</ElButton>
|
||||
<p v-if="lineIssueText(entry)" class="order-reply-issue">{{ lineIssueText(entry) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 批量通知二次确认:共享 DeleteConfirmDialog(primary 语气,非删除;确认/取消文案用组件默认 i18n) -->
|
||||
<DeleteConfirmDialog
|
||||
v-model="notifyConfirmVisible"
|
||||
:title="t('workspace.orderDeliveryReply.batchNotify')"
|
||||
:message="t('workspace.orderDeliveryReply.notifyBatchConfirm', { count: notifiableSelected.length })"
|
||||
confirm-tone="primary"
|
||||
@confirm="doNotifyBatch"
|
||||
/>
|
||||
<template #footer>
|
||||
<ElButton @click="modalVisible = false">{{ t('common.cancel') }}</ElButton>
|
||||
<ElButton type="primary" :loading="saving" :disabled="saving" @click="saveReplies">
|
||||
{{ saving ? t('workspace.orderDeliveryReply.saving') : t('workspace.orderDeliveryReply.saveReply') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.order-reply-keyword {
|
||||
width: min(100%, 22rem);
|
||||
}
|
||||
|
||||
.order-reply-status {
|
||||
width: 11rem;
|
||||
}
|
||||
|
||||
.order-reply-quick,
|
||||
.order-reply-line__head,
|
||||
.order-reply-batch {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.order-reply-quick,
|
||||
.order-reply-line {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.order-reply-line {
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: var(--el-border-radius-base);
|
||||
}
|
||||
|
||||
.order-reply-line__head {
|
||||
padding: 8px 12px;
|
||||
background: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
.order-reply-line__no {
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: var(--el-fill-color);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.order-reply-line__qty {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.order-reply-line__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.order-reply-batch {
|
||||
display: grid;
|
||||
grid-template-columns: 170px 120px minmax(0, 1fr) 40px;
|
||||
}
|
||||
|
||||
.order-reply-add {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.order-reply-issue {
|
||||
margin: 0;
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user