fix: Create/Update 成本字段分离 — Create 保留 BOM 自动计算值,Update 按 hasFormFieldPermission 剥离敏感字段
This commit is contained in:
@ -1418,6 +1418,14 @@ const submitForm = async () => {
|
|||||||
production_end_time: form.production_time_range?.[1]
|
production_end_time: form.production_time_range?.[1]
|
||||||
}
|
}
|
||||||
delete payload.production_time_range
|
delete payload.production_time_range
|
||||||
|
// Update 模式:无成本/售价权限则剥离敏感字段,防止库管修改已入库的数据
|
||||||
|
// Create 模式:保留成本字段,确保 BOM 自动计算的值能正确提交
|
||||||
|
if (dialogStatus.value === 'update') {
|
||||||
|
if (!hasFormFieldPermission('raw_material_cost')) delete payload.raw_material_cost
|
||||||
|
if (!hasFormFieldPermission('unit_total_cost')) delete payload.unit_total_cost
|
||||||
|
if (!hasFormFieldPermission('total_price')) delete payload.total_price
|
||||||
|
if (!hasFormFieldPermission('sale_price')) delete payload.sale_price
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if(dialogStatus.value === 'create') {
|
if(dialogStatus.value === 'create') {
|
||||||
const res: any = await createProductInbound(payload)
|
const res: any = await createProductInbound(payload)
|
||||||
|
|||||||
@ -1507,6 +1507,13 @@ const submitForm = async () => {
|
|||||||
production_end_time: form.production_time_range?.[1] || null
|
production_end_time: form.production_time_range?.[1] || null
|
||||||
}
|
}
|
||||||
delete payload.production_time_range
|
delete payload.production_time_range
|
||||||
|
// Update 模式:无成本权限则剥离成本字段,防止库管修改已入库的成本数据
|
||||||
|
// Create 模式:保留成本字段,确保 BOM 自动计算的值能正确提交
|
||||||
|
if (dialogStatus.value === 'update') {
|
||||||
|
if (!hasFormFieldPermission('raw_material_cost')) delete payload.raw_material_cost
|
||||||
|
if (!hasFormFieldPermission('unit_total_cost')) delete payload.unit_total_cost
|
||||||
|
if (!hasFormFieldPermission('total_price')) delete payload.total_price
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (dialogStatus.value === 'create') {
|
if (dialogStatus.value === 'create') {
|
||||||
const res: any = await createSemiInbound(payload)
|
const res: any = await createSemiInbound(payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user