diff --git a/src/views/material/packageMaterial/component/BatchImportDialog.vue b/src/views/material/packageMaterial/component/BatchImportDialog.vue
index 73c8286c..b8c29b68 100644
--- a/src/views/material/packageMaterial/component/BatchImportDialog.vue
+++ b/src/views/material/packageMaterial/component/BatchImportDialog.vue
@@ -54,7 +54,7 @@
{{ formatCellNumber(row.height) }}
- {{ formatCellNumber(row.weight) }}
+ {{ formatCellNumber(row.weight) ? formatCellNumber(row.weight) + 'g' : '--' }}
{{ formatCellNumber(row.cost_price) }}
@@ -129,7 +129,7 @@ const previewColumns = [
{ prop: 'length', label: '长度', width: '80' },
{ prop: 'width', label: '宽度', width: '80' },
{ prop: 'height', label: '高度', width: '80' },
- { prop: 'weight', label: '重量', width: '80' },
+ { prop: 'weight', label: '重量(g)', width: '80' },
{ prop: 'cost_price', label: '成本价', width: '90' },
{ prop: 'status', label: '状态', width: '70' },
{ prop: 'import_status', label: '导入状态', width: '100' },
diff --git a/src/views/material/packageMaterial/index.vue b/src/views/material/packageMaterial/index.vue
index 848cde29..f23045ee 100644
--- a/src/views/material/packageMaterial/index.vue
+++ b/src/views/material/packageMaterial/index.vue
@@ -59,7 +59,7 @@
- {{ formatNumber(row.weight) }}
+ {{ formatNumber(row.weight) ? formatNumber(row.weight) + 'g' : '--' }}
@@ -152,7 +152,7 @@
-
+
{{ selectedRow.goods_code || '—' }}
{{ selectedRow.brand_name || '—' }}
{{ selectedRow.stock_unit || '—' }}
- {{ selectedRow.gross_weight ?? '—' }}
+ {{ selectedRow.gross_weight != null ? selectedRow.gross_weight + 'g' : '—' }}
row.gross_weight ? `${formatNumber(row.gross_weight, 0)}g` : '--'
},
@@ -212,7 +212,7 @@ export const stockColumns = [
},
{
prop: 'net_weight',
- label: '净重',
+ label: '净重(g)',
width: '100',
formatter: (row: any) => row.net_weight ? `${formatNumber(row.net_weight, 0)}g` : '--'
},
@@ -507,6 +507,11 @@ export const stockFormRules = {
stock_unit: [{ required: true, message: '库存单位不能为空', trigger: 'change' }],
gross_weight: [
{ required: true, message: '毛重不能为空', trigger: 'blur' },
+ {
+ pattern: /^(0|[1-9]\d*)$/,
+ message: '毛重必须为非负整数(g)',
+ trigger: 'blur'
+ },
{
validator: (rule: any, value: any, callback: any) => {
if (value < 0) callback(new Error('毛重不能小于0'))
diff --git a/src/views/storage/receiving/component/Product.vue b/src/views/storage/receiving/component/Product.vue
index 3f59a0c0..63b077f2 100644
--- a/src/views/storage/receiving/component/Product.vue
+++ b/src/views/storage/receiving/component/Product.vue
@@ -238,7 +238,7 @@
-
+
@@ -265,7 +265,7 @@
-
+
@@ -337,7 +337,7 @@
{ prop: 'item_name', label: '商品名称', minWidth: '220' },
{ prop: 'barcodes', label: '条码', width: '180' },
{ prop: 'store_name', label: '货主', width: '180' },
- { prop: 'weight', label: '重量', width: '110', align: 'right' }
+ { prop: 'weight', label: '重量(g)', width: '110', align: 'right' }
]"
@selection-change="handleSystemProductSelectionChange"
@row-click="handleSystemProductRowClick"
@@ -2213,6 +2213,18 @@ const submitEditDetail = async () => {
const itemPayload: any = {}
+ // 重量字段必须为整数(g)
+ for (const wf of ['weight', 'box_weight'] as const) {
+ const raw = editForm[wf]
+ if (raw !== '' && raw !== null && raw !== undefined) {
+ const n = Number(raw)
+ if (!Number.isInteger(n) || n < 0) {
+ ElMessage.warning(`${wf === 'weight' ? '毛重/重量' : '实测箱重'}必须为非负整数(g)`)
+ return
+ }
+ }
+ }
+
const numberFields = [
'actual_quantity',
'box_quantity',
diff --git a/src/views/storage/receiving/index.vue b/src/views/storage/receiving/index.vue
index ceaa6a6e..63e653c3 100644
--- a/src/views/storage/receiving/index.vue
+++ b/src/views/storage/receiving/index.vue
@@ -1526,7 +1526,7 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
'实收数量': item.actual_quantity ?? '',
'箱数': item.box_quantity ?? '',
'箱规': item.boxes_per_pallet ?? '',
- '重量': item.weight ?? '',
+ '重量(g)': item.weight ?? '',
'批次号': item.batch_number || '',
'生产日期': item.production_date || '',
'有效期': item.expiry_date || '',
diff --git a/src/views/storage/receiving/receiving-config.ts b/src/views/storage/receiving/receiving-config.ts
index a74a7fed..7a83e11f 100644
--- a/src/views/storage/receiving/receiving-config.ts
+++ b/src/views/storage/receiving/receiving-config.ts
@@ -406,7 +406,7 @@ export const productdetail = [
{ prop: 'actual_quantity', label: '实际收货数量', width: '160' },
{ prop: 'box_quantity', label: '箱数', width: '160' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '160' },
- { prop: 'weight', label: '重量', width: '160' },
+ { prop: 'weight', label: '重量(g)', width: '160' },
{ prop: 'pallet_quantity', label: '托盘数', width: '160' },
{ prop: 'receiving_time', label: '收货时间', width: '160' },
{ prop: 'receiving_status', label: '收货状态', width: '160' },
@@ -445,7 +445,7 @@ export const productquick = [
{ prop: 'actual_quantity', label: '收货数量', width: '100', align: 'right' },
{ prop: 'box_quantity', label: '箱数', width: '100', align: 'right' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '100', align: 'right' },
- { prop: 'weight', label: '重量', width: '100', align: 'right' },
+ { prop: 'weight', label: '重量(g)', width: '100', align: 'right' },
{ prop: 'batch_number', label: '批次号', width: '120' },
{ prop: 'production_date', label: '生产日期', width: '120' },
{ prop: 'expiry_date', label: '到期日期', width: '120' },
@@ -495,7 +495,7 @@ export const printFormConfig = [
{ prop: 'barcode', label: '商品条码', type: 'input' },
{ prop: 'box_quantity', label: '箱数', type: 'number' },
{ prop: 'boxes_per_pallet', label: '箱规', type: 'number' },
- { prop: 'weight', label: '重量', type: 'number' },
+ { prop: 'weight', label: '重量(g)', type: 'number' },
{ prop: 'actual_quantity', label: '实际收货数量', type: 'number' },
{ prop: 'remark', label: '明细备注', type: 'input' },
]}