feat: replace manual cost with unit total cost in inbound forms
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -392,14 +392,19 @@
|
|||||||
<el-date-picker v-model="form.production_time_range" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss" style="width:100%" />
|
<el-date-picker v-model="form.production_time_range" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss" style="width:100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6">
|
<el-col :span="4">
|
||||||
<el-form-item label="原料成本">
|
<el-form-item label="原料成本">
|
||||||
<el-input-number v-model="form.raw_material_cost" :precision="2" :controls="false" style="width:100%" placeholder="请输入"/>
|
<el-input-number v-model="form.raw_material_cost" :precision="2" :controls="false" style="width:100%" placeholder="请输入"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6">
|
<el-col :span="4">
|
||||||
<el-form-item label="人工成本">
|
<el-form-item label="单件成本">
|
||||||
<el-input-number v-model="form.manual_cost" :precision="2" :controls="false" style="width:100%" placeholder="请输入"/>
|
<el-input-number v-model="form.unit_total_cost" :precision="2" :controls="false" style="width:100%" placeholder="请输入"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-form-item label="总成本">
|
||||||
|
<el-input-number v-model="form.total_price" :precision="2" :controls="false" style="width:100%" placeholder="自动计算" disabled/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -643,7 +648,8 @@ const form = reactive({
|
|||||||
bom_code: '', bom_version: '', work_order_code: '', order_id: '',
|
bom_code: '', bom_version: '', work_order_code: '', order_id: '',
|
||||||
production_manager: '', production_time_range: [] as string[],
|
production_manager: '', production_time_range: [] as string[],
|
||||||
raw_material_cost: undefined as number | undefined,
|
raw_material_cost: undefined as number | undefined,
|
||||||
manual_cost: undefined as number | undefined,
|
unit_total_cost: undefined as number | undefined,
|
||||||
|
total_price: undefined as number | undefined,
|
||||||
sale_price: undefined as number | undefined,
|
sale_price: undefined as number | undefined,
|
||||||
quality_report_link: [] as string[], inspection_report_link: [] as string[], product_photo: [] as string[], detail_link: ''
|
quality_report_link: [] as string[], inspection_report_link: [] as string[], product_photo: [] as string[], detail_link: ''
|
||||||
})
|
})
|
||||||
@ -982,7 +988,8 @@ const submitForm = async () => {
|
|||||||
quality_report_link: qImages,
|
quality_report_link: qImages,
|
||||||
inspection_report_link: iImages,
|
inspection_report_link: iImages,
|
||||||
raw_material_cost: Number(form.raw_material_cost || 0),
|
raw_material_cost: Number(form.raw_material_cost || 0),
|
||||||
manual_cost: Number(form.manual_cost || 0),
|
unit_total_cost: Number(form.unit_total_cost || 0),
|
||||||
|
total_price: Number(form.total_price || 0),
|
||||||
sale_price: Number(form.sale_price || 0),
|
sale_price: Number(form.sale_price || 0),
|
||||||
production_start_time: form.production_time_range?.[0],
|
production_start_time: form.production_time_range?.[0],
|
||||||
production_end_time: form.production_time_range?.[1]
|
production_end_time: form.production_time_range?.[1]
|
||||||
@ -1012,7 +1019,7 @@ const handlePrint = async (row: any) => {
|
|||||||
const confirmPrint = async () => { printing.value = true; try { await executePrint(currentPrintData.value); ElMessage.success('已发送'); printVisible.value = false } catch (e: any) { ElMessage.error('打印失败') } finally { printing.value = false } }
|
const confirmPrint = async () => { printing.value = true; try { await executePrint(currentPrintData.value); ElMessage.success('已发送'); printVisible.value = false } catch (e: any) { ElMessage.error('打印失败') } finally { printing.value = false } }
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
materialOptions.value = []; bomOptions.value = []; productPhotoList.value = []; qualityFileList.value = []; inspectionFileList.value = []; quality_url.value = ''; inspection_url.value = ''
|
materialOptions.value = []; bomOptions.value = []; productPhotoList.value = []; qualityFileList.value = []; inspectionFileList.value = []; quality_url.value = ''; inspection_url.value = ''
|
||||||
Object.assign(form, { id: undefined, base_id: undefined, material_name: '', spec_model: '', material_type: '', category: '', unit: '', sku: '', barcode: '', serial_number: '', in_date: '', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', status: '在库', quality_status: '合格', bom_code: '', bom_version: '', work_order_code: '', order_id: '', production_manager: '', production_time_range: [], raw_material_cost: undefined, manual_cost: undefined, sale_price: undefined, quality_report_link: [], inspection_report_link: [], product_photo: [], detail_link: '' })
|
Object.assign(form, { id: undefined, base_id: undefined, material_name: '', spec_model: '', material_type: '', category: '', unit: '', sku: '', barcode: '', serial_number: '', in_date: '', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', status: '在库', quality_status: '合格', bom_code: '', bom_version: '', work_order_code: '', order_id: '', production_manager: '', production_time_range: [], raw_material_cost: undefined, unit_total_cost: undefined, total_price: undefined, sale_price: undefined, quality_report_link: [], inspection_report_link: [], product_photo: [], detail_link: '' })
|
||||||
}
|
}
|
||||||
const getStatusType = (s:string) => ({'在库':'success','出库':'info','借库':'warning','损耗':'danger'}[s]||'warning')
|
const getStatusType = (s:string) => ({'在库':'success','出库':'info','借库':'warning','损耗':'danger'}[s]||'warning')
|
||||||
const getQualityType = (s:string) => ({'合格':'success','不合格':'danger','待检':'info'}[s]||'info')
|
const getQualityType = (s:string) => ({'合格':'success','不合格':'danger','待检':'info'}[s]||'info')
|
||||||
@ -1023,6 +1030,13 @@ onMounted(() => {
|
|||||||
fetchData()
|
fetchData()
|
||||||
fetchOptions()
|
fetchOptions()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 成本计算监听
|
||||||
|
watch([() => form.unit_total_cost, () => form.in_quantity], ([unit, qty]) => {
|
||||||
|
const unitNum = Number(unit || 0)
|
||||||
|
const qtyNum = Number(qty || 1)
|
||||||
|
form.total_price = Number((unitNum * qtyNum).toFixed(2))
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -727,8 +727,8 @@ const form = reactive({
|
|||||||
company_name: '',
|
company_name: '',
|
||||||
material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
|
material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
|
||||||
raw_material_cost: undefined as number | undefined,
|
raw_material_cost: undefined as number | undefined,
|
||||||
manual_cost: undefined as number | undefined,
|
|
||||||
unit_total_cost: undefined as number | undefined,
|
unit_total_cost: undefined as number | undefined,
|
||||||
|
total_price: undefined as number | undefined,
|
||||||
production_manager: '', production_time_range: [] as string[], arrival_photo: [] as string[], quality_report_link: [] as string[], detail_link: ''
|
production_manager: '', production_time_range: [] as string[], arrival_photo: [] as string[], quality_report_link: [] as string[], detail_link: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1103,8 +1103,8 @@ const submitForm = async () => {
|
|||||||
quality_report_link: onlyImages,
|
quality_report_link: onlyImages,
|
||||||
in_quantity: Number(form.in_quantity),
|
in_quantity: Number(form.in_quantity),
|
||||||
raw_material_cost: Number(form.raw_material_cost || 0),
|
raw_material_cost: Number(form.raw_material_cost || 0),
|
||||||
manual_cost: Number(form.manual_cost || 0),
|
|
||||||
unit_total_cost: Number(form.unit_total_cost || 0),
|
unit_total_cost: Number(form.unit_total_cost || 0),
|
||||||
|
total_price: Number(form.total_price || 0),
|
||||||
production_start_time: form.production_time_range?.[0] || null,
|
production_start_time: form.production_time_range?.[0] || null,
|
||||||
production_end_time: form.production_time_range?.[1] || null
|
production_end_time: form.production_time_range?.[1] || null
|
||||||
}
|
}
|
||||||
@ -1141,7 +1141,7 @@ const resetForm = () => {
|
|||||||
id: undefined, base_id: undefined,
|
id: undefined, base_id: undefined,
|
||||||
company_name: '', // [新增]
|
company_name: '', // [新增]
|
||||||
material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
|
material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
|
||||||
raw_material_cost: undefined, manual_cost: undefined, unit_total_cost: undefined,
|
raw_material_cost: undefined, unit_total_cost: undefined, total_price: undefined,
|
||||||
production_manager: '', production_time_range: [], arrival_photo: [], quality_report_link: [], detail_link: '' })
|
production_manager: '', production_time_range: [], arrival_photo: [], quality_report_link: [], detail_link: '' })
|
||||||
}
|
}
|
||||||
const getStatusType = (status: string) => { const map: any = { '在库': 'success', '出库': 'info', '借库': 'warning', '损耗': 'danger' }; return map[status] || 'warning' }
|
const getStatusType = (status: string) => { const map: any = { '在库': 'success', '出库': 'info', '借库': 'warning', '损耗': 'danger' }; return map[status] || 'warning' }
|
||||||
|
|||||||
Reference in New Issue
Block a user