feat(stock): add stock management dialogs and fix combo quantity handling
新增库存表单、批量编辑和回收处理弹窗,完善库存管理流程 调整库存首页及相关组件交互,统一任务面板样式与操作体验 修复组合商品在创建待处理订单时的数量展开逻辑,确保库存选择与计划数量一致 更新订单称重和订单复核页面及配置,优化业务操作流程 调整收货商品相关展示逻辑,适配最新库存数据流
This commit is contained in:
parent
267b97330d
commit
5b3528b601
@ -929,6 +929,24 @@ function buildSelectedItemFromImport(itemCode: string, planQty: string): Preview
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合商品展开后的子商品数量:子商品简记中「|」后的数量 × Excel 计划数量。
|
||||
* 例:简记 162971|4,156957|2,计划数量 1 → 4、2;计划数量 2 → 8、4。
|
||||
* 非组合商品(无 combo_item_quantity)保持原计划数量不变。
|
||||
*/
|
||||
function resolveExpandedPlanQty(planQty: string | number | undefined, comboItemQuantity: unknown): string {
|
||||
const rawPlanQty = String(planQty ?? '').trim()
|
||||
const base = Number(rawPlanQty)
|
||||
const normalizedBase = Number.isFinite(base) && base > 0 ? base : 1
|
||||
const factor = Number(comboItemQuantity)
|
||||
if (!Number.isFinite(factor) || factor <= 0) {
|
||||
// 非组合商品:保持原有计划数量文案
|
||||
return rawPlanQty || '1'
|
||||
}
|
||||
// 避免 0.1 * 3 之类的浮点误差
|
||||
return String(Math.round(normalizedBase * factor * 1e6) / 1e6)
|
||||
}
|
||||
|
||||
function collectGroupOrderItems(rows: ImportPreviewRow[]) {
|
||||
const items: Array<{ item_id: number; item_code: string; item_name: string; plan_qty: number }> = []
|
||||
for (const row of rows) {
|
||||
@ -985,7 +1003,7 @@ async function resolveMissingItemIdsForGroup(rows: ImportPreviewRow[]) {
|
||||
item_code: subItem.item_code,
|
||||
item_name: subItem.item_name,
|
||||
barcode: subItem.barcode,
|
||||
plan_qty: planQty,
|
||||
plan_qty: resolveExpandedPlanQty(planQty, subItem.combo_item_quantity),
|
||||
store_id: subItem.store_id,
|
||||
is_combo: false,
|
||||
combo_id: undefined
|
||||
@ -2017,7 +2035,7 @@ async function parseImportPreviewFromFile(file: File) {
|
||||
item_code: subItem.item_code,
|
||||
item_name: subItem.item_name,
|
||||
barcode: subItem.barcode,
|
||||
plan_qty: planQty,
|
||||
plan_qty: resolveExpandedPlanQty(planQty, subItem.combo_item_quantity),
|
||||
store_id: subItem.store_id,
|
||||
is_combo: false,
|
||||
combo_id: undefined
|
||||
|
||||
@ -14,6 +14,8 @@ export type OrderSelectedProductItem = {
|
||||
/** 是否为组合商品(建单 item_id 优先 combo_sku_id,否则取组合 id) */
|
||||
is_combo?: boolean
|
||||
combo_id?: number
|
||||
/** 组合商品子项数量(展开时带出;建单导入按「该数量 × Excel 计划数量」计算) */
|
||||
combo_item_quantity?: number
|
||||
}
|
||||
|
||||
export function isStockApiSuccess(res: any) {
|
||||
@ -198,12 +200,32 @@ export function parseComboSimpleNotation(notation: string): Map<number, string>
|
||||
return map
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 simpleNotation 中「|」后的数量:162971|4,156957|2 → Map<序号, 数量>
|
||||
* 序号与 parseComboSimpleNotation 一致(按 ',' 拆分后的出现顺序,1 基)。
|
||||
*/
|
||||
export function parseComboSimpleNotationQuantity(notation: string): Map<number, number> {
|
||||
const map = new Map<number, number>()
|
||||
const text = String(notation || '').trim()
|
||||
if (!text) return map
|
||||
text.split(',').forEach((pair, idx) => {
|
||||
const [, quantityText] = pair.split('|')
|
||||
const quantity = Number(String(quantityText ?? '').trim())
|
||||
if (Number.isFinite(quantity) && quantity > 0) {
|
||||
map.set(idx + 1, quantity)
|
||||
}
|
||||
})
|
||||
return map
|
||||
}
|
||||
|
||||
/** 将单条组合商品记录展开为子 SKU 草稿行(使用组合记录内置字段,无需额外 API 查询) */
|
||||
export function expandComboRecordToDraftRows(combo: any) {
|
||||
const comboCode = getComboCode(combo)
|
||||
const comboName = getComboName(combo)
|
||||
const nameByIndex = parseComboNameNotation(combo?.nameNotation)
|
||||
const simpleByIndex = parseComboSimpleNotation(combo?.simpleNotation)
|
||||
// 「|」后的数字为子商品数量,优先取简记;缺失时回退 items 内置的 item_quantity
|
||||
const simpleQtyByIndex = parseComboSimpleNotationQuantity(combo?.simpleNotation)
|
||||
const items = mapComboGoodsItemsFromRecord(combo?.items)
|
||||
if (!items.length) return []
|
||||
|
||||
@ -218,6 +240,9 @@ export function expandComboRecordToDraftRows(combo: any) {
|
||||
|| simpleByIndex.get(nameIndex)
|
||||
|| String(item.item_goods_sku_id)
|
||||
const barcode = item.barcode || itemCode || ''
|
||||
const sortOrder = Number(item.sort_order)
|
||||
const notationQuantity = simpleQtyByIndex.get(nameIndex)
|
||||
?? (Number.isFinite(sortOrder) ? simpleQtyByIndex.get(sortOrder) : undefined)
|
||||
return {
|
||||
item_id: item.item_goods_sku_id,
|
||||
item_code: itemCode,
|
||||
@ -225,7 +250,7 @@ export function expandComboRecordToDraftRows(combo: any) {
|
||||
barcode,
|
||||
source_combo_code: comboCode,
|
||||
source_combo_name: comboName,
|
||||
combo_item_quantity: item.item_quantity,
|
||||
combo_item_quantity: notationQuantity ?? item.item_quantity,
|
||||
_from_combo_expanded: true
|
||||
}
|
||||
})
|
||||
@ -387,7 +412,12 @@ export function stockRowMatchesKeyword(row: any, keyword: string) {
|
||||
}
|
||||
|
||||
/** 在 stock.warehouse.search 结果中按编码/条码/id 定位商品 */
|
||||
export function findStockRowByKeyword(list: any[], keyword: string, mode?: WarehouseSearchMode) {
|
||||
export function findStockRowByKeyword(
|
||||
list: any[],
|
||||
keyword: string,
|
||||
mode?: WarehouseSearchMode,
|
||||
options: { exactOnly?: boolean } = {}
|
||||
) {
|
||||
const normalized = String(keyword || '').trim()
|
||||
if (!normalized || !list.length) return undefined
|
||||
|
||||
@ -399,6 +429,8 @@ export function findStockRowByKeyword(list: any[], keyword: string, mode?: Wareh
|
||||
})
|
||||
const direct = mappedList.find((row) => matcher(row, normalized))
|
||||
if (direct) return direct
|
||||
// exactOnly:不做「唯一返回项」兜底,避免把模糊结果误当成该编码
|
||||
if (options.exactOnly) return undefined
|
||||
return mappedList.length === 1 ? mappedList[0] : undefined
|
||||
}
|
||||
|
||||
@ -481,9 +513,23 @@ export async function lookupStockProductByKeyword(storeId: number | undefined, k
|
||||
return toOrderSelectedProductItem(matched, { displayCode: normalizedKeyword })
|
||||
}
|
||||
|
||||
/** 判断 API 返回的 row 是否为组合商品(有 combo_code/combo_name 字段) */
|
||||
/** 判断 API 返回的 row 是否为组合商品(combo_code/combo_name/combo_sku_id/is_combo 任一命中) */
|
||||
export function isComboResponseRow(row: any): boolean {
|
||||
return Boolean(String(row?.combo_code ?? '').trim() || String(row?.combo_name ?? '').trim())
|
||||
return isComboStockRow(row)
|
||||
}
|
||||
|
||||
/** 组合商品记录 → 建单子商品行(展开后按普通商品处理) */
|
||||
function expandComboRecordToSelectedItems(combo: any): OrderSelectedProductItem[] {
|
||||
return expandComboRecordToDraftRows(combo)
|
||||
.map((draft) => mapStockPickerItem(draft))
|
||||
.filter((item) => item.item_id)
|
||||
.map((item) => ({
|
||||
...item,
|
||||
source_combo_code: combo?.combo_code ?? combo?.custom_code ?? '',
|
||||
source_combo_name: combo?.combo_name ?? '',
|
||||
is_combo: false,
|
||||
combo_id: undefined
|
||||
}) as OrderSelectedProductItem)
|
||||
}
|
||||
|
||||
/** 建单商品匹配:一次查询,根据响应字段自动区分普通/组合商品 */
|
||||
@ -535,28 +581,19 @@ export async function lookupAndExpandProductByKeyword(
|
||||
const normalizedKeyword = String(keyword || '').trim()
|
||||
if (!normalizedKeyword) return []
|
||||
|
||||
// 一次查询:不指定 mode
|
||||
// 一次查询:不指定 mode(组合编码只在 mode='combo' 下能查到)
|
||||
const { res, list } = await queryStockProducts({
|
||||
keyword: normalizedKeyword,
|
||||
storeId
|
||||
})
|
||||
|
||||
if (isStockApiSuccess(res) && list.length) {
|
||||
const matched = findStockRowByKeyword(list, normalizedKeyword)
|
||||
// 只接受精确命中:不能用「唯一一条模糊结果」冒充该编码
|
||||
const matched = findStockRowByKeyword(list, normalizedKeyword, undefined, { exactOnly: true })
|
||||
if (matched) {
|
||||
// 组合商品:展开为子 SKU 列表
|
||||
if (isComboResponseRow(matched)) {
|
||||
const expanded = expandComboRecordToDraftRows(matched)
|
||||
return expanded
|
||||
.map((draft) => mapStockPickerItem(draft))
|
||||
.filter((item) => item.item_id)
|
||||
.map((item) => ({
|
||||
...item,
|
||||
source_combo_code: matched.combo_code ?? matched.custom_code ?? '',
|
||||
source_combo_name: matched.combo_name ?? '',
|
||||
is_combo: false, // 展开后子商品按普通商品处理
|
||||
combo_id: undefined
|
||||
}) as OrderSelectedProductItem)
|
||||
if (isComboStockRow(matched)) {
|
||||
return expandComboRecordToSelectedItems(matched)
|
||||
}
|
||||
// 普通商品:直接返回
|
||||
const stockItem = toOrderSelectedProductItem(matched, { displayCode: normalizedKeyword })
|
||||
@ -564,7 +601,7 @@ export async function lookupAndExpandProductByKeyword(
|
||||
}
|
||||
}
|
||||
|
||||
// 未匹配 → 尝试 mode='combo' 查询
|
||||
// 普通查询无精确命中 → 尝试 mode='combo' 查询
|
||||
const comboTry = await queryStockProducts({
|
||||
keyword: normalizedKeyword,
|
||||
storeId,
|
||||
@ -573,17 +610,7 @@ export async function lookupAndExpandProductByKeyword(
|
||||
if (isStockApiSuccess(comboTry.res) && comboTry.list.length) {
|
||||
const comboMatched = findStockRowByKeyword(comboTry.list, normalizedKeyword, 'combo')
|
||||
if (comboMatched) {
|
||||
const expanded = expandComboRecordToDraftRows(comboMatched)
|
||||
return expanded
|
||||
.map((draft) => mapStockPickerItem(draft))
|
||||
.filter((item) => item.item_id)
|
||||
.map((item) => ({
|
||||
...item,
|
||||
source_combo_code: comboMatched.combo_code ?? comboMatched.custom_code ?? '',
|
||||
source_combo_name: comboMatched.combo_name ?? '',
|
||||
is_combo: false,
|
||||
combo_id: undefined
|
||||
}) as OrderSelectedProductItem)
|
||||
return expandComboRecordToSelectedItems(comboMatched)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
52
src/views/order/orderWeighing/config/weighing-config.ts
Normal file
52
src/views/order/orderWeighing/config/weighing-config.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
|
||||
/**
|
||||
* 运单称重页面配置(样式与结构对齐 order/waveOrder)
|
||||
*/
|
||||
|
||||
/** ScanBox 筛选分组:称重信息 */
|
||||
const WEIGHING_SCAN_GROUP = '称重信息'
|
||||
|
||||
/**
|
||||
* 称重记录列表 ScanBox 可用筛选字段。
|
||||
* 说明:order.pendingOrder.list 的 where 无字段白名单,可直接按订单表列名过滤;
|
||||
* 数值/时间字段由 buildOrderWhereConditions 归一为 { operator, value }。
|
||||
*/
|
||||
export const weighingAvailableFields = [
|
||||
{ label: '运单号', value: 'waybill_no', type: 'text', group: WEIGHING_SCAN_GROUP },
|
||||
{ label: '订单号', value: 'delivery_order_code', type: 'text', group: WEIGHING_SCAN_GROUP },
|
||||
{ label: '重量(g)', value: 'weighing_weight', type: 'number', group: WEIGHING_SCAN_GROUP },
|
||||
{ label: '称重时间', value: 'updated_at', type: 'datetimerange', group: WEIGHING_SCAN_GROUP }
|
||||
]
|
||||
|
||||
/** 称重记录列表列配置(对齐 waveOrder 的 upper-table 用法) */
|
||||
export const weighingTableColumns = [
|
||||
{ prop: 'waybill_no', label: '运单号', minWidth: 170, showOverflowTooltip: true },
|
||||
{ prop: 'delivery_order_code', label: '订单号', minWidth: 170, showOverflowTooltip: true },
|
||||
{ prop: 'weighing_weight', label: '重量(g)', width: 130, align: 'center' },
|
||||
{ prop: 'updated_at', label: '称重时间', width: 170, align: 'center' },
|
||||
{ prop: 'id', label: 'ID', width: 90, align: 'center', sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 90, fixed: 'right', align: 'center' }
|
||||
]
|
||||
|
||||
/** 工具栏按钮:刷新(蓝底白字)/ 运单称重(白底蓝框) */
|
||||
export const weighingToolbarButtons: ToolbarButtonConfig[] = [
|
||||
{
|
||||
key: 'refresh',
|
||||
label: '刷新',
|
||||
size: 'small',
|
||||
category: 'refresh',
|
||||
loadingKey: 'listLoading',
|
||||
action: 'refresh'
|
||||
},
|
||||
{
|
||||
key: 'weigh',
|
||||
label: '运单称重',
|
||||
size: 'small',
|
||||
category: 'action',
|
||||
action: 'weigh'
|
||||
}
|
||||
]
|
||||
|
||||
/** 称重记录列表默认空态文案 */
|
||||
export const WEIGHING_EMPTY_TEXT = '暂无称重记录'
|
||||
@ -1,107 +1,139 @@
|
||||
<template>
|
||||
<div class="weighing-container" :style="{ height: containerHeight }">
|
||||
<div class="weighing-panel">
|
||||
<div class="panel-header">
|
||||
<span class="panel-title">最近称重</span>
|
||||
</div>
|
||||
<div class="order-sub-container" :style="{ height: containerHeight }">
|
||||
<div class="side-panel">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
cache-key="order-weighing"
|
||||
width="100%"
|
||||
:tree-props="{ children: 'children', label: 'label' }"
|
||||
:auto-submit="false"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFieldsRef"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleConditionReset"
|
||||
@condition-clear="handleConditionClear"
|
||||
/>
|
||||
|
||||
<div v-if="lastResult" class="panel-result">
|
||||
<div class="result-title">{{ lastResult.wave_no || lastResult.waybill || '称重结果' }}</div>
|
||||
<div class="result-weights">
|
||||
<div class="weight-row">
|
||||
<el-tag size="default" :type="weightWarnType" class="weight-tag">{{ lastResult.weighing_weight }} g</el-tag>
|
||||
<span class="weight-label">称重</span>
|
||||
</div>
|
||||
<div class="weight-row" v-if="lastResult.total_weight != null">
|
||||
<el-tag size="default" type="info" class="weight-tag">{{ lastResult.total_weight }} g</el-tag>
|
||||
<span class="weight-label">系统</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="result-meta" v-if="lastResult.order_id">
|
||||
<span>订单 ID {{ lastResult.order_id }}</span>
|
||||
</div>
|
||||
<div class="result-meta" v-if="lastResult.wave_id">
|
||||
<span>波次 {{ lastResult.wave_no }}</span>
|
||||
<span class="meta-divider">|</span>
|
||||
<span>{{ lastResult.store_name || '' }}</span>
|
||||
<template v-if="lastResult.sys_logistics_name">
|
||||
<span class="meta-divider">|</span>
|
||||
<el-tag size="small" type="warning">{{ lastResult.sys_logistics_name }}</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
<div class="result-meta" v-if="lastResult.split_count > 1">
|
||||
<span>拆单 {{ lastResult.split_count }} 个</span>
|
||||
</div>
|
||||
<div class="result-splits" v-if="lastResult.splits && lastResult.splits.length > 1">
|
||||
<div
|
||||
v-for="s in lastResult.splits"
|
||||
:key="s.business_key"
|
||||
class="split-row"
|
||||
:class="{ 'has-waybill': s.waybill_code }"
|
||||
<!-- 最近称重:固定在左侧下方,称重后立即核对重量 / 拆单 -->
|
||||
<div class="weighing-panel">
|
||||
<div class="panel-header">
|
||||
<span class="panel-title">最近称重</span>
|
||||
<span
|
||||
v-if="lastResult && lastResult.total_weight != null"
|
||||
:class="getStatusTextClass(weightWarnType)"
|
||||
>
|
||||
<span class="split-key">{{ s.business_key }}</span>
|
||||
<span class="split-weight">{{ s.weighing_weight }} g</span>
|
||||
<span class="split-waybill" v-if="s.waybill_code">{{ s.waybill_code }}</span>
|
||||
<span class="split-waybill empty" v-else>待分配</span>
|
||||
{{ weightStatusText }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="lastResult" class="panel-result">
|
||||
<div class="result-title">{{ lastResult.wave_no || lastResult.waybill || '称重结果' }}</div>
|
||||
<div class="result-weights">
|
||||
<div class="weight-row">
|
||||
<el-tag size="default" :type="weightWarnType" class="weight-tag">{{ lastResult.weighing_weight }} g</el-tag>
|
||||
<span class="weight-label">称重</span>
|
||||
</div>
|
||||
<div v-if="lastResult.total_weight != null" class="weight-row">
|
||||
<el-tag size="default" type="info" class="weight-tag">{{ lastResult.total_weight }} g</el-tag>
|
||||
<span class="weight-label">系统</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="lastResult.order_id" class="result-meta">
|
||||
<span>订单 ID {{ lastResult.order_id }}</span>
|
||||
</div>
|
||||
<div v-if="lastResult.wave_no" class="result-meta">
|
||||
<span>波次 {{ lastResult.wave_no }}</span>
|
||||
<span class="meta-divider">|</span>
|
||||
<span>{{ lastResult.store_name || '' }}</span>
|
||||
<template v-if="lastResult.sys_logistics_name">
|
||||
<span class="meta-divider">|</span>
|
||||
<el-tag size="small" type="warning">{{ lastResult.sys_logistics_name }}</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="lastResult.split_count > 1" class="result-meta">
|
||||
<span>拆单 {{ lastResult.split_count }} 个</span>
|
||||
</div>
|
||||
<div v-if="lastResult.splits && lastResult.splits.length > 1" class="result-splits">
|
||||
<div
|
||||
v-for="s in lastResult.splits"
|
||||
:key="s.business_key"
|
||||
class="split-row"
|
||||
:class="{ 'has-waybill': s.waybill_code }"
|
||||
>
|
||||
<span class="split-key">{{ s.business_key }}</span>
|
||||
<span class="split-weight">{{ s.weighing_weight }} g</span>
|
||||
<span v-if="s.waybill_code" class="split-waybill">{{ s.waybill_code }}</span>
|
||||
<span v-else class="split-waybill empty">待分配</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="panel-empty">
|
||||
点击右侧「运单称重」录入重量
|
||||
<div v-else class="panel-empty">点击「运单称重」录入重量</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadList">刷新</el-button>
|
||||
<el-button size="small" type="success" @click="openWeighingForm">运单称重</el-button>
|
||||
<!-- <el-tag size="small" type="info">共 {{ pagination.total }} 条</el-tag> -->
|
||||
<order-toolbar-button-group
|
||||
:buttons="toolbarButtons"
|
||||
:resolve-disabled="resolveButtonDisabled"
|
||||
:resolve-loading="resolveButtonLoading"
|
||||
:resolve-label="resolveButtonLabel"
|
||||
:layout-key="toolbarLayoutKey"
|
||||
@action="handleToolbarButtonClick"
|
||||
/>
|
||||
</div>
|
||||
<el-input
|
||||
v-model="filterWaybill"
|
||||
size="small"
|
||||
style="width:200px"
|
||||
placeholder="筛选运单号"
|
||||
clearable
|
||||
@keyup.enter="loadList"
|
||||
@clear="loadList"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="upper-wrapper">
|
||||
<upper-table
|
||||
ref="upperTable"
|
||||
title="称重记录"
|
||||
table-id="order-weighing-records"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadList"
|
||||
>
|
||||
<template #column-weighing_weight="{ row }">
|
||||
<span v-if="row.weighing_weight != null">{{ row.weighing_weight }} g</span>
|
||||
<span v-else style="color:#c0c4cc">未称重</span>
|
||||
</template>
|
||||
<div class="split-stack">
|
||||
<div class="upper-wrapper upper-wrapper--full">
|
||||
<upper-table
|
||||
title="称重记录"
|
||||
table-id="order-weighing-records"
|
||||
default-align="center"
|
||||
:enable-column-config="true"
|
||||
:column-config-schema-version="1"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadList"
|
||||
>
|
||||
<template #column-weighing_weight="{ row }">
|
||||
<span v-if="row.weighing_weight != null" class="weighing-weight-text">
|
||||
{{ row.weighing_weight }} g
|
||||
</span>
|
||||
<span v-else :class="getStatusTextClass('info')">未称重</span>
|
||||
</template>
|
||||
|
||||
<template #column-updated_at="{ row }">
|
||||
{{ formatTime(row.updated_at) }}
|
||||
</template>
|
||||
</upper-table>
|
||||
<template #column-updated_at="{ row }">
|
||||
{{ formatTime(row.updated_at) }}
|
||||
</template>
|
||||
|
||||
<template #column-operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click.stop="openWeighingForm(row.waybill_no)">
|
||||
称重
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">{{ WEIGHING_EMPTY_TEXT }}</div>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ExpressWeighingForm
|
||||
v-model="weighingFormVisible"
|
||||
:initial-waybill-code="filterWaybill"
|
||||
:initial-waybill-code="weighingInitialWaybill"
|
||||
@success="handleWeighingSuccess"
|
||||
/>
|
||||
</div>
|
||||
@ -110,50 +142,112 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, 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 OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { orderPendingOrderList } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { isOrderIndexApiSuccess } from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
import {
|
||||
buildOrderWhereConditions,
|
||||
isOrderIndexApiSuccess,
|
||||
parseOrderListResponse
|
||||
} from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
import type { UpdateExpressWeighingWeightResponse } from '@/api/order.index/orderindex'
|
||||
import ExpressWeighingForm, { type ExpressWeighingFormResult } from './ExpressWeighingForm.vue'
|
||||
import {
|
||||
WEIGHING_EMPTY_TEXT,
|
||||
weighingAvailableFields,
|
||||
weighingTableColumns,
|
||||
weighingToolbarButtons
|
||||
} from './config/weighing-config'
|
||||
|
||||
/** ScanBox 暴露的方法(仅用到读取条件与重置) */
|
||||
type ScanBoxExpose = {
|
||||
getConditions?: () => Record<string, unknown>
|
||||
reset?: () => void
|
||||
}
|
||||
|
||||
/** 称重记录行(order.pendingOrder.list 返回的订单行,仅声明本页展示字段) */
|
||||
type WeighingRecordRow = {
|
||||
id?: number | string
|
||||
waybill_no?: string
|
||||
delivery_order_code?: string
|
||||
weighing_weight?: number | string | null
|
||||
updated_at?: string
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
/** 最近一次称重结果 */
|
||||
type WeighingResult = Partial<UpdateExpressWeighingWeightResponse> & {
|
||||
waybill: string
|
||||
split_count: number
|
||||
splits: NonNullable<UpdateExpressWeighingWeightResponse['splits']>
|
||||
store_name: string
|
||||
sys_logistics_name: string
|
||||
}
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const upperTable = ref<any>(null)
|
||||
const scanBox = ref<ScanBoxExpose | null>(null)
|
||||
|
||||
/** ScanBox 预设过滤树(本页暂无预设过滤项) */
|
||||
const presetTree = ref<unknown[]>([])
|
||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(weighingAvailableFields)))
|
||||
|
||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||||
const containerHeight = computed(() =>
|
||||
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
|
||||
)
|
||||
|
||||
const columns = [
|
||||
{ prop: 'waybill_no', label: '运单号', minWidth: '160', showOverflowTooltip: true },
|
||||
{ prop: 'delivery_order_code', label: '订单号', minWidth: '160', showOverflowTooltip: true },
|
||||
{ prop: 'weighing_weight', label: '重量', width: '120', align: 'center' },
|
||||
{ prop: 'updated_at', label: '称重时间', width: '170', align: 'center' },
|
||||
{ prop: 'id', label: 'ID', width: '80', sortable: true }
|
||||
]
|
||||
const columns = ref([...weighingTableColumns])
|
||||
const toolbarButtons = weighingToolbarButtons
|
||||
|
||||
const tableData = ref<any[]>([])
|
||||
const tableData = ref<WeighingRecordRow[]>([])
|
||||
const loading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
||||
const filterWaybill = ref('')
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const lastResult = ref<any>(null)
|
||||
const lastResult = ref<WeighingResult | null>(null)
|
||||
const weighingFormVisible = ref(false)
|
||||
const weighingInitialWaybill = ref('')
|
||||
|
||||
const weightWarnType = computed(() => {
|
||||
/** 称重重量与系统重量偏差超过 1/3 视为异常 */
|
||||
const weightWarnType = computed<'success' | 'danger'>(() => {
|
||||
const actual = Number(lastResult.value?.weighing_weight)
|
||||
const system = Number(lastResult.value?.total_weight)
|
||||
if (!actual || !system) return 'success'
|
||||
const diff = Math.abs(actual - system)
|
||||
const threshold = system / 3
|
||||
if (diff > threshold) return 'danger'
|
||||
return 'success'
|
||||
return Math.abs(actual - system) > threshold ? 'danger' : 'success'
|
||||
})
|
||||
|
||||
function isSuccess(res: any) {
|
||||
return isOrderIndexApiSuccess(res)
|
||||
/** 最近称重结果状态文案 */
|
||||
const weightStatusText = computed(() => {
|
||||
if (lastResult.value?.total_weight == null) return '已称重'
|
||||
return weightWarnType.value === 'danger' ? '重量偏差' : '重量相符'
|
||||
})
|
||||
|
||||
function resolveButtonLoading(loadingKey?: string) {
|
||||
return loadingKey === 'listLoading' && loading.value
|
||||
}
|
||||
|
||||
function resolveButtonDisabled() {
|
||||
return false
|
||||
}
|
||||
|
||||
function resolveButtonLabel(label: string) {
|
||||
return label
|
||||
}
|
||||
|
||||
const toolbarLayoutKey = computed(() => JSON.stringify({ loading: loading.value }))
|
||||
|
||||
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
if (action === 'refresh') {
|
||||
void loadList()
|
||||
return
|
||||
}
|
||||
if (action === 'weigh') openWeighingForm()
|
||||
}
|
||||
|
||||
function formatTime(v: string) {
|
||||
@ -166,30 +260,35 @@ function formatTime(v: string) {
|
||||
} catch { return v }
|
||||
}
|
||||
|
||||
/** ScanBox 条件 → order.pendingOrder.list where(禁止传 warehouse_id / warehouseId) */
|
||||
function buildWhere() {
|
||||
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
delete where.warehouse_id
|
||||
delete where.warehouseId
|
||||
return where
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
const start = Date.now()
|
||||
try {
|
||||
const where: Record<string, unknown> = {}
|
||||
const fw = filterWaybill.value.trim()
|
||||
if (fw) where.waybill_no = { operator: 'contains', value: fw, type: 'text' }
|
||||
const res: any = await orderPendingOrderList({
|
||||
const res = await orderPendingOrderList({
|
||||
pagination: {
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
},
|
||||
where
|
||||
where: buildWhere()
|
||||
})
|
||||
if (!isSuccess(res)) {
|
||||
if (!isOrderIndexApiSuccess(res)) {
|
||||
ElMessage.error(res?.message || '获取列表失败')
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
return
|
||||
}
|
||||
const data = res?.data || {}
|
||||
tableData.value = data.list || []
|
||||
pagination.total = Number(data.pagination?.total ?? data.total ?? 0)
|
||||
const data = parseOrderListResponse(res)
|
||||
tableData.value = data.list
|
||||
pagination.total = data.total
|
||||
} catch {
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
@ -200,7 +299,8 @@ async function loadList() {
|
||||
}
|
||||
}
|
||||
|
||||
function openWeighingForm() {
|
||||
function openWeighingForm(waybillNo?: string) {
|
||||
weighingInitialWaybill.value = String(waybillNo ?? '').trim()
|
||||
weighingFormVisible.value = true
|
||||
}
|
||||
|
||||
@ -218,7 +318,23 @@ function handleWeighingSuccess(detail: ExpressWeighingFormResult) {
|
||||
store_name: detail.store_name || '',
|
||||
sys_logistics_name: detail.sys_logistics_name || ''
|
||||
}
|
||||
loadList()
|
||||
void loadList()
|
||||
}
|
||||
|
||||
function handleConditionChange() {
|
||||
pagination.currentPage = 1
|
||||
void loadList()
|
||||
}
|
||||
|
||||
function handleConditionClear() {
|
||||
pagination.currentPage = 1
|
||||
void loadList()
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
pagination.currentPage = 1
|
||||
scanBox.value?.reset?.()
|
||||
void loadList()
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) { pagination.currentPage = page; loadList() }
|
||||
@ -228,22 +344,44 @@ onMounted(() => { loadList() })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.weighing-container {
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
|
||||
/* 左侧:ScanBox(上)+ 最近称重(下)上下分区 */
|
||||
.side-panel {
|
||||
flex: 0 0 220px;
|
||||
width: 220px;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
background-color: #f0f2f5;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border-right: 1px solid #e8e8e8;
|
||||
box-shadow: 1px 0 2px rgba(0, 0, 0, 0.05);
|
||||
|
||||
/* 覆盖 order-sub.scss 中「ScanBox 直接作为左右分栏」的固定宽度/高度规则 */
|
||||
:deep(.scan-box-container) {
|
||||
flex: 1 1 auto;
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
border-right: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.weighing-panel {
|
||||
flex: 0 0 280px;
|
||||
width: 280px;
|
||||
background: #fff;
|
||||
border-right: 1px solid #e4e7ed;
|
||||
flex: 0 0 auto;
|
||||
max-height: 48%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
gap: 10px;
|
||||
gap: 8px;
|
||||
padding: 8px 10px 10px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
overflow-y: auto;
|
||||
|
||||
.panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
|
||||
.panel-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
@ -252,14 +390,13 @@ onMounted(() => { loadList() })
|
||||
}
|
||||
|
||||
.panel-empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
padding: 16px;
|
||||
padding: 12px 8px;
|
||||
border: 1px dashed #e4e7ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
@ -268,57 +405,93 @@ onMounted(() => { loadList() })
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
padding: 8px;
|
||||
.result-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
|
||||
|
||||
.result-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.result-weights {
|
||||
margin-bottom: 4px;
|
||||
.weight-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
|
||||
.weight-tag { font-size: 15px; font-weight: 700; }
|
||||
.weight-label { font-size: 12px; color: #909399; }
|
||||
|
||||
.weight-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.weight-tag {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.weight-label {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.result-meta {
|
||||
font-size: 12px; color: #909399; margin-bottom: 2px;
|
||||
.meta-divider { margin: 0 6px; color: #dcdfe6; }
|
||||
strong { color: #e6a23c; }
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-bottom: 2px;
|
||||
|
||||
.meta-divider {
|
||||
margin: 0 6px;
|
||||
color: #dcdfe6;
|
||||
}
|
||||
}
|
||||
|
||||
.result-splits {
|
||||
margin-top: 6px;
|
||||
|
||||
.split-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
font-size: 12px; padding: 3px 6px; border-radius: 3px;
|
||||
&.has-waybill { background: #f0f9eb; }
|
||||
.split-key { font-weight: 600; min-width: 24px; color: #409eff; }
|
||||
.split-weight { color: #e6a23c; min-width: 60px; }
|
||||
.split-waybill { color: #67c23a; font-family: monospace; }
|
||||
.split-waybill.empty { color: #c0c4cc; }
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
padding: 3px 6px;
|
||||
border-radius: 3px;
|
||||
|
||||
&.has-waybill {
|
||||
background: #f0f9eb;
|
||||
}
|
||||
|
||||
.split-key {
|
||||
font-weight: 600;
|
||||
min-width: 24px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.split-weight {
|
||||
color: #e6a23c;
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
.split-waybill {
|
||||
color: #67c23a;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.split-waybill.empty {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
.weighing-weight-text {
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
padding: 5px 8px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
flex-shrink: 0;
|
||||
.toolbar-left { display: flex; align-items: center; gap: 8px; }
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,78 +1,67 @@
|
||||
<template>
|
||||
<div class="storage-receiving-container order-recheck-page" :style="{ height: containerHeight }">
|
||||
<div class="recheck-panel-wrapper">
|
||||
<RecheckOrderPanel
|
||||
ref="recheckPanelRef"
|
||||
:orders="panelOrders"
|
||||
:total-count="panelTotalCount"
|
||||
:remaining-count="panelRemainingCount"
|
||||
:loading="scanLoading"
|
||||
:active-waybill="panelActiveWaybill"
|
||||
:scan-mode="panelScanMode"
|
||||
:all-scanned="allItemsScanned"
|
||||
:task-id="panelTaskId"
|
||||
:refresh-task-loading="refreshTaskLoading"
|
||||
waybill-field="waybill_no"
|
||||
recheck-status-field="recheck_status"
|
||||
@search="handlePanelSearch"
|
||||
@select="handlePanelSelect"
|
||||
@scan-barcode="handleScanBarcode"
|
||||
@confirm="handleConfirm"
|
||||
@refresh-task="handleRefreshTask"
|
||||
/>
|
||||
</div>
|
||||
<div class="order-sub-container" :style="{ height: containerHeight }">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
cache-key="order-recheck"
|
||||
width="220px"
|
||||
:tree-props="{ children: 'children', label: 'label' }"
|
||||
:auto-submit="false"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFieldsRef"
|
||||
@submit="handleScanSubmit"
|
||||
@reset="handleConditionReset"
|
||||
@condition-clear="handleConditionClear"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button
|
||||
v-if="!hasSelectedIntercept"
|
||||
size="small"
|
||||
type="success"
|
||||
:disabled="!canConfirm"
|
||||
:loading="confirmLoading"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
确认复核
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasSelectedIntercept"
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="handleConfirmIntercept"
|
||||
>
|
||||
确认拦截
|
||||
</el-button>
|
||||
<el-button size="small" @click="resetAll">清空</el-button>
|
||||
<el-button size="small" type="primary" plain @click="batchRecheckDialogVisible = true">
|
||||
批量快捷复核
|
||||
</el-button>
|
||||
<el-button size="small" type="primary" plain @click="singleListDialogVisible = true">
|
||||
散单复核列表
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!hasSelectedIntercept"
|
||||
size="small"
|
||||
type="warning"
|
||||
:disabled="!activeOrderId"
|
||||
:loading="reprintLoading"
|
||||
@click="handleReprint"
|
||||
>
|
||||
面单补打
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="info"
|
||||
:disabled="!activeOrderId"
|
||||
@click="openWeighingDialog"
|
||||
>
|
||||
称重
|
||||
</el-button>
|
||||
<order-toolbar-button-group
|
||||
:buttons="toolbarButtons"
|
||||
:resolve-disabled="resolveButtonDisabled"
|
||||
:resolve-loading="resolveButtonLoading"
|
||||
:resolve-label="resolveButtonLabel"
|
||||
:layout-key="toolbarLayoutKey"
|
||||
@action="handleToolbarButtonClick"
|
||||
/>
|
||||
<div class="scan-inline">
|
||||
<el-tag size="small" :type="panelScanMode === 'recheck' ? 'warning' : 'info'" effect="dark">
|
||||
{{ panelScanMode === 'recheck' ? '复核扫描' : '查询' }}
|
||||
</el-tag>
|
||||
<el-input-number
|
||||
v-if="panelScanMode === 'recheck'"
|
||||
v-model="scanQty"
|
||||
:min="1"
|
||||
:max="999"
|
||||
size="small"
|
||||
controls-position="right"
|
||||
class="scan-qty"
|
||||
/>
|
||||
<el-input
|
||||
ref="scanInputRef"
|
||||
v-model="scanKeyword"
|
||||
size="small"
|
||||
class="scan-input"
|
||||
:placeholder="panelScanMode === 'recheck' ? '扫描商品条码(全部扫完后回车确认)' : '输入运单号/车号,回车查询'"
|
||||
clearable
|
||||
@keyup.enter="handleScanInputEnter"
|
||||
/>
|
||||
<span
|
||||
v-if="scanHint"
|
||||
class="scan-hint"
|
||||
:class="`is-${scanHintType}`"
|
||||
:title="scanHint"
|
||||
>
|
||||
{{ scanHint }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-select
|
||||
v-model="recheckPrintStationId"
|
||||
placeholder="选择打印台"
|
||||
size="small"
|
||||
style="width: 130px"
|
||||
class="toolbar-select"
|
||||
:loading="stationLoading"
|
||||
clearable
|
||||
@change="handleRecheckStationChange"
|
||||
@ -88,7 +77,7 @@
|
||||
v-model="recheckWorkflowMode"
|
||||
placeholder="复核流程"
|
||||
size="small"
|
||||
style="width: 130px"
|
||||
class="toolbar-select"
|
||||
clearable
|
||||
@change="handleWorkflowModeChange"
|
||||
>
|
||||
@ -99,27 +88,122 @@
|
||||
v-model="recheckWeighingMode"
|
||||
placeholder="数据一致后称重"
|
||||
size="small"
|
||||
style="width: 150px"
|
||||
class="toolbar-select toolbar-select--wide"
|
||||
clearable
|
||||
@change="handleWeighingModeChange"
|
||||
>
|
||||
<el-option label="不称重" value="off" />
|
||||
<el-option label="称重" value="on" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div v-if="scanPayload" class="toolbar-right">
|
||||
<el-tag v-if="scanPayloadPickerName" size="small" type="primary">拣货人:{{ scanPayloadPickerName }}</el-tag>
|
||||
<el-tag v-if="scanPayloadStoreRemark" size="small" type="primary">货主:{{ scanPayloadStoreRemark }}</el-tag>
|
||||
<el-tag v-if="scanPayloadWaveNo && scanPayloadWaveNo !== '—'" size="small" type="info">波次:{{ scanPayloadWaveNo }}</el-tag>
|
||||
<el-tag v-if="scanPayloadWaveIndex" size="small" type="warning">篮号:{{ scanPayloadWaveIndex }}</el-tag>
|
||||
|
||||
<el-tooltip content="本次命中的订单总数" placement="bottom">
|
||||
<span class="summary-chip">
|
||||
<span class="chip-label">总单数</span>
|
||||
<em class="chip-count">{{ panelTotalCount }}</em>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="尚未复核的订单数(波次维度)" placement="bottom">
|
||||
<span class="summary-chip" :class="{ 'is-active': panelRemainingCount > 0 }">
|
||||
<span class="chip-label">剩余未复核</span>
|
||||
<em class="chip-count">{{ panelRemainingCount }}</em>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
v-if="panelTaskId != null"
|
||||
link
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="refreshTaskLoading"
|
||||
@click="refreshTaskData"
|
||||
>
|
||||
刷新任务
|
||||
</el-button>
|
||||
|
||||
<template v-if="scanPayload">
|
||||
<span v-if="scanPayloadPickerName" class="info-chip">拣货人:{{ scanPayloadPickerName }}</span>
|
||||
<span v-if="scanPayloadStoreRemark" class="info-chip">货主:{{ scanPayloadStoreRemark }}</span>
|
||||
<span v-if="scanPayloadWaveNo && scanPayloadWaveNo !== '—'" class="info-chip">波次:{{ scanPayloadWaveNo }}</span>
|
||||
<span v-if="scanPayloadWaveIndex" class="info-chip is-warning">篮号:{{ scanPayloadWaveIndex }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
<div v-if="showDetailPane" class="detail-pane">
|
||||
<div ref="splitStackRef" class="split-stack">
|
||||
<div class="upper-wrapper" :style="showDetailPane ? upperPaneStyle : upperPaneFullStyle">
|
||||
<upper-table
|
||||
ref="upperTable"
|
||||
table-id="order-recheck-orders"
|
||||
default-align="center"
|
||||
:enable-column-config="true"
|
||||
:column-config-schema-version="1"
|
||||
:data="panelOrders"
|
||||
:columns="orderColumns"
|
||||
:row-key="getOrderRowKey"
|
||||
:current-row-key="panelActiveWaybill"
|
||||
:show-pagination="false"
|
||||
:table-size="tableSize"
|
||||
:loading="scanLoading"
|
||||
@current-change="handleOrderRowClick"
|
||||
@row-click="handleOrderRowClick"
|
||||
>
|
||||
<template #column-order_type="{ row }">
|
||||
<span :class="getStatusTextClass(row._is_wave ? 'primary' : 'info')">
|
||||
{{ row._is_wave ? '团购波次' : '散单' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-waybill_no="{ row }">
|
||||
<span class="order-waybill-text">{{ row.waybill_no || '—' }}</span>
|
||||
</template>
|
||||
|
||||
<template #column-recheck_status="{ row }">
|
||||
<span :class="getStatusTextClass(isOrderReviewedRow(row) ? 'success' : 'warning')">
|
||||
{{ isOrderReviewedRow(row) ? '已复核' : '未复核' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-basket="{ row }">
|
||||
<span>{{ row.wave_index ?? row.box_no ?? '—' }}</span>
|
||||
</template>
|
||||
|
||||
<template #column-order_count="{ row }">
|
||||
<span>{{ row._is_wave ? (row.order_count ?? row.total_orders ?? '—') : 1 }}</span>
|
||||
</template>
|
||||
|
||||
<template #column-store="{ row }">
|
||||
<span>{{ row.store_remark || row.shop_nick || '—' }}</span>
|
||||
</template>
|
||||
|
||||
<template #column-intercept_status="{ row }">
|
||||
<span :class="getStatusTextClass(isOrderInterceptedRow(row) ? 'danger' : 'info')">
|
||||
{{ isOrderInterceptedRow(row) ? '已拦截' : '—' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-print_status="{ row }">
|
||||
<span :class="getStatusTextClass(isOrderAlreadyPrinted(row) ? 'success' : 'info')">
|
||||
{{ isOrderAlreadyPrinted(row) ? '已打印' : '未打印' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click.stop="handleOrderRowClick(row)">
|
||||
复核
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无待复核订单,请扫码或使用左侧筛选查询</div>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<div v-if="showDetailPane" class="pane-resizer" @mousedown.prevent="beginSplitDrag"></div>
|
||||
|
||||
<div v-if="showDetailPane" class="lower-level" :style="lowerPaneStyle">
|
||||
<div class="detail-header">
|
||||
<div class="detail-header-title">商品明细</div>
|
||||
<div class="detail-header-summary" v-if="itemsRows.length">
|
||||
<div v-if="itemsRows.length" class="detail-header-summary">
|
||||
已扫 <strong class="text-scanned">{{ scannedCount }}</strong> / {{ itemsTotalCount }} 件
|
||||
</div>
|
||||
</div>
|
||||
@ -161,11 +245,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-selection">
|
||||
<div class="empty-tip">
|
||||
<p>在左侧列表选择订单后,在此查看商品明细</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -213,11 +292,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, h, nextTick, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { computed, h, nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { FormInstance, FormRules, InputInstance } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import RecheckOrderPanel from './component/RecheckOrderPanel.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import BatchQuickRecheckDialog from './component/BatchQuickRecheckDialog.vue'
|
||||
import RecheckOrderSingleListForm from './form/RecheckOrderSingleListForm.vue'
|
||||
import * as stationApi from '@/api/print/print'
|
||||
@ -257,7 +340,7 @@ const SCAN_PARAM_KEYS: (keyof RecheckScanOrderParams)[] = [
|
||||
]
|
||||
|
||||
const scanBox = ref<InstanceType<typeof ScanBox> | null>(null)
|
||||
const recheckPanelRef = ref<InstanceType<typeof RecheckOrderPanel> | null>(null)
|
||||
const upperTable = ref<InstanceType<typeof UpperTable> | null>(null)
|
||||
const presetTree = ref<any[]>([])
|
||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(recheckAvailableFields)))
|
||||
|
||||
@ -268,7 +351,15 @@ const containerHeight = computed(() =>
|
||||
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
|
||||
)
|
||||
|
||||
const splitStackRef = ref<HTMLElement | null>(null)
|
||||
// 上下分栏(待复核订单列表 / 商品明细),与 waveOrder 一致可拖动
|
||||
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
||||
defaultLowerPercent: 40
|
||||
})
|
||||
const upperPaneFullStyle = computed(() => ({
|
||||
flex: '1 1 auto',
|
||||
minHeight: '0',
|
||||
overflow: 'hidden' as const
|
||||
}))
|
||||
|
||||
const detailVisible = ref(true)
|
||||
const activeTab = ref('order')
|
||||
@ -446,7 +537,7 @@ function handleWeighingModeChange(val: string | undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── RecheckOrderPanel 状态 ─────────────────────────────────────────────────
|
||||
// ─── 待复核订单列表(toolbar + upper-table)状态 ─────────────────────────────
|
||||
const panelOrders = ref<any[]>([])
|
||||
const panelTotalCount = ref(0)
|
||||
const panelRemainingCount = ref(0)
|
||||
@ -704,6 +795,220 @@ const selectedOrderRow = ref<Record<string, unknown> | null>(null)
|
||||
|
||||
const showDetailPane = computed(() => scanPayload.value != null && activeOrderId.value != null)
|
||||
|
||||
// ─── 顶部工具栏(waveOrder 样式:按钮组 + 扫码输入 + 状态标签)─────────────────
|
||||
/** 扫码/查询输入框内容 */
|
||||
const scanKeyword = ref('')
|
||||
/** 复核扫描数量 */
|
||||
const scanQty = ref(1)
|
||||
const scanInputRef = ref<InputInstance | null>(null)
|
||||
|
||||
/** 待复核订单列表列配置(兼容散单与团购波次行) */
|
||||
const orderColumns = [
|
||||
{ prop: 'order_type', label: '类型', width: 96, align: 'center' },
|
||||
{ prop: 'waybill_no', label: '运单号 / 波次号', minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'recheck_status', label: '复核状态', width: 100, align: 'center' },
|
||||
{ prop: 'basket', label: '篮号 / 箱号', width: 100, align: 'center' },
|
||||
{ prop: 'order_count', label: '订单数', width: 90, align: 'center' },
|
||||
{ prop: 'store', label: '货主 / 店铺', minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'intercept_status', label: '拦截', width: 90, align: 'center' },
|
||||
{ prop: 'print_status', label: '打印', width: 90, align: 'center' },
|
||||
{ prop: 'operation', label: '操作', width: 90, fixed: 'right', align: 'center' }
|
||||
]
|
||||
|
||||
/** 待复核订单行(散单 / 团购波次兼容) */
|
||||
type RecheckOrderRow = Record<string, unknown> | null | undefined
|
||||
|
||||
/** 订单行唯一键(散单用运单号,波次用波次号) */
|
||||
function getOrderRowKey(row: RecheckOrderRow) {
|
||||
const key = row?.waybill_no ?? row?.id ?? row?.order_id
|
||||
return key == null ? '' : String(key)
|
||||
}
|
||||
|
||||
function isOrderReviewedRow(row: RecheckOrderRow) {
|
||||
const reviewed = row?.is_reviewed
|
||||
if (reviewed === true || reviewed === 1) return true
|
||||
if (typeof reviewed === 'string' && ['true', '1'].includes(reviewed.trim().toLowerCase())) return true
|
||||
return String(row?.recheck_status ?? '').trim() === 'fin'
|
||||
}
|
||||
|
||||
function isOrderInterceptedRow(row: RecheckOrderRow) {
|
||||
return String(row?.intercept_status ?? 'none').trim() !== 'none'
|
||||
}
|
||||
|
||||
/** 点击订单行:避免 current-change 与 row-click 重复触发(重复会重复自动打印) */
|
||||
let lastRowClickKey = ''
|
||||
let lastRowClickAt = 0
|
||||
function handleOrderRowClick(row: RecheckOrderRow) {
|
||||
if (!row) return
|
||||
const key = getOrderRowKey(row)
|
||||
const now = Date.now()
|
||||
if (key && key === lastRowClickKey && now - lastRowClickAt < 300) return
|
||||
lastRowClickKey = key
|
||||
lastRowClickAt = now
|
||||
void handlePanelSelect(row)
|
||||
}
|
||||
|
||||
const toolbarButtons = computed<ToolbarButtonConfig[]>(() => {
|
||||
const list: ToolbarButtonConfig[] = []
|
||||
if (hasSelectedIntercept.value) {
|
||||
list.push({
|
||||
key: 'confirmIntercept',
|
||||
label: '确认拦截',
|
||||
size: 'small',
|
||||
category: 'cancel',
|
||||
action: 'confirmIntercept'
|
||||
})
|
||||
} else {
|
||||
list.push({
|
||||
key: 'confirm',
|
||||
label: '确认复核',
|
||||
size: 'small',
|
||||
type: 'success',
|
||||
action: 'confirm',
|
||||
disabledKey: 'cannotConfirm',
|
||||
loadingKey: 'confirmLoading'
|
||||
})
|
||||
}
|
||||
list.push(
|
||||
{ key: 'reset', label: '清空', size: 'small', category: 'setting', action: 'reset' },
|
||||
{ key: 'batchRecheck', label: '批量快捷复核', size: 'small', category: 'action', action: 'batchRecheck' },
|
||||
{ key: 'singleList', label: '散单复核列表', size: 'small', category: 'action', action: 'singleList' }
|
||||
)
|
||||
if (!hasSelectedIntercept.value) {
|
||||
list.push({
|
||||
key: 'reprint',
|
||||
label: '面单补打',
|
||||
size: 'small',
|
||||
type: 'warning',
|
||||
action: 'reprint',
|
||||
disabledKey: 'noOrder',
|
||||
loadingKey: 'reprintLoading'
|
||||
})
|
||||
}
|
||||
list.push({
|
||||
key: 'weighing',
|
||||
label: '称重',
|
||||
size: 'small',
|
||||
type: 'info',
|
||||
action: 'weighing',
|
||||
disabledKey: 'noOrder'
|
||||
})
|
||||
return list
|
||||
})
|
||||
|
||||
const toolbarLayoutKey = computed(() =>
|
||||
JSON.stringify({
|
||||
keys: toolbarButtons.value.map((button) => button.key),
|
||||
cannotConfirm: !canConfirm.value,
|
||||
noOrder: !activeOrderId.value,
|
||||
confirmLoading: confirmLoading.value,
|
||||
reprintLoading: reprintLoading.value
|
||||
})
|
||||
)
|
||||
|
||||
function resolveButtonDisabled(disabledKey?: string) {
|
||||
if (disabledKey === 'cannotConfirm') return !canConfirm.value
|
||||
if (disabledKey === 'noOrder') return !activeOrderId.value
|
||||
return false
|
||||
}
|
||||
|
||||
function resolveButtonLoading(loadingKey?: string) {
|
||||
if (loadingKey === 'confirmLoading') return confirmLoading.value
|
||||
if (loadingKey === 'reprintLoading') return reprintLoading.value
|
||||
return false
|
||||
}
|
||||
|
||||
function resolveButtonLabel(label: string) {
|
||||
return label
|
||||
}
|
||||
|
||||
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
switch (action) {
|
||||
case 'confirm':
|
||||
void handleConfirm()
|
||||
break
|
||||
case 'confirmIntercept':
|
||||
void handleConfirmIntercept()
|
||||
break
|
||||
case 'reset':
|
||||
resetAll()
|
||||
break
|
||||
case 'batchRecheck':
|
||||
batchRecheckDialogVisible.value = true
|
||||
break
|
||||
case 'singleList':
|
||||
singleListDialogVisible.value = true
|
||||
break
|
||||
case 'reprint':
|
||||
void handleReprint()
|
||||
break
|
||||
case 'weighing':
|
||||
openWeighingDialog()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/** 刷新拣货任务数据(工具栏 chip 旁入口) */
|
||||
function refreshTaskData() {
|
||||
const taskId = Number(panelTaskId.value)
|
||||
if (!Number.isFinite(taskId) || taskId <= 0) return
|
||||
void handleRefreshTask(taskId)
|
||||
}
|
||||
|
||||
/** 扫码框回车:查询模式查订单,复核模式按商品条码计数(空回车=全部扫完确认) */
|
||||
function handleScanInputEnter() {
|
||||
const keyword = scanKeyword.value.trim()
|
||||
if (!keyword) {
|
||||
if (panelScanMode.value === 'recheck' && allItemsScanned.value) void handleConfirm()
|
||||
return
|
||||
}
|
||||
if (panelScanMode.value === 'recheck') {
|
||||
handleScanBarcode(keyword, scanQty.value)
|
||||
scanKeyword.value = ''
|
||||
scanQty.value = 1
|
||||
return
|
||||
}
|
||||
handlePanelSearch(keyword)
|
||||
}
|
||||
|
||||
/** 全局键盘监听:无输入焦点时按可打印字符自动聚焦扫码框(保持原面板行为) */
|
||||
function handleGlobalKeydown(e: KeyboardEvent) {
|
||||
// 弹窗打开时不抢焦点
|
||||
if (weighingDialogVisible.value || batchRecheckDialogVisible.value || singleListDialogVisible.value) return
|
||||
const tag = document.activeElement?.tagName
|
||||
if (tag === 'INPUT' || tag === 'TEXTAREA') return
|
||||
if (e.ctrlKey || e.altKey || e.metaKey) return
|
||||
if (e.key.length > 1 && !['Tab', 'Enter'].includes(e.key)) return
|
||||
scanInputRef.value?.focus?.()
|
||||
}
|
||||
|
||||
/** 注册扫码框键盘监听(页面激活 / 挂载时) */
|
||||
function startKeyListener() {
|
||||
document.removeEventListener('keydown', handleGlobalKeydown)
|
||||
document.addEventListener('keydown', handleGlobalKeydown)
|
||||
}
|
||||
|
||||
/** 移除扫码框键盘监听(页面失活 / 卸载时) */
|
||||
function stopKeyListener() {
|
||||
document.removeEventListener('keydown', handleGlobalKeydown)
|
||||
}
|
||||
|
||||
/** 查询结束后清空输入框(避免下一次扫码带入上次内容) */
|
||||
watch(
|
||||
() => scanLoading.value,
|
||||
(loading, prev) => {
|
||||
if (prev === true && loading === false) scanKeyword.value = ''
|
||||
}
|
||||
)
|
||||
|
||||
/** 进入复核扫描模式时自动聚焦扫码框 */
|
||||
watch(
|
||||
() => panelScanMode.value,
|
||||
(mode) => {
|
||||
if (mode === 'recheck') void nextTick(() => scanInputRef.value?.focus?.())
|
||||
}
|
||||
)
|
||||
|
||||
function resolvePanelOrderId(order: any): number | null {
|
||||
if (order?._is_wave) return null
|
||||
const raw = order?.order_id ?? order?.id
|
||||
@ -748,7 +1053,8 @@ function resetAll() {
|
||||
lastPrintWaveGroups.value = null
|
||||
lastPrintOrderId.value = null
|
||||
panelTaskId.value = undefined
|
||||
recheckPanelRef.value?.resetLocalState?.()
|
||||
scanKeyword.value = ''
|
||||
scanQty.value = 1
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
@ -965,7 +1271,7 @@ function resolveTopOrderId(p: ScanOrderResultShape | null): number | undefined {
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** 从 scanOrder 响应提取 RecheckOrderPanel 所需数据 */
|
||||
/** 从 scanOrder 响应提取待复核订单列表所需数据 */
|
||||
function updatePanelFromPayload(payload: ScanOrderResultShape) {
|
||||
const tid = payload.task_id
|
||||
panelTaskId.value = tid != null ? tid : undefined
|
||||
@ -1504,7 +1810,7 @@ async function executeScan(params: RecheckScanOrderParams) {
|
||||
const payload = unwrapResponse(res)
|
||||
scanPayload.value = payload
|
||||
|
||||
// ── 更新 RecheckOrderPanel 数据 ──
|
||||
// ── 更新上方待复核订单列表 ──
|
||||
updatePanelFromPayload(payload)
|
||||
|
||||
const rawList = asArray((payload as any).list)
|
||||
@ -1522,7 +1828,7 @@ async function executeScan(params: RecheckScanOrderParams) {
|
||||
} else if (panelList.length === 1) {
|
||||
handlePanelSelect(panelList[0])
|
||||
} else {
|
||||
scanHint.value = `共 ${rawList.length} 个订单,请从左侧列表中选择要复核的订单。`
|
||||
scanHint.value = `共 ${rawList.length} 个订单,请从上方列表中选择要复核的订单。`
|
||||
scanHintType.value = 'info'
|
||||
ElMessage.success(`已加载 ${rawList.length} 个订单`)
|
||||
}
|
||||
@ -1686,7 +1992,19 @@ async function doConfirm() {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadRecheckStationOptions)
|
||||
onMounted(() => {
|
||||
startKeyListener()
|
||||
void nextTick(() => scanInputRef.value?.focus?.())
|
||||
void loadRecheckStationOptions()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
startKeyListener()
|
||||
})
|
||||
|
||||
onDeactivated(stopKeyListener)
|
||||
|
||||
onBeforeUnmount(stopKeyListener)
|
||||
|
||||
// ─── 称重 ──────────────────────────────────────────────────────────────────
|
||||
const weighingDialogVisible = ref(false)
|
||||
@ -1832,161 +2150,160 @@ async function submitWeighing() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.storage-receiving-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
background-color: #f0f2f5;
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
|
||||
.recheck-panel-wrapper {
|
||||
flex: 0 0 330px;
|
||||
width: 330px;
|
||||
overflow: hidden;
|
||||
/* 工具栏:左侧按钮组 + 扫码输入,右侧设置与状态标签 */
|
||||
.main-content .toolbar {
|
||||
gap: 8px;
|
||||
|
||||
.toolbar-left {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
.toolbar-right {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.scan-inline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.scan-qty {
|
||||
flex: 0 0 auto;
|
||||
width: 90px;
|
||||
|
||||
:deep(.el-input-number__decrease),
|
||||
:deep(.el-input-number__increase) {
|
||||
width: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
.scan-input {
|
||||
flex: 0 1 260px;
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
.scan-hint {
|
||||
max-width: 320px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
&.is-success {
|
||||
color: var(--el-color-success);
|
||||
}
|
||||
|
||||
&.is-warning {
|
||||
color: var(--el-color-warning);
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-select {
|
||||
width: 130px;
|
||||
|
||||
&--wide {
|
||||
width: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 统计 / 信息 chip(对齐 waveOrder 的 fetchable-order-chip) */
|
||||
.summary-chip,
|
||||
.info-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
height: 22px;
|
||||
padding: 0 10px;
|
||||
border-radius: 11px;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: #606266;
|
||||
background: #f4f4f5;
|
||||
border: 1px solid #e9e9eb;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.summary-chip {
|
||||
.chip-count {
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #d48806;
|
||||
background: rgba(230, 162, 60, 0.1);
|
||||
border-color: rgba(230, 162, 60, 0.35);
|
||||
|
||||
.chip-count {
|
||||
color: #d48806;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-chip.is-warning {
|
||||
color: #d48806;
|
||||
background: rgba(230, 162, 60, 0.1);
|
||||
border-color: rgba(230, 162, 60, 0.35);
|
||||
}
|
||||
|
||||
.order-waybill-text {
|
||||
font-family: monospace;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 商品明细:占满分栏剩余空间,表头对齐 waveOrder 的 lower-level */
|
||||
.main-content .lower-level {
|
||||
.detail-header {
|
||||
height: 42px;
|
||||
min-height: 42px;
|
||||
padding: 0 12px;
|
||||
|
||||
.detail-header-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.detail-header-summary {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.text-scanned {
|
||||
color: var(--el-color-primary);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
padding: 6px 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.toolbar {
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
flex-shrink: 0;
|
||||
|
||||
.toolbar-left {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 8px;
|
||||
height: 30px;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.split-stack {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pane-resizer {
|
||||
flex: 0 0 6px;
|
||||
min-height: 6px;
|
||||
background: #e4e7ed;
|
||||
cursor: row-resize;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
&:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-pane {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-top: 1px solid #ebeef5;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
.recheck-detail-pane {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
|
||||
.detail-header {
|
||||
flex-shrink: 0;
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background-color: #fafafa;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.detail-header-title {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-header-summary {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.text-scanned {
|
||||
color: #409eff;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.detail-tab {
|
||||
margin-bottom: -1px;
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item) {
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
font-size: 12px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap::after) {
|
||||
height: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
padding: 6px 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
|
||||
.recheck-detail-pane {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-selection {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
max-width: 360px;
|
||||
}
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,70 +1,83 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="组合商品快速搜索"
|
||||
width="900px"
|
||||
class="combo-goods-search-dialog"
|
||||
width="min(900px, 96vw)"
|
||||
align-center
|
||||
destroy-on-close
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="!loading"
|
||||
destroy-on-close
|
||||
@closed="emit('closed')"
|
||||
>
|
||||
<!-- <el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="search-alert"
|
||||
title="comboGoods.search"
|
||||
description="模糊匹配 combo_code / combo_name,仅返回启用状态记录,默认 20 条,上限 100 条。"
|
||||
/> -->
|
||||
<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="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>
|
||||
|
||||
<el-form :inline="true" size="small" class="search-form" @submit.prevent="handleSearch">
|
||||
<el-form-item label="关键字">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
clearable
|
||||
placeholder="组合编码 / 名称"
|
||||
style="width: 260px"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="条数">
|
||||
<el-input-number v-model="limit" :min="1" :max="100" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="handleSearch">搜索</el-button>
|
||||
<el-button :disabled="loading" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="task-panel__body task-panel__body--scroll">
|
||||
<el-form :inline="true" size="small" class="search-form" @submit.prevent="handleSearch">
|
||||
<el-form-item label="关键字">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
clearable
|
||||
placeholder="组合编码 / 名称"
|
||||
style="width: 260px"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="条数">
|
||||
<el-input-number v-model="limit" :min="1" :max="100" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="handleSearch">搜索</el-button>
|
||||
<el-button :disabled="loading" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="result-meta">共 {{ list.length }} 条</div>
|
||||
<p class="task-panel__form-tip">共 {{ list.length }} 条;默认 20 条,上限 100 条。</p>
|
||||
|
||||
<el-table
|
||||
:data="list"
|
||||
border
|
||||
size="small"
|
||||
max-height="420"
|
||||
v-loading="loading"
|
||||
row-key="id"
|
||||
empty-text="暂无组合商品"
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column prop="id" label="ID" width="72" />
|
||||
<el-table-column prop="combo_code" label="组合编码" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="combo_name" label="组合名称" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="simpleNotation" label="子商品简记" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="nameNotation" label="名称简记" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="状态" width="88" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(formatComboGoodsStatus(row.status).type)">
|
||||
{{ formatComboGoodsStatus(row.status).text }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table
|
||||
:data="list"
|
||||
border
|
||||
size="small"
|
||||
max-height="420"
|
||||
v-loading="loading"
|
||||
row-key="id"
|
||||
empty-text="暂无组合商品"
|
||||
style="margin-top: 8px"
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column prop="id" label="ID" width="72" />
|
||||
<el-table-column prop="combo_code" label="组合编码" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="combo_name" label="组合名称" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="simpleNotation" label="子商品简记" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="nameNotation" label="名称简记" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="状态" width="88" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(formatComboGoodsStatus(row.status).type)">
|
||||
{{ formatComboGoodsStatus(row.status).text }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">关闭</el-button>
|
||||
</template>
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">搜索仅在点击「搜索」或回车后执行</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="visible = false">关闭</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -126,19 +139,18 @@ function handleReset() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.search-alert {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.result-meta {
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.combo-goods-search-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,58 +1,70 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="选择子商品"
|
||||
width="760px"
|
||||
class="combo-stock-picker-dialog"
|
||||
width="min(820px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<!-- <el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="picker-alert"
|
||||
title="stock.warehouse.search"
|
||||
description="搜索仓库商品后勾选加入组合明细;子商品须属于同一货主且库存记录有效。"
|
||||
/> -->
|
||||
<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="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="picker-toolbar">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
placeholder="商品编码 / 条码 / 名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="handleSearch">搜索</el-button>
|
||||
<div class="task-panel__body task-panel__body--scroll">
|
||||
<div class="picker-toolbar">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
placeholder="商品编码 / 条码 / 名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="handleSearch">搜索</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="list"
|
||||
border
|
||||
size="small"
|
||||
max-height="360"
|
||||
v-loading="loading"
|
||||
row-key="item_goods_sku_id"
|
||||
empty-text="暂无商品"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="46" :reserve-selection="true" />
|
||||
<el-table-column prop="item_goods_sku_id" label="SKU ID" width="90" />
|
||||
<el-table-column prop="item_code" label="商品编码" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="item_name" label="商品名称" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="barcode" label="条码" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="store_id" label="货主 ID" width="88" />
|
||||
</el-table>
|
||||
|
||||
<!-- <p class="task-panel__form-tip">已选 {{ selectedItems.length }} 个商品;勾选状态在搜索切换后保留。</p> -->
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">仅展示有效库存商品</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :disabled="!selectedItems.length" @click="handleConfirm">确定</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="list"
|
||||
border
|
||||
size="small"
|
||||
max-height="320"
|
||||
v-loading="loading"
|
||||
row-key="item_goods_sku_id"
|
||||
empty-text="暂无商品"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="46" :reserve-selection="true" />
|
||||
<el-table-column prop="item_goods_sku_id" label="SKU ID" width="90" />
|
||||
<el-table-column prop="item_code" label="商品编码" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="item_name" label="商品名称" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="barcode" label="条码" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="store_id" label="货主 ID" width="88" />
|
||||
</el-table>
|
||||
|
||||
<div class="picker-meta">已选 {{ selectedItems.length }} 个商品</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :disabled="!selectedItems.length" @click="handleConfirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -201,19 +213,19 @@ function handleClosed() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.picker-alert {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
.picker-toolbar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
.picker-meta {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.combo-stock-picker-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
|
||||
61
src/views/stock/stock/component/RecycleDialog.vue
Normal file
61
src/views/stock/stock/component/RecycleDialog.vue
Normal file
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
class="stock-recycle-dialog"
|
||||
width="min(1040px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<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="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 stock-recycle-dialog__body">
|
||||
<Recycle :drawer-visible="visible" />
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">批量恢复或彻底删除后列表会自动刷新</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="visible = false">关闭</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Recycle from './recycle.vue'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
.stock-recycle-dialog__body {
|
||||
:deep(.recycle-bin-container) {
|
||||
height: auto;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.stock-recycle-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
334
src/views/stock/stock/component/StockBatchEditDialog.vue
Normal file
334
src/views/stock/stock/component/StockBatchEditDialog.vue
Normal file
@ -0,0 +1,334 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
class="stock-batch-edit-dialog"
|
||||
width="min(560px, 92vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<!-- 面板结构对齐「手工录入运单号」(order/orderManagement/form/ManualWaybillForm) -->
|
||||
<div class="task-panel">
|
||||
<header class="task-panel__head">
|
||||
<div class="task-panel__titles">
|
||||
<h2>{{ title || '批量修改' }}</h2>
|
||||
<p>对已选中的商品统一修改「{{ fieldLabel }}」,仅提交该字段</p>
|
||||
</div>
|
||||
<button class="task-panel__close" type="button" aria-label="关闭" @click="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">
|
||||
<div class="task-panel__form">
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">已选商品</span>
|
||||
<strong class="task-panel__field-value">{{ selectedCount }} 件</strong>
|
||||
</div>
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">修改字段</span>
|
||||
<strong class="task-panel__field-value">{{ fieldLabel || '—' }}</strong>
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
:rules="rules"
|
||||
class="stock-batch-edit-form"
|
||||
@submit.prevent
|
||||
>
|
||||
<!-- 下拉选择 -->
|
||||
<div v-if="type === 'select'" class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label is-required">{{ fieldLabel }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="value">
|
||||
<el-select
|
||||
v-model="formModel.value"
|
||||
filterable
|
||||
clearable
|
||||
:placeholder="placeholder || '请选择'"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in options"
|
||||
:key="String(option.value)"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数字 -->
|
||||
<div v-else-if="type === 'number'" class="task-panel__field task-panel__field--control">
|
||||
<span class="task-panel__field-label is-required">{{ fieldLabel }}</span>
|
||||
<div class="task-panel__field-form task-panel__field-form--row">
|
||||
<el-form-item prop="value">
|
||||
<el-input-number
|
||||
v-model="numberValue"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
:placeholder="placeholder || '请输入数字'"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 单行文本 -->
|
||||
<div v-else-if="type === 'text'" class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label is-required">{{ fieldLabel }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="value">
|
||||
<el-input
|
||||
v-model="textValue"
|
||||
:placeholder="placeholder || '请输入'"
|
||||
:maxlength="maxlength"
|
||||
:show-word-limit="!!maxlength"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 多行文本 -->
|
||||
<div
|
||||
v-else-if="type === 'textarea'"
|
||||
class="task-panel__field task-panel__field--input task-panel__field--textarea task-panel__field--full"
|
||||
>
|
||||
<span class="task-panel__field-label is-required">{{ fieldLabel }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="value">
|
||||
<el-input
|
||||
v-model="textValue"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
resize="none"
|
||||
:placeholder="placeholder || '请输入'"
|
||||
:maxlength="maxlength"
|
||||
:show-word-limit="!!maxlength"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 多选(管理标识) -->
|
||||
<div v-else-if="type === 'checkbox'" class="task-panel__field task-panel__field--control">
|
||||
<span class="task-panel__field-label">{{ fieldLabel }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="value">
|
||||
<el-checkbox-group v-model="checkboxValue">
|
||||
<el-checkbox
|
||||
v-for="option in options"
|
||||
:key="String(option.value)"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<p class="task-panel__form-tip">{{ tipText }}</p>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">提交前请确认修改值</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" @click="handleSubmit">确定修改</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
type BatchOption = { label: string; value: string | number }
|
||||
type BatchValue = string | number | null | string[]
|
||||
type BatchSubmitValue = BatchValue | Record<string, string>
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
const value = defineModel<BatchValue>('value', { default: null })
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string
|
||||
/** 字段中文名(如「库存单位」) */
|
||||
fieldLabel?: string
|
||||
/** select / number / text / textarea / checkbox */
|
||||
type?: 'select' | 'number' | 'text' | 'textarea' | 'checkbox'
|
||||
options?: BatchOption[]
|
||||
placeholder?: string
|
||||
maxlength?: number
|
||||
/** 本次批量修改选中的商品数 */
|
||||
selectedCount?: number
|
||||
loading?: boolean
|
||||
}>(),
|
||||
{
|
||||
title: '',
|
||||
fieldLabel: '',
|
||||
type: 'text',
|
||||
options: () => [],
|
||||
placeholder: '',
|
||||
maxlength: undefined,
|
||||
selectedCount: 0,
|
||||
loading: false
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'confirm', value: BatchSubmitValue): void
|
||||
}>()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const formModel = reactive<{ value: BatchValue }>({ value: null })
|
||||
|
||||
/* 各控件与统一 model 值之间的类型适配 */
|
||||
const numberValue = computed<number | null>({
|
||||
get: () => (typeof formModel.value === 'number' ? formModel.value : null),
|
||||
set: (val) => {
|
||||
formModel.value = val
|
||||
}
|
||||
})
|
||||
|
||||
const textValue = computed<string>({
|
||||
get: () => (Array.isArray(formModel.value) || formModel.value == null ? '' : String(formModel.value)),
|
||||
set: (val) => {
|
||||
formModel.value = val
|
||||
}
|
||||
})
|
||||
|
||||
const checkboxValue = computed<string[]>({
|
||||
get: () => (Array.isArray(formModel.value) ? formModel.value : []),
|
||||
set: (val) => {
|
||||
formModel.value = val
|
||||
}
|
||||
})
|
||||
|
||||
/** 打开时同步父级传入的初始值(多选统一用数组) */
|
||||
function syncFromModel() {
|
||||
if (props.type === 'checkbox') {
|
||||
formModel.value = Array.isArray(value.value) ? [...value.value] : []
|
||||
return
|
||||
}
|
||||
formModel.value = value.value ?? (props.type === 'number' ? null : '')
|
||||
}
|
||||
|
||||
watch(visible, (open) => {
|
||||
if (open) syncFromModel()
|
||||
}, { immediate: true })
|
||||
|
||||
const tipText = computed(() => {
|
||||
switch (props.type) {
|
||||
case 'select':
|
||||
return '仅修改所选商品的该项字段,其他字段保持不变。'
|
||||
case 'number':
|
||||
return '请输入非负整数,单位与商品表单一致(毛重为 g)。'
|
||||
case 'textarea':
|
||||
return `文本最多 ${props.maxlength || 255} 个字符,提交后将覆盖原内容。`
|
||||
case 'text':
|
||||
return `文本最多 ${props.maxlength || 255} 个字符,提交后将覆盖原内容。`
|
||||
case 'checkbox':
|
||||
return '勾选表示开启,未勾选的标识会批量关闭。'
|
||||
default:
|
||||
return '提交后仅修改当前字段。'
|
||||
}
|
||||
})
|
||||
|
||||
const rules = computed<FormRules>(() => {
|
||||
if (props.type === 'checkbox') return {}
|
||||
const trigger = props.type === 'select' ? 'change' : 'blur'
|
||||
const list: Record<string, unknown>[] = [
|
||||
{
|
||||
required: true,
|
||||
message: `请${props.type === 'select' ? '选择' : '输入'}${props.fieldLabel || '修改值'}`,
|
||||
trigger
|
||||
}
|
||||
]
|
||||
if (props.type === 'number') {
|
||||
list.push({
|
||||
validator: (_rule: unknown, val: unknown, callback: (error?: Error) => void) => {
|
||||
const num = Number(val)
|
||||
if (val === null || val === undefined || val === '' || !Number.isFinite(num) || num < 0) {
|
||||
callback(new Error('请输入有效的非负数'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
})
|
||||
}
|
||||
if (props.type === 'text' || props.type === 'textarea') {
|
||||
list.push({
|
||||
validator: (_rule: unknown, val: unknown, callback: (error?: Error) => void) => {
|
||||
const text = String(val ?? '')
|
||||
if (!text.trim()) {
|
||||
callback(new Error(`${props.fieldLabel || '内容'}不能为空`))
|
||||
return
|
||||
}
|
||||
if (props.maxlength && text.length > props.maxlength) {
|
||||
callback(new Error(`最多 ${props.maxlength} 个字符`))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
})
|
||||
}
|
||||
return { value: list } as FormRules
|
||||
})
|
||||
|
||||
/** 管理标识:转为后端要求的 { is_sn_mgmt: 'Y'|'N', ... } */
|
||||
function buildSubmitValue(): BatchSubmitValue {
|
||||
if (props.type !== 'checkbox') return formModel.value
|
||||
const checked = new Set(Array.isArray(formModel.value) ? formModel.value : [])
|
||||
return {
|
||||
is_sn_mgmt: checked.has('is_sn_mgmt') ? 'Y' : 'N',
|
||||
is_shelf_life_mgmt: checked.has('is_shelf_life_mgmt') ? 'Y' : 'N',
|
||||
is_batch_mgmt: checked.has('is_batch_mgmt') ? 'Y' : 'N'
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
emit('confirm', buildSubmitValue())
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
formRef.value?.resetFields()
|
||||
formModel.value = props.type === 'checkbox' ? [] : null
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
/* el-form 只作为校验宿主,布局交给内部的 task-panel__field 行 */
|
||||
.stock-batch-edit-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.stock-batch-edit-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
127
src/views/stock/stock/component/StockFormDialog.vue
Normal file
127
src/views/stock/stock/component/StockFormDialog.vue
Normal file
@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
class="stock-form-dialog"
|
||||
width="min(920px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
>
|
||||
<!-- 弹窗结构对齐 order/waveOrder 的 task-panel -->
|
||||
<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="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 stock-form-dialog__body">
|
||||
<Add
|
||||
ref="addRef"
|
||||
hide-actions
|
||||
:stores="stores"
|
||||
:prohibited_type="prohibitedType"
|
||||
:initial-store="initialStore"
|
||||
:store-disabled="storeDisabled"
|
||||
@saved="handleSaved"
|
||||
@saving-change="handleSavingChange"
|
||||
@update-prohibited-types="handleUpdateProhibitedTypes"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">商品编码保存前会校验唯一性;保存成功后自动关闭</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="visible = false">取消</el-button>
|
||||
<el-button size="small" :disabled="saving" @click="handleReset">重置</el-button>
|
||||
<el-button size="small" type="primary" :loading="saving" @click="handleSave">保存</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import Add from './add.vue'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
stores?: Array<{ label: string; value: string | number }>
|
||||
prohibitedType?: Array<{ label: string; value: string | number }>
|
||||
/** 收货建单等场景锁定货主 */
|
||||
initialStore?: Record<string, unknown> | null
|
||||
storeDisabled?: boolean
|
||||
}>(),
|
||||
{
|
||||
stores: () => [],
|
||||
prohibitedType: () => [],
|
||||
initialStore: null,
|
||||
storeDisabled: false
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'saved'): void
|
||||
(e: 'update-prohibited-types', types: unknown[]): void
|
||||
}>()
|
||||
|
||||
const addRef = ref<InstanceType<typeof Add> | null>(null)
|
||||
const saving = ref(false)
|
||||
|
||||
function handleSavingChange(value: boolean) {
|
||||
saving.value = value
|
||||
}
|
||||
|
||||
function handleSave() {
|
||||
void addRef.value?.save?.()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
addRef.value?.resetForm?.()
|
||||
}
|
||||
|
||||
function handleSaved() {
|
||||
visible.value = false
|
||||
emit('saved')
|
||||
}
|
||||
|
||||
function handleUpdateProhibitedTypes(types: unknown[]) {
|
||||
emit('update-prohibited-types', types)
|
||||
}
|
||||
|
||||
// 供父页面(如收货建单)在打开弹窗后重置表单 / 预填字段
|
||||
defineExpose({
|
||||
resetForm: () => addRef.value?.resetForm?.(),
|
||||
getFormData: () => addRef.value?.formData
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
.stock-form-dialog__body {
|
||||
/* 表单本体(add.vue)已自带 task-panel 栅格间距,这里只兜底最小高度 */
|
||||
:deep(.stock-form) {
|
||||
min-height: 320px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.stock-form-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@ -43,20 +43,46 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
v-model="showStoreStock"
|
||||
direction="rtl"
|
||||
:with-header="false"
|
||||
size="800px"
|
||||
class="el-drawers"
|
||||
<el-dialog
|
||||
v-model="showStoreStock"
|
||||
class="stock-erp-bind-dialog"
|
||||
width="min(1000px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
>
|
||||
<StoreStock
|
||||
v-if="showStoreStock"
|
||||
:store_id="store_id"
|
||||
:warehouse_stock="id"
|
||||
@bind-item="handleBindSuccess"
|
||||
/>
|
||||
</el-drawer>
|
||||
<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="showStoreStock = 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 stock-erp-bind-dialog__body">
|
||||
<StoreStock
|
||||
v-if="showStoreStock"
|
||||
:store_id="store_id"
|
||||
:warehouse_stock="id"
|
||||
@bind-item="handleBindSuccess"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">绑定成功后列表会自动刷新</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="showStoreStock = false">关闭</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -206,6 +232,8 @@ function handleAddBind() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
/* 样式与 storage/receiving「商品明细」保持一致:
|
||||
header-actions(按钮行,间距 6px 对齐 toolbar) + table-host(自适应剩余高度) */
|
||||
.erp-stock-container {
|
||||
@ -265,8 +293,21 @@ function handleAddBind() {
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
.stock-erp-bind-dialog__body {
|
||||
min-height: 260px;
|
||||
|
||||
:deep(.erp-stock-container),
|
||||
:deep(.store-stock-container) {
|
||||
height: auto;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.stock-erp-bind-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -454,133 +454,134 @@
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<!-- 库存单位管理抽屉 -->
|
||||
<el-drawer
|
||||
<!-- 库存单位管理弹窗 -->
|
||||
<el-dialog
|
||||
v-model="unitDrawerVisible"
|
||||
direction="rtl"
|
||||
size="500px"
|
||||
:with-header="false"
|
||||
class="unit-drawer"
|
||||
class="stock-unit-dialog"
|
||||
width="min(520px, 92vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="drawer-header">
|
||||
<h3>库存单位管理</h3>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="Close"
|
||||
@click="unitDrawerVisible = false"
|
||||
class="close-btn"
|
||||
/>
|
||||
</div>
|
||||
<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="unitDrawerVisible = 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="drawer-content">
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<div class="scrollable-box">
|
||||
<div class="task-panel__body">
|
||||
<div class="unit-list-container">
|
||||
<div class="list-item" v-for="unit in stockUnits" :key="unit.id">
|
||||
<span class="unit-name">{{ unit.value }}</span>
|
||||
<div v-for="unit in stockUnits" :key="unit.id" class="unit-list-item">
|
||||
<span class="unit-list-item__name">{{ unit.value }}</span>
|
||||
<el-button
|
||||
v-if="!unit.isSystem"
|
||||
type="primary"
|
||||
type="danger"
|
||||
link
|
||||
icon="Close"
|
||||
size="small"
|
||||
@click="deleteUnit(unit.id)"
|
||||
class="delete-btn"
|
||||
/>
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="!stockUnits.length" class="unit-list-empty">暂无单位</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__form unit-add-form">
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">单位名称</span>
|
||||
<div class="task-panel__field-form">
|
||||
<div class="task-panel__field-form--row">
|
||||
<el-input v-model="newUnitName" placeholder="请输入单位名称" clearable @keyup.enter="handleAddUnit" />
|
||||
<el-button size="small" type="primary" :disabled="!newUnitName.trim()" @click="handleAddUnit">添加</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部输入框 -->
|
||||
<div class="input-footer">
|
||||
<div class="input-container">
|
||||
<el-input
|
||||
v-model="newUnitName"
|
||||
placeholder="请输入单位名称"
|
||||
clearable
|
||||
@keyup.enter="handleAddUnit"
|
||||
class="unit-input"
|
||||
>
|
||||
<template #append>
|
||||
<el-button
|
||||
@click="handleAddUnit"
|
||||
:disabled="!newUnitName.trim()"
|
||||
class="add-btn"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="input-tip">输入单位名称后点击添加</div>
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">共 {{ stockUnits.length }} 个单位</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="unitDrawerVisible = false">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 违禁品类型管理抽屉 -->
|
||||
<el-drawer
|
||||
<!-- 违禁品类型管理弹窗 -->
|
||||
<el-dialog
|
||||
v-model="prohibitedDrawerVisible"
|
||||
direction="rtl"
|
||||
size="500px"
|
||||
:with-header="false"
|
||||
class="prohibited-drawer"
|
||||
class="stock-prohibited-dialog"
|
||||
width="min(520px, 92vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="drawer-header">
|
||||
<h3>违禁品类型管理</h3>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="Close"
|
||||
@click="prohibitedDrawerVisible = false"
|
||||
class="close-btn"
|
||||
/>
|
||||
</div>
|
||||
<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="prohibitedDrawerVisible = 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="drawer-content">
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<div class="scrollable-box">
|
||||
<div class="prohibited-list-container">
|
||||
<div class="list-item" v-for="item in prohibitedList" :key="item.value">
|
||||
<div class="item-content">
|
||||
<span class="item-name">{{ item.label }}</span>
|
||||
</div>
|
||||
<div class="task-panel__body">
|
||||
<div class="unit-list-container">
|
||||
<div v-for="item in prohibitedList" :key="item.value" class="unit-list-item">
|
||||
<span class="unit-list-item__name">{{ item.label }}</span>
|
||||
<el-button
|
||||
v-if="item.warehouse_id"
|
||||
type="primary"
|
||||
type="danger"
|
||||
link
|
||||
icon="Close"
|
||||
size="small"
|
||||
@click="handleDeleteProhibited(item.value)"
|
||||
class="delete-btn"
|
||||
/>
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="!prohibitedList.length" class="unit-list-empty">暂无违禁品类型</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__form unit-add-form">
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">类型名称</span>
|
||||
<div class="task-panel__field-form">
|
||||
<div class="task-panel__field-form--row">
|
||||
<el-input
|
||||
v-model="newProhibitedName"
|
||||
placeholder="请输入违禁品类型名称"
|
||||
clearable
|
||||
@keyup.enter="handleAddProhibited"
|
||||
/>
|
||||
<el-button size="small" type="primary" :disabled="!newProhibitedName.trim()" @click="handleAddProhibited">添加</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部输入框 -->
|
||||
<div class="input-footer">
|
||||
<div class="input-container">
|
||||
<el-input
|
||||
v-model="newProhibitedName"
|
||||
placeholder="请输入违禁品类型名称"
|
||||
clearable
|
||||
@keyup.enter="handleAddProhibited"
|
||||
class="prohibited-input"
|
||||
>
|
||||
<template #append>
|
||||
<el-button
|
||||
@click="handleAddProhibited"
|
||||
:disabled="!newProhibitedName.trim()"
|
||||
class="add-btn"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="input-tip">输入名称点击添加</div>
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">共 {{ prohibitedList.length }} 个类型</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="prohibitedDrawerVisible = false">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -1172,6 +1173,8 @@ async function handleDeleteProhibited(id: number) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
.stock-info-container {
|
||||
// padding: 5px;
|
||||
height: 100%;
|
||||
@ -1227,58 +1230,53 @@ async function handleDeleteProhibited(id: number) {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.drawer-header {
|
||||
/* 单位 / 违禁品类型列表(弹窗内) */
|
||||
.unit-list-container {
|
||||
max-height: 320px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.unit-list-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
height: 50px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
color: #303133;
|
||||
border-bottom: 1px solid #f2f3f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&__name {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.drawer-content {
|
||||
height: calc(100vh - 50px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.scrollable-box {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #f0f2f5;
|
||||
|
||||
&:hover {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.unit-name, .item-name {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-footer {
|
||||
padding: 20px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
|
||||
.input-tip {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
.unit-list-empty {
|
||||
padding: 24px 12px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.unit-add-form {
|
||||
margin-top: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.stock-unit-dialog,
|
||||
.el-dialog.stock-prohibited-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -60,19 +60,45 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
v-model="showRequestData"
|
||||
direction="rtl"
|
||||
:with-header="false"
|
||||
size="800px"
|
||||
class="el-drawers"
|
||||
<el-dialog
|
||||
v-model="showRequestData"
|
||||
class="stock-request-dialog"
|
||||
width="min(1000px, 96vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
>
|
||||
<RequestData
|
||||
v-if="showRequestData"
|
||||
:id="requestId"
|
||||
:type="requestType"
|
||||
/>
|
||||
</el-drawer>
|
||||
<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="showRequestData = 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 stock-request-dialog__body">
|
||||
<RequestData
|
||||
v-if="showRequestData"
|
||||
:id="requestId"
|
||||
:type="requestType"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">报文仅供排查,不可编辑</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="showRequestData = false">关闭</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -219,6 +245,8 @@ function backData(row: any) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
/* 样式与 storage/receiving「商品明细」保持一致:
|
||||
header-actions(按钮行,间距 6px 对齐 toolbar) + table-host(自适应剩余高度) + 右对齐分页 */
|
||||
.log-container {
|
||||
@ -278,8 +306,20 @@ function backData(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
.stock-request-dialog__body {
|
||||
min-height: 240px;
|
||||
|
||||
:deep(.log-container) {
|
||||
height: auto;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
@use "../../styles/task-panel.scss" as tp;
|
||||
|
||||
.el-dialog.stock-request-dialog {
|
||||
@include tp.task-dialog-shell;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -179,47 +179,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 抽屉:添加 -->
|
||||
<el-drawer v-model="drawer" :with-header="false" direction="rtl" size="800px">
|
||||
<Add
|
||||
v-if="drawer"
|
||||
:stores="storeFieldOptions"
|
||||
:prohibited_type="prohibitedTypeFieldOptions"
|
||||
@saved="handleSaved"
|
||||
@update-prohibited-types="handleUpdateProhibitedTypes"
|
||||
/>
|
||||
</el-drawer>
|
||||
<!-- 弹窗:新增商品 -->
|
||||
<StockFormDialog
|
||||
v-model="drawer"
|
||||
:stores="storeFieldOptions"
|
||||
:prohibited-type="prohibitedTypeFieldOptions"
|
||||
@saved="handleSaved"
|
||||
@update-prohibited-types="handleUpdateProhibitedTypes"
|
||||
/>
|
||||
|
||||
<!-- 批量修改(下拉类:库存单位、违禁品类型等) -->
|
||||
<el-dialog :title="batchDialogTitle" align-center v-model="showBatchDialog" width="420px">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item :label="batchDialogFieldLabel">
|
||||
<el-select
|
||||
v-model="batchDialogValue"
|
||||
:placeholder="batchDialogPlaceholder"
|
||||
filterable
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in batchDialogOptions"
|
||||
:key="`${batchDialogCommand}-${opt.value}`"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="showBatchDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmBatchDialog">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 批量修改(task-panel 弹窗,设计对齐 order/orderManagement 手工录入运单号) -->
|
||||
<StockBatchEditDialog
|
||||
v-model="showBatchDialog"
|
||||
v-model:value="batchDialogValue"
|
||||
:title="batchDialogTitle"
|
||||
:field-label="batchDialogFieldLabel"
|
||||
:type="batchDialogType"
|
||||
:options="batchDialogOptions"
|
||||
:placeholder="batchDialogPlaceholder"
|
||||
:maxlength="batchDialogMaxlength"
|
||||
:selected-count="selectionIds.length"
|
||||
:loading="batchLoading"
|
||||
@confirm="confirmBatchDialog"
|
||||
/>
|
||||
|
||||
<!-- 抽屉:回收站 -->
|
||||
<el-drawer v-model="showRecycle" :with-header="false" direction="rtl" size="800px">
|
||||
<Recycle :drawer-visible="showRecycle" />
|
||||
</el-drawer>
|
||||
<!-- 弹窗:回收站 -->
|
||||
<RecycleDialog v-model="showRecycle" />
|
||||
|
||||
<AsyncExportProgressDialog
|
||||
v-model:visible="exportDialogVisible"
|
||||
@ -258,8 +243,9 @@ import ErpStock from './component/erpStock.vue'
|
||||
import Storage from './component/storage.vue'
|
||||
import Barcode from './component/barcode.vue'
|
||||
import Log from './component/log.vue'
|
||||
import Add from './component/add.vue'
|
||||
import Recycle from './component/recycle.vue'
|
||||
import StockFormDialog from './component/StockFormDialog.vue'
|
||||
import RecycleDialog from './component/RecycleDialog.vue'
|
||||
import StockBatchEditDialog from './component/StockBatchEditDialog.vue'
|
||||
import ImportDialog from './component/ImportDialog.vue'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
@ -297,7 +283,7 @@ const showBatchDialog = ref(false)
|
||||
const batchDialogOptions = ref<any[]>([])
|
||||
const batchDialogValue = ref<any>(null)
|
||||
const batchDialogCommand = ref('')
|
||||
const BATCH_SELECT_COMMANDS = new Set(['stock_unit', 'prohibited_id', 'merge_requirements'])
|
||||
const batchLoading = ref(false)
|
||||
const importFileInputRef = ref<HTMLInputElement | null>(null)
|
||||
|
||||
type ProhibitedOption = { value: number; label: string }
|
||||
@ -522,6 +508,16 @@ const batchDialogPlaceholder = computed(() => {
|
||||
return config?.placeholder || '请选择'
|
||||
})
|
||||
|
||||
/** 批量修改弹窗字段类型(select / number / text / textarea / checkbox) */
|
||||
const batchDialogType = computed<
|
||||
'select' | 'number' | 'text' | 'textarea' | 'checkbox'
|
||||
>(() => ((batchConfig as any)[batchDialogCommand.value]?.type || 'text'))
|
||||
|
||||
const batchDialogMaxlength = computed<number | undefined>(() => {
|
||||
const maxlength = (batchConfig as any)[batchDialogCommand.value]?.maxlength
|
||||
return typeof maxlength === 'number' ? maxlength : undefined
|
||||
})
|
||||
|
||||
// Methods
|
||||
const handleConditionChange = (conditions: any) => {
|
||||
currentConditions.value = conditions
|
||||
@ -675,89 +671,71 @@ const handleBatchChange = async (command: string) => {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
let value: any
|
||||
if (config.type === 'select') {
|
||||
if (BATCH_SELECT_COMMANDS.has(command)) {
|
||||
const options = config.options || []
|
||||
if (!options.length) {
|
||||
ElMessage.warning(`暂无可选的${config.title}`)
|
||||
return
|
||||
}
|
||||
batchDialogOptions.value = options
|
||||
const first = options[0]?.value
|
||||
if (command === 'prohibited_id') {
|
||||
const pid = Number(first)
|
||||
batchDialogValue.value = Number.isFinite(pid) ? Math.trunc(pid) : null
|
||||
} else {
|
||||
batchDialogValue.value = first ?? ''
|
||||
}
|
||||
batchDialogCommand.value = command
|
||||
showBatchDialog.value = true
|
||||
return
|
||||
}
|
||||
const { value: inputValue } = await ElMessageBox.prompt(`请输入${config.title}`, `批量修改${config.title}`, {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPlaceholder: config.placeholder,
|
||||
inputValue: ''
|
||||
})
|
||||
value = inputValue
|
||||
} else if (config.type === 'checkbox') {
|
||||
// Checkbox is hard with ElMessageBox.
|
||||
ElMessage.warning('批量修改管理标识暂未迁移')
|
||||
return
|
||||
} else {
|
||||
const maxlength: number | undefined = config.maxlength
|
||||
const { value: inputValue } = await ElMessageBox.prompt(`请输入${config.title}`, `批量修改${config.title}`, {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPattern: config.type === 'number' ? /^-?\d+(\.\d+)?$/ : undefined,
|
||||
inputErrorMessage: config.type === 'number' ? '请输入有效的数字' : undefined,
|
||||
inputPlaceholder: config.placeholder,
|
||||
// 作业要求类文本字段:非空 + 长度上限(后端 handleBatchChange 白名单限制 ≤255 字符)
|
||||
inputValidator: (val: string) => {
|
||||
if (config.type === 'number') return true
|
||||
const text = String(val ?? '')
|
||||
if (!text.trim()) return `${config.title}不能为空`
|
||||
if (maxlength && text.length > maxlength) return `${config.title}最多 ${maxlength} 个字符`
|
||||
return true
|
||||
}
|
||||
})
|
||||
value = inputValue
|
||||
// 初始化弹窗选项与初始值(统一走 task-panel 弹窗,不再使用 prompt)
|
||||
if (config.type === 'select') {
|
||||
const options = config.options || []
|
||||
if (!options.length) {
|
||||
ElMessage.warning(`暂无可选的${config.title}`)
|
||||
return
|
||||
}
|
||||
|
||||
await submitBatchChange(command, value)
|
||||
} catch (e) {
|
||||
if (e !== 'cancel') console.error(e)
|
||||
batchDialogOptions.value = options
|
||||
if (command === 'prohibited_id') {
|
||||
const pid = Number(options[0]?.value)
|
||||
batchDialogValue.value = Number.isFinite(pid) ? Math.trunc(pid) : null
|
||||
} else {
|
||||
batchDialogValue.value = options[0]?.value ?? ''
|
||||
}
|
||||
} else if (config.type === 'checkbox') {
|
||||
batchDialogOptions.value = config.options || []
|
||||
batchDialogValue.value = []
|
||||
} else if (config.type === 'number') {
|
||||
batchDialogOptions.value = []
|
||||
batchDialogValue.value = null
|
||||
} else {
|
||||
batchDialogOptions.value = []
|
||||
batchDialogValue.value = ''
|
||||
}
|
||||
|
||||
batchDialogCommand.value = command
|
||||
showBatchDialog.value = true
|
||||
}
|
||||
|
||||
const submitBatchChange = async (command: string, value: any) => {
|
||||
/** 提交批量修改,返回是否成功 */
|
||||
const submitBatchChange = async (command: string, value: any): Promise<boolean> => {
|
||||
batchLoading.value = true
|
||||
try {
|
||||
const requestData = {
|
||||
ids: selectionIds.value.map(item => item.id),
|
||||
const response = await stockApi.handleBatchChange({
|
||||
ids: selectionIds.value.map((item) => item.id),
|
||||
method: command,
|
||||
value: value
|
||||
}
|
||||
const response = await stockApi.handleBatchChange(requestData)
|
||||
value
|
||||
})
|
||||
if ((response as any).code === 200) {
|
||||
ElMessage.success((response as any).message || '修改成功')
|
||||
loadData()
|
||||
selectionIds.value = []
|
||||
} else {
|
||||
ElMessage.error((response as any).message || '修改失败')
|
||||
return true
|
||||
}
|
||||
ElMessage.error((response as any).message || '修改失败')
|
||||
return false
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return false
|
||||
} finally {
|
||||
batchLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const confirmBatchDialog = async () => {
|
||||
/** 弹窗「确定修改」:value 由弹窗校验后回传(管理标识已转为 Y/N 对象) */
|
||||
const confirmBatchDialog = async (submittedValue?: any) => {
|
||||
const command = batchDialogCommand.value
|
||||
let value: string | number | null = batchDialogValue.value
|
||||
let value: any = submittedValue !== undefined ? submittedValue : batchDialogValue.value
|
||||
|
||||
if (command === 'prohibited_id') {
|
||||
if (command === 'managementFlags') {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
||||
ElMessage.warning('请选择管理标识')
|
||||
return
|
||||
}
|
||||
} else if (command === 'prohibited_id') {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
ElMessage.warning('请选择违禁品类型')
|
||||
return
|
||||
@ -769,19 +747,15 @@ const confirmBatchDialog = async () => {
|
||||
}
|
||||
value = pid
|
||||
} else if (value === null || value === undefined || value === '') {
|
||||
ElMessage.warning('请选择选项')
|
||||
ElMessage.warning('请填写修改值')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await submitBatchChange(command, value)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
showBatchDialog.value = false
|
||||
batchDialogValue.value = null
|
||||
batchDialogCommand.value = ''
|
||||
}
|
||||
const ok = await submitBatchChange(command, value)
|
||||
if (!ok) return
|
||||
showBatchDialog.value = false
|
||||
batchDialogValue.value = null
|
||||
batchDialogCommand.value = ''
|
||||
}
|
||||
|
||||
const handleClearData = () => {
|
||||
|
||||
@ -466,6 +466,7 @@ export const stockBatchConfig = {
|
||||
brand_name: {
|
||||
title: '品牌',
|
||||
placeholder: '请输入品牌名称',
|
||||
type: 'text',
|
||||
validator: (value: any) => value && value.trim().length > 0,
|
||||
errorMessage: '品牌名称不能为空'
|
||||
},
|
||||
@ -491,6 +492,7 @@ export const stockBatchConfig = {
|
||||
packing_requirements: {
|
||||
title: '打包要求',
|
||||
placeholder: '请输入打包要求',
|
||||
type: 'textarea',
|
||||
// 后端 handleBatchChange 白名单:字符串,≤255 字符
|
||||
maxlength: 255,
|
||||
validator: (value: any) => value && value.trim().length > 0,
|
||||
@ -499,6 +501,7 @@ export const stockBatchConfig = {
|
||||
pick_requirements: {
|
||||
title: '拣货要求',
|
||||
placeholder: '请输入拣货要求',
|
||||
type: 'textarea',
|
||||
// 后端 handleBatchChange 白名单(拆分后独立字段):字符串,≤255 字符
|
||||
maxlength: 255,
|
||||
validator: (value: any) => value && value.trim().length > 0,
|
||||
@ -507,6 +510,7 @@ export const stockBatchConfig = {
|
||||
recheck_requirements: {
|
||||
title: '复核要求',
|
||||
placeholder: '请输入复核要求',
|
||||
type: 'textarea',
|
||||
// 后端 handleBatchChange 白名单(拆分后独立字段):字符串,≤255 字符
|
||||
maxlength: 255,
|
||||
validator: (value: any) => value && value.trim().length > 0,
|
||||
|
||||
288
src/views/stock/styles/task-panel.scss
Normal file
288
src/views/stock/styles/task-panel.scss
Normal file
@ -0,0 +1,288 @@
|
||||
/**
|
||||
* stock 模块弹窗统一风格:task-panel(对齐 order/waveOrder 的弹窗设计语言)
|
||||
*
|
||||
* 用法:
|
||||
* <style scoped lang="scss">@use "../../styles/task-panel.scss";</style>
|
||||
* <style lang="scss">
|
||||
* @use "../../styles/task-panel.scss" as tp;
|
||||
* .el-dialog.stock-xxx-dialog { @include tp.task-dialog-shell; }
|
||||
* </style>
|
||||
*/
|
||||
@mixin task-dialog-shell {
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
||||
.el-dialog__header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-dialog__body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.el-dialog__footer {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.task-panel {
|
||||
background: #fff;
|
||||
color: #303133;
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
&__titles {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
font-weight: 400;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
&__close {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: #909399;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s;
|
||||
|
||||
svg {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding: 12px 16px 0;
|
||||
|
||||
&--scroll {
|
||||
max-height: 66vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
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;
|
||||
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;
|
||||
|
||||
&.is-required::before {
|
||||
top: 7px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--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 {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
&--full {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&__field-label {
|
||||
position: relative;
|
||||
flex: 0 0 88px;
|
||||
width: 88px;
|
||||
padding-left: 10px;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #606266;
|
||||
text-align: left;
|
||||
|
||||
&.is-required::before {
|
||||
content: '*';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
color: #f56c6c;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&__field-value {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
text-align: right;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
&__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) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
&__form-tip {
|
||||
margin: 8px 0 0;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
background: #f4f4f5;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
/* 分组标题(基础信息 / 尺寸信息 / 箱规信息 / 作业要求 ...) */
|
||||
&__sub-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 12px 0 8px;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__sub-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
&__sub-meta {
|
||||
margin-right: auto;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&__table-wrap {
|
||||
:deep(.el-table) {
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&__foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
&__hint {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,9 +154,12 @@
|
||||
</div>
|
||||
|
||||
<!-- 添加商品抽屉(复用 stock add.vue) -->
|
||||
<el-drawer v-model="addDrawerVisible" title="创建商品" :append-to-body="true" size="800px">
|
||||
<AddProduct ref="addCompRef" :initialStore="addDrawerStore" :storeDisabled="true" />
|
||||
</el-drawer>
|
||||
<StockFormDialog
|
||||
ref="addCompRef"
|
||||
v-model="addDrawerVisible"
|
||||
:initial-store="addDrawerStore"
|
||||
:store-disabled="true"
|
||||
/>
|
||||
|
||||
<el-dialog v-model="dateDialogVisible" title="日期修改" align-center width="420px" append-to-body>
|
||||
<el-form :model="dateForm" label-width="90px" size="small">
|
||||
@ -828,7 +831,7 @@ import {
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { FullScreen, Close, CopyDocument, Search } from '@element-plus/icons-vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import AddProduct from '@/views/stock/stock/component/add.vue'
|
||||
import StockFormDialog from '@/views/stock/stock/component/StockFormDialog.vue'
|
||||
import * as receivingApi from '@/api/storage_receiving/receiving'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
@ -2838,7 +2841,7 @@ const openAddDrawer = (row?: any) => {
|
||||
if (typeof addCompRef.value.resetForm === 'function') {
|
||||
addCompRef.value.resetForm()
|
||||
}
|
||||
const formData = addCompRef.value.formData
|
||||
const formData = addCompRef.value.getFormData?.()
|
||||
if (!formData) return
|
||||
|
||||
if (addDrawerStore.value) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user