gaoluyang
6 天以前 4f51c5dfbb3354d01c6ad4cfe260b703e15269dd
1.海川开心-增加价格字段,所有的原料,材料版块添加供应商字段
已修改5个文件
183 ■■■■■ 文件已修改
src/views/inventoryManagement/issueManagement/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/components/formDia.vue 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionReporting/components/formDia.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/issueManagement/index.vue
@@ -95,7 +95,7 @@
           <el-table-column align="center" label="序号" type="index" width="60" />
           <el-table-column label="入库时间" prop="createTime" width="100" show-overflow-tooltip />
           <!-- <el-table-column label="入库批次" prop="inboundBatches" width="160" show-overflow-tooltip /> -->
<!-- &lt;!&ndash;            <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />&ndash;&gt; -->
<el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />
           <el-table-column label="产品大类" prop="productCategory" show-overflow-tooltip />
           <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip />
           <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip />
@@ -153,7 +153,7 @@
            <el-table-column align="center" label="序号" type="index" width="60" />
            <el-table-column label="入库时间" prop="inboundDate" width="100" show-overflow-tooltip />
            <!-- <el-table-column label="入库批次" prop="inboundBatches" width="160" show-overflow-tooltip /> -->
            <!-- <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip /> -->
             <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />
            <el-table-column label="产品大类" prop="productCategory" show-overflow-tooltip />
            <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip />
            <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip />
src/views/inventoryManagement/receiptManagement/components/formDia.vue
@@ -8,8 +8,6 @@
          placeholder="请选择采购订单号"
          clearable
          filterable
          remote
          :remote-method="loadPurchaseOptions"
          :loading="loadingPurchaseOptions"
          @change="handlePurchaseChange"
          :disabled="operationType === 'edit'"
@@ -44,28 +42,22 @@
        <el-table-column label="待入库数量" prop="quantity0" width="100" />
        <el-table-column label="本次入库数量" prop="quantityStock" width="150">
          <template #default="scope">
            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" />
            <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="taxRate" width="120" />-->
<!--        <el-table-column-->
<!--          label="含税单价(元)"-->
<!--          prop="taxInclusiveUnitPrice"-->
<!--          :formatter="formattedNumber"-->
<!--          width="150"-->
<!--        />-->
<!--        <el-table-column-->
<!--          label="含税总价(元)"-->
<!--          prop="taxInclusiveTotalPrice"-->
<!--          :formatter="formattedNumber"-->
<!--          width="150"-->
<!--        />-->
<!--        <el-table-column-->
<!--          label="不含税总价(元)"-->
<!--          prop="taxExclusiveTotalPrice"-->
<!--          :formatter="formattedNumber"-->
<!--          width="150"-->
<!--        />-->
        <el-table-column label="税率(%)" prop="taxRate" width="120" />
        <el-table-column label="单价(元)" prop="unitPrice" width="150">
                    <template #default="scope">
                        <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" />
                    </template>
                </el-table-column>
        <el-table-column
          label="总价(元)"
                    :formatter="formattedNumber"
          prop="totalPrice"
          width="150"
        >
        </el-table-column>
      </el-table>
    </el-form>
    <template #footer>
@@ -199,6 +191,18 @@
  return parseFloat(cellValue).toFixed(2);
};
// 计算总价
const calculateTotalPrice = (row) => {
  const quantityStock = Number(row?.quantityStock ?? 0);
  const unitPrice = Number(row?.unitPrice ?? 0);
  if (Number.isFinite(quantityStock) && Number.isFinite(unitPrice)) {
    row.totalPrice = quantityStock * unitPrice;
  } else {
    row.totalPrice = 0;
  }
};
const fetchProductsByContract = async () => {
  if (!form.value.purchaseContractNumber) {
    proxy.$modal.msgWarning('请选择合同号')
@@ -217,6 +221,8 @@
    productList.value = productRes.data.map(item => ({
      ...item,
      quantityStock: 0,
      unitPrice: Number(item?.unitPrice ?? 0),
      totalPrice: 0,
      originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? 0),
    }))
  } catch (error) {
@@ -283,7 +289,9 @@
      nickName: userStore.nickName,
      details: selectedRows.value.map(product => ({
        id: product.id,
        inboundQuantity: Number(product.quantityStock)
        inboundQuantity: Number(product.quantityStock),
                unitPrice: Number(product.unitPrice),
                totalPrice: Number(product.totalPrice)
      })),
    };
    loading.value = true
@@ -365,6 +373,8 @@
      productList.value = res.data.map(item => ({
        ...item,
        quantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0),
        unitPrice: Number(item?.unitPrice ?? 0),
        totalPrice: Number(item?.quantityStock ?? 0) * Number(item?.unitPrice ?? 0),
        originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0),
      }))
      selectedRows.value = productList.value
src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
@@ -31,12 +31,12 @@
            <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="supplierName" width="200">
          <template #default="scope">
            <el-input v-model="scope.row.supplierName" placeholder="请输入供应商" />
          </template>
        </el-table-column> -->
        <el-table-column label="物品类型" prop="itemType">
        </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
@@ -48,7 +48,7 @@
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="入库数量" prop="inboundNum">
        <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)" />
          </template>
@@ -65,45 +65,22 @@
            />
          </template>
        </el-table-column>
<!--        <el-table-column label="税率(%)" prop="taxRate" width="150">-->
<!--          <template #default="scope">-->
<!--            <el-select v-model="scope.row.taxRate" placeholder="请选择税率" style="width: 100%" @change="() => calculateExclusivePrice(scope.row)">-->
<!--              <el-option-->
<!--                v-for="item in taxRateOptions"-->
<!--                :key="item.value"-->
<!--                :label="item.label"-->
<!--                :value="item.value"-->
<!--              />-->
<!--            </el-select>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column-->
<!--          label="含税单价(元)"-->
<!--          prop="taxInclusiveUnitPrice"-->
<!--          width="180"-->
<!--        >-->
<!--          <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"-->
<!--          width="180"-->
<!--        >-->
<!--          <template #default="scope">-->
<!--            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveTotalPrice" @change="calculateExclusivePrice(scope.row)" />-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column-->
<!--          label="不含税总价(元)"-->
<!--          prop="taxExclusiveTotalPrice"-->
<!--          width="180"-->
<!--        >-->
<!--          <template #default="scope">-->
<!--            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxExclusiveTotalPrice" />-->
<!--          </template>-->
<!--        </el-table-column>-->
        <el-table-column label="数量" prop="quantityStock" width="150">
          <template #default="scope">
            <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"
           width="150"
         >
        </el-table-column>
        <el-table-column label="操作" width="80" v-if="operationType === 'add'">
          <template #default="scope">
            <el-button type="danger" size="small" @click="removeProductRow(scope.$index)">删除</el-button>
@@ -199,9 +176,10 @@
    itemType: '',
    inboundNum: 0,
    inboundDate: '',
    taxRate: null,
    quantityStock: 0,
    taxInclusiveUnitPrice: 0,
    taxInclusiveTotalPrice: 0,
    taxRate: null,
    taxExclusiveTotalPrice: 0,
  });
};
@@ -211,19 +189,20 @@
  productList.value.splice(index, 1);
};
// 计算含税总价(根据单价和数量)
// 计算总价(根据数量、单价和含税单价)
const calculateTotalPrice = (row) => {
  const unitPrice = Number(row.taxInclusiveUnitPrice || 0);
  const quantity = Number(row.inboundNum || 0);
  row.taxInclusiveTotalPrice = unitPrice * quantity;
  // 计算普通总价:quantityStock * taxInclusiveUnitPrice
  const quantity = Number(row.quantityStock || 0);
  const taxInclusiveUnitPrice = Number(row.taxInclusiveUnitPrice || 0);
  row.taxInclusiveTotalPrice = quantity * taxInclusiveUnitPrice;
  calculateExclusivePrice(row);
};
// 计算不含税总价(根据含税总价和税率)
const calculateExclusivePrice = (row) => {
  const totalPrice = Number(row.taxInclusiveTotalPrice || 0);
  const taxInclusiveTotalPrice = Number(row.taxInclusiveTotalPrice || 0);
  const taxRate = Number(row.taxRate || 0);
  row.taxExclusiveTotalPrice = totalPrice / (1 + taxRate / 100);
  row.taxExclusiveTotalPrice = taxInclusiveTotalPrice / (1 + taxRate / 100);
};
const submitForm = async () => {
@@ -267,9 +246,9 @@
      itemType: product.itemType,
      inboundDate: formatDateTime(product.inboundDate, false),
      taxRate: Number(product.taxRate || 0),
      taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0),
      taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice || 0),
      taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice || 0),
      taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0),
    }));
    loading.value = true
    if (operationType.value === 'edit') {
@@ -335,6 +314,7 @@
      itemType: row?.itemType ?? '',
      inboundNum: Number(row?.inboundNum ?? row?.inboundQuantity ?? 0),
      inboundDate: row?.inboundDate ?? row?.createTime ?? '',
      quantityStock: Number(row?.quantityStock ?? 0),
      taxRate: Number(row?.taxRate ?? 0),
      taxInclusiveUnitPrice: Number(row?.taxInclusiveUnitPrice ?? 0),
      taxInclusiveTotalPrice: Number(row?.taxInclusiveTotalPrice ?? 0),
src/views/inventoryManagement/receiptManagement/index.vue
@@ -42,6 +42,8 @@
            <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip />
            <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip />
            <el-table-column label="入库数量" prop="inboundNum" width="90" show-overflow-tooltip />
                        <el-table-column label="单价(元)" prop="unitPrice" width="150"></el-table-column>
                        <el-table-column label="总价(元)" prop="totalPrice" width="150"></el-table-column>
<!--            <el-table-column label="含税单价" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />-->
<!--            <el-table-column label="含税总价" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />-->
<!--            <el-table-column label="税率(%)" prop="taxRate" width="80" show-overflow-tooltip />-->
@@ -92,11 +94,13 @@
           <el-table-column align="center" label="序号" type="index" width="60" />
           <el-table-column label="入库时间" prop="createTime" width="100" show-overflow-tooltip />
           <!-- <el-table-column label="入库批次" prop="inboundBatches" width="160" show-overflow-tooltip /> -->
<!--&lt;!&ndash;            <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />&ndash;&gt;-->
<el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />
           <el-table-column label="产品大类" prop="productCategory" show-overflow-tooltip />
           <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip />
           <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip />
           <el-table-column label="入库数量" prop="inboundNum" width="90" show-overflow-tooltip />
                     <el-table-column label="单价(元)" prop="unitPrice" width="150"></el-table-column>
                     <el-table-column label="总价(元)" prop="totalPrice" width="150"></el-table-column>
<!--&lt;!&ndash;            <el-table-column label="含税单价" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />&ndash;&gt;-->
<!--&lt;!&ndash;            <el-table-column label="含税总价" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />&ndash;&gt;-->
<!--&lt;!&ndash;            <el-table-column label="税率(%)" prop="taxRate" width="80" show-overflow-tooltip />&ndash;&gt;-->
@@ -152,12 +156,14 @@
            <el-table-column align="center" label="序号" type="index" width="60" />
            <el-table-column label="入库时间" prop="inboundDate" width="100" show-overflow-tooltip />
            <!-- <el-table-column label="入库批次" prop="inboundBatches" show-overflow-tooltip /> -->
            <!-- <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip /> -->
             <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />
            <el-table-column label="产品大类" prop="productCategory" show-overflow-tooltip />
            <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip />
            <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip />
            <el-table-column label="物品类型" prop="itemType" show-overflow-tooltip />
            <el-table-column label="入库数量" prop="inboundNum" show-overflow-tooltip />
                        <el-table-column label="单价(元)" prop="taxInclusiveUnitPrice" width="150"></el-table-column>
                        <el-table-column label="总价(元)" prop="taxInclusiveTotalPrice" width="150"></el-table-column>
<!--            <el-table-column label="含税单价" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />-->
<!--            <el-table-column label="含税总价" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />-->
<!--            <el-table-column label="税率(%)" prop="taxRate" width="80" show-overflow-tooltip />-->
src/views/productionManagement/productionReporting/components/formDia.vue
@@ -14,6 +14,13 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
                        <el-form-item label="待生产数量:" prop="pendingNum">
                            <el-input v-model="form.pendingNum" placeholder="请输入" clearable disabled/>
                        </el-form-item>
                    </el-col>
        </el-row>
        <el-row :gutter="30">
                    <el-col :span="12">
            <el-form-item label="本次生产数量:" prop="finishedNum">
                            <el-input-number
                                v-model="form.finishedNum"
@@ -27,11 +34,16 @@
                            />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="单价(元):" prop="unitPrice">
              <el-input v-model="form.unitPrice" placeholder="请输入" clearable @input="calculateTotalPrice"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="待生产数量:" prop="pendingNum">
              <el-input v-model="form.pendingNum" placeholder="请输入" clearable disabled/>
            <el-form-item label="总价(元):" prop="totalPrice">
              <el-input v-model="form.totalPrice" placeholder="请输入" clearable disabled/>
            </el-form-item>
          </el-col>
        </el-row>
@@ -98,6 +110,8 @@
        finishedNum: "",
        schedulingUserId: "",
        schedulingDate: "",
        unitPrice: "",
        totalPrice: "",
  },
  rules: {
        schedulingNum: [{ required: true, message: "请输入", trigger: "blur" },],
@@ -121,6 +135,19 @@
        proxy.$modal.msgWarning('本次生产数量不可大于排产数量')
    }
    form.value.pendingNum = form.value.schedulingNum - form.value.finishedNum;
    calculateTotalPrice();
}
// 计算总价
const calculateTotalPrice = () => {
    const quantity = Number(form.value.finishedNum ?? 0);
    const unitPrice = Number(form.value.unitPrice ?? 0);
    if (quantity > 0 && unitPrice > 0) {
        form.value.totalPrice = (quantity * unitPrice).toFixed(2);
    } else {
        form.value.totalPrice = '0.00';
    }
}
// 提交产品表单
const submitForm = () => {