feat(stock): 新增拣货缺货补货页面并统一弹窗样式
新增「拣货缺货(缺货补货)」页面 - 基于 views/mode 模板 v2:ScanBox 筛选 + 工具栏(刷新/导出选中/字段设置)+ 汇总指标 (SKU 总数 / 缺货 SKU / 建议补货 / 真实缺货) - 表格展开行展示「补货库位明细」(存货区与分拣区库存),替代原侧栏「缺货明细」面板 - 路由 stock/pickingShortage/index 改为指向新页面,原补货需求页保留在 storage/management/replenishmentDemand - UpperTable 新增 showExpand 属性与 expand 插槽,支持通用展开行 perf(order): 订单模块参照数据复用缓存并降低切页开销 - 新增 utils/order-meta-cache.ts:快递公司 / 平台 / 店铺列表 60s 缓存,key 带 当前 token(切账号自动失效),请求失败不落缓存 - 订单管理 8 个页签、待处理建单、储位分配、同步订单号等改为复用该缓存 - 角标查询增加 3s 节流(手动刷新强制)、tab→角标字段改反查表、 选中订单 ID 改 computed,避免切页签重复请求与重复计算 - 状态文本 class 改为查表 + 结果缓存,减少大列表单元格渲染开销 feat(task-progress): 进度弹窗成功后统一 1.5 秒自动关闭 - 新增 components/task-progress/useAutoCloseOnSuccess.ts:成功延时关闭、失败保持 打开、手动关闭/组件卸载清理定时器 - 波次抓取 / 波次批量 / 快速扫描、同步订单号、批量异步任务、储位分配等接入 - 同步更新《进度条弹窗-使用清单》 style(ui): 继续统一弹窗与详情面板为 task-panel 风格 - 店铺策略配置 / 一键开户、快递接口配置、收货详情面板、待处理订单详情、 订单商品明细等页面重排为自定义头部 + 关闭按钮、min(px, 96vw) 宽度、 双列栅格与静态信息行 - 收货详情面板拆为「表单区可独立滚动 + 图片区固定」 - ScanBox 多选折叠标签气泡固定向下弹出、限宽换行,方便逐个移除标签 - 异常单 / 待处理单批量处理的订单 ID 改为胶囊换行展示 - 带远程搜索的下拉补充 remote-show-suffix,面单数量输入占满右侧剩余宽度
This commit is contained in:
parent
c2b8a9fe5e
commit
6053b8916f
@ -6,8 +6,10 @@
|
||||
> **状态(2026-10-20)**:下列 9 个进度弹窗组件均已改为基于
|
||||
> `components/task-progress/UnifiedTaskProgressDialog.vue`(猎豹进度条)渲染,
|
||||
> 组件名与页面调用方式保持不变。
|
||||
> 任务完成后弹窗保持打开并展示完成状态,由用户手动关闭(导出、抓取、波次批量任务同样)。
|
||||
> **例外**:波次策略快速扫描弹窗扫描成功后 **1.5 秒自动关闭**(失败保持打开,见下方第 4 项)。
|
||||
> **完成任务后的关闭策略**:任务**成功**后 **1.5 秒自动关闭**(失败保持打开,便于查看错误)。
|
||||
> 已接入:第 4、5、6 项(波次策略快速扫描 / 抓取任务 / 波次批量任务)与第三节 3 个表单内嵌进度弹窗,
|
||||
> 统一由 `components/task-progress/useAutoCloseOnSuccess.ts` 实现;
|
||||
> 导出类(`AsyncExportProgressDialog` / `OrderExportProgressDialog`)由各自的导出 composable 定时关闭。
|
||||
>
|
||||
> 示例入口:`order/waveOrder?tab=sandanFallbackOrders` → 「不符合波次策略订单列表」→ 工具栏「快速扫描」→ 波次策略快速扫描进度弹窗。
|
||||
|
||||
@ -76,11 +78,12 @@
|
||||
- `views/order/waveOrder/GroupWaveBatchListPanel.vue` ← `tab=groupWave` 团购波次
|
||||
- 触发:工具栏「快速扫描」(`wave-config.ts` 中 `label: '快速扫描'`)
|
||||
- 已改为基于 `UnifiedTaskProgressDialog` 渲染(猎豹进度条);扫描中可「后台运行」关闭弹窗,轮询继续,任务结束后刷新列表。
|
||||
- **扫描成功后 1.5 秒自动关闭弹窗**(`AUTO_CLOSE_DELAY = 1500`,与导出进度弹窗一致);失败(failed / not_found)不自动关闭,便于查看错误信息。
|
||||
- **扫描成功后 1.5 秒自动关闭弹窗**(`useAutoCloseOnSuccess`,延迟 1500ms);失败(failed / not_found)不自动关闭,便于查看错误信息。
|
||||
|
||||
### 5. `views/order/waveOrder/component/WaveFetchTaskProgressDialog.vue`
|
||||
- 标题:`抓取任务`
|
||||
- 实现:`UnifiedTaskProgressDialog`;弹窗显隐由 `taskId` 自动控制,底部操作区常驻(运行中为禁用的「处理中…」,完成后为「关闭」)
|
||||
- **任务成功后 1.5 秒自动关闭弹窗**(`useAutoCloseOnSuccess`);失败保持打开
|
||||
- 使用位置(2 处):
|
||||
- `SandanWaveBatchListPanel.vue`(散单波次)
|
||||
- `GroupWaveBatchListPanel.vue`(团购波次)
|
||||
@ -88,6 +91,7 @@
|
||||
### 6. `views/order/waveOrder/component/WaveBatchTaskProgressDialog.vue`
|
||||
- 标题由调用方传入,同一组件复用 4 类任务
|
||||
- 实现:`UnifiedTaskProgressDialog`;弹窗显隐由 `taskId` 自动控制,底部操作区常驻(运行中为禁用的「处理中…」,完成后为「关闭」)
|
||||
- **任务成功后 1.5 秒自动关闭弹窗**(`useAutoCloseOnSuccess`);失败保持打开
|
||||
- 使用位置(8 处,散单波次 / 团购波次各 4 处):
|
||||
| 标题 | 所在文件 |
|
||||
|---|---|
|
||||
@ -103,7 +107,8 @@
|
||||
> 已统一改为基于 `components/task-progress/UnifiedTaskProgressDialog.vue`(猎豹进度条)。
|
||||
> 下面 3 个表单组件保留原有 props/emits 作为业务包装层,页面调用方式无需改动:
|
||||
> 无任务 ID 时显示 `mode="form"` 参数区,提交后切到 `mode="progress"` 进度区。
|
||||
> 任务完成后**不自动关闭**,停留在完成状态,由用户点击「关闭」退出。
|
||||
> 任务**成功**后 **1.5 秒自动关闭**(`useAutoCloseOnSuccess`);失败保持打开,便于查看错误。
|
||||
> 表单态(未提交)不参与自动关闭。
|
||||
|
||||
### 7. `views/order/orderManagement/form/SyncOrderIdsForm.vue`
|
||||
- 表单:同步订单 ID(勾选数量 → 确认同步 → 任务 ID / 状态 / 处理进度 / 总数/已处理/成功/失败)
|
||||
|
||||
@ -298,6 +298,9 @@
|
||||
<el-select
|
||||
v-model="customConditions[field.value].value"
|
||||
:multiple="!!field.multiple"
|
||||
:collapse-tags="!!field.multiple"
|
||||
:collapse-tags-tooltip="!!field.multiple"
|
||||
:tag-tooltip="collapseTagTooltip"
|
||||
:placeholder="field.placeholder || `请选择${field.label}`"
|
||||
size="small"
|
||||
filterable
|
||||
@ -325,6 +328,9 @@
|
||||
<el-select
|
||||
v-model="customConditions[field.value].value"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
:tag-tooltip="collapseTagTooltip"
|
||||
:placeholder="field.placeholder || `请选择${field.label}`"
|
||||
size="small"
|
||||
:filterable = "field.filterable"
|
||||
@ -466,6 +472,9 @@
|
||||
<el-select
|
||||
v-model="customConditions[field.value].value"
|
||||
:multiple="!!field.multiple"
|
||||
:collapse-tags="!!field.multiple"
|
||||
:collapse-tags-tooltip="!!field.multiple"
|
||||
:tag-tooltip="collapseTagTooltip"
|
||||
:placeholder="field.label"
|
||||
size="small"
|
||||
clearable
|
||||
@ -486,6 +495,9 @@
|
||||
<el-select
|
||||
v-model="customConditions[field.value].value"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
:tag-tooltip="collapseTagTooltip"
|
||||
:placeholder="field.label"
|
||||
size="small"
|
||||
:filterable="field.filterable"
|
||||
@ -911,6 +923,17 @@ const route = useRoute()
|
||||
const scanBoxCacheStore = useScanBoxCacheStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
/**
|
||||
* 多选折叠标签(+N)的气泡配置:
|
||||
* - 固定向下弹出(fallbackPlacements 只留 bottom,避免空间不够时翻到右侧/上方)
|
||||
* - 自定义 popperClass,配合文末非 scoped 样式限制宽度 → 标签多行换行,方便逐个关闭
|
||||
*/
|
||||
const collapseTagTooltip = {
|
||||
placement: 'bottom',
|
||||
fallbackPlacements: ['bottom'],
|
||||
popperClass: 'scanbox-tags-tooltip'
|
||||
}
|
||||
|
||||
// 紧凑模式
|
||||
const isCompact = computed(() => settingsStore.scanBoxMode === 'compact')
|
||||
function toggleMode() {
|
||||
@ -2476,3 +2499,32 @@ defineExpose({ getConditions, reset, clear, getFieldDraft, setFieldCondition, su
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* 多选折叠标签(+N)的气泡:固定向下弹出 + 限制宽度让标签多行换行,
|
||||
避免一排横向铺开导致气泡过宽、标签关闭按钮难点。
|
||||
气泡被 teleport 到 body,必须用非 scoped 样式。 */
|
||||
.el-popper.scanbox-tags-tooltip {
|
||||
max-width: min(360px, 88vw);
|
||||
}
|
||||
|
||||
.el-popper.scanbox-tags-tooltip .el-select__selection {
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.el-popper.scanbox-tags-tooltip .el-select__selected-item {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.el-popper.scanbox-tags-tooltip .el-select__selected-item .el-tag {
|
||||
max-width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-popper.scanbox-tags-tooltip .el-tag__content {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -56,6 +56,13 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 展开行(showExpand 开启时渲染,内容由 expand 插槽提供) -->
|
||||
<el-table-column v-if="showExpand" type="expand" width="48" fixed="left">
|
||||
<template #default="scope">
|
||||
<slot name="expand" :row="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 动态列 -->
|
||||
<template v-for="column in displayColumns" :key="column.prop">
|
||||
<el-table-column
|
||||
@ -454,6 +461,11 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 是否显示展开行(展开内容由 expand 插槽提供)
|
||||
showExpand: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 是否可勾选函数
|
||||
selectable: {
|
||||
type: Function,
|
||||
|
||||
52
src/components/task-progress/useAutoCloseOnSuccess.ts
Normal file
52
src/components/task-progress/useAutoCloseOnSuccess.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { onBeforeUnmount, watch } from 'vue'
|
||||
|
||||
/** 完成态自动关闭延时(毫秒),与导出进度弹窗保持一致 */
|
||||
export const AUTO_CLOSE_DELAY = 1500
|
||||
|
||||
interface AutoCloseOnSuccessOptions {
|
||||
/** 弹窗是否可见 */
|
||||
visible: () => boolean
|
||||
/** 进度状态:running / success / failed */
|
||||
state: () => string
|
||||
/** 关闭弹窗(通常是 emit('update:modelValue', false)) */
|
||||
close: () => void
|
||||
/** 自定义延时,缺省 AUTO_CLOSE_DELAY */
|
||||
delay?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 进度弹窗「完成后 1.5 秒自动关闭」。
|
||||
*
|
||||
* - 成功:延迟 `delay` 后自动关闭,留出时间让用户看到完成态
|
||||
* - 失败:保持打开,便于查看错误信息
|
||||
* - 运行中 / 被手动关闭:清除定时器(避免误关下一次任务)
|
||||
*
|
||||
* 用两个独立 watch 而不是 `watch(() => [visible, state])`:
|
||||
* 数组源每次返回新引用会导致回调重复触发,容易把刚排好的定时器清掉。
|
||||
*/
|
||||
export function useAutoCloseOnSuccess(options: AutoCloseOnSuccessOptions) {
|
||||
const delay = options.delay ?? AUTO_CLOSE_DELAY
|
||||
let timer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
function stop() {
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
timer = null
|
||||
}
|
||||
}
|
||||
|
||||
function schedule() {
|
||||
stop()
|
||||
// 仅在「弹窗打开 + 成功态」时排定时器
|
||||
if (!options.visible() || options.state() !== 'success') return
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
options.close()
|
||||
}, delay)
|
||||
}
|
||||
|
||||
watch([options.visible, options.state], schedule, { immediate: true })
|
||||
onBeforeUnmount(stop)
|
||||
|
||||
return { stop, schedule, delay }
|
||||
}
|
||||
@ -23,7 +23,8 @@ export const componentMap: Record<string, any> = {
|
||||
/** 组合商品并入商品管理,保留旧路径兼容 */
|
||||
// 'stock/combo_stock': () => import('@/views/stock/stockManagement/index.vue'),
|
||||
// 'stock/combo_stock/index': () => import('@/views/stock/stockManagement/index.vue'),
|
||||
'stock/pickingShortage/index': () => import('@/views/storage/management/replenishmentDemand/index.vue'),
|
||||
/** 缺货补货(picker 侧):新页面模板 views/mode 结构 */
|
||||
'stock/pickingShortage/index': () => import('@/views/stock/pickingShortage/index.vue'),
|
||||
'storage/management/replenishmentDemand/index': () => import('@/views/storage/management/replenishmentDemand/index.vue'),
|
||||
'storage/receiving': () => import('@/views/storage/receiving/index.vue'),
|
||||
/** 货主侧收货单管理 */
|
||||
|
||||
@ -141,7 +141,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderArchiveOrder } from '@/api/order.archiveorder/orderarchiveorder'
|
||||
|
||||
import {
|
||||
@ -322,8 +322,8 @@ const {
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, expressRes]: any = await Promise.all([
|
||||
indexApi.loadStores(),
|
||||
indexApi.getExpressList({ systemOnly: 'true' })
|
||||
loadStoresCached(),
|
||||
loadExpressListCached({ systemOnly: 'true' })
|
||||
])
|
||||
fillStoreScanFieldOptions(availableFieldsRef, extractStoreListFromResponse(storesRes))
|
||||
const expressData: any = expressRes?.data
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
size="default"
|
||||
filterable
|
||||
remote
|
||||
remote-show-suffix
|
||||
clearable
|
||||
reserve-keyword
|
||||
placeholder="输入编码/名称搜索"
|
||||
|
||||
@ -503,7 +503,7 @@ import * as XLSX from 'xlsx'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import SelectProductDialog from './SelectProductDialog.vue'
|
||||
import type { SelectProductItem } from './SelectProductDialog.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '../utils/order-meta-cache'
|
||||
import { settingPlatformList } from '@/api/setting.platform/platform'
|
||||
import {
|
||||
lookupAndExpandProductByKeyword,
|
||||
@ -1230,7 +1230,7 @@ function getOrderGroupKey(row: ImportPreviewRow) {
|
||||
|
||||
async function loadStoreOptions() {
|
||||
try {
|
||||
const storesRes: any = await indexApi.loadStores()
|
||||
const storesRes: any = await loadStoresCached()
|
||||
storeOptions.value = mapStoreListToSelectOptions(extractStoreListFromResponse(storesRes))
|
||||
} catch {
|
||||
storeOptions.value = []
|
||||
@ -1260,9 +1260,9 @@ function resolveStoreId(raw: unknown): number | undefined {
|
||||
async function loadImportSelectOptions() {
|
||||
try {
|
||||
const [expressRes, sourcePlatformRes, platformRes]: any = await Promise.all([
|
||||
indexApi.getExpressList({ systemOnly: 'true' }),
|
||||
loadExpressListCached({ systemOnly: 'true' }),
|
||||
settingPlatformList({ pagination: { page: 1, pageSize: 500 } }),
|
||||
indexApi.getPlatformList({ systemOnly: 'true' })
|
||||
loadPlatformListCached()
|
||||
])
|
||||
const expressRaw = expressRes?.data?.list || expressRes?.data || []
|
||||
const sourcePlatformRaw = sourcePlatformRes?.data?.list || sourcePlatformRes?.data || []
|
||||
|
||||
@ -408,7 +408,7 @@ watch(
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
|
||||
/* 控件行:数字输入左对齐,行高与输入框(32px)一致 */
|
||||
/* 控件行:数字输入占满右侧剩余宽度(右边缘与上方「运单号」行 / 提示条对齐),行高与输入框(32px)一致 */
|
||||
&--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -416,7 +416,9 @@ watch(
|
||||
min-height: 32px;
|
||||
|
||||
:deep(.el-input-number) {
|
||||
width: 180px;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,20 @@
|
||||
<div class="order-items-detail" v-loading="loading">
|
||||
<div v-if="!row?.id" class="empty-tip">请从上方列表中选择一项查看商品明细</div>
|
||||
<template v-else>
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
:disabled="!row?.id"
|
||||
@click="handleRefresh"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
@ -131,6 +145,12 @@ function handlePageChange(page: number) {
|
||||
resetTableScroll()
|
||||
}
|
||||
|
||||
/** 刷新商品明细(与订单日志面板的刷新按钮交互一致) */
|
||||
function handleRefresh() {
|
||||
if (!props.row?.id) return
|
||||
loadItems()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
@ -246,6 +266,29 @@ onBeforeUnmount(() => {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 顶部操作行(对齐订单日志面板的 header-actions) */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.order-items-detail .pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
|
||||
@ -2,27 +2,21 @@
|
||||
<div class="pending-order-detail" v-loading="loading">
|
||||
<div v-if="!row?.id" class="empty-tip">请从上方列表中选择一项查看订单明细</div>
|
||||
<template v-else-if="detail">
|
||||
<div v-for="section in activeSections" :key="section.title" class="section">
|
||||
<div v-for="section in sectionViews" :key="section.title" class="section">
|
||||
<div class="section-title">{{ section.title }}</div>
|
||||
<el-descriptions :column="section.column || 3" border size="small" class="detail-descriptions">
|
||||
<el-descriptions :column="section.column" border size="small" class="detail-descriptions">
|
||||
<el-descriptions-item
|
||||
v-for="field in section.fields"
|
||||
:key="field.prop"
|
||||
:label="field.label"
|
||||
:span="field.span || 1"
|
||||
:span="field.span"
|
||||
>
|
||||
<template v-if="field.tag">
|
||||
<span :class="getStatusTextClass(getTagType(field.prop, getFieldRawValue(field.prop)))">
|
||||
{{ displayFieldValue(field) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else-if="field.multiline">
|
||||
<div class="field-multiline" :title="displayFieldValue(field)">
|
||||
{{ displayFieldValue(field) }}
|
||||
</div>
|
||||
</template>
|
||||
<span v-if="field.tagClass" :class="field.tagClass">{{ field.text }}</span>
|
||||
<div v-else-if="field.multiline" class="field-multiline" :title="field.text">
|
||||
{{ field.text }}
|
||||
</div>
|
||||
<template v-else>
|
||||
{{ displayFieldValue(field) }}
|
||||
{{ field.text }}
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
@ -159,6 +153,44 @@ function displayFieldValue(field: OrderDetailFieldConfig) {
|
||||
return raw
|
||||
}
|
||||
|
||||
type DetailFieldView = {
|
||||
prop: string
|
||||
label: string
|
||||
span: number
|
||||
multiline: boolean
|
||||
text: string
|
||||
tagClass?: string
|
||||
}
|
||||
|
||||
type DetailSectionView = {
|
||||
title: string
|
||||
column: number
|
||||
fields: DetailFieldView[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细字段视图模型:把「格式化 + 翻译 + tag 取色」一次性算好并缓存。
|
||||
* 原先在模板里直接调 displayFieldValue()(单字段被调 2 次),
|
||||
* 且 formatWaybillCodes 里的 JSON.parse / translateOrderField 会随每次渲染重跑。
|
||||
*/
|
||||
const sectionViews = computed<DetailSectionView[]>(() => {
|
||||
if (!detail.value) return []
|
||||
return activeSections.value.map((section) => ({
|
||||
title: section.title,
|
||||
column: section.column || 3,
|
||||
fields: section.fields.map((field) => ({
|
||||
prop: field.prop,
|
||||
label: field.label,
|
||||
span: field.span || 1,
|
||||
multiline: !!field.multiline,
|
||||
text: String(displayFieldValue(field) ?? ''),
|
||||
tagClass: field.tag
|
||||
? getStatusTextClass(getTagType(field.prop, getFieldRawValue(field.prop)))
|
||||
: undefined
|
||||
}))
|
||||
}))
|
||||
})
|
||||
|
||||
function normalizeDetailPayload(payload: Record<string, any>) {
|
||||
const orderDetail = payload.order || payload.detail || payload
|
||||
if (!orderDetail || typeof orderDetail !== 'object') return null
|
||||
|
||||
@ -751,18 +751,29 @@ function lookupTranslationTable(table: Record<string, string> | undefined, field
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** 将 el-tag 的 type 映射为轻量状态文本的颜色 class(方案②:减少 el-tag 组件,提升大列表滚动性能) */
|
||||
/**
|
||||
* el-tag type → 轻量状态文本颜色 class(方案②:减少 el-tag 组件,提升大列表滚动性能)
|
||||
* 映射表与结果串都放到模块级缓存:表格每个单元格、每次渲染都会调它,
|
||||
* 原实现每次调用都新建 map 对象并拼串,属于纯浪费。
|
||||
*/
|
||||
const STATUS_TEXT_CLASS_MAP: Record<string, string> = {
|
||||
primary: 'ut-status-text--primary',
|
||||
success: 'ut-status-text--success',
|
||||
warning: 'ut-status-text--warning',
|
||||
info: 'ut-status-text--info',
|
||||
danger: 'ut-status-text--danger',
|
||||
error: 'ut-status-text--danger'
|
||||
}
|
||||
|
||||
const STATUS_TEXT_CLASS_CACHE = new Map<string, string>()
|
||||
|
||||
export function getStatusTextClass(tagType?: string) {
|
||||
const t = String(tagType || 'info')
|
||||
const map: Record<string, string> = {
|
||||
primary: 'ut-status-text--primary',
|
||||
success: 'ut-status-text--success',
|
||||
warning: 'ut-status-text--warning',
|
||||
info: 'ut-status-text--info',
|
||||
danger: 'ut-status-text--danger',
|
||||
error: 'ut-status-text--danger'
|
||||
}
|
||||
return `ut-status-text ${map[t] || 'ut-status-text--info'}`
|
||||
const cached = STATUS_TEXT_CLASS_CACHE.get(t)
|
||||
if (cached) return cached
|
||||
const className = `ut-status-text ${STATUS_TEXT_CLASS_MAP[t] || 'ut-status-text--info'}`
|
||||
STATUS_TEXT_CLASS_CACHE.set(t, className)
|
||||
return className
|
||||
}
|
||||
|
||||
export function getTagType(field: string, value: any) {
|
||||
|
||||
@ -137,7 +137,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderDeliveryExpectionOrder } from '@/api/order.deliveryexpectionorder/orderdeliveryexpectionorder'
|
||||
|
||||
import {
|
||||
@ -317,8 +317,8 @@ const {
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, expressRes]: any = await Promise.all([
|
||||
indexApi.loadStores(),
|
||||
indexApi.getExpressList({ systemOnly: 'true' })
|
||||
loadStoresCached(),
|
||||
loadExpressListCached({ systemOnly: 'true' })
|
||||
])
|
||||
fillStoreScanFieldOptions(availableFieldsRef, extractStoreListFromResponse(storesRes))
|
||||
const expressData: any = expressRes?.data
|
||||
|
||||
@ -349,7 +349,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderDeliveryOrder } from '@/api/order.deliveryorder/orderdeliveryOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
@ -512,9 +512,9 @@ function mapNameOptions(rawList: any[], nameKeys: string[]) {
|
||||
async function loadOrderMetaOptions() {
|
||||
try {
|
||||
const [expressRes, platformRes, storesRes] = await Promise.all([
|
||||
indexApi.getExpressList({ systemOnly: 'true' }),
|
||||
indexApi.getPlatformList({ systemOnly: 'true' }),
|
||||
indexApi.loadStores()
|
||||
loadExpressListCached({ systemOnly: 'true' }),
|
||||
loadPlatformListCached(),
|
||||
loadStoresCached()
|
||||
])
|
||||
const expressData: any = expressRes?.data
|
||||
const platformData: any = platformRes?.data
|
||||
|
||||
@ -137,7 +137,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderEntrustOrder } from '@/api/order.entrustorder/orderentrustorder'
|
||||
|
||||
import {
|
||||
@ -317,8 +317,8 @@ const {
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, expressRes]: any = await Promise.all([
|
||||
indexApi.loadStores(),
|
||||
indexApi.getExpressList({ systemOnly: 'true' })
|
||||
loadStoresCached(),
|
||||
loadExpressListCached({ systemOnly: 'true' })
|
||||
])
|
||||
fillStoreScanFieldOptions(availableFieldsRef, extractStoreListFromResponse(storesRes))
|
||||
const expressData: any = expressRes?.data
|
||||
|
||||
@ -351,9 +351,12 @@
|
||||
<span class="task-panel__field-label">已选订单数</span>
|
||||
<strong class="task-panel__field-value">{{ resolveExceptionOrderIds.length }} 条</strong>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--stack">
|
||||
<div class="task-panel__field task-panel__field--ids">
|
||||
<span class="task-panel__field-label">订单 ID</span>
|
||||
<div class="task-panel__ids">{{ resolveExceptionOrderIds.join(', ') || '—' }}</div>
|
||||
<div class="task-panel__ids">
|
||||
<span v-for="id in resolveExceptionOrderIds" :key="id" class="task-panel__id">{{ id }}</span>
|
||||
<span v-if="!resolveExceptionOrderIds.length" class="task-panel__ids-empty">—</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="task-panel__form-tip">
|
||||
@ -421,7 +424,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
@ -732,7 +735,7 @@ const {
|
||||
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const storesRes: any = await indexApi.loadStores()
|
||||
const storesRes: any = await loadStoresCached()
|
||||
fillStoreScanFieldOptions(availableFieldsRef, extractStoreListFromResponse(storesRes))
|
||||
} catch {
|
||||
fillStoreScanFieldOptions(availableFieldsRef, [])
|
||||
@ -742,8 +745,8 @@ async function loadFilterData() {
|
||||
async function loadOrderMetaOptions() {
|
||||
try {
|
||||
const [expressRes, platformRes] = await Promise.all([
|
||||
indexApi.getExpressList(),
|
||||
indexApi.getPlatformList({ systemOnly: 'true' })
|
||||
loadExpressListCached(),
|
||||
loadPlatformListCached()
|
||||
])
|
||||
const expressData: any = expressRes?.data
|
||||
const platformData: any = platformRes?.data
|
||||
@ -1253,10 +1256,10 @@ function onBatchPrintSuccess() {
|
||||
border-radius: 4px;
|
||||
background: #fafafa;
|
||||
|
||||
&--stack {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
/* 订单 ID 行:标签在上、值在下(多 ID 胶囊换行展示) */
|
||||
&--ids {
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1281,12 +1284,30 @@ function onBatchPrintSuccess() {
|
||||
}
|
||||
|
||||
&__ids {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px 6px;
|
||||
max-height: 96px;
|
||||
overflow-y: auto;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
&__id {
|
||||
padding: 0 6px;
|
||||
border-radius: 3px;
|
||||
background: #eef1f6;
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
word-break: break-all;
|
||||
line-height: 20px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__ids-empty {
|
||||
font-size: 13px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
&__form-tip {
|
||||
|
||||
@ -16,9 +16,9 @@
|
||||
:error="errorMessage || ''"
|
||||
:result-ids="resultOrderIds"
|
||||
:result-ids-label="resultIdsLabel"
|
||||
:tip="progressState === 'success' ? (acceptMessage || '任务已结束,可关闭窗口') : (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断。' : '')"
|
||||
:tip="progressState === 'success' ? (acceptMessage || '任务已结束,窗口将在 1.5 秒后自动关闭') : (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断。' : '')"
|
||||
:tip-type="progressState === 'success' ? 'primary' : 'default'"
|
||||
:footer-hint="isProgress ? (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断' : '任务已结束,可关闭窗口') : '操作不可撤销,请确认后提交'"
|
||||
:footer-hint="isProgress ? (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断' : (progressState === 'success' ? '任务已完成,窗口将在 1.5 秒后自动关闭' : '任务失败,请查看错误信息后关闭窗口')) : '操作不可撤销,请确认后提交'"
|
||||
:submit-text="submitButtonText"
|
||||
:closable="!loading"
|
||||
@update:visible="visible = $event"
|
||||
@ -44,6 +44,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
|
||||
import { useAutoCloseOnSuccess } from '@/components/task-progress/useAutoCloseOnSuccess'
|
||||
import type { ProgressFormField, ProgressMetricItem, ProgressState } from '@/components/task-progress/types'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
@ -118,6 +119,15 @@ const progressState = computed<ProgressState>(() => {
|
||||
return 'running'
|
||||
})
|
||||
|
||||
// 任务成功后 1.5 秒自动关闭弹窗;失败保持打开,便于查看错误原因(确认表单态不参与)
|
||||
useAutoCloseOnSuccess({
|
||||
visible: () => visible.value,
|
||||
state: () => (isProgress.value ? progressState.value : 'running'),
|
||||
close: () => {
|
||||
visible.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const progressDetail = computed(() =>
|
||||
props.totalOrderCount ? `已处理 ${props.processedOrderCount ?? 0} / ${props.totalOrderCount}` : ''
|
||||
)
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
:form-tip="formTip"
|
||||
:message="progressState === 'running' ? (message || '') : ''"
|
||||
:error="progressState === 'failed' ? (message || '') : ''"
|
||||
:tip="progressState === 'success' ? (message || '任务已结束,可关闭窗口') : (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断。' : '')"
|
||||
:tip="progressState === 'success' ? (message || '任务已结束,窗口将在 1.5 秒后自动关闭') : (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断。' : '')"
|
||||
:tip-type="progressState === 'success' ? 'primary' : 'default'"
|
||||
:footer-hint="isProgress ? (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断' : '任务已结束,可关闭窗口') : '提交前请确认已选订单'"
|
||||
:footer-hint="isProgress ? (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断' : (progressState === 'success' ? '任务已完成,窗口将在 1.5 秒后自动关闭' : '任务失败,请查看错误信息后关闭窗口')) : '提交前请确认已选订单'"
|
||||
:submit-text="submitButtonText"
|
||||
@toggle-field="handleToggleField"
|
||||
@update:visible="visible = $event"
|
||||
@ -45,6 +45,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
|
||||
import { useAutoCloseOnSuccess } from '@/components/task-progress/useAutoCloseOnSuccess'
|
||||
import type { ProgressFormField, ProgressMetricItem, ProgressState } from '@/components/task-progress/types'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
@ -133,6 +134,15 @@ const progressState = computed<ProgressState>(() => {
|
||||
return 'running'
|
||||
})
|
||||
|
||||
// 任务成功后 1.5 秒自动关闭弹窗;失败保持打开,便于查看错误原因(表单态不参与)
|
||||
useAutoCloseOnSuccess({
|
||||
visible: () => visible.value,
|
||||
state: () => (isProgress.value ? progressState.value : 'running'),
|
||||
close: () => {
|
||||
visible.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const progressDetail = computed(() =>
|
||||
props.totalCount ? `已处理 ${(props.successCount ?? 0) + (props.failedCount ?? 0)} / ${props.totalCount}` : ''
|
||||
)
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
form-tip="将逐条同步订单 ID,任务完成后可在列表中查看最新数据。"
|
||||
:message="progressState === 'running' ? (message || '') : ''"
|
||||
:error="progressState === 'failed' ? (message || '') : ''"
|
||||
:tip="progressState === 'success' ? (message || '任务已结束,可关闭窗口') : (progressState === 'running' ? '任务在后台执行,可关闭窗口稍后查看。' : '')"
|
||||
:tip="progressState === 'success' ? (message || '任务已结束,窗口将在 1.5 秒后自动关闭') : (progressState === 'running' ? '任务在后台执行,可关闭窗口稍后查看。' : '')"
|
||||
:tip-type="progressState === 'success' ? 'primary' : 'default'"
|
||||
:footer-hint="isProgress ? (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断' : '任务已结束,可关闭窗口') : '任务提交后可在后台运行'"
|
||||
:footer-hint="isProgress ? (progressState === 'running' ? '任务在后台执行,关闭窗口不会中断' : (progressState === 'success' ? '任务已完成,窗口将在 1.5 秒后自动关闭' : '任务失败,请查看错误信息后关闭窗口')) : '任务提交后可在后台运行'"
|
||||
submit-text="确认同步"
|
||||
@update:visible="visible = $event"
|
||||
@closed="emit('closed')"
|
||||
@ -82,6 +82,7 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
|
||||
import { useAutoCloseOnSuccess } from '@/components/task-progress/useAutoCloseOnSuccess'
|
||||
import type { ProgressFormField, ProgressMetricItem, ProgressState } from '@/components/task-progress/types'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
@ -158,6 +159,15 @@ const progressState = computed<ProgressState>(() => {
|
||||
return 'running'
|
||||
})
|
||||
|
||||
// 任务成功后 1.5 秒自动关闭弹窗;失败保持打开,便于查看错误原因(表单态不参与)
|
||||
useAutoCloseOnSuccess({
|
||||
visible: () => visible.value,
|
||||
state: () => (isProgress.value ? progressState.value : 'running'),
|
||||
close: () => {
|
||||
visible.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const progressDetail = computed(() => {
|
||||
const total = props.totalCount
|
||||
const processed = props.processedCount
|
||||
|
||||
@ -221,8 +221,18 @@ const badgeToTabMap: Record<string, string> = {
|
||||
archiveOrder: 'archiveOrder'
|
||||
}
|
||||
|
||||
async function loadBadgeCounts() {
|
||||
/** tab.name → 角标接口字段(反查表;避免每次刷新都对 badgeToTabMap 做 Object.keys+find) */
|
||||
const tabNameToBadgeKey: Record<string, string> = Object.fromEntries(
|
||||
Object.entries(badgeToTabMap).map(([badgeKey, tabName]) => [tabName, badgeKey])
|
||||
)
|
||||
|
||||
/** 角标刷新最小间隔:切页签时做节流,避免连续切换重复打角标聚合查询(手动刷新不受限) */
|
||||
const BADGE_REFRESH_MIN_INTERVAL = 3000
|
||||
let lastBadgeSyncAt = 0
|
||||
|
||||
async function loadBadgeCounts(options: { force?: boolean } = {}) {
|
||||
if (badgeLoading.value) return
|
||||
if (!options.force && Date.now() - lastBadgeSyncAt < BADGE_REFRESH_MIN_INTERVAL) return
|
||||
badgeLoading.value = true
|
||||
try {
|
||||
const res: any = await orderBadgeCount()
|
||||
@ -230,10 +240,11 @@ async function loadBadgeCounts() {
|
||||
const data = res.data as Record<string, number | string>
|
||||
// 就地更新 count,避免整表替换导致 el-tabs 子项反复重建、事件重入
|
||||
for (const tab of tabs.value) {
|
||||
const badgeKey = Object.keys(badgeToTabMap).find((key) => badgeToTabMap[key] === tab.name)
|
||||
const badgeKey = tabNameToBadgeKey[tab.name]
|
||||
if (!badgeKey) continue
|
||||
tab.count = data[badgeKey] ?? 0
|
||||
}
|
||||
lastBadgeSyncAt = Date.now()
|
||||
} catch (error) {
|
||||
console.error('order.badgeCount error:', error)
|
||||
} finally {
|
||||
@ -242,7 +253,7 @@ async function loadBadgeCounts() {
|
||||
}
|
||||
|
||||
function refreshBadgeCounts() {
|
||||
safeInvoke(() => loadBadgeCounts())
|
||||
safeInvoke(() => loadBadgeCounts({ force: true }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -204,7 +204,7 @@ import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderOutboundOrder } from '@/api/order.outboundorder/orderoutboundOrder'
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
@ -456,9 +456,9 @@ function mapNameOptions(rawList: any[], nameKeys: string[]) {
|
||||
async function loadOrderMetaOptions() {
|
||||
try {
|
||||
const [expressRes, platformRes, storesRes] = await Promise.all([
|
||||
indexApi.getExpressList({ systemOnly: 'true' }),
|
||||
indexApi.getPlatformList({ systemOnly: 'true' }),
|
||||
indexApi.loadStores()
|
||||
loadExpressListCached({ systemOnly: 'true' }),
|
||||
loadPlatformListCached(),
|
||||
loadStoresCached()
|
||||
])
|
||||
const expressData: any = expressRes?.data
|
||||
const platformData: any = platformRes?.data
|
||||
|
||||
@ -252,7 +252,7 @@
|
||||
<sync-order-ids-form
|
||||
v-model="syncOrderIdsDialogVisible"
|
||||
:order-count="selectionRows.length"
|
||||
:order-ids="getSelectedIds()"
|
||||
:order-ids="selectedOrderIds"
|
||||
:loading="syncOrderIdsLoading"
|
||||
:request-id="syncOrderIdsRequestId"
|
||||
:task-status="syncOrderIdsTaskStatus"
|
||||
@ -347,9 +347,12 @@
|
||||
<span class="task-panel__field-label">已选订单数</span>
|
||||
<strong class="task-panel__field-value">{{ resolveExceptionOrderIds.length }} 条</strong>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--stack">
|
||||
<div class="task-panel__field task-panel__field--ids">
|
||||
<span class="task-panel__field-label">订单 ID</span>
|
||||
<div class="task-panel__ids">{{ resolveExceptionOrderIds.join(', ') || '—' }}</div>
|
||||
<div class="task-panel__ids">
|
||||
<span v-for="id in resolveExceptionOrderIds" :key="id" class="task-panel__id">{{ id }}</span>
|
||||
<span v-if="!resolveExceptionOrderIds.length" class="task-panel__ids-empty">—</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="task-panel__form-tip">
|
||||
@ -429,7 +432,7 @@ import TaskProgressDialog from '@/components/TaskProgressDialog.vue'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { confirmIntercept } from '@/api/order.recheckorder/recheckOrder'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
@ -509,6 +512,9 @@ const columns = ref(buildPendingStyleColumns())
|
||||
const selectionRows = ref<any[]>([])
|
||||
const hasSelection = ref(false)
|
||||
|
||||
/** 选中行订单 ID(模板里直接调 getSelectedIds() 会在每次渲染重算,这里转成 computed 缓存) */
|
||||
const selectedOrderIds = computed(() => getSelectedIds())
|
||||
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
|
||||
@ -1033,8 +1039,8 @@ function mapNameOptions(rawList: any[], nameKeys: string[]) {
|
||||
async function loadOrderMetaOptions() {
|
||||
try {
|
||||
const [expressRes, platformRes] = await Promise.all([
|
||||
indexApi.getExpressList(),
|
||||
indexApi.getPlatformList({ systemOnly: 'true' })
|
||||
loadExpressListCached(),
|
||||
loadPlatformListCached()
|
||||
])
|
||||
const expressData: any = expressRes?.data
|
||||
const platformData: any = platformRes?.data
|
||||
@ -1064,7 +1070,7 @@ async function loadOrderMetaOptions() {
|
||||
|
||||
async function loadStoreOptions() {
|
||||
try {
|
||||
const storesRes: any = await indexApi.loadStores()
|
||||
const storesRes: any = await loadStoresCached()
|
||||
fillStoreScanFieldOptions(availableFieldsRef, extractStoreListFromResponse(storesRes))
|
||||
} catch {
|
||||
fillStoreScanFieldOptions(availableFieldsRef, [])
|
||||
@ -1250,10 +1256,10 @@ async function handleConfirmInterceptBatch() {
|
||||
border-radius: 4px;
|
||||
background: #fafafa;
|
||||
|
||||
&--stack {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
/* 订单 ID 行:标签在上、值在下(多 ID 胶囊换行展示) */
|
||||
&--ids {
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,12 +1284,30 @@ async function handleConfirmInterceptBatch() {
|
||||
}
|
||||
|
||||
&__ids {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px 6px;
|
||||
max-height: 96px;
|
||||
overflow-y: auto;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
&__id {
|
||||
padding: 0 6px;
|
||||
border-radius: 3px;
|
||||
background: #eef1f6;
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
word-break: break-all;
|
||||
line-height: 20px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__ids-empty {
|
||||
font-size: 13px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
&__form-tip {
|
||||
|
||||
@ -185,7 +185,7 @@ import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { orderReviewOrder } from '@/api/order.revieworder/orderreviewOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
@ -308,9 +308,9 @@ function mapNameOptions(rawList: any[], nameKeys: string[]) {
|
||||
async function loadOrderMetaOptions() {
|
||||
try {
|
||||
const [platformRes, expressRes, storesRes] = await Promise.all([
|
||||
indexApi.getPlatformList({ systemOnly: 'true' }),
|
||||
indexApi.getExpressList({ systemOnly: 'true' }),
|
||||
indexApi.loadStores()
|
||||
loadPlatformListCached(),
|
||||
loadExpressListCached({ systemOnly: 'true' }),
|
||||
loadStoresCached()
|
||||
])
|
||||
const platformData: any = platformRes?.data
|
||||
const platformRaw = platformData?.list || platformData || []
|
||||
|
||||
64
src/views/order/orderManagement/utils/order-meta-cache.ts
Normal file
64
src/views/order/orderManagement/utils/order-meta-cache.ts
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* 订单模块「基础参照数据」请求缓存(快递公司 / 平台 / 店铺)。
|
||||
*
|
||||
* 背景:订单管理 8 个页签各自在 mounted 里拉取这 3 个列表(仅用于 ScanBox 筛选下拉与
|
||||
* 「分配快递号」等弹窗的选项)。页签切换(KeepAlive 淘汰后重建)会重复请求同一份
|
||||
* 几乎不变的数据,属于无效开销。
|
||||
*
|
||||
* 设计:
|
||||
* - 缓存的是**原始接口响应**,调用方仍按各自逻辑解析,互不影响;
|
||||
* - 缓存 key 带当前 token:切换账号后自动失效,避免跨租户脏数据;
|
||||
* - 请求失败即从缓存移除,下次进入页面会重试;
|
||||
* - 默认 TTL 60s,参照数据变更(设置页新增快递公司等)最迟 1 分钟内可见。
|
||||
*/
|
||||
import { getToken } from '@/utils/auth'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import type { GetExpressListParams, GetPlatformListParams } from '@/api/index/index'
|
||||
|
||||
/** 参照数据缓存有效期(毫秒) */
|
||||
export const ORDER_META_CACHE_TTL = 60_000
|
||||
|
||||
type CacheEntry = { at: number; promise: Promise<any> }
|
||||
|
||||
const cache = new Map<string, CacheEntry>()
|
||||
|
||||
function sessionKey(name: string) {
|
||||
return `${name}|${getToken() ?? ''}`
|
||||
}
|
||||
|
||||
function cachedRequest<T>(name: string, loader: () => Promise<T>, ttl = ORDER_META_CACHE_TTL): Promise<T> {
|
||||
const key = sessionKey(name)
|
||||
const now = Date.now()
|
||||
const hit = cache.get(key)
|
||||
if (hit && now - hit.at < ttl) return hit.promise as Promise<T>
|
||||
|
||||
const promise = loader().catch((error) => {
|
||||
// 失败不留在缓存里,避免一次网络抖动导致整段时间都用不到数据
|
||||
if (cache.get(key)?.promise === promise) cache.delete(key)
|
||||
throw error
|
||||
})
|
||||
cache.set(key, { at: now, promise })
|
||||
return promise
|
||||
}
|
||||
|
||||
/** 快递公司列表(systemOnly 不同视为不同缓存项) */
|
||||
export function loadExpressListCached(params?: GetExpressListParams) {
|
||||
const name = params?.systemOnly === 'true' ? 'express:systemOnly' : 'express:all'
|
||||
return cachedRequest(name, () => indexApi.getExpressList(params))
|
||||
}
|
||||
|
||||
/** 平台列表(订单页统一用 systemOnly=true) */
|
||||
export function loadPlatformListCached(params: GetPlatformListParams = { systemOnly: 'true' }) {
|
||||
const name = params.systemOnly === 'true' ? 'platform:systemOnly' : 'platform:all'
|
||||
return cachedRequest(name, () => indexApi.getPlatformList(params))
|
||||
}
|
||||
|
||||
/** 货主店铺列表(ScanBox 货主筛选项) */
|
||||
export function loadStoresCached() {
|
||||
return cachedRequest('stores', () => indexApi.loadStores())
|
||||
}
|
||||
|
||||
/** 清空参照数据缓存(如基础数据被编辑后可手动调用) */
|
||||
export function clearOrderMetaCache() {
|
||||
cache.clear()
|
||||
}
|
||||
@ -35,6 +35,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
|
||||
import { useAutoCloseOnSuccess } from '@/components/task-progress/useAutoCloseOnSuccess'
|
||||
import type {
|
||||
ProgressMetricItem,
|
||||
ProgressState,
|
||||
@ -138,14 +139,23 @@ const metricItems = computed<ProgressMetricItem[]>(() => {
|
||||
})
|
||||
|
||||
const tipText = computed(() => {
|
||||
if (progressState.value === 'success') return props.progress.message || '任务已结束,可关闭窗口'
|
||||
if (progressState.value === 'running') return '任务在后台执行,完成后可关闭窗口。'
|
||||
if (progressState.value === 'success') return props.progress.message || '任务已结束,窗口将在 1.5 秒后自动关闭'
|
||||
if (progressState.value === 'running') return '任务在后台执行,完成后窗口会自动关闭。'
|
||||
return ''
|
||||
})
|
||||
|
||||
const footerHint = computed(() =>
|
||||
progressState.value === 'running' ? '任务在后台执行' : '任务已结束'
|
||||
)
|
||||
const footerHint = computed(() => {
|
||||
if (progressState.value === 'running') return '任务在后台执行'
|
||||
if (progressState.value === 'success') return '任务已完成,窗口将在 1.5 秒后自动关闭'
|
||||
return '任务失败,请查看错误信息后关闭窗口'
|
||||
})
|
||||
|
||||
// 任务成功 1.5 秒后自动关闭弹窗;失败保持打开,便于查看错误原因
|
||||
useAutoCloseOnSuccess({
|
||||
visible: () => props.modelValue,
|
||||
state: () => progressState.value,
|
||||
close: () => emit('update:modelValue', false)
|
||||
})
|
||||
|
||||
function formatDateTime(value: string | number | null | undefined) {
|
||||
if (!value) return '—'
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
|
||||
import { useAutoCloseOnSuccess } from '@/components/task-progress/useAutoCloseOnSuccess'
|
||||
import type {
|
||||
ProgressMetricItem,
|
||||
ProgressState,
|
||||
@ -140,18 +141,27 @@ const metricItems = computed<ProgressMetricItem[]>(() => {
|
||||
})
|
||||
|
||||
const tipText = computed(() => {
|
||||
if (progressState.value === 'success') return props.progress.message || '抓取完成,可关闭窗口'
|
||||
if (progressState.value === 'success') return props.progress.message || '抓取完成,窗口将在 1.5 秒后自动关闭'
|
||||
if (progressState.value === 'running') {
|
||||
if (props.progress.stopReason) return props.progress.stopReason
|
||||
if (props.progress.limitReached) return '已达抓取上限,任务即将结束。'
|
||||
return '抓取任务在后台执行,完成后可关闭窗口。'
|
||||
return '抓取任务在后台执行,完成后窗口会自动关闭。'
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
const footerHint = computed(() =>
|
||||
progressState.value === 'running' ? '抓取任务在后台执行' : '任务已结束'
|
||||
)
|
||||
const footerHint = computed(() => {
|
||||
if (progressState.value === 'running') return '抓取任务在后台执行'
|
||||
if (progressState.value === 'success') return '抓取完成,窗口将在 1.5 秒后自动关闭'
|
||||
return '抓取失败,请查看错误信息后关闭窗口'
|
||||
})
|
||||
|
||||
// 抓取成功 1.5 秒后自动关闭弹窗;失败保持打开,便于查看错误原因
|
||||
useAutoCloseOnSuccess({
|
||||
visible: () => props.modelValue,
|
||||
state: () => progressState.value,
|
||||
close: () => emit('update:modelValue', false)
|
||||
})
|
||||
|
||||
function formatDateTime(value: string | number | null | undefined) {
|
||||
if (!value) return '—'
|
||||
|
||||
@ -21,8 +21,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, watch } from 'vue'
|
||||
import { computed } from 'vue'
|
||||
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
|
||||
import { useAutoCloseOnSuccess } from '@/components/task-progress/useAutoCloseOnSuccess'
|
||||
import type {
|
||||
ProgressMetricItem,
|
||||
ProgressState,
|
||||
@ -143,32 +144,12 @@ const footerHint = computed(() => {
|
||||
// ============================================================
|
||||
// 完成后自动关闭(失败不自动关,便于查看错误)
|
||||
// ============================================================
|
||||
/** 完成后自动关闭的延迟(与导出进度弹窗保持一致:1.5 秒) */
|
||||
const AUTO_CLOSE_DELAY = 1500
|
||||
let autoCloseTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
function stopAutoCloseTimer() {
|
||||
if (autoCloseTimer) {
|
||||
clearTimeout(autoCloseTimer)
|
||||
autoCloseTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.modelValue, progressState.value] as const,
|
||||
([visible, state]) => {
|
||||
stopAutoCloseTimer()
|
||||
// 仅在「弹窗打开 + 扫描成功」时延时关闭;失败 / 手动关闭 / 重置状态都不排新定时器
|
||||
if (!visible || state !== 'success') return
|
||||
autoCloseTimer = setTimeout(() => {
|
||||
autoCloseTimer = null
|
||||
emit('update:modelValue', false)
|
||||
}, AUTO_CLOSE_DELAY)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onBeforeUnmount(stopAutoCloseTimer)
|
||||
/** 扫描成功 1.5 秒后自动关闭弹窗(与导出进度弹窗保持一致) */
|
||||
useAutoCloseOnSuccess({
|
||||
visible: () => props.modelValue,
|
||||
state: () => progressState.value,
|
||||
close: () => emit('update:modelValue', false)
|
||||
})
|
||||
|
||||
function formatDateTime(value: string | number | null | undefined) {
|
||||
if (!value) return '—'
|
||||
|
||||
@ -0,0 +1,112 @@
|
||||
<!--
|
||||
ColumnCellRenderer — 通用表格列渲染器(拣货缺货页)
|
||||
type='tag' → 状态/数值颜色文字(ut-status-text)
|
||||
type='barcodes' → 多值标签(如条码)
|
||||
type='locations' → 补货库位数量
|
||||
type='text' → 纯文本(支持 datetime 格式化)
|
||||
-->
|
||||
<template>
|
||||
<template v-if="!config || config.type === 'default'">
|
||||
<slot />
|
||||
</template>
|
||||
<template v-else-if="config.type === 'tag'">
|
||||
<span :class="getStatusTextClass(resolvedTagType)">
|
||||
{{ displayValue }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else-if="config.type === 'barcodes'">
|
||||
<div v-if="barcodeList.length" class="barcode-list">
|
||||
<span v-for="(code, index) in barcodeList" :key="index" class="barcode-tag">{{ code }}</span>
|
||||
</div>
|
||||
<span v-else class="cell-empty">—</span>
|
||||
</template>
|
||||
<template v-else-if="config.type === 'locations'">
|
||||
<span v-if="locationCount > 0" :class="getStatusTextClass('success')">{{ locationCount }} 个</span>
|
||||
<span v-else class="cell-empty">—</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{ displayValue }}</span>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { ColumnSlotConfig } from '../config/picking-shortage-config'
|
||||
import { TAG_RESOLVERS, translate, formatTime } from '../config/picking-shortage-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
|
||||
defineOptions({ name: 'PickingShortageColumnCellRenderer' })
|
||||
|
||||
const props = defineProps<{
|
||||
config: ColumnSlotConfig | undefined
|
||||
value: any
|
||||
row?: Record<string, any>
|
||||
}>()
|
||||
|
||||
/** 显示文本:translateField 翻译 > format 格式化 > 原始值 */
|
||||
const displayValue = computed(() => {
|
||||
const v = props.value
|
||||
if (props.config?.translateField) {
|
||||
return translate(props.config.translateField, v)
|
||||
}
|
||||
if (props.config?.format === 'datetime') {
|
||||
return formatTime(v)
|
||||
}
|
||||
return v ?? '—'
|
||||
})
|
||||
|
||||
const resolvedTagType = computed(() => {
|
||||
if (!props.config || props.config.type !== 'tag') return ''
|
||||
const { tagType, tagResolver } = props.config
|
||||
const resolver = tagResolver ? TAG_RESOLVERS[tagResolver] : undefined
|
||||
if (resolver) {
|
||||
return resolver(props.value)
|
||||
}
|
||||
if (tagType && typeof tagType === 'object') {
|
||||
return tagType[String(props.value)] ?? 'info'
|
||||
}
|
||||
return typeof tagType === 'string' ? tagType : 'info'
|
||||
})
|
||||
|
||||
/** 多值条码:兼容字符串数组 / { barcode } 数组 */
|
||||
const barcodeList = computed<string[]>(() => {
|
||||
const raw = props.value
|
||||
if (!Array.isArray(raw)) return []
|
||||
return raw
|
||||
.map((item: any) => (typeof item === 'string' ? item : item?.barcode))
|
||||
.filter((code: any) => !!code)
|
||||
})
|
||||
|
||||
const locationCount = computed(() => {
|
||||
const raw = props.value
|
||||
return Array.isArray(raw) ? raw.length : 0
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.barcode-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.barcode-tag {
|
||||
padding: 0 6px;
|
||||
border-radius: 3px;
|
||||
background: #eef1f6;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cell-empty {
|
||||
color: #c0c4cc;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,513 @@
|
||||
/**
|
||||
* 拣货缺货(缺货补货)页面配置 — 基于 views/mode 页面模板 v2
|
||||
*
|
||||
* 结构:
|
||||
* FIELD_DICT — 字段唯一真相来源(label / ScanBox / 表格列 / 单元格渲染 / 明细标签)
|
||||
* VALUE_MAPS — 值翻译映射
|
||||
* TAG_RESOLVERS — 状态文字颜色解析器
|
||||
* tabPages — 标签页配置(本页为单页模式,仅一个 shortage 页签)
|
||||
* resolveTabConfig — 将 key 列表展开为完整配置
|
||||
*/
|
||||
|
||||
import type { Component } from 'vue'
|
||||
import { getReplenishmentDemand } from '@/api/storage.management/management'
|
||||
import {
|
||||
isReplenishmentDemandSuccess,
|
||||
parseReplenishmentDemandResponse,
|
||||
replenishmentStatusLabelMap,
|
||||
replenishmentStatusTagMap
|
||||
} from '@/views/storage/management/replenishmentDemand/replenishment-demand-config'
|
||||
|
||||
// ============================================================
|
||||
// 〇、全局页面配置(本页为单页模式,不需要顶部标签栏)
|
||||
// ============================================================
|
||||
export const PAGE_CONFIG = {
|
||||
showTabArea: false,
|
||||
singlePage: true,
|
||||
/** 已移除「缺货明细」面板:补货库位明细改为表格展开行展示 */
|
||||
enableDetailPanel: false
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 〇-A、组件注册表
|
||||
// ============================================================
|
||||
export const COMPONENT_REGISTRY: Record<string, Component> = {}
|
||||
|
||||
// ============================================================
|
||||
// 〇-B、ScanBox 分组
|
||||
// ============================================================
|
||||
export const SCANBOX_GROUPS = {
|
||||
basic: '基础信息',
|
||||
stock: '库存与需求'
|
||||
} as const
|
||||
|
||||
// ============================================================
|
||||
// 一、FIELD_DICT
|
||||
// ============================================================
|
||||
export interface FieldDefinition {
|
||||
key: string
|
||||
label: string
|
||||
scanBox: {
|
||||
type: 'text' | 'select' | 'daterange' | 'number'
|
||||
group?: string
|
||||
options?: { label: string; value: any }[]
|
||||
} | null
|
||||
table: {
|
||||
minWidth?: number
|
||||
width?: number
|
||||
fixed?: 'left' | 'right' | boolean
|
||||
align?: 'left' | 'center' | 'right'
|
||||
sortable?: boolean
|
||||
showOverflowTooltip?: boolean
|
||||
copyAction?: 'copy' | 'copyQr'
|
||||
copyValue?: (row: any) => any
|
||||
} | null
|
||||
slot: {
|
||||
type: 'tag' | 'text' | 'default' | 'operation' | 'barcodes' | 'locations'
|
||||
tagType?: string | Record<string, string>
|
||||
tagResolver?: string
|
||||
translateField?: string
|
||||
format?: 'datetime'
|
||||
} | null
|
||||
detailLabel?: string
|
||||
}
|
||||
|
||||
/** 货主下拉选项(异步填充;index.vue 加载完成后 bump 版本号触发 ScanBox 重渲染) */
|
||||
export const storeScanBoxOptions: { label: string; value: any }[] = []
|
||||
|
||||
// ============================================================
|
||||
// 二、VALUE_MAPS / 翻译
|
||||
// ============================================================
|
||||
export const VALUE_MAPS: Record<string, Record<string, string>> = {
|
||||
replenishment_status: replenishmentStatusLabelMap
|
||||
}
|
||||
|
||||
export function translate(field: string, value: any): string {
|
||||
const map = VALUE_MAPS[field]
|
||||
if (!map) return String(value ?? '—')
|
||||
return map[String(value)] ?? String(value ?? '—')
|
||||
}
|
||||
|
||||
export function formatTime(value: any): string {
|
||||
if (!value) return '—'
|
||||
const d = new Date(value)
|
||||
if (isNaN(d.getTime())) return String(value)
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 三、TAG_RESOLVERS
|
||||
// ============================================================
|
||||
export const TAG_RESOLVERS: Record<string, (val: any) => string> = {
|
||||
/** 补货状态:真实缺货=danger / 可补货=warning / 充足=success */
|
||||
resolveReplenishmentStatus(v) {
|
||||
return replenishmentStatusTagMap[String(v ?? '')] ?? 'info'
|
||||
},
|
||||
/** 建议补货量:>0 用 warning,否则 success */
|
||||
resolveReplenishmentNeeded(v) {
|
||||
return Number(v) > 0 ? 'warning' : 'success'
|
||||
},
|
||||
/** 缺口数量:>0 用 danger,否则 info */
|
||||
resolveShortage(v) {
|
||||
return Number(v) > 0 ? 'danger' : 'info'
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 四、FIELD_DICT 实例
|
||||
// ============================================================
|
||||
export const FIELD_DICT: Record<string, FieldDefinition> = {
|
||||
/** 货主筛选(仅 ScanBox 使用) */
|
||||
store_id: {
|
||||
key: 'store_id',
|
||||
label: '货主',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: storeScanBoxOptions },
|
||||
table: null,
|
||||
slot: null
|
||||
},
|
||||
stock_id: {
|
||||
key: 'stock_id',
|
||||
label: 'SKU ID',
|
||||
scanBox: null,
|
||||
table: { minWidth: 100, align: 'right', sortable: true },
|
||||
slot: null,
|
||||
detailLabel: 'SKU ID'
|
||||
},
|
||||
stock_code: {
|
||||
key: 'stock_code',
|
||||
label: 'SKU编码',
|
||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||
table: { minWidth: 140, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: 'SKU编码'
|
||||
},
|
||||
stock_name: {
|
||||
key: 'stock_name',
|
||||
label: '商品名称',
|
||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||
table: { minWidth: 160, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '商品名称'
|
||||
},
|
||||
store_name: {
|
||||
key: 'store_name',
|
||||
label: '货主名称',
|
||||
scanBox: null,
|
||||
table: { minWidth: 140, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '货主名称'
|
||||
},
|
||||
barcodes: {
|
||||
key: 'barcodes',
|
||||
label: '条码',
|
||||
scanBox: null,
|
||||
table: { minWidth: 180 },
|
||||
slot: { type: 'barcodes' },
|
||||
detailLabel: '条码'
|
||||
},
|
||||
pick_zone_quantity: {
|
||||
key: 'pick_zone_quantity',
|
||||
label: '分拣区库存',
|
||||
scanBox: null,
|
||||
table: { minWidth: 110, align: 'right', sortable: true },
|
||||
slot: null,
|
||||
detailLabel: '分拣区库存'
|
||||
},
|
||||
storage_zone_quantity: {
|
||||
key: 'storage_zone_quantity',
|
||||
label: '存货区库存',
|
||||
scanBox: null,
|
||||
table: { minWidth: 110, align: 'right', sortable: true },
|
||||
slot: null,
|
||||
detailLabel: '存货区库存'
|
||||
},
|
||||
total_demand: {
|
||||
key: 'total_demand',
|
||||
label: '总需求量',
|
||||
scanBox: null,
|
||||
table: { minWidth: 100, align: 'right', sortable: true },
|
||||
slot: null,
|
||||
detailLabel: '总需求量'
|
||||
},
|
||||
shortage: {
|
||||
key: 'shortage',
|
||||
label: '缺口数量',
|
||||
scanBox: null,
|
||||
table: { minWidth: 100, align: 'right', sortable: true },
|
||||
slot: { type: 'tag', tagResolver: 'resolveShortage' },
|
||||
detailLabel: '缺口数量'
|
||||
},
|
||||
replenishment_needed: {
|
||||
key: 'replenishment_needed',
|
||||
label: '建议补货量',
|
||||
scanBox: null,
|
||||
table: { minWidth: 110, align: 'right', sortable: true },
|
||||
slot: { type: 'tag', tagResolver: 'resolveReplenishmentNeeded' },
|
||||
detailLabel: '建议补货量'
|
||||
},
|
||||
replenishment_status: {
|
||||
key: 'replenishment_status',
|
||||
label: '补货状态',
|
||||
scanBox: null,
|
||||
table: { minWidth: 110, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveReplenishmentStatus', translateField: 'replenishment_status' },
|
||||
detailLabel: '补货状态'
|
||||
},
|
||||
replenishment_locations: {
|
||||
key: 'replenishment_locations',
|
||||
label: '补货库位',
|
||||
scanBox: null,
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: { type: 'locations' },
|
||||
detailLabel: '补货库位'
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 五、类型定义(与模板一致)
|
||||
// ============================================================
|
||||
export interface ColumnSlotConfig {
|
||||
type: 'tag' | 'text' | 'default' | 'operation' | 'barcodes' | 'locations'
|
||||
tagType?: string | Record<string, string>
|
||||
tagResolver?: string
|
||||
translateField?: string
|
||||
format?: 'datetime'
|
||||
}
|
||||
|
||||
export interface DetailFieldConfig {
|
||||
key: string
|
||||
label?: string
|
||||
span?: number
|
||||
renderType?: 'text' | 'tag' | 'pre' | 'barcodes'
|
||||
tagType?: string | Record<string, string>
|
||||
tagResolver?: string
|
||||
translateField?: string
|
||||
}
|
||||
|
||||
export interface DetailSectionConfig {
|
||||
title: string
|
||||
columnCount: number
|
||||
fields: DetailFieldConfig[]
|
||||
}
|
||||
|
||||
export interface DetailTabConfig {
|
||||
name: string
|
||||
label: string
|
||||
componentKey: string
|
||||
component?: Component
|
||||
}
|
||||
|
||||
export type ApiMethod = (...args: any[]) => Promise<any>
|
||||
|
||||
export interface TabPageApiConfig {
|
||||
list: ApiMethod
|
||||
detail?: { source: 'list' } | ApiMethod
|
||||
parseListResponse?: (res: any) => { list: any[]; total: number; summary?: Record<string, any> }
|
||||
buildListParams?: (params: {
|
||||
pagination: { page: number; pageSize: number }
|
||||
conditions: Record<string, any>
|
||||
sort?: { prop: string; order: string }
|
||||
}) => Record<string, any>
|
||||
}
|
||||
|
||||
export interface TabPageRawConfig {
|
||||
name: string
|
||||
label: string
|
||||
scanBoxCacheKey: string
|
||||
scanBoxFieldKeys: string[]
|
||||
tableColumnKeys: string[]
|
||||
upperTableDefaults: {
|
||||
title: string
|
||||
enableColumnConfig?: boolean
|
||||
showIndex?: boolean
|
||||
showSelection?: boolean
|
||||
emptyText?: string
|
||||
}
|
||||
detailTabs?: { name: string; label: string; componentKey: string }[]
|
||||
detailSections: { title: string; columnCount: number; fieldKeys: string[] }[]
|
||||
api?: TabPageApiConfig
|
||||
}
|
||||
|
||||
export interface TabPageConfig {
|
||||
name: string
|
||||
label: string
|
||||
scanBoxCacheKey: string
|
||||
scanBoxFields: Record<string, any>[]
|
||||
upperTable: {
|
||||
title: string
|
||||
enableColumnConfig: boolean
|
||||
showIndex: boolean
|
||||
showSelection: boolean
|
||||
emptyText: string
|
||||
columns: Record<string, any>[]
|
||||
}
|
||||
columnSlots: Record<string, ColumnSlotConfig>
|
||||
detailConfig: DetailSectionConfig[]
|
||||
detailTabs: DetailTabConfig[]
|
||||
api?: TabPageApiConfig
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 六、resolveTabConfig
|
||||
// ============================================================
|
||||
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||
const scanBoxFields: Record<string, any>[] = []
|
||||
for (const key of raw.scanBoxFieldKeys) {
|
||||
const def = FIELD_DICT[key]
|
||||
if (!def || !def.scanBox) continue
|
||||
scanBoxFields.push({
|
||||
label: def.label,
|
||||
value: def.key,
|
||||
type: def.scanBox.type,
|
||||
options: def.scanBox.options,
|
||||
group: def.scanBox.group
|
||||
})
|
||||
}
|
||||
|
||||
const columns: Record<string, any>[] = []
|
||||
for (const key of raw.tableColumnKeys) {
|
||||
const def = FIELD_DICT[key]
|
||||
if (!def || !def.table) continue
|
||||
columns.push({ prop: def.key, label: def.label, ...def.table })
|
||||
}
|
||||
|
||||
const columnSlots: Record<string, ColumnSlotConfig> = {}
|
||||
for (const key of raw.tableColumnKeys) {
|
||||
const def = FIELD_DICT[key]
|
||||
if (!def || !def.slot) continue
|
||||
columnSlots[def.key] = { ...def.slot }
|
||||
}
|
||||
|
||||
const detailConfig: DetailSectionConfig[] = raw.detailSections.map((sec) => ({
|
||||
title: sec.title,
|
||||
columnCount: sec.columnCount,
|
||||
fields: sec.fieldKeys
|
||||
.map((key): DetailFieldConfig | null => {
|
||||
const def = FIELD_DICT[key]
|
||||
if (!def) return null
|
||||
return {
|
||||
key: def.key,
|
||||
label: def.detailLabel ?? def.label,
|
||||
translateField: def.slot?.translateField,
|
||||
tagResolver: def.slot?.tagResolver,
|
||||
tagType: def.slot?.tagType,
|
||||
renderType:
|
||||
def.slot?.type === 'tag'
|
||||
? 'tag'
|
||||
: def.slot?.type === 'barcodes'
|
||||
? 'barcodes'
|
||||
: 'text'
|
||||
}
|
||||
})
|
||||
.filter((f): f is DetailFieldConfig => f !== null)
|
||||
}))
|
||||
|
||||
const detailTabs: DetailTabConfig[] = (raw.detailTabs ?? []).map((tab) => ({
|
||||
name: tab.name,
|
||||
label: tab.label,
|
||||
componentKey: tab.componentKey,
|
||||
component: COMPONENT_REGISTRY[tab.componentKey]
|
||||
}))
|
||||
|
||||
return {
|
||||
name: raw.name,
|
||||
label: raw.label,
|
||||
scanBoxCacheKey: raw.scanBoxCacheKey,
|
||||
scanBoxFields,
|
||||
upperTable: {
|
||||
title: raw.upperTableDefaults.title,
|
||||
enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true,
|
||||
showIndex: raw.upperTableDefaults.showIndex ?? true,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? true,
|
||||
emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据',
|
||||
columns
|
||||
},
|
||||
columnSlots,
|
||||
detailConfig,
|
||||
detailTabs,
|
||||
api: raw.api
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 七、工具栏按钮
|
||||
// ============================================================
|
||||
export interface ToolbarButtonConfig {
|
||||
key: string
|
||||
label: string
|
||||
size?: '' | 'default' | 'small' | 'large'
|
||||
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
||||
plain?: boolean
|
||||
loadingKey?: string
|
||||
disabledKey?: string
|
||||
action: string
|
||||
dynamicLabelKey?: string
|
||||
buttonType?: 'default' | 'dropdown'
|
||||
dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }>
|
||||
}
|
||||
|
||||
export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
||||
refresh: {
|
||||
key: 'refresh',
|
||||
label: '刷新',
|
||||
type: 'primary',
|
||||
size: 'small',
|
||||
loadingKey: 'loading',
|
||||
action: 'loadData'
|
||||
},
|
||||
export: {
|
||||
key: 'export',
|
||||
label: '导出选中',
|
||||
size: 'small',
|
||||
type: 'success',
|
||||
plain: true,
|
||||
disabledKey: 'noSelection',
|
||||
action: 'handleExport'
|
||||
},
|
||||
columnConfig: {
|
||||
key: 'columnConfig',
|
||||
label: '字段设置',
|
||||
size: 'small',
|
||||
action: 'openColumnConfigPanel'
|
||||
},
|
||||
toggleDetail: {
|
||||
key: 'toggleDetail',
|
||||
label: '显示详情',
|
||||
dynamicLabelKey: 'detailToggleLabel',
|
||||
size: 'small',
|
||||
action: 'toggleDetailVisible'
|
||||
}
|
||||
}
|
||||
|
||||
export function getTabToolbarButtons(): ToolbarButtonConfig[] {
|
||||
return Object.values(TOOLBAR_BUTTONS).filter((btn) => {
|
||||
// 详情面板禁用时,隐藏「显示/隐藏详情」按钮
|
||||
if (!PAGE_CONFIG.enableDetailPanel && btn.key === 'toggleDetail') return false
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 八、标签页注册(单页)
|
||||
// ============================================================
|
||||
export const tabPages: TabPageRawConfig[] = [
|
||||
{
|
||||
name: 'shortage',
|
||||
label: '缺货补货',
|
||||
scanBoxCacheKey: 'picking-shortage',
|
||||
scanBoxFieldKeys: ['store_id'],
|
||||
tableColumnKeys: [
|
||||
'stock_code',
|
||||
'stock_name',
|
||||
'store_name',
|
||||
'barcodes',
|
||||
'pick_zone_quantity',
|
||||
'storage_zone_quantity',
|
||||
'total_demand',
|
||||
'shortage',
|
||||
'replenishment_needed',
|
||||
'replenishment_status',
|
||||
'replenishment_locations'
|
||||
],
|
||||
upperTableDefaults: {
|
||||
title: '缺货补货需求',
|
||||
showSelection: true,
|
||||
emptyText: '暂无补货需求数据,可调整筛选条件后重新查询'
|
||||
},
|
||||
detailTabs: [],
|
||||
detailSections: [],
|
||||
api: {
|
||||
list: (params: Record<string, any>) => getReplenishmentDemand(params as any),
|
||||
detail: { source: 'list' },
|
||||
parseListResponse(res: any) {
|
||||
const parsed = parseReplenishmentDemandResponse(res)
|
||||
return {
|
||||
list: parsed.list,
|
||||
total: parsed.pagination.total,
|
||||
summary: parsed.summary as Record<string, any>
|
||||
}
|
||||
},
|
||||
buildListParams({ pagination, conditions, sort }) {
|
||||
const body: Record<string, any> = {
|
||||
pagination: { page: pagination.page, pageSize: pagination.pageSize },
|
||||
sort: {
|
||||
sortField: sort?.prop || 'shortage',
|
||||
sortOrder: sort?.order === 'ascending' ? 'ASC' : 'DESC'
|
||||
}
|
||||
}
|
||||
// ScanBox 货主条件:{ operator, value } 或直接值
|
||||
const raw = conditions?.store_id
|
||||
const storeVal =
|
||||
raw && typeof raw === 'object' && 'value' in raw ? (raw as any).value : raw
|
||||
if (storeVal !== undefined && storeVal !== null && storeVal !== '') {
|
||||
body.store_id = storeVal
|
||||
}
|
||||
return body
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
/** 响应成功判断(供 index.vue 复用) */
|
||||
export { isReplenishmentDemandSuccess }
|
||||
491
src/views/stock/pickingShortage/index.vue
Normal file
491
src/views/stock/pickingShortage/index.vue
Normal file
@ -0,0 +1,491 @@
|
||||
<!--
|
||||
拣货缺货(缺货补货)— 基于 views/mode 页面模板 v2
|
||||
|
||||
结构:ScanBox(筛选) + 工具栏(刷新/导出选中/字段设置 + 汇总) +
|
||||
UpperTable(表格,展开行展示「补货库位明细」)
|
||||
-->
|
||||
<template>
|
||||
<div class="page-wrapper" :style="{ height: containerHeight }">
|
||||
<div class="main-container">
|
||||
<div class="order-sub-container">
|
||||
<!-- 左侧:ScanBox 筛选面板 -->
|
||||
<ScanBox
|
||||
:key="scanBoxRenderKey"
|
||||
ref="scanBoxRef"
|
||||
:cache-key="currentScanBoxCacheKey"
|
||||
width="220px"
|
||||
:tree-props="{ children: 'children', label: 'label' }"
|
||||
:auto-submit="false"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="currentScanBoxFields"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleConditionReset"
|
||||
@condition-clear="handleConditionClear"
|
||||
/>
|
||||
|
||||
<!-- 右侧:内容区 -->
|
||||
<div class="main-content">
|
||||
<div class="tab-content-inner">
|
||||
<!-- 工具栏按钮组 + 汇总统计 -->
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<OrderToolbarButtonGroup
|
||||
:buttons="currentToolbarButtons"
|
||||
:resolve-disabled="resolveButtonDisabled"
|
||||
:resolve-loading="resolveButtonLoading"
|
||||
:resolve-label="resolveButtonLabel"
|
||||
:layout-key="toolbarLayoutKey"
|
||||
@action="handleToolbarButtonClick"
|
||||
/>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<span class="summary-chip">SKU总数 <strong>{{ summary.total_skus ?? '-' }}</strong></span>
|
||||
<span class="summary-chip summary-chip--warning">缺货SKU <strong>{{ summary.total_shortage_skus ?? '-' }}</strong></span>
|
||||
<span class="summary-chip summary-chip--primary">建议补货 <strong>{{ summary.total_replenishment_needed ?? '-' }}</strong></span>
|
||||
<span class="summary-chip summary-chip--danger">真实缺货 <strong>{{ summary.total_true_shortage_skus ?? '-' }}</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格(占满高度;展开行显示补货库位明细) -->
|
||||
<div class="upper-wrapper upper-wrapper--full">
|
||||
<UpperTable
|
||||
ref="upperTableRef"
|
||||
:title="currentTabConfig?.upperTable.title ?? '缺货补货需求'"
|
||||
default-align="center"
|
||||
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
|
||||
:column-config-schema-version="1"
|
||||
table-id="picking-shortage-list"
|
||||
:data="listData"
|
||||
row-key="stock_id"
|
||||
:columns="currentColumns"
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:show-expand="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
@sort-change="handleSortChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template
|
||||
v-for="(slotConfig, colProp) in currentColumnSlots"
|
||||
:key="`columnSlots-${colProp}`"
|
||||
#[`column-${colProp}`]="{ row }"
|
||||
>
|
||||
<ColumnCellRenderer :config="slotConfig" :value="row[colProp]" :row="row" />
|
||||
</template>
|
||||
|
||||
<!-- 展开行:补货库位明细 -->
|
||||
<template #expand="{ row }">
|
||||
<div class="expand-locations">
|
||||
<template v-if="rowLocations(row).length">
|
||||
<div class="expand-locations__title">补货库位明细</div>
|
||||
<el-table :data="rowLocations(row)" border size="small" class="expand-locations__table">
|
||||
<el-table-column label="序号" width="64" align="center">
|
||||
<template #default="{ $index }">{{ $index + 1 }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="space_code" label="库位编码" min-width="160" align="center" />
|
||||
<el-table-column prop="space_name" label="库位名称" min-width="140" align="center" />
|
||||
<el-table-column prop="available_quantity" label="可用数量" min-width="100" align="center" />
|
||||
</el-table>
|
||||
</template>
|
||||
<div v-else class="expand-locations__empty">
|
||||
无可用补货库位(存货区与分拣区均无库存)
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
|
||||
</template>
|
||||
</UpperTable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({ name: 'PickingShortage' })
|
||||
|
||||
import { ref, computed, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { loadStores } from '@/api/index/index'
|
||||
import {
|
||||
extractStoreListFromResponse,
|
||||
mapStoreListToSelectOptions
|
||||
} from '@/views/order/orderManagement/config/order-common-config'
|
||||
import {
|
||||
exportReplenishmentDemandCsv,
|
||||
isReplenishmentDemandSuccess,
|
||||
type ReplenishmentDemandSummary
|
||||
} from '@/views/storage/management/replenishmentDemand/replenishment-demand-config'
|
||||
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import {
|
||||
tabPages,
|
||||
storeScanBoxOptions,
|
||||
resolveTabConfig,
|
||||
getTabToolbarButtons,
|
||||
type TabPageConfig,
|
||||
type ToolbarButtonConfig
|
||||
} from './config/picking-shortage-config'
|
||||
|
||||
// ============================================================
|
||||
// 容器高度
|
||||
// ============================================================
|
||||
const settingsStore = useSettingsStore()
|
||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||||
const containerHeight = computed(() =>
|
||||
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
|
||||
)
|
||||
|
||||
// ============================================================
|
||||
// 页面配置(单页模式,无详情面板)
|
||||
// ============================================================
|
||||
const activeTabName = ref(tabPages[0]?.name ?? 'shortage')
|
||||
|
||||
const currentTabConfig = computed<TabPageConfig | undefined>(() => {
|
||||
const raw = tabPages.find((t) => t.name === activeTabName.value)
|
||||
if (!raw) return undefined
|
||||
return resolveTabConfig(raw)
|
||||
})
|
||||
|
||||
const currentScanBoxCacheKey = computed(
|
||||
() => currentTabConfig.value?.scanBoxCacheKey ?? 'picking-shortage'
|
||||
)
|
||||
const currentScanBoxFields = computed(() => currentTabConfig.value?.scanBoxFields ?? [])
|
||||
const currentColumns = computed(() => currentTabConfig.value?.upperTable.columns ?? [])
|
||||
const currentColumnSlots = computed(() => currentTabConfig.value?.columnSlots ?? {})
|
||||
|
||||
/** ScanBox 重渲染 key:货主下拉选项异步加载完成后 bump,使新 options 生效 */
|
||||
const scanBoxRenderKey = ref(0)
|
||||
|
||||
// ============================================================
|
||||
// 工具栏按钮
|
||||
// ============================================================
|
||||
const currentToolbarButtons = computed<OrderToolbarButtonConfig[]>(() =>
|
||||
getTabToolbarButtons().map((btn: ToolbarButtonConfig) => ({
|
||||
key: btn.key,
|
||||
label: btn.label,
|
||||
size: btn.size,
|
||||
type: btn.type,
|
||||
plain: btn.plain,
|
||||
loadingKey: btn.loadingKey,
|
||||
disabledKey: btn.disabledKey,
|
||||
action: btn.action,
|
||||
dynamicLabelKey: btn.dynamicLabelKey,
|
||||
buttonType: btn.buttonType,
|
||||
dropdownOptions: btn.dropdownOptions
|
||||
}))
|
||||
)
|
||||
|
||||
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
|
||||
noSelection: selectedRows.value.length === 0
|
||||
}))
|
||||
|
||||
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
loading: loading.value
|
||||
}))
|
||||
|
||||
const toolbarLayoutKey = computed(() =>
|
||||
JSON.stringify({
|
||||
loading: buttonLoadingMap.value,
|
||||
disabled: buttonDisabledMap.value
|
||||
})
|
||||
)
|
||||
|
||||
function resolveButtonLoading(loadingKey?: string) {
|
||||
if (!loadingKey) return false
|
||||
return Boolean(buttonLoadingMap.value[loadingKey])
|
||||
}
|
||||
|
||||
function resolveButtonDisabled(disabledKey?: string) {
|
||||
if (!disabledKey) return false
|
||||
return Boolean(buttonDisabledMap.value[disabledKey])
|
||||
}
|
||||
|
||||
function resolveButtonLabel(defaultLabel: string) {
|
||||
return defaultLabel
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 工具栏动作
|
||||
// ============================================================
|
||||
const toolbarActionMap: Record<string, () => void> = {
|
||||
loadData: () => {
|
||||
void loadData()
|
||||
},
|
||||
openColumnConfigPanel: () => upperTableRef.value?.openColumnConfig?.(),
|
||||
handleExport: () => handleExport()
|
||||
}
|
||||
|
||||
function handleToolbarButtonClick(action: string) {
|
||||
const handler = toolbarActionMap[action]
|
||||
if (handler) {
|
||||
handler()
|
||||
return
|
||||
}
|
||||
console.warn('[PickingShortage] 未处理的工具栏动作:', action)
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
if (!selectedRows.value.length) {
|
||||
ElMessage.warning('请先勾选要导出的数据')
|
||||
return
|
||||
}
|
||||
exportReplenishmentDemandCsv(selectedRows.value as any, '缺货补货需求.csv')
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 列表数据
|
||||
// ============================================================
|
||||
const listData = ref<Record<string, any>[]>([])
|
||||
const loading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
const summary = ref<ReplenishmentDemandSummary>({})
|
||||
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const currentSort = reactive({ prop: 'shortage', order: 'descending' })
|
||||
|
||||
const loadData = async () => {
|
||||
const cfg = currentTabConfig.value
|
||||
if (!cfg?.api) return
|
||||
loading.value = true
|
||||
const startTime = performance.now()
|
||||
|
||||
try {
|
||||
const conditions = scanBoxRef.value?.getConditions?.() || {}
|
||||
const params = cfg.api.buildListParams
|
||||
? cfg.api.buildListParams({
|
||||
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
||||
conditions,
|
||||
sort: currentSort.prop ? { prop: currentSort.prop, order: currentSort.order } : undefined
|
||||
})
|
||||
: {
|
||||
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize }
|
||||
}
|
||||
|
||||
const res = await cfg.api.list(params)
|
||||
if (!isReplenishmentDemandSuccess(res)) {
|
||||
throw new Error((res as any)?.message || '接口返回异常')
|
||||
}
|
||||
const parsed = cfg.api.parseListResponse
|
||||
? cfg.api.parseListResponse(res)
|
||||
: { list: [], total: 0, summary: {} }
|
||||
listData.value = parsed.list
|
||||
pagination.total = parsed.total
|
||||
summary.value = (parsed.summary ?? {}) as ReplenishmentDemandSummary
|
||||
} catch (e: any) {
|
||||
console.error('[PickingShortage] 加载列表失败:', e)
|
||||
ElMessage.error(e?.message || '获取缺货补货需求失败')
|
||||
listData.value = []
|
||||
pagination.total = 0
|
||||
summary.value = {}
|
||||
} finally {
|
||||
loading.value = false
|
||||
queryTime.value = Math.round(performance.now() - startTime)
|
||||
}
|
||||
}
|
||||
|
||||
/** 展开行:补货库位列表 */
|
||||
function rowLocations(row: Record<string, any>): any[] {
|
||||
return Array.isArray(row?.replenishment_locations) ? row.replenishment_locations : []
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ScanBox 事件
|
||||
// ============================================================
|
||||
const scanBoxRef = ref<any>(null)
|
||||
const presetTree = ref<any[]>([])
|
||||
|
||||
function resetAndReload() {
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
const handleConditionChange = () => resetAndReload()
|
||||
const handleConditionReset = () => resetAndReload()
|
||||
const handleConditionClear = () => resetAndReload()
|
||||
|
||||
// ============================================================
|
||||
// UpperTable 事件
|
||||
// ============================================================
|
||||
const upperTableRef = ref<any>(null)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
const handleSortChange = ({ prop, order }: any) => {
|
||||
currentSort.prop = prop
|
||||
currentSort.order = order
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
pagination.currentPage = page
|
||||
void loadData()
|
||||
}
|
||||
|
||||
const handlePageSizeChange = (size: number) => {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
const handleSelectionChange = (rows: Record<string, any>[]) => {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 货主下拉(ScanBox 选项异步填充)
|
||||
// ============================================================
|
||||
async function loadStoreScanBoxOptions() {
|
||||
try {
|
||||
const res: any = await loadStores()
|
||||
const options = mapStoreListToSelectOptions(extractStoreListFromResponse(res)).map((opt) => ({
|
||||
label: opt.label,
|
||||
value: opt.value
|
||||
}))
|
||||
storeScanBoxOptions.length = 0
|
||||
storeScanBoxOptions.push(...options)
|
||||
// options 变化后重挂 ScanBox,使下拉选项生效
|
||||
scanBoxRenderKey.value += 1
|
||||
} catch (e) {
|
||||
console.warn('[PickingShortage] 货主列表加载失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadStoreScanBoxOptions()
|
||||
void loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 布局样式对齐 order/orderManagement(order-sub.scss) */
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.page-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
background: #fff;
|
||||
border: 1px solid #e8eef7;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab-content-inner {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 工具栏右侧汇总统计 */
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.summary-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #f4f4f5;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: #909399;
|
||||
|
||||
strong {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
&--primary strong {
|
||||
color: var(--el-color-primary, #409eff);
|
||||
}
|
||||
|
||||
&--warning strong {
|
||||
color: var(--el-color-warning, #e6a23c);
|
||||
}
|
||||
|
||||
&--danger strong {
|
||||
color: var(--el-color-danger, #f56c6c);
|
||||
}
|
||||
}
|
||||
|
||||
/* 展开行:补货库位明细 */
|
||||
.expand-locations {
|
||||
padding: 8px 12px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.expand-locations__title {
|
||||
margin-bottom: 6px;
|
||||
padding-left: 8px;
|
||||
position: relative;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
color: #303133;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 5px;
|
||||
bottom: 5px;
|
||||
width: 3px;
|
||||
border-radius: 2px;
|
||||
background: var(--el-color-primary, #409eff);
|
||||
}
|
||||
}
|
||||
|
||||
.expand-locations__table {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.expand-locations__empty {
|
||||
padding: 12px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
@ -1,109 +1,152 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="receiving-details-container">
|
||||
<el-form :model="form" label-width="92px" size="small" class="details-form">
|
||||
<el-row :gutter="16">
|
||||
<!-- 第一列:收货明细 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
v-for="field in detailpanel"
|
||||
:key="field.prop"
|
||||
:label="field.label"
|
||||
:prop="field.prop"
|
||||
>
|
||||
<!-- 特殊处理:货主行,根据绑定状态显示不同内容 -->
|
||||
<template v-if="field.prop === 'store_name'">
|
||||
<div class="store-name-row">
|
||||
<!-- 已绑定货主:显示文本,禁用按钮 -->
|
||||
<template v-if="storeBound">
|
||||
<div class="store-name-readonly">
|
||||
{{ form.store_name || '未设置' }}
|
||||
</div>
|
||||
</template>
|
||||
<!-- 未绑定货主:显示下拉选择,按钮可用 -->
|
||||
<template v-else>
|
||||
<div class="details-body">
|
||||
<!-- 左:收货明细(表单本身独立滚动,不带动右侧图片) -->
|
||||
<div class="details-pane details-pane--form">
|
||||
<div class="task-panel__form">
|
||||
<template v-for="field in detailpanel" :key="field.prop">
|
||||
<!-- 只读字段(收货单号 / 创建人):静态信息行 -->
|
||||
<div v-if="field.prop !== 'store_name' && field.disabled" class="task-panel__field">
|
||||
<span class="task-panel__field-label">{{ field.label }}</span>
|
||||
<strong class="task-panel__field-value">{{ displayValue((form as any)[field.prop]) }}</strong>
|
||||
</div>
|
||||
|
||||
<!-- 货主:已绑定只读,未绑定可选 + 绑定按钮 -->
|
||||
<div
|
||||
v-else-if="field.prop === 'store_name'"
|
||||
class="task-panel__field task-panel__field--input"
|
||||
>
|
||||
<span class="task-panel__field-label">货主</span>
|
||||
<div class="task-panel__field-form task-panel__field-form--row">
|
||||
<template v-if="storeBound">
|
||||
<div class="store-name-readonly">{{ form.store_name || '未设置' }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-select
|
||||
v-model="form.store_id"
|
||||
placeholder="请选择货主"
|
||||
size="default"
|
||||
filterable
|
||||
:loading="storeListLoading"
|
||||
style="flex: 1; min-width: 0"
|
||||
@focus="loadStoreList"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="storeBound"
|
||||
@click="handleBindStore"
|
||||
>
|
||||
货主绑定
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 下拉字段 -->
|
||||
<div
|
||||
v-else-if="field.type === 'select'"
|
||||
class="task-panel__field task-panel__field--input"
|
||||
>
|
||||
<span class="task-panel__field-label">{{ field.label }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-select
|
||||
v-model="form.store_id"
|
||||
v-model="(form as any)[field.prop]"
|
||||
:placeholder="'请选择' + field.label"
|
||||
style="flex: 1;"
|
||||
filterable
|
||||
:loading="storeListLoading"
|
||||
@focus="loadStoreList"
|
||||
size="default"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in (localAvailableFields.find((f: { value: string }) => f.value === 'store_id')?.options || [])"
|
||||
v-for="item in fieldOptions(field.prop)"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="handleBindStore"
|
||||
:disabled="storeBound"
|
||||
>
|
||||
货主绑定
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="field.type === 'select'">
|
||||
<el-select
|
||||
v-model="(form as any)[field.prop]"
|
||||
:placeholder="'请选择' + field.label"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in localAvailableFields.find((f: { value: string }) => f.value === field.prop)?.options || []"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input
|
||||
v-model="(form as any)[field.prop]"
|
||||
:disabled="field.disabled"
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 第二列:收货图片 -->
|
||||
<el-col :span="12">
|
||||
<div class="receiving-images">
|
||||
<div v-if="imagesArr.length > 0" class="images-grid">
|
||||
<div v-for="(src, idx) in imagesArr" :key="idx" class="img-cell" @click="handlePreview(src)">
|
||||
<el-image :src="src" fit="cover" style="width:100%; height:100%" />
|
||||
<!-- 备注等长文本字段 -->
|
||||
<div
|
||||
v-else-if="field.type === 'textarea'"
|
||||
class="task-panel__field task-panel__field--input task-panel__field--textarea"
|
||||
>
|
||||
<span class="task-panel__field-label">{{ field.label }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="(form as any)[field.prop]"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
resize="none"
|
||||
size="default"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 普通输入 -->
|
||||
<div v-else class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">{{ field.label }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="(form as any)[field.prop]"
|
||||
size="default"
|
||||
:disabled="field.disabled"
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 右:收货图片(固定区域,不跟随左侧表单滚动) -->
|
||||
<div class="details-pane details-pane--images">
|
||||
<div class="receiving-images">
|
||||
<template v-if="imagesArr.length > 0">
|
||||
<div class="images-meta">共 {{ imagesArr.length }} 张(点击查看大图)</div>
|
||||
<div class="images-grid">
|
||||
<div
|
||||
v-for="(src, idx) in imagesArr"
|
||||
:key="idx"
|
||||
class="img-cell"
|
||||
@click="handlePreview(src)"
|
||||
>
|
||||
<el-image :src="src" fit="cover" style="width: 100%; height: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="image-placeholder">
|
||||
<div class="placeholder-content">
|
||||
<el-icon :size="36" color="#909399"><Picture /></el-icon>
|
||||
<el-icon :size="36" color="#c0c4cc"><Picture /></el-icon>
|
||||
<p>暂无收货图片</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<div class="bottom">
|
||||
<el-button-group class="toolbar-btn-group">
|
||||
<el-button type="primary" size="small" icon="Check" :loading="saveLoading" @click="handleSave">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="danger" size="small" icon="Refresh" @click="handleReset">
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部操作栏:保持原位置与分组,按钮间距 6px -->
|
||||
<div class="bottom">
|
||||
<el-button size="small" plain :icon="Refresh" @click="handleReset">重置</el-button>
|
||||
<el-button size="small" type="primary" :icon="Check" :loading="saveLoading" @click="handleSave">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 图片预览对话框 -->
|
||||
<el-dialog v-model="previewVisible" title="图片预览" width="60%" align-center append-to-body>
|
||||
<img :src="dialogImageUrl" alt="预览" style="width: 100%; max-height: 70vh; object-fit: contain;" />
|
||||
<el-dialog v-model="previewVisible" title="图片预览" width="60%" align-center append-to-body>
|
||||
<img :src="dialogImageUrl" alt="预览" style="width: 100%; max-height: 70vh; object-fit: contain" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@ -145,6 +188,20 @@ const form = ref({
|
||||
|
||||
const saveLoading = ref(false)
|
||||
|
||||
/** 货主下拉选项(沿用 availableFields 中的 store_id 选项,focus 时远程加载) */
|
||||
const storeOptions = computed(() => {
|
||||
const field = localAvailableFields.find((f: any) => f.value === 'store_id')
|
||||
return field?.options || []
|
||||
})
|
||||
|
||||
function fieldOptions(prop: string) {
|
||||
return localAvailableFields.find((f: any) => f.value === prop)?.options || []
|
||||
}
|
||||
|
||||
function displayValue(value: any) {
|
||||
return value === null || value === undefined || value === '' ? '—' : String(value)
|
||||
}
|
||||
|
||||
const parseOptionalNumber = (value: any) => {
|
||||
if (value === '' || value === null || value === undefined) return undefined
|
||||
const n = Number(value)
|
||||
@ -398,6 +455,7 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 收货明细:保持「左表单 + 右图片 + 底部操作栏」布局,仅做外观优化 */
|
||||
.receiving-details-container {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
@ -407,94 +465,232 @@ onMounted(() => {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.store-name-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.store-name-readonly {
|
||||
/* 主体:左右两栏;左侧表单独立滚动,右侧图片区域不跟随滚动 */
|
||||
.details-body {
|
||||
flex: 1;
|
||||
padding: 0 10px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
color: #606266;
|
||||
border: 1px solid #dcdfe6;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.details-form {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 6px 10px 8px;
|
||||
width: 100%;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
column-gap: 16px;
|
||||
padding: 10px 14px 8px;
|
||||
box-sizing: border-box;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 14px;
|
||||
@media (max-width: 960px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
row-gap: 12px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
:deep(.el-form-item:last-child) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 隐藏滚动条 */
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.image-placeholder {
|
||||
width: 100%;
|
||||
min-height: 140px;
|
||||
max-height: min(260px, 32vh);
|
||||
height: min(220px, 28vh);
|
||||
background-color: #f5f7fa;
|
||||
border: 1px dashed #dcdfe6;
|
||||
border-radius: 4px;
|
||||
.details-pane {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 左:表单区——只有这里滚动 */
|
||||
.details-pane--form {
|
||||
overflow-y: auto;
|
||||
padding-right: 6px;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #e4e7ed;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 右:图片区——固定不随表单滚动(图片很多时自身独立滚动) */
|
||||
.details-pane--images {
|
||||
overflow-y: auto;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #e4e7ed;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表单行:结构 / 尺寸完全对齐「新建波次策略」的 task-panel 字段行 */
|
||||
.task-panel__form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.task-panel__field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.placeholder-content {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
|
||||
p {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
min-height: 40px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background: #fafafa;
|
||||
|
||||
/* 输入行:去掉灰色容器,与静态信息行拉开层次 */
|
||||
&--input {
|
||||
align-items: flex-start;
|
||||
min-height: 0;
|
||||
padding: 4px 0 0 12px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
|
||||
.task-panel__field-label {
|
||||
padding-top: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 多行文本行:标签与文本域首行对齐 */
|
||||
&--textarea {
|
||||
padding-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 标签列固定 88px:各行列、控件左边缘严格对齐 */
|
||||
.task-panel__field-label {
|
||||
flex: 0 0 88px;
|
||||
width: 88px;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #606266;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-panel__field-value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
text-align: right;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* 输入控件容器:占满标签列右侧剩余宽度 */
|
||||
.task-panel__field-form {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-textarea) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 行内「输入框 + 按钮」(货主行) */
|
||||
&--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 已绑定货主:只读展示(不可再改) */
|
||||
.store-name-readonly {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0 10px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
color: #606266;
|
||||
border: 1px solid #e4e7ed;
|
||||
height: 32px;
|
||||
line-height: 30px;
|
||||
font-size: 13px;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 右列:收货图片 */
|
||||
.receiving-images {
|
||||
.images-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
.img-cell {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
border: 1px solid #eef2f6;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.images-meta {
|
||||
margin-bottom: 6px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.images-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.img-cell {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
border: 1px solid #eef2f6;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--el-color-primary, #409eff);
|
||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.18);
|
||||
}
|
||||
}
|
||||
|
||||
.image-placeholder {
|
||||
width: 100%;
|
||||
height: min(220px, 28vh);
|
||||
min-height: 140px;
|
||||
background-color: #fafafa;
|
||||
border: 1px dashed #dcdfe6;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.placeholder-content {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
|
||||
p {
|
||||
margin: 8px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 底部操作栏:保持原位置,按钮间距统一 6px */
|
||||
.bottom {
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
padding: 6px 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 6px;
|
||||
padding: 8px 14px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -387,158 +387,208 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 签约策略配置弹窗 -->
|
||||
<!-- 签约策略配置弹窗:面板结构 / 双列栅格对齐「新建波次策略」 -->
|
||||
<el-dialog
|
||||
v-model="policyDialog.visible"
|
||||
:title="`策略配置 — ${policyDialog.contractRow?.store_name || policyDialog.contractRow?.remask || policyDialog.contractRow?.counterparty_name || ''}`"
|
||||
width="560px"
|
||||
class="policy-config-dialog"
|
||||
width="min(880px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
@close="resetPolicyDialog"
|
||||
>
|
||||
<div v-loading="policyDialog.loading">
|
||||
<!-- 签约基本信息 -->
|
||||
<el-descriptions :column="2" size="small" border style="margin-bottom:16px">
|
||||
<el-descriptions-item label="货主">{{ policyDialog.contractRow?.store_name || policyDialog.contractRow?.counterparty_name }}</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="面单余额">
|
||||
<span :style="{ color: (policyDialog.contractRow?.print_quantity ?? 0) <= 0 ? '#f56c6c' : '' }">
|
||||
{{ policyDialog.contractRow?.print_quantity ?? '—' }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 结构化策略配置表单 -->
|
||||
<template v-if="policyDialog.fields.length > 0">
|
||||
<div class="policy-form-scroll">
|
||||
<el-form :model="policyDialog.formData" label-width="140px" size="small" style="margin-top:4px">
|
||||
<el-row :gutter="16">
|
||||
<el-col v-for="field in policyDialog.fields" :key="field.key" :span="24">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<span>{{ field.name }}</span>
|
||||
<el-tooltip v-if="field.description" :content="field.description" placement="top">
|
||||
<el-icon style="margin-left:4px;cursor:pointer;color:#999;vertical-align:middle"><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<!-- 快递类字段(默认快递 / 出库单默认快递等):使用快递接口列表,后端返回哪个菜单项就显示哪个 -->
|
||||
<el-select
|
||||
v-if="isExpressSelectField(field)"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
clearable
|
||||
filterable
|
||||
:placeholder="field.placeholder || '请选择默认快递'"
|
||||
style="width:220px"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in policyExpressOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- 默认平台:使用平台列表 -->
|
||||
<el-select
|
||||
v-else-if="field.key === 'default_platform_code'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择默认平台"
|
||||
style="width:220px"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in policyPlatformOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- enum 类型 -->
|
||||
<el-select v-else-if="field.type === 'enum'" v-model="policyDialog.formData[field.key]" clearable style="width:220px">
|
||||
<template v-if="field.key === 'receive_mode'">
|
||||
<el-option label="标准模式" value="standard" />
|
||||
<el-option label="严格模式" value="strict" />
|
||||
<el-option label="手动模式" value="manual" />
|
||||
</template>
|
||||
<template v-else-if="field.key === 'sku_visibility'">
|
||||
<el-option label="全部可见" value="all" />
|
||||
<el-option label="白名单" value="whitelist" />
|
||||
<el-option label="黑名单" value="blacklist" />
|
||||
</template>
|
||||
<el-option
|
||||
v-for="opt in field.options"
|
||||
v-else
|
||||
:key="getEnumOptionValue(opt)"
|
||||
:label="getEnumOptionLabel(opt)"
|
||||
:value="getEnumOptionValue(opt)"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- flag 类型 -->
|
||||
<el-switch
|
||||
v-else-if="field.type === 'flag'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
/>
|
||||
<!-- integer 类型 (支持可选小数精度) -->
|
||||
<el-input-number
|
||||
v-else-if="field.type === 'integer'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
:min="field.min ?? 0"
|
||||
:max="field.max ?? 1000000"
|
||||
:precision="field.precision ?? 0"
|
||||
:step="field.step ?? (field.precision ? 0.01 : 1)"
|
||||
style="width:200px"
|
||||
/>
|
||||
<!-- string / 其他类型 -->
|
||||
<el-input
|
||||
v-else
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
:maxlength="field.maxLength"
|
||||
show-word-limit
|
||||
type="input"
|
||||
:rows="2"
|
||||
:placeholder="field.description || ''"
|
||||
style="width:100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="task-panel task-panel--policy">
|
||||
<header class="task-panel__head">
|
||||
<div class="task-panel__titles">
|
||||
<h2>策略配置</h2>
|
||||
<p>货主:{{ policyDialog.contractRow?.store_name || policyDialog.contractRow?.remask || policyDialog.contractRow?.counterparty_name || '—' }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<button
|
||||
class="task-panel__close"
|
||||
type="button"
|
||||
aria-label="关闭"
|
||||
@click="policyDialog.visible = false"
|
||||
>
|
||||
<svg viewBox="0 0 12 12" fill="none">
|
||||
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<!-- 降级:字段元信息加载失败时显示 JSON 编辑器 -->
|
||||
<template v-else>
|
||||
<div class="policy-json-editor">
|
||||
<div class="policy-json-label">
|
||||
策略配置(JSON)
|
||||
<el-tooltip content="后端 policy_config 为自由结构 object,直接编辑 JSON 提交" placement="top">
|
||||
<el-icon style="margin-left:4px;cursor:pointer;color:#999"><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
<div v-loading="policyDialog.loading" class="task-panel__body task-panel__body--scroll">
|
||||
<el-form :model="policyDialog.formData" class="task-panel__form" @submit.prevent>
|
||||
<!-- 签约信息 -->
|
||||
<div class="task-panel__grid">
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">货主</span>
|
||||
<strong class="task-panel__field-value">
|
||||
{{ policyDialog.contractRow?.store_name || policyDialog.contractRow?.counterparty_name || '—' }}
|
||||
</strong>
|
||||
</div>
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">面单余额</span>
|
||||
<strong
|
||||
class="task-panel__field-value"
|
||||
:class="{ 'is-danger': (policyDialog.contractRow?.print_quantity ?? 0) <= 0 }"
|
||||
>
|
||||
{{ policyDialog.contractRow?.print_quantity ?? '—' }}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
<el-input
|
||||
v-model="policyDialog.jsonText"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder='暂无策略配置,输入 JSON 对象后保存,例如:{"key": "value"}'
|
||||
:class="{ 'is-error-textarea': policyDialog.jsonError }"
|
||||
@blur="validatePolicyJson"
|
||||
spellcheck="false"
|
||||
style="font-family: monospace; font-size: 13px"
|
||||
/>
|
||||
<div v-if="policyDialog.jsonError" class="policy-json-error">{{ policyDialog.jsonError }}</div>
|
||||
<div class="policy-json-tip">留空则清除策略配置;必须是合法的 JSON 对象 <code>{}</code></div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button size="small" @click="policyDialog.visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="policyDialog.saving" @click="submitPolicyConfig">保存策略</el-button>
|
||||
</template>
|
||||
<!-- 结构化策略配置表单 -->
|
||||
<div v-if="policyDialog.fields.length > 0" class="task-panel__grid">
|
||||
<div
|
||||
v-for="field in policyDialog.fields"
|
||||
:key="field.key"
|
||||
class="task-panel__field"
|
||||
:class="field.type === 'flag' || field.type === 'integer' ? 'task-panel__field--control' : 'task-panel__field--input'"
|
||||
>
|
||||
<span class="task-panel__field-label">
|
||||
{{ field.name }}
|
||||
<el-tooltip v-if="field.description" :content="field.description" placement="top">
|
||||
<el-icon class="task-panel__field-help"><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<div
|
||||
class="task-panel__field-form"
|
||||
:class="{ 'task-panel__field-form--row': field.type === 'flag' || field.type === 'integer' }"
|
||||
>
|
||||
<!-- 快递类字段(默认快递 / 出库单默认快递等):使用快递接口列表 -->
|
||||
<el-select
|
||||
v-if="isExpressSelectField(field)"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
size="default"
|
||||
clearable
|
||||
filterable
|
||||
:placeholder="field.placeholder || '请选择默认快递'"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in policyExpressOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- 默认平台:使用平台列表 -->
|
||||
<el-select
|
||||
v-else-if="field.key === 'default_platform_code'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
size="default"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择默认平台"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in policyPlatformOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- enum 类型 -->
|
||||
<el-select
|
||||
v-else-if="field.type === 'enum'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
size="default"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<template v-if="field.key === 'receive_mode'">
|
||||
<el-option label="标准模式" value="standard" />
|
||||
<el-option label="严格模式" value="strict" />
|
||||
<el-option label="手动模式" value="manual" />
|
||||
</template>
|
||||
<template v-else-if="field.key === 'sku_visibility'">
|
||||
<el-option label="全部可见" value="all" />
|
||||
<el-option label="白名单" value="whitelist" />
|
||||
<el-option label="黑名单" value="blacklist" />
|
||||
</template>
|
||||
<el-option
|
||||
v-for="opt in field.options"
|
||||
v-else
|
||||
:key="getEnumOptionValue(opt)"
|
||||
:label="getEnumOptionLabel(opt)"
|
||||
:value="getEnumOptionValue(opt)"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- flag 类型 -->
|
||||
<el-switch
|
||||
v-else-if="field.type === 'flag'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
/>
|
||||
<!-- integer 类型(支持可选小数精度) -->
|
||||
<el-input-number
|
||||
v-else-if="field.type === 'integer'"
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
:min="field.min ?? 0"
|
||||
:max="field.max ?? 1000000"
|
||||
:precision="field.precision ?? 0"
|
||||
:step="field.step ?? (field.precision ? 0.01 : 1)"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<!-- string / 其他类型 -->
|
||||
<el-input
|
||||
v-else
|
||||
v-model="policyDialog.formData[field.key]"
|
||||
size="default"
|
||||
:maxlength="field.maxLength"
|
||||
show-word-limit
|
||||
:placeholder="field.placeholder || field.description || '请输入'"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 降级:字段元信息加载失败时显示 JSON 编辑器 -->
|
||||
<div v-else class="task-panel__field task-panel__field--input task-panel__field--textarea task-panel__field--full">
|
||||
<span class="task-panel__field-label">
|
||||
JSON
|
||||
<el-tooltip content="后端 policy_config 为自由结构 object,直接编辑 JSON 提交" placement="top">
|
||||
<el-icon class="task-panel__field-help"><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="policyDialog.jsonText"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
resize="none"
|
||||
placeholder='暂无策略配置,输入 JSON 对象后保存,例如:{"key": "value"}'
|
||||
:class="{ 'is-error-textarea': policyDialog.jsonError }"
|
||||
spellcheck="false"
|
||||
style="font-family: monospace; font-size: 13px"
|
||||
@blur="validatePolicyJson"
|
||||
/>
|
||||
<div v-if="policyDialog.jsonError" class="task-panel__field-error">{{ policyDialog.jsonError }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<p class="task-panel__form-tip">
|
||||
{{ policyDialog.fields.length > 0
|
||||
? '字段留空表示使用系统默认;修改后对该货主后续单据生效。'
|
||||
: '留空保存将清除策略配置;必须是合法的 JSON 对象 {}。' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">提交前请确认默认快递与收货策略</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="policyDialog.visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="policyDialog.saving" @click="submitPolicyConfig">保存策略</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 奇门接口配置管理弹窗 -->
|
||||
@ -1051,70 +1101,250 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 代开户弹窗 -->
|
||||
<!-- 代开户弹窗:面板结构 / 双列栅格对齐「新建波次策略」 -->
|
||||
<el-dialog
|
||||
v-model="openAccountDialog.visible"
|
||||
title="仓库代货主一键开户"
|
||||
width="720px"
|
||||
class="open-account-dialog"
|
||||
width="min(880px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
@close="resetOpenAccountDialog"
|
||||
>
|
||||
<el-form
|
||||
ref="openAccountFormRef"
|
||||
:model="openAccountForm"
|
||||
:rules="openAccountFormRules"
|
||||
label-width="120px"
|
||||
size="small"
|
||||
class="open-account-form-grid"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col v-for="item in openAccountFormItems" :key="item.prop" :span="12">
|
||||
<el-form-item :label="item.label" :prop="item.prop" :required="item.required">
|
||||
<el-input-number
|
||||
v-if="item.type === 'number'"
|
||||
v-model="openAccountForm[item.prop]"
|
||||
:placeholder="item.placeholder"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
style="width:100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-date-picker
|
||||
v-else-if="item.type === 'date'"
|
||||
v-model="openAccountForm[item.prop]"
|
||||
type="date"
|
||||
:placeholder="item.placeholder"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width:100%"
|
||||
/>
|
||||
<div v-else-if="item.prop === 'username'" class="username-field-row">
|
||||
<el-input
|
||||
v-model="openAccountForm[item.prop]"
|
||||
:placeholder="item.placeholder"
|
||||
style="flex:1"
|
||||
/>
|
||||
<el-button size="small" @click="generateRandomUsername">
|
||||
<el-icon><Refresh /></el-icon> 随机生成
|
||||
</el-button>
|
||||
<div class="task-panel">
|
||||
<header class="task-panel__head">
|
||||
<div class="task-panel__titles">
|
||||
<h2>仓库代货主一键开户</h2>
|
||||
<p>代货主创建登录账号、货主档案与仓库授权,带 * 为必填项</p>
|
||||
</div>
|
||||
<button
|
||||
class="task-panel__close"
|
||||
type="button"
|
||||
aria-label="关闭"
|
||||
@click="openAccountDialog.visible = false"
|
||||
>
|
||||
<svg viewBox="0 0 12 12" fill="none">
|
||||
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="task-panel__body task-panel__body--scroll">
|
||||
<el-form
|
||||
ref="openAccountFormRef"
|
||||
:model="openAccountForm"
|
||||
:rules="openAccountFormRules"
|
||||
class="task-panel__form"
|
||||
@submit.prevent
|
||||
>
|
||||
<!-- 登录账号:整行(含随机生成按钮) -->
|
||||
<div class="task-panel__field task-panel__field--input task-panel__field--full">
|
||||
<span class="task-panel__field-label is-required">登录账号</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="username">
|
||||
<div class="task-panel__inline">
|
||||
<el-input
|
||||
v-model="openAccountForm.username"
|
||||
size="default"
|
||||
placeholder="登录账号(全局唯一)"
|
||||
style="flex: 1"
|
||||
/>
|
||||
<el-button size="small" @click="generateRandomUsername">
|
||||
<el-icon><Refresh /></el-icon> 随机生成
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-input
|
||||
v-else
|
||||
v-model="openAccountForm[item.prop]"
|
||||
:placeholder="item.placeholder"
|
||||
:maxlength="item.prop === 'company_name' ? 200 : item.prop === 'apply_reason' ? 2000 : item.prop === 'store_remask' || item.prop === 'warehouse_remask' ? 50 : undefined"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button size="small" @click="openAccountDialog.visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="openAccountDialog.loading" @click="submitOpenAccount">
|
||||
确认开户
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__grid">
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">初始密码</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="openAccountForm.password"
|
||||
size="default"
|
||||
placeholder="留空则自动随机生成 12 位密码"
|
||||
show-word-limit
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">真实姓名</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.real_name" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input task-panel__field--full">
|
||||
<span class="task-panel__field-label is-required">公司全称</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="company_name">
|
||||
<el-input
|
||||
v-model="openAccountForm.company_name"
|
||||
size="default"
|
||||
placeholder="公司全称(全局唯一,1-200 字符)"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">营业执照号</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.business_license" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">所属行业</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.industry" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label is-required">联系人</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="contact_person">
|
||||
<el-input
|
||||
v-model="openAccountForm.contact_person"
|
||||
size="default"
|
||||
placeholder="联系人姓名(1-50 字符)"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">联系电话</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.contact_phone" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">法人代表</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.legal_person" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">联系邮箱</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.contact_email" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input task-panel__field--full">
|
||||
<span class="task-panel__field-label">公司地址</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input v-model="openAccountForm.address" size="default" placeholder="可选" show-word-limit />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--control">
|
||||
<span class="task-panel__field-label">初始面单余额</span>
|
||||
<div class="task-panel__field-form task-panel__field-form--row">
|
||||
<el-input-number
|
||||
v-model="openAccountForm.print_quantity"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
placeholder="默认 0"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">授权开始日期</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-date-picker
|
||||
v-model="openAccountForm.auth_start"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
size="default"
|
||||
placeholder="默认当天"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">授权结束日期</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-date-picker
|
||||
v-model="openAccountForm.auth_end"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
size="default"
|
||||
placeholder="可选"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">货主备注名</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="openAccountForm.store_remask"
|
||||
size="default"
|
||||
placeholder="最长 50 字符"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">仓库备注名</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="openAccountForm.warehouse_remask"
|
||||
size="default"
|
||||
placeholder="最长 50 字符"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--input task-panel__field--textarea task-panel__field--full">
|
||||
<span class="task-panel__field-label">申请原因</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-input
|
||||
v-model="openAccountForm.apply_reason"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
resize="none"
|
||||
size="default"
|
||||
maxlength="2000"
|
||||
show-word-limit
|
||||
placeholder="默认“仓库代开户”"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<p class="task-panel__form-tip">
|
||||
初始密码留空将自动生成 12 位随机密码;公司全称全局唯一;授权开始日期默认当天,申请原因默认“仓库代开户”。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">提交前请确认登录账号与公司全称</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="openAccountDialog.visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="openAccountDialog.loading" @click="submitOpenAccount">
|
||||
确认开户
|
||||
</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 创建用户弹窗(面板结构 / 尺寸对齐「手工录入运单号」ManualWaybillForm) -->
|
||||
@ -1326,7 +1556,7 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, qimenFormDefault, qimenFormItems, qimenTableColumns, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems, createUserDialogDefault, createUserFormDefault, storeToolbarButtons } from './store-config.ts'
|
||||
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, qimenFormDefault, qimenFormItems, qimenTableColumns, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, createUserDialogDefault, createUserFormDefault, storeToolbarButtons } from './store-config.ts'
|
||||
import { inboxBindCode } from '@/api/inbox/inbox'
|
||||
|
||||
// ─── 列表 ───────────────────────────────────────────────────────────────────
|
||||
@ -3272,40 +3502,6 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.policy-form-scroll {
|
||||
max-height: 48vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.policy-json-editor {
|
||||
.policy-json-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.policy-json-tip {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
code {
|
||||
background: #f5f5f5;
|
||||
padding: 0 4px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.policy-json-error {
|
||||
color: #f56c6c;
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
:deep(.is-error-textarea .el-textarea__inner) {
|
||||
border-color: #f56c6c;
|
||||
}
|
||||
@ -3394,6 +3590,12 @@ onMounted(() => {
|
||||
|
||||
&__body {
|
||||
padding: 12px 16px 0;
|
||||
|
||||
/* 字段较多时面板内滚动(对齐新建波次策略) */
|
||||
&--scroll {
|
||||
max-height: 64vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__form {
|
||||
@ -3402,6 +3604,18 @@ onMounted(() => {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 双列栅格:每格一个「标签 + 控件」行,窄屏自动降为单列 */
|
||||
&__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
column-gap: 16px;
|
||||
row-gap: 8px;
|
||||
|
||||
@media (max-width: 720px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
&__field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -3431,6 +3645,32 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 开关 / 数字输入等控件行:与输入行同构,行高对齐 32px */
|
||||
&--control {
|
||||
align-items: center;
|
||||
min-height: 0;
|
||||
padding: 4px 0 0 12px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
|
||||
.task-panel__field-label {
|
||||
padding-top: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 多行文本行:标签与文本域首行对齐 */
|
||||
&--textarea {
|
||||
.task-panel__field-label {
|
||||
padding-top: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 整行占满(登录账号 / 公司全称 / 公司地址 / 申请原因) */
|
||||
&--full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 标签列固定宽度:输入框左边缘与上方静态信息行的标签列对齐 */
|
||||
@ -3501,6 +3741,60 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 输入控件容器(双列栅格内使用):占满标签列右侧剩余宽度 */
|
||||
&__field-form {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
margin-left: 0 !important;
|
||||
width: 100%;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__error) {
|
||||
position: static;
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-input-number),
|
||||
:deep(.el-date-editor) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 控件行:数字输入左对齐,行高与输入框(32px)一致 */
|
||||
&--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 行内「输入框 + 按钮」组合(如登录账号 + 随机生成) */
|
||||
&__inline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__form-tip {
|
||||
margin: 8px 0 0;
|
||||
padding: 8px 12px;
|
||||
@ -3536,6 +3830,56 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 策略配置:后端字段名普遍较长,标签列放宽并允许换行,避免文字溢出压住控件(不影响其它弹窗) */
|
||||
.task-panel--policy {
|
||||
.task-panel__field {
|
||||
/* 标签与控件之间留出安全间距,长标签换行时不与控件重叠 */
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.task-panel__field-label {
|
||||
flex: 0 0 104px;
|
||||
width: 104px;
|
||||
/* 覆盖全局 nowrap:字段名过长时折行,避免溢出覆盖右侧控件 */
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.task-panel__field--input .task-panel__field-label,
|
||||
.task-panel__field--control .task-panel__field-label {
|
||||
/* 折行后标签首行与控件首行对齐 */
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
.task-panel__field-help {
|
||||
display: inline-block;
|
||||
margin-left: 2px;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
vertical-align: -2px;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.task-panel__field-value {
|
||||
/* 长货主名称在静态行内折行,不顶到标签 */
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.task-panel__field-value.is-danger {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.task-panel__field-error {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
/* 接口配置表:APPKEY / APPSECRET 单元格内容居中(含复制按钮) */
|
||||
.appkey-cell,
|
||||
.appsecret-cell {
|
||||
@ -3568,6 +3912,7 @@ onMounted(() => {
|
||||
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板 */
|
||||
.el-dialog.rename-store-dialog,
|
||||
.el-dialog.adjust-balance-dialog,
|
||||
.el-dialog.open-account-dialog,
|
||||
.el-dialog.create-user-dialog,
|
||||
.el-dialog.policy-config-dialog,
|
||||
.el-dialog.bind-code-dialog,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user