| | |
| | | boundTime: [{ required: true, message: '请选择库存时间', trigger: 'change' }], |
| | | inboundTime: [{ required: true, message: '请选择入库时间', trigger: 'change' }], |
| | | inboundPerson: [{ required: true, message: '请选择出库人', trigger: 'change' }], |
| | | warnNum: [{ required: true, message: '请输入最低库存', trigger: 'blur' }], |
| | | warnNum: [{ required: true, message: '请输入最低库存', trigger: 'blur' }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | |
| | | getStockManagePageByCustom(params).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | |
| | | |
| | | // 为表格数据自动计算总价 |
| | | tableData.value = tableData.value.map(item => { |
| | | // 计算剩余库存 |
| | | const stockQuantity = parseFloat(item.inboundNum) || 0 |
| | | const outboundQuantity = parseFloat(item.totalInboundNum) || 0 |
| | | const remainingStock = Math.max(stockQuantity - outboundQuantity, 0) |
| | | |
| | | |
| | | // 材料库存:含税总价 = 含税单价 × 剩余库存 |
| | | const taxInclusiveUnitPrice = parseFloat(item.taxInclusiveUnitPrice) || 0 |
| | | item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * remainingStock).toFixed(2) |
| | | |
| | | |
| | | return item |
| | | }) |
| | | |
| | | |
| | | total.value = res.data.total |
| | | // 数据加载完成后检查库存 |
| | | // checkStockAndCreatePurchase(); |
| | |
| | | |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | | console.log(row) |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | |
| | | }) |
| | | } |
| | | form.value.entryDate = getCurrentDate() // 设置默认录入日期为当前日期 |
| | | |
| | | |
| | | // 仅材料库存弹框 |
| | | manualDialogVisible.value = true |
| | | } |
| | |
| | | // 提交表单 |
| | | const submitForm = (submittedData) => { |
| | | console.log('子组件提交的数据:', submittedData) |
| | | |
| | | |
| | | // 使用子组件提交的数据,而不是父组件的form对象 |
| | | const submitData = { ...submittedData } |
| | | |
| | | |
| | | // 材料库存:移除含税总价字段 |
| | | delete submitData.taxInclusiveTotalPrice |
| | | // 移除其他可能的总价字段 |
| | | delete submitData.taxExclusiveTotalPrice |
| | | |
| | | |
| | | console.log('提交给后端的数据(已移除总价字段):', submitData) |
| | | |
| | | |
| | | // 材料库存使用 updateManagementByCustom 接口 |
| | | updateManagementByCustom(submitData).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功") |
| | |
| | | :deep(.row-low-stock:hover > td) { |
| | | background-color: #fcd4d4; |
| | | } |
| | | </style> |
| | | </style> |