refactor: replace manual_cost with unit_total_cost and total_price
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -878,9 +878,13 @@ const handleUpdate = (row: any) => {
|
|||||||
inspection_report_link: row.inspection_report_link || [],
|
inspection_report_link: row.inspection_report_link || [],
|
||||||
in_quantity: Number(row.qty_inbound),
|
in_quantity: Number(row.qty_inbound),
|
||||||
raw_material_cost: (row.raw_material_cost !== null && row.raw_material_cost !== undefined) ? Number(row.raw_material_cost) : undefined,
|
raw_material_cost: (row.raw_material_cost !== null && row.raw_material_cost !== undefined) ? Number(row.raw_material_cost) : undefined,
|
||||||
manual_cost: (row.manual_cost !== null && row.manual_cost !== undefined) ? Number(row.manual_cost) : undefined,
|
unit_total_cost: (row.unit_total_cost !== null && row.unit_total_cost !== undefined) ? Number(row.unit_total_cost) : undefined,
|
||||||
sale_price: (row.sale_price !== null && row.sale_price !== undefined) ? Number(row.sale_price) : undefined
|
sale_price: (row.sale_price !== null && row.sale_price !== undefined) ? Number(row.sale_price) : undefined
|
||||||
})
|
})
|
||||||
|
// 计算总成本
|
||||||
|
const u = Number(form.unit_total_cost || 0)
|
||||||
|
const q = Number(form.in_quantity || 1)
|
||||||
|
form.total_price = Number((u * q).toFixed(2))
|
||||||
if(row.production_start_time && row.production_end_time) { form.production_time_range = [row.production_start_time, row.production_end_time] } else { form.production_time_range = [] }
|
if(row.production_start_time && row.production_end_time) { form.production_time_range = [row.production_start_time, row.production_end_time] } else { form.production_time_range = [] }
|
||||||
productPhotoList.value = form.product_photo.map(url => ({ name: url.split('/').pop(), url: getImageUrl(url) }))
|
productPhotoList.value = form.product_photo.map(url => ({ name: url.split('/').pop(), url: getImageUrl(url) }))
|
||||||
const qReports = form.quality_report_link || []
|
const qReports = form.quality_report_link || []
|
||||||
|
|||||||
@ -999,13 +999,16 @@ const handleUpdate = (row: any) => {
|
|||||||
in_quantity: Number(row.qty_inbound), stock_quantity: Number(row.qty_stock), available_quantity: Number(row.qty_available),
|
in_quantity: Number(row.qty_inbound), stock_quantity: Number(row.qty_stock), available_quantity: Number(row.qty_available),
|
||||||
bom_code: row.bom_code, bom_version: row.bom_version, work_order_code: row.work_order_code,
|
bom_code: row.bom_code, bom_version: row.bom_version, work_order_code: row.work_order_code,
|
||||||
raw_material_cost: (row.raw_material_cost !== null && row.raw_material_cost !== undefined) ? Number(row.raw_material_cost) : undefined,
|
raw_material_cost: (row.raw_material_cost !== null && row.raw_material_cost !== undefined) ? Number(row.raw_material_cost) : undefined,
|
||||||
manual_cost: (row.manual_cost !== null && row.manual_cost !== undefined) ? Number(row.manual_cost) : undefined,
|
|
||||||
unit_total_cost: (row.unit_total_cost !== null && row.unit_total_cost !== undefined) ? Number(row.unit_total_cost) : undefined,
|
unit_total_cost: (row.unit_total_cost !== null && row.unit_total_cost !== undefined) ? Number(row.unit_total_cost) : undefined,
|
||||||
production_manager: row.production_manager,
|
production_manager: row.production_manager,
|
||||||
production_time_range: (row.production_start_time && row.production_end_time) ? [row.production_start_time, row.production_end_time] : [],
|
production_time_range: (row.production_start_time && row.production_end_time) ? [row.production_start_time, row.production_end_time] : [],
|
||||||
detail_link: row.detail_link,
|
detail_link: row.detail_link,
|
||||||
arrival_photo: row.arrival_photo || [], quality_report_link: row.quality_report_link || []
|
arrival_photo: row.arrival_photo || [], quality_report_link: row.quality_report_link || []
|
||||||
})
|
})
|
||||||
|
// 计算总成本
|
||||||
|
const u = Number(form.unit_total_cost || 0)
|
||||||
|
const q = Number(form.in_quantity || 1)
|
||||||
|
form.total_price = Number((u * q).toFixed(2))
|
||||||
arrivalFileList.value = form.arrival_photo.map(url => ({ name: url.split('/').pop(), url: getImageUrl(url) }))
|
arrivalFileList.value = form.arrival_photo.map(url => ({ name: url.split('/').pop(), url: getImageUrl(url) }))
|
||||||
const reports = form.quality_report_link || []
|
const reports = form.quality_report_link || []
|
||||||
const reportImgs = reports.filter(r => !isExternalLink(r))
|
const reportImgs = reports.filter(r => !isExternalLink(r))
|
||||||
|
|||||||
Reference in New Issue
Block a user