From 5b3528b601d2caa5e498f9f1b89b88a21badcaf5 Mon Sep 17 00:00:00 2001 From: yin <3313488199@qq.com> Date: Tue, 3 Nov 2026 18:21:39 +0800 Subject: [PATCH] feat(stock): add stock management dialogs and fix combo quantity handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增库存表单、批量编辑和回收处理弹窗,完善库存管理流程 调整库存首页及相关组件交互,统一任务面板样式与操作体验 修复组合商品在创建待处理订单时的数量展开逻辑,确保库存选择与计划数量一致 更新订单称重和订单复核页面及配置,优化业务操作流程 调整收货商品相关展示逻辑,适配最新库存数据流 --- .../component/CreatePendingOrderDialog.vue | 22 +- .../utils/stock-picker-helpers.ts | 87 +- .../orderWeighing/config/weighing-config.ts | 52 + src/views/order/orderWeighing/index.vue | 495 ++++++--- src/views/order/orderreview/index.vue | 793 ++++++++++----- .../component/ComboGoodsSearchDialog.vue | 146 +-- .../component/ComboStockPickerDialog.vue | 116 ++- .../stock/stock/component/RecycleDialog.vue | 61 ++ .../stock/component/StockBatchEditDialog.vue | 334 ++++++ .../stock/stock/component/StockFormDialog.vue | 127 +++ src/views/stock/stock/component/add.vue | 955 +++++++++++------- src/views/stock/stock/component/erpStock.vue | 73 +- src/views/stock/stock/component/info.vue | 292 +++--- src/views/stock/stock/component/log.vue | 70 +- src/views/stock/stock/index.vue | 208 ++-- src/views/stock/stock/stock-config.ts | 4 + src/views/stock/styles/task-panel.scss | 288 ++++++ .../storage/receiving/component/Product.vue | 13 +- 18 files changed, 2936 insertions(+), 1200 deletions(-) create mode 100644 src/views/order/orderWeighing/config/weighing-config.ts create mode 100644 src/views/stock/stock/component/RecycleDialog.vue create mode 100644 src/views/stock/stock/component/StockBatchEditDialog.vue create mode 100644 src/views/stock/stock/component/StockFormDialog.vue create mode 100644 src/views/stock/styles/task-panel.scss diff --git a/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue b/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue index 89d16b58..ca996879 100644 --- a/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue +++ b/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue @@ -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 diff --git a/src/views/order/orderManagement/utils/stock-picker-helpers.ts b/src/views/order/orderManagement/utils/stock-picker-helpers.ts index db6b54df..12dde419 100644 --- a/src/views/order/orderManagement/utils/stock-picker-helpers.ts +++ b/src/views/order/orderManagement/utils/stock-picker-helpers.ts @@ -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 return map } +/** + * 解析 simpleNotation 中「|」后的数量:162971|4,156957|2 → Map<序号, 数量> + * 序号与 parseComboSimpleNotation 一致(按 ',' 拆分后的出现顺序,1 基)。 + */ +export function parseComboSimpleNotationQuantity(notation: string): Map { + const map = new Map() + 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) } } diff --git a/src/views/order/orderWeighing/config/weighing-config.ts b/src/views/order/orderWeighing/config/weighing-config.ts new file mode 100644 index 00000000..6915e56d --- /dev/null +++ b/src/views/order/orderWeighing/config/weighing-config.ts @@ -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 = '暂无称重记录' diff --git a/src/views/order/orderWeighing/index.vue b/src/views/order/orderWeighing/index.vue index 7f2a2afd..fe46d277 100644 --- a/src/views/order/orderWeighing/index.vue +++ b/src/views/order/orderWeighing/index.vue @@ -1,107 +1,139 @@  @@ -1172,6 +1173,8 @@ async function handleDeleteProhibited(id: number) { + + diff --git a/src/views/stock/stock/component/log.vue b/src/views/stock/stock/component/log.vue index c0c42f88..033dec67 100644 --- a/src/views/stock/stock/component/log.vue +++ b/src/views/stock/stock/component/log.vue @@ -60,19 +60,45 @@ /> - - - +
+
+
+

报文详情

+

展示接口推送 / 回传的原始报文内容

+
+ +
+ +
+ +
+ +
+ 报文仅供排查,不可编辑 +
+ 关闭 +
+
+
+ @@ -219,6 +245,8 @@ function backData(row: any) { + + diff --git a/src/views/stock/stock/index.vue b/src/views/stock/stock/index.vue index 90eb2af8..4b6719ed 100644 --- a/src/views/stock/stock/index.vue +++ b/src/views/stock/stock/index.vue @@ -179,47 +179,32 @@ - - - - + + - - - - - - - - - - - + + - - - - + + ([]) const batchDialogValue = ref(null) const batchDialogCommand = ref('') -const BATCH_SELECT_COMMANDS = new Set(['stock_unit', 'prohibited_id', 'merge_requirements']) +const batchLoading = ref(false) const importFileInputRef = ref(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(() => { + 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 => { + 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 = () => { diff --git a/src/views/stock/stock/stock-config.ts b/src/views/stock/stock/stock-config.ts index 39ac21d9..fdece93f 100644 --- a/src/views/stock/stock/stock-config.ts +++ b/src/views/stock/stock/stock-config.ts @@ -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, diff --git a/src/views/stock/styles/task-panel.scss b/src/views/stock/styles/task-panel.scss new file mode 100644 index 00000000..b5ad85f9 --- /dev/null +++ b/src/views/stock/styles/task-panel.scss @@ -0,0 +1,288 @@ +/** + * stock 模块弹窗统一风格:task-panel(对齐 order/waveOrder 的弹窗设计语言) + * + * 用法: + * + * + */ +@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; + } + } +} diff --git a/src/views/storage/receiving/component/Product.vue b/src/views/storage/receiving/component/Product.vue index b29ffc20..b0ee5ecb 100644 --- a/src/views/storage/receiving/component/Product.vue +++ b/src/views/storage/receiving/component/Product.vue @@ -154,9 +154,12 @@ - - - + @@ -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) {