zouyu
8 天以前 e03ff28fb1dbaa19571b7ea0414e0161f178cf26
src/views/inventoryManagement/stockManagement/index.vue
@@ -163,7 +163,7 @@
    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)
@@ -194,21 +194,21 @@
  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();
@@ -243,6 +243,7 @@
// 打开弹框
const openForm = async (type, row) => {
  console.log(row)
  operationType.value = type
  form.value = {}
  productData.value = []
@@ -262,7 +263,7 @@
    })
  }
  form.value.entryDate = getCurrentDate() // 设置默认录入日期为当前日期
  // 仅材料库存弹框
  manualDialogVisible.value = true
}
@@ -270,17 +271,17 @@
// 提交表单
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("提交成功")
@@ -385,4 +386,4 @@
:deep(.row-low-stock:hover > td) {
  background-color: #fcd4d4;
}
</style>
</style>