周宾
3 天以前 cd17315666ec8099678c55329d3e5889efb23c1e
src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
@@ -29,32 +29,37 @@
              accept="image/*"
              :data="{ type: 9 }"
            >
              <img v-if="scope.row.url" :src="javaApiUrl+scope.row.url"></img>
              <img class="upload-img" v-if="scope.row.url" :src="javaApiUrl+scope.row.url"></img>
              <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
            </el-upload>
          </template>
        </el-table-column>
        <el-table-column label="产品大类" prop="productCategory" width="200">
        <el-table-column label="产品名称" prop="productCategory" width="200">
          <template #default="scope">
            <el-input v-model="scope.row.productCategory" placeholder="请输入产品大类" />
            <el-input v-model="scope.row.productCategory" placeholder="请输入产品名称" />
          </template>
        </el-table-column>
        <el-table-column label="规格型号" prop="specificationModel" width="200">
        <el-table-column label="产品高度" prop="specificationModel" width="200">
          <template #default="scope">
            <el-input v-model="scope.row.specificationModel" placeholder="请输入规格型号" />
            <el-input v-model="scope.row.specificationModel" placeholder="请输入产品高度" />
          </template>
        </el-table-column>
        <el-table-column label="单位" prop="unit" width="100">
        <el-table-column label="高度单位" prop="unit" width="100">
          <template #default="scope">
            <el-input v-model="scope.row.unit" placeholder="请输入单位" />
            <el-input v-model="scope.row.unit" placeholder="请输入高度单位" />
          </template>
        </el-table-column>
        <el-table-column label="供应商" prop="supplierName" width="200">
        <el-table-column label="纸箱规格" prop="cartonSpecifications" width="200">
          <template #default="scope">
            <el-input v-model="scope.row.cartonSpecifications" placeholder="请输入纸箱规格" />
          </template>
        </el-table-column>
        <!-- <el-table-column label="供应商" prop="supplierName" width="200">
          <template #default="scope">
            <el-input v-model="scope.row.supplierName" placeholder="请输入供应商" />
          </template>
        </el-table-column>
        <el-table-column label="物品类型" prop="itemType" width="150">
        </el-table-column> -->
        <!-- <el-table-column label="物品类型" prop="itemType" width="150">
          <template #default="scope">
            <el-select v-model="scope.row.itemType" filterable allow-create placeholder="请选择物品类型" style="width: 100%">
              <el-option
@@ -65,12 +70,27 @@
              />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="入库数量" prop="inboundNum" width="150">
        </el-table-column> -->
        <el-table-column label="入库数量-件" prop="inboundNum" width="150">
          <template #default="scope">
            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" />
            <el-input-number :step="1" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" />
          </template>
        </el-table-column>
        <el-table-column label="每件数量/支" prop="boxNum" width="150">
          <template #default="scope">
            <el-input-number :step="1" :min="0" style="width: 100%" v-model="scope.row.boxNum" @change="() => calculateTotalPrice(scope.row)" />
          </template>
        </el-table-column>
        <el-table-column label="单价(元)/件" prop="taxInclusiveUnitPrice" width="150">
         <template #default="scope">
           <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" />
         </template>
       </el-table-column>
       <el-table-column label="单价(美元)/件" prop="dollarPrice" width="150">
         <template #default="scope">
           <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.dollarPrice"/>
         </template>
       </el-table-column>
        <el-table-column label="入库日期" prop="inboundDate" width="180">
          <template #default="scope">
            <el-date-picker
@@ -88,11 +108,7 @@
<!--            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" @change="() => calculateTotalPrice(scope.row)" />-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column label="单价(元)" prop="taxInclusiveUnitPrice" width="150">-->
<!--          <template #default="scope">-->
<!--            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" />-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column -->
<!--           label="总价(元)" -->
<!--           prop="taxInclusiveTotalPrice" -->
@@ -127,10 +143,7 @@
  Authorization: "Bearer " + getToken(),
});
const imeUrl = ref(import.meta.env.VITE_APP_ENV)
console.log(import.meta)
const javaApiUrl = __BASE_API__;
console.log('Java API 地址:', javaApiUrl)
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
@@ -200,6 +213,7 @@
    id: null,
    productCategory: '',
    specificationModel: '',
    cartonSpecifications:'',
    unit: '',
    supplierName: form.value.supplierName || '',
    itemType: '',
@@ -210,6 +224,8 @@
    taxInclusiveTotalPrice: 0,
    taxRate: null,
    taxExclusiveTotalPrice: 0,
    boxNum: 0,
    dollarPrice: 0
  });
};
@@ -247,22 +263,46 @@
    for (let i = 0; i < productList.value.length; i++) {
      const product = productList.value[i];
      if (!product.productCategory || !product.specificationModel || !product.unit) {
        proxy.$modal.msgError(`第${i + 1}行产品数据未填写完整(产品大类、规格型号、单位为必填)`)
        proxy.$modal.msgError(`第${i + 1}行产品数据未填写完整(产品、产品高度、高度单位为必填)`)
        return
      }
      if (!product.itemType) {
        proxy.$modal.msgError(`第${i + 1}行请选择物品类型`)
      if (!product.url) {
        proxy.$modal.msgError(`第${i + 1}行产品未上传产品图片`)
        return
      }
      if (!product.cartonSpecifications) {
        proxy.$modal.msgError(`第${i + 1}行产品未填写纸箱规格`)
        return
      }
      // if (!product.itemType) {
      //   proxy.$modal.msgError(`第${i + 1}行请选择物品类型`)
      //   return
      // }
      const stock = Number(product?.inboundNum ?? 0);
      if (!Number.isFinite(stock) || stock <= 0) {
        proxy.$modal.msgError(`第${i + 1}行本次入库数量需大于0`)
        return
      }
      const boxNum = Number(product?.boxNum ?? 0);
      if (!Number.isFinite(boxNum) || boxNum <= 0) {
        proxy.$modal.msgError(`第${i + 1}行每件数量/支需大于0`)
        return
      }
      const taxInclusiveUnitPrice = Number(product?.taxInclusiveUnitPrice ?? 0);
      if (!Number.isFinite(taxInclusiveUnitPrice) || taxInclusiveUnitPrice <= 0) {
        proxy.$modal.msgError(`第${i + 1}行单价(元)需大于0`)
        return
      }
      const dollarPrice = Number(product?.dollarPrice ?? 0);
      if (!Number.isFinite(dollarPrice) || dollarPrice <= 0) {
        proxy.$modal.msgError(`第${i + 1}行单价(美元)需大于0`)
        return
      }
      if (!product.inboundDate) {
        proxy.$modal.msgError(`第${i + 1}行请选择入库日期`)
        return
      }
      const stock = Number(product?.inboundNum ?? 0);
      if (!Number.isFinite(stock) || stock <= 0) {
        proxy.$modal.msgError(`第${i + 1}行本次入库数量需大于0`)
        return
      }
    }
    const payloadList = productList.value.map(product => ({
@@ -278,7 +318,10 @@
      taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0),
         taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice || 0),
         taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice || 0),
      url: product.url,
      boxNum:Number(product.boxNum),
      cartonSpecifications: product.cartonSpecifications,
      url: product.url||'',
      dollarPrice: Number(product.dollarPrice || 0),
    }));
    loading.value = true
    if (operationType.value === 'edit') {
@@ -373,6 +416,10 @@
      taxInclusiveUnitPrice: Number(row?.taxInclusiveUnitPrice ?? 0),
      taxInclusiveTotalPrice: Number(row?.taxInclusiveTotalPrice ?? 0),
      taxExclusiveTotalPrice: Number(row?.taxExclusiveTotalPrice ?? 0),
      boxNum: Number(row?.boxNum ?? 0),
      cartonSpecifications: row?.cartonSpecifications ?? '',
      url: row?.url ?? '',
      dollarPrice: Number(row?.dollarPrice ?? 0),
    }]
  }
}
@@ -382,5 +429,11 @@
})
</script>
<style scoped lang="scss"></style>
<style scoped lang="scss">
  .upload-img{
    width: 80px;
    height: 80px;
    object-fit: contain;
  }
</style>