|
|
@@ -255,9 +255,7 @@
|
|
|
|
|
|
<!-- 新增字段:包装费(未税) -->
|
|
|
<template v-slot:packagingFeeNotTaxed="{ row, $index }">
|
|
|
- <el-form-item
|
|
|
- :prop="'datasource.' + $index + '.packagingFeeNotTaxed'"
|
|
|
- >
|
|
|
+ <el-form-item :prop="'datasource.' + $index + '.packagingFeeNotTaxed'">
|
|
|
<el-input
|
|
|
v-model="row.packagingFeeNotTaxed"
|
|
|
placeholder="请输入包装费"
|
|
|
@@ -816,6 +814,7 @@ const dayjs = require('dayjs');
|
|
|
import { levelList } from '@/enum/dict.js';
|
|
|
import {
|
|
|
getGoodsPriceByCondition,
|
|
|
+ getNewsGoodsByCategoryId,
|
|
|
getGoodsByCategoryId
|
|
|
} from '@/api/goodsManage/index';
|
|
|
import { parameterGetByCode } from '@/api/main/index.js';
|
|
|
@@ -1887,240 +1886,292 @@ export default {
|
|
|
this.$refs.headRef.open(item, index);
|
|
|
},
|
|
|
//选择产品回调
|
|
|
- changeParent(obj, idx) {
|
|
|
- obj.forEach((item, index) => {
|
|
|
- let i = idx == -1 ? index : idx;
|
|
|
- let row = JSON.parse(JSON.stringify(this.defaultForm));
|
|
|
- row.key = this.form.datasource.length + 1;
|
|
|
- let parasm = idx == -1 ? row : this.form.datasource[i];
|
|
|
-
|
|
|
- this.$set(parasm, 'productId', item.id);
|
|
|
- this.$set(parasm, 'categoryName', item.name);
|
|
|
- this.$set(parasm, 'productCategoryId', item.categoryLevelId);
|
|
|
- this.$set(parasm, 'productBrand', item.brandNum);
|
|
|
- this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
|
|
|
- this.$set(parasm, 'productCode', item.code);
|
|
|
- this.$set(parasm, 'productName', item.name);
|
|
|
- this.$set(parasm, 'modelType', item.modelType);
|
|
|
- this.$set(parasm, 'availableCountBase', item.availableCountBase);
|
|
|
- this.$set(parasm, 'measuringUnit', item.measuringUnit);
|
|
|
- this.$set(parasm, 'specification', item.specification);
|
|
|
- this.$set(parasm, 'weightUnit', item.weightUnit);
|
|
|
- this.$set(parasm, 'singleWeight', item.netWeight);
|
|
|
- this.$set(parasm, 'pricingWay', 1);
|
|
|
- this.$set(parasm, 'goodsLevel', item.goodsLevel);
|
|
|
- this.$set(parasm, 'guaranteePeriod', item.warrantyPeriod);
|
|
|
- if (item.modelKey) {
|
|
|
- this.$set(parasm, 'modelKey', item.modelKey.split(','));
|
|
|
- }
|
|
|
- if (item.colorKey) {
|
|
|
- this.$set(parasm, 'colorKey', item.colorKey.split(','));
|
|
|
- }
|
|
|
- if (this.defTaxRate) {
|
|
|
- this.$set(parasm, 'taxRate', parasm.taxRate || this.defTaxRate);
|
|
|
- }
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'guaranteePeriodUnitCode',
|
|
|
- item.warrantyPeriodUnit ? item.warrantyPeriodUnit + '' : ''
|
|
|
- );
|
|
|
- if (item.warrantyPeriod && item.warrantyPeriodUnit) {
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'guaranteePeriodDeadline',
|
|
|
- this.setDay(
|
|
|
- item.warrantyPeriod,
|
|
|
- this.guaranteePeriodUnit(item.warrantyPeriodUnit),
|
|
|
- {}
|
|
|
- )
|
|
|
- );
|
|
|
- }
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'packageDispositionList',
|
|
|
- item.packageDispositionList
|
|
|
- );
|
|
|
- if (item.packageDispositionList?.length) {
|
|
|
+ async changeParent(obj, idx) {
|
|
|
+ for (const [loopIndex, item] of obj.entries()) {
|
|
|
+ try {
|
|
|
+ let i = idx === -1 ? loopIndex : idx;
|
|
|
+ let row = JSON.parse(JSON.stringify(this.defaultForm));
|
|
|
+ row.key = this.form.datasource.length + 1;
|
|
|
+ let parasm = idx === -1 ? row : this.form.datasource[i];
|
|
|
+ this.$set(parasm, 'productId', item.id);
|
|
|
+ this.$set(parasm, 'categoryName', item.name);
|
|
|
+ this.$set(parasm, 'productCategoryId', item.categoryLevelId);
|
|
|
+ this.$set(parasm, 'productBrand', item.brandNum);
|
|
|
+ this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
|
|
|
+ this.$set(parasm, 'productCode', item.code);
|
|
|
+ this.$set(parasm, 'productName', item.name);
|
|
|
+ this.$set(parasm, 'modelType', item.modelType);
|
|
|
+ this.$set(parasm, 'availableCountBase', item.availableCountBase);
|
|
|
+ this.$set(parasm, 'measuringUnit', item.measuringUnit);
|
|
|
+ this.$set(parasm, 'specification', item.specification);
|
|
|
+ this.$set(parasm, 'weightUnit', item.weightUnit);
|
|
|
+ this.$set(parasm, 'singleWeight', item.netWeight);
|
|
|
+ this.$set(parasm, 'pricingWay', 1);
|
|
|
+ this.$set(parasm, 'goodsLevel', item.goodsLevel);
|
|
|
+ this.$set(parasm, 'guaranteePeriod', item.warrantyPeriod);
|
|
|
+
|
|
|
+ // 处理机型/颜色(数组化)
|
|
|
+ if (item.modelKey) {
|
|
|
+ this.$set(parasm, 'modelKey', item.modelKey.split(','));
|
|
|
+ }
|
|
|
+ if (item.colorKey) {
|
|
|
+ this.$set(parasm, 'colorKey', item.colorKey.split(','));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置默认税率
|
|
|
+ if (this.defTaxRate) {
|
|
|
+ this.$set(parasm, 'taxRate', parasm.taxRate || this.defTaxRate);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理保质期单位和截止日期
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
- this.countObj.unitIdKey,
|
|
|
- item.packageDispositionList[0].id
|
|
|
+ 'guaranteePeriodUnitCode',
|
|
|
+ item.warrantyPeriodUnit ? item.warrantyPeriodUnit + '' : ''
|
|
|
);
|
|
|
+ if (item.warrantyPeriod && item.warrantyPeriodUnit) {
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'guaranteePeriodDeadline',
|
|
|
+ this.setDay(
|
|
|
+ item.warrantyPeriod,
|
|
|
+ this.guaranteePeriodUnit(item.warrantyPeriodUnit),
|
|
|
+ {}
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理包装规格
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
- this.countObj.unitKey,
|
|
|
- item.packageDispositionList[0].conversionUnit
|
|
|
+ 'packageDispositionList',
|
|
|
+ item.packageDispositionList
|
|
|
);
|
|
|
- }
|
|
|
+ if (item.packageDispositionList?.length) {
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ this.countObj.unitIdKey,
|
|
|
+ item.packageDispositionList[0].id
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ this.countObj.unitKey,
|
|
|
+ item.packageDispositionList[0].conversionUnit
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
|
|
|
+ // 其他基础信息
|
|
|
+ this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
|
|
|
+ this.$set(parasm, 'imgCode', item.imgCode);
|
|
|
+ this.$set(parasm, 'produceType', item.componentAttribute);
|
|
|
|
|
|
- this.$set(parasm, 'imgCode', item.imgCode);
|
|
|
- this.$set(parasm, 'produceType', item.componentAttribute);
|
|
|
- if (this.isOrderNo) {
|
|
|
- this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
|
|
|
- this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
|
|
|
- }
|
|
|
- if (this.isGoods && item.goodsId) {
|
|
|
- this.$set(parasm, 'goodsId', item.goodsId);
|
|
|
- this.$set(parasm, 'goodsPriceId', item.goodsPriceId);
|
|
|
- this.$set(parasm, 'goodsPriceType', item.goodsPriceType);
|
|
|
- this.$set(parasm, 'singlePrice', item.singlePrice);
|
|
|
- this.$set(parasm, 'notaxSinglePrice', item.notaxSinglePrice);
|
|
|
- this.$set(parasm, 'taxRate', item.taxRate);
|
|
|
- this.$set(parasm, 'discountSinglePrice', item.singlePrice);
|
|
|
- this.$set(parasm, 'totalCount', '');
|
|
|
- } else {
|
|
|
- this.$set(parasm, 'singlePrice', parasm.singlePrice || 0);
|
|
|
- }
|
|
|
+ // 订单编码关联
|
|
|
+ if (this.isOrderNo) {
|
|
|
+ this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
|
|
|
+ this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
|
|
|
+ }
|
|
|
|
|
|
- if (this.isSupplier) {
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'entrustedEnterpriseIdList',
|
|
|
- item.entrustedEnterpriseIdList
|
|
|
- );
|
|
|
+ // 商品价格信息
|
|
|
+ if (this.isGoods && item.goodsId) {
|
|
|
+ this.$set(parasm, 'goodsId', item.goodsId);
|
|
|
+ this.$set(parasm, 'goodsPriceId', item.goodsPriceId);
|
|
|
+ this.$set(parasm, 'goodsPriceType', item.goodsPriceType);
|
|
|
+ this.$set(parasm, 'singlePrice', item.singlePrice);
|
|
|
+ this.$set(parasm, 'notaxSinglePrice', item.notaxSinglePrice);
|
|
|
+ this.$set(parasm, 'taxRate', item.taxRate);
|
|
|
+ this.$set(parasm, 'discountSinglePrice', item.singlePrice);
|
|
|
+ this.$set(parasm, 'totalCount', '');
|
|
|
+ } else {
|
|
|
+ this.$set(parasm, 'singlePrice', parasm.singlePrice || 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 供应商信息
|
|
|
+ if (this.isSupplier) {
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'entrustedEnterpriseIdList',
|
|
|
+ item.entrustedEnterpriseIdList
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'entrustedEnterpriseId',
|
|
|
+ item.entrustedEnterpriseId
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 其他扩展信息
|
|
|
+ this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
- 'entrustedEnterpriseId',
|
|
|
- item.entrustedEnterpriseId
|
|
|
+ 'packingSpecification',
|
|
|
+ item.extField.packingSpecification
|
|
|
);
|
|
|
- }
|
|
|
- this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'packingSpecification',
|
|
|
- item.extField.packingSpecification
|
|
|
- );
|
|
|
- this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
- if (item.purchaseOrigins?.length > 0) {
|
|
|
- item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
- }
|
|
|
- this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
-
|
|
|
- row.customerExpectDeliveryDeadline = dayjs().format('YYYY-MM-DD');
|
|
|
+ this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
+ if (item.purchaseOrigins?.length > 0) {
|
|
|
+ item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
+ }
|
|
|
+ this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
|
|
|
- this.$set(parasm, this.countObj.countKey, 1);
|
|
|
- this.$set(parasm, 'totalCount', 1);
|
|
|
+ // 数量初始化
|
|
|
+ this.$set(parasm, this.countObj.countKey, 1);
|
|
|
+ this.$set(parasm, 'totalCount', 1);
|
|
|
|
|
|
- // 初始化新增字段
|
|
|
- this.$set(parasm, 'thickNess', '');
|
|
|
- this.$set(parasm, 'squareNumber', '');
|
|
|
- this.$set(parasm, 'processingFeeBeforeTax', '');
|
|
|
- this.$set(parasm, 'packagingFeeNotTaxed', '');
|
|
|
- this.$set(parasm, 'transportationFeeWithoutTax', '');
|
|
|
+ // 初始化新增字段
|
|
|
+ this.$set(parasm, 'thickNess', '');
|
|
|
+ this.$set(parasm, 'squareNumber', '');
|
|
|
+ this.$set(parasm, 'processingFeeBeforeTax', '');
|
|
|
+ this.$set(parasm, 'packagingFeeNotTaxed', '');
|
|
|
+ this.$set(parasm, 'transportationFeeWithoutTax', '');
|
|
|
+
|
|
|
+ if (item.id) {
|
|
|
+ const priceData = await getNewsGoodsByCategoryId(item.id);
|
|
|
+ if (priceData?.unitPrice) {
|
|
|
+ this.$set(parasm, 'singlePrice', priceData.unitPrice);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (idx == -1) {
|
|
|
- this.form.datasource.push(row);
|
|
|
+ if (idx === -1) {
|
|
|
+ this.form.datasource.push(row);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`处理第${loopIndex + 1}个产品失败:`, error);
|
|
|
+ this.$message.error(
|
|
|
+ `加载产品信息失败: ${error.message || '未知错误'}`
|
|
|
+ );
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ // 重新计算总价
|
|
|
this.changeCount();
|
|
|
},
|
|
|
- replaceTable(obj, idx) {
|
|
|
- obj.forEach(async (item, index) => {
|
|
|
- let i = idx == -1 ? index : idx;
|
|
|
- let row = JSON.parse(JSON.stringify(this.defaultForm));
|
|
|
- row.key = this.form.datasource.length + 1;
|
|
|
- let parasm = idx == -1 ? row : this.form.datasource[i];
|
|
|
- this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
-
|
|
|
- this.$set(parasm, 'productId', item.productId);
|
|
|
- this.$set(parasm, 'categoryName', item.productName);
|
|
|
- this.$set(parasm, 'productCategoryId', item.categoryLevelId);
|
|
|
- this.$set(parasm, 'productBrand', item.productBrand);
|
|
|
- this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
|
|
|
- this.$set(parasm, 'productCode', item.productCode);
|
|
|
- this.$set(parasm, 'productName', item.productName);
|
|
|
- this.$set(parasm, 'modelType', item.categoryModel);
|
|
|
- this.$set(parasm, 'availableCountBase', item.measureQuantity);
|
|
|
- this.$set(parasm, 'measuringUnit', item.measuringUnit);
|
|
|
- this.$set(parasm, 'specification', item.specification);
|
|
|
- this.$set(parasm, 'weightUnit', item.weightUnit);
|
|
|
- this.$set(parasm, 'singleWeight', item.weight);
|
|
|
- this.$set(parasm, 'pricingWay', 1);
|
|
|
- this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
|
|
|
- this.$set(parasm, 'batchNo', item.batchNo);
|
|
|
- this.$set(parasm, 'imgCode', '');
|
|
|
- this.$set(parasm, 'produceType', item.componentAttribute);
|
|
|
- let goodsData = await getGoodsByCategoryId(item.productId);
|
|
|
- goodsData = goodsData.filter((item) => item.approvalStatus == 2);
|
|
|
- if (goodsData?.length) {
|
|
|
- let goodsPriceList = goodsData[0]?.goodsPriceList[0];
|
|
|
- this.$set(parasm, 'goodsId', goodsData[0].id);
|
|
|
- this.$set(parasm, 'goodsPriceId', goodsPriceList.id);
|
|
|
- this.$set(parasm, 'goodsPriceType', goodsPriceList.priceType);
|
|
|
- this.$set(parasm, 'singlePrice', goodsPriceList.unitPrice || 0);
|
|
|
- this.$set(parasm, 'notaxSinglePrice', goodsPriceList.excludeTaxPrice);
|
|
|
- this.$set(parasm, 'taxRate', goodsPriceList.taxRate);
|
|
|
- this.$set(parasm, 'discountSinglePrice', goodsPriceList.unitPrice);
|
|
|
- this.$set(parasm, 'totalCount', '');
|
|
|
- } else {
|
|
|
- this.$set(parasm, 'singlePrice', 0);
|
|
|
- }
|
|
|
- if (item.modelKey) {
|
|
|
- this.$set(parasm, 'modelKey', item.modelKey.split(','));
|
|
|
- }
|
|
|
- if (item.colorKey) {
|
|
|
- this.$set(parasm, 'colorKey', item.colorKey.split(','));
|
|
|
- }
|
|
|
- if (this.isSupplier) {
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'entrustedEnterpriseIdList',
|
|
|
- item.entrustedEnterpriseIdList
|
|
|
- );
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'entrustedEnterpriseId',
|
|
|
- item.entrustedEnterpriseId
|
|
|
- );
|
|
|
- }
|
|
|
- this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'packingSpecification',
|
|
|
- item.extField.packingSpecification
|
|
|
- );
|
|
|
+ async replaceTable(obj, idx) {
|
|
|
+ // 遍历对象,使用 for...of 支持 async/await
|
|
|
+ for (const [loopIndex, item] of obj.entries()) {
|
|
|
+ try {
|
|
|
+ // 计算当前行索引
|
|
|
+ let i = idx === -1 ? loopIndex : idx;
|
|
|
+ // 初始化行数据
|
|
|
+ let row = JSON.parse(JSON.stringify(this.defaultForm));
|
|
|
+ row.key = this.form.datasource.length + 1;
|
|
|
+ let parasm = idx === -1 ? row : this.form.datasource[i];
|
|
|
+
|
|
|
+ // 基础信息设置
|
|
|
+ this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
+ this.$set(parasm, 'productId', item.productId);
|
|
|
+ this.$set(parasm, 'categoryName', item.productName);
|
|
|
+ this.$set(parasm, 'productCategoryId', item.categoryLevelId);
|
|
|
+ this.$set(parasm, 'productBrand', item.productBrand);
|
|
|
+ this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
|
|
|
+ this.$set(parasm, 'productCode', item.productCode);
|
|
|
+ this.$set(parasm, 'productName', item.productName);
|
|
|
+ this.$set(parasm, 'modelType', item.categoryModel);
|
|
|
+ this.$set(parasm, 'availableCountBase', item.measureQuantity);
|
|
|
+ this.$set(parasm, 'measuringUnit', item.measuringUnit);
|
|
|
+ this.$set(parasm, 'specification', item.specification);
|
|
|
+ this.$set(parasm, 'weightUnit', item.weightUnit);
|
|
|
+ this.$set(parasm, 'singleWeight', item.weight);
|
|
|
+ this.$set(parasm, 'pricingWay', 1);
|
|
|
+ this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
|
|
|
+ this.$set(parasm, 'batchNo', item.batchNo);
|
|
|
+ this.$set(parasm, 'imgCode', '');
|
|
|
+ this.$set(parasm, 'produceType', item.componentAttribute);
|
|
|
+
|
|
|
+ // 异步获取商品数据(核心修复:await 正确使用)
|
|
|
+ const goodsData = await getGoodsByCategoryId(item.productId);
|
|
|
+ const validGoods = goodsData.filter((g) => g.approvalStatus === 2);
|
|
|
+
|
|
|
+ if (validGoods.length) {
|
|
|
+ const goodsPrice = validGoods[0].goodsPriceList[0];
|
|
|
+ this.$set(parasm, 'goodsId', validGoods[0].id);
|
|
|
+ this.$set(parasm, 'goodsPriceId', goodsPrice?.id);
|
|
|
+ this.$set(parasm, 'goodsPriceType', goodsPrice?.priceType);
|
|
|
+ this.$set(parasm, 'singlePrice', goodsPrice?.unitPrice || 0);
|
|
|
+ this.$set(parasm, 'notaxSinglePrice', goodsPrice?.excludeTaxPrice);
|
|
|
+ this.$set(parasm, 'taxRate', goodsPrice?.taxRate);
|
|
|
+ this.$set(parasm, 'discountSinglePrice', goodsPrice?.unitPrice);
|
|
|
+ this.$set(parasm, 'totalCount', '');
|
|
|
+ } else {
|
|
|
+ this.$set(parasm, 'singlePrice', 0);
|
|
|
+ }
|
|
|
|
|
|
- this.$set(
|
|
|
- parasm,
|
|
|
- 'packageDispositionList',
|
|
|
- item.packageDispositionList
|
|
|
- );
|
|
|
- if (item.packageDispositionList?.length) {
|
|
|
+ // 机型/颜色处理
|
|
|
+ if (item.modelKey) {
|
|
|
+ this.$set(parasm, 'modelKey', item.modelKey.split(','));
|
|
|
+ }
|
|
|
+ if (item.colorKey) {
|
|
|
+ this.$set(parasm, 'colorKey', item.colorKey.split(','));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 供应商信息
|
|
|
+ if (this.isSupplier) {
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'entrustedEnterpriseIdList',
|
|
|
+ item.entrustedEnterpriseIdList
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'entrustedEnterpriseId',
|
|
|
+ item.entrustedEnterpriseId
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 包装规格
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
- this.countObj.unitIdKey,
|
|
|
- item.packageDispositionList[0].id
|
|
|
+ 'packageDispositionList',
|
|
|
+ item.packageDispositionList
|
|
|
);
|
|
|
+ if (item.packageDispositionList?.length) {
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ this.countObj.unitIdKey,
|
|
|
+ item.packageDispositionList[0].id
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ this.countObj.unitKey,
|
|
|
+ item.packageDispositionList[0].conversionUnit
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 其他信息
|
|
|
+ this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
- this.countObj.unitKey,
|
|
|
- item.packageDispositionList[0].conversionUnit
|
|
|
+ 'packingSpecification',
|
|
|
+ item.extField.packingSpecification
|
|
|
);
|
|
|
- }
|
|
|
-
|
|
|
- this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
- if (item.purchaseOrigins?.length > 0) {
|
|
|
- item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
- }
|
|
|
- this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
-
|
|
|
- this.$set(parasm, this.countObj.countKey, 1);
|
|
|
- this.$set(parasm, 'totalCount', 1);
|
|
|
+ this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
+ if (item.purchaseOrigins?.length > 0) {
|
|
|
+ item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
+ }
|
|
|
+ this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
|
|
|
- // 初始化新增字段
|
|
|
- this.$set(parasm, 'thickNess', '');
|
|
|
- this.$set(parasm, 'squareNumber', '');
|
|
|
- this.$set(parasm, 'processingFeeBeforeTax', '');
|
|
|
- this.$set(parasm, 'packagingFeeNotTaxed', '');
|
|
|
- this.$set(parasm, 'transportationFeeWithoutTax', '');
|
|
|
+ // 数量初始化
|
|
|
+ this.$set(parasm, this.countObj.countKey, 1);
|
|
|
+ this.$set(parasm, 'totalCount', 1);
|
|
|
|
|
|
- parasm.customerExpectDeliveryDeadline = dayjs().format('YYYY-MM-DD');
|
|
|
- if (idx == -1) {
|
|
|
- this.form.datasource.push(row);
|
|
|
+ // 初始化新增字段
|
|
|
+ this.$set(parasm, 'thickNess', '');
|
|
|
+ this.$set(parasm, 'squareNumber', '');
|
|
|
+ this.$set(parasm, 'processingFeeBeforeTax', '');
|
|
|
+ this.$set(parasm, 'packagingFeeNotTaxed', '');
|
|
|
+ this.$set(parasm, 'transportationFeeWithoutTax', '');
|
|
|
+
|
|
|
+ // 交期默认值
|
|
|
+ parasm.customerExpectDeliveryDeadline = dayjs().format('YYYY-MM-DD');
|
|
|
+
|
|
|
+ // 新增行则推入数据源
|
|
|
+ if (idx === -1) {
|
|
|
+ this.form.datasource.push(row);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`处理第${loopIndex + 1}个库存项失败:`, error);
|
|
|
+ this.$message.error(
|
|
|
+ `加载库存信息失败: ${error.message || '未知错误'}`
|
|
|
+ );
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
},
|
|
|
remove(index) {
|
|
|
this.form.datasource.splice(index, 1);
|