Browse Source

解决售后服务bug和优化,账单管理优化和新需求默认价格功能

hezhanp 11 months ago
parent
commit
4950310541

+ 260 - 209
src/BIZComponents/inventoryTable.vue

@@ -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);

+ 18 - 0
src/api/goodsManage/index.js

@@ -103,3 +103,21 @@ export async function getGoodsByCategoryId(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//查询默认价
+export async function getNewsGoodsByCategoryId(id) {
+  const res = await request.get(`/eom/goods/getNewsGoodsByCategoryId/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//批量更新价格
+
+export async function updateProductsPrice(data) {
+  const res = await request.post('/eom/quote/updateProductsPrice', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 1
src/api/saleManage/quotation.js

@@ -149,4 +149,12 @@ export async function queryLastContractProductList (type) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+//批量更新未提交状态报价单产品清单价格
+export async function updateProductPrice(data) {
+  const res = await request.post(`/eom/quote/updateProductPrice`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 0
src/api/saleManage/saleorder.js

@@ -191,3 +191,12 @@ export async function updateOrderInfo(data) {
   return Promise.reject(new Error(res.data.message));
   
 }
+
+//选择物品获取价格
+export async function getProductPrice(id) {
+  const res = await request.get(`/eom/purchaseorder/queryNewPriceByCode/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 266 - 275
src/views/commodityManagement/commodityPriceList/components/addDialog.vue

@@ -77,8 +77,7 @@
                 :key="item.value"
                 :label="item.label"
                 :value="item.value"
-              >
-              </el-option>
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -163,15 +162,6 @@
             ></el-input>
           </el-form-item>
         </el-col>
-        <!-- <el-col :span="8">
-          <el-form-item label="包装规格:">
-            <el-input
-              disabled="true"
-              v-model="form.packingSpecification"
-              maxlength="50"
-            ></el-input>
-          </el-form-item>
-        </el-col> -->
         <el-col :span="8">
           <el-form-item label="仓库名称:">
             <el-select
@@ -185,8 +175,7 @@
                 :key="item.warehouseId"
                 :label="item.warehouseName"
                 :value="item.warehouseId"
-              >
-              </el-option>
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -226,7 +215,13 @@
       ></BIZproductList>
     </el-form>
     <headerTitle title="价格" v-show="activeComp == 'main'"></headerTitle>
-    <ProductTable ref="inventoryTable" :type="type" v-show="activeComp == 'main'" />
+    <ProductTable
+      ref="inventoryTable"
+      :type="type"
+      :default-price="defaultPrice"
+      :category-name="form.categoryLevelName"
+      v-show="activeComp == 'main'"
+    />
     <template slot="footer">
       <el-button type="primary" @click="save" v-if="type != 'view'"
         >保存</el-button
@@ -241,288 +236,284 @@
   </ele-modal>
 </template>
 <script>
-  const formDef = {
-    id: '', //商品id
-    categoryLevelId: '', //商品分类
-    goodsName: '', //商品名称
-    goodsCode: '', //商品编码
-    imagesPaths: '', //商品图片
-    imagesFileIds: '', //商品图片id
-    categoryId: '', //物品id
-    productName: '', //物品名称
-    productCategoryName: '', //物品类型
-    productCode: '', //物品编码
-    produceType: '', //属性类型
-    warehouseId: '', //仓库名称
-    warehouseNum: '', //库存
-    packingSpecification: '', //包装规格
-    measuringUnit: '', //计量单位
-    weightUnit: '', //重量单位
-    warehouseList: [], //仓库
-    level: '2',
-    children: [] //价格数组
-  };
-  import BIZproductList from '@/BIZComponents/product-list.vue';
-  import SelectTree from './selectTree.vue';
-  import modalTitle from '@/BIZComponents/modalTitle.vue';
-  import dictMixins from '@/mixins/dictMixins';
-  import ProductTable from './productTable.vue';
-  import { saveGoods } from '@/api/goodsManage/index';
-  import { getTreeByPid, getPcTreeByPids } from '@/api/classifyManage';
-  import { getByCode } from '@/api/system/dictionary-data';
-  import { copyObj } from '@/utils/util';
-  import {
-    getWarehouseOutStock,
-    getIdWarehouseList
-  } from '@/api/saleManage/saleorder';
-  import { lbjtList } from '@/enum/dict.js';
-  import { getCode } from '@/api/login/index';
-  import ImgUpload from './imgUpload.vue';
-  import { getGoodsById, updateGoods } from '@/api/goodsManage/index';
-  import { levelList } from '@/enum/dict.js';
-  import bpmDetail from '@/views/bpm/processInstance/detail.vue';
+const formDef = {
+  id: '', //商品id
+  categoryLevelId: '', //商品分类ID
+  categoryLevelName: '', // 商品分类名称(新增)
+  goodsName: '', //商品名称
+  goodsCode: '', //商品编码
+  imagesPaths: '', //商品图片
+  imagesFileIds: '', //商品图片id
+  categoryId: '', //物品id
+  productName: '', //物品名称
+  productCategoryName: '', //物品类型
+  productCode: '', //物品编码
+  produceType: '', //属性类型
+  warehouseId: '', //仓库名称
+  warehouseNum: '', //库存
+  packingSpecification: '', //包装规格
+  measuringUnit: '', //计量单位
+  weightUnit: '', //重量单位
+  warehouseList: [], //仓库
+  level: '2',
+  children: [] //价格数组
+};
+import BIZproductList from '@/BIZComponents/product-list.vue';
+import SelectTree from './selectTree.vue';
+import modalTitle from '@/BIZComponents/modalTitle.vue';
+import dictMixins from '@/mixins/dictMixins';
+import ProductTable from './productTable.vue';
+import { saveGoods } from '@/api/goodsManage/index';
+import { getTreeByPid, getPcTreeByPids } from '@/api/classifyManage';
+import { getByCode } from '@/api/system/dictionary-data';
+import { copyObj } from '@/utils/util';
+import {
+  getWarehouseOutStock,
+  getIdWarehouseList,
+  getProductPrice
+} from '@/api/saleManage/saleorder';
+import { lbjtList } from '@/enum/dict.js';
+import { getCode } from '@/api/login/index';
+import ImgUpload from './imgUpload.vue';
+import { getGoodsById, updateGoods } from '@/api/goodsManage/index';
+import { levelList } from '@/enum/dict.js';
+import bpmDetail from '@/views/bpm/processInstance/detail.vue';
 
-  export default {
-    components: {
-      ProductTable,
-      modalTitle,
-      SelectTree,
-      BIZproductList,
-      ImgUpload,bpmDetail
-    },
-    mixins: [dictMixins],
-    data() {
-      return {
-        activeComp: 'main',
-        tabOptions: [
-          { key: 'main', name: '详情' },
-          { key: 'bpm', name: '流程详情' }
+export default {
+  components: {
+    ProductTable,
+    modalTitle,
+    SelectTree,
+    BIZproductList,
+    ImgUpload,
+    bpmDetail
+  },
+  mixins: [dictMixins],
+  data() {
+    return {
+      activeComp: 'main',
+      tabOptions: [
+        { key: 'main', name: '详情' },
+        { key: 'bpm', name: '流程详情' }
+      ],
+      imgs: [],
+      title: '',
+      visible: false,
+      type: '',
+      fullscreen: false,
+      form: copyObj(formDef),
+      loading: false,
+      isUpdate: false,
+      gList: [], //商品分类
+      levelList,
+      rules: {
+        categoryLevelId: [
+          { required: true, message: '请选择商品分类', trigger: 'change' }
+        ],
+        goodsName: [
+          { required: true, message: '请输入商品名称', trigger: 'blur' }
         ],
-        imgs: [],
-        title: '',
-        visible: false,
-        type: '',
-        fullscreen: false,
-        form: copyObj(formDef),
-        // 提交状态
-        loading: false,
-        // 是否是修改
-        isUpdate: false,
-        gList: [], //商品分类
-        levelList,
-        rules: {
-          categoryLevelId: [
-            { required: true, message: '请选择商品分类', trigger: 'change' }
-          ],
-          goodsName: [
-            { required: true, message: '请输入商品名称', trigger: 'blur' }
-          ],
-          goodsCode: [
-            { required: true, message: '请输入商品编码', trigger: 'blur' }
-          ],
-          // level: [
-          //   { required: true, message: '请选择商品级别', trigger: 'blur' }
-          // ]
+        goodsCode: [
+          { required: true, message: '请输入商品编码', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  // 核心:监听商品分类ID变化,实时更新分类名称
+  watch: {
+    'form.categoryLevelId': {
+      immediate: true, // 初始化时立即执行
+      deep: true,
+      handler(newVal) {
+        if (!newVal) {
+          this.form.categoryLevelName = '';
+          return;
         }
-      };
+        // 从分类列表中查找对应名称
+        this.form.categoryLevelName = this.findCategoryName(this.gList, newVal);
+      }
+    }
+  },
+  created() {
+    this.getTreeData();
+  },
+  methods: {
+    // 递归查找分类名称(确保能从树形结构中找到对应ID的名称)
+    findCategoryName(tree, targetId) {
+      for (const node of tree) {
+        if (node.id === targetId) {
+          return node.name;
+        }
+        if (node.children && node.children.length) {
+          const childName = this.findCategoryName(node.children, targetId);
+          if (childName) return childName;
+        }
+      }
+      return '';
     },
 
-    created() {
-      this.getTreeData();
+    // 打开弹出框
+    async open(type, row, contactCategoryId) {
+      this.form.categoryLevelId = contactCategoryId;
+      this.title = type === 'add' ? '新增' : type === 'view' ? '详情' : '修改';
+      this.type = type;
+      this.visible = true;
+      this.isUpdate = type !== 'add';
+      if (type !== 'add') {
+        this.getGoodsById(row.id);
+      }
     },
-    methods: {
-      //打开弹出框
-      async open(type, row, contactCategoryId) {
-        // this.$refs.inventoryTable.resetTable()
-        this.form.categoryLevelId = contactCategoryId;
-        this.title =
-          type === 'add' ? '新增' : type === 'view' ? '详情' : '修改';
-        this.type = type;
-        this.visible = true;
-        if (type == 'add') {
-          this.isUpdate = false;
-        } else {
-          this.isUpdate = true;
-        }
-        if (type != 'add') {
-          this.getGoodsById(row.id);
-        }
-      },
 
-      //获取详情数据
-      async getGoodsById(id) {
-        let res = await getGoodsById(id);
-        if (res.imagesPaths) {
-          res.imagesPaths.split(',').map((item, index) => {
-            this.imgs.push({
-              id: res.imagesFileIds.split(',')[index],
-              url:
-                window.location.origin +
-                '/api/main/file/getFile?objectName=' +
-                item,
-              status: 'done'
-            });
-          });
-        }
-        console.log(this.imgs, 'this.imgs');
-        this.form = res;
-        this.$refs.imgUploadRef?.putValue(this.imgs);
-        this.$refs.inventoryTable?.putTableList(res.goodsPriceList);
-      },
+    // 获取详情数据
+    async getGoodsById(id) {
+      const res = await getGoodsById(id);
+      // 处理图片
+      if (res.imagesPaths) {
+        this.imgs = res.imagesPaths.split(',').map((item, index) => ({
+          id: res.imagesFileIds.split(',')[index],
+          url: `${window.location.origin}/api/main/file/getFile?objectName=${item}`,
+          status: 'done'
+        }));
+      }
+      // 赋值表单数据(会触发categoryLevelId的watch)
+      this.form = { ...res };
+      this.$refs.imgUploadRef?.putValue(this.imgs);
+      this.$refs.inventoryTable?.putTableList(res.goodsPriceList || []);
+    },
 
-      //查询商品分类
-      async getTreeData() {
-        const res = await getTreeByPid('1789827921908150274');
-        if (res?.code === '0') {
-          this.gList = res.data;
-        }
-      },
+    // 查询商品分类
+    async getTreeData() {
+      const res = await getTreeByPid('1789827921908150274');
+      if (res?.code === '0') {
+        this.gList = res.data;
+      }
+    },
 
-      //查询商品价格字典
-      async getByCode(code) {
-        const res = await getByCode(code);
-        if (res?.code === '0') {
-          this.goodsTypeList = res.data;
-        }
-      },
+    // 库存计算
+    async warehouseChange(e) {
+      const warehouseOutStock = await getWarehouseOutStock({
+        warehouseId: e,
+        code: this.form.productCode
+      });
+      this.form.warehouseNum = warehouseOutStock || 0;
+    },
 
-      //库存计算
-      async warehouseChange(e) {
-        const warehouseOutStock = await getWarehouseOutStock({
-          warehouseId: e,
-          code: this.form.productCode
+    // 选择物品
+    handParent() {
+      this.$refs.BIZproductListRef.open('', 1);
+    },
+
+    changeParentBiz(obj = []) {
+      this.getGoodsCode('goods_code');
+      obj.forEach(async (item) => {
+        this.form.categoryId = item.id;
+        this.form.productName = item.name;
+        this.form.goodsName = item.name;
+        this.form.productCategoryName = item.categoryLevelPath;
+        this.form.packingSpecification = item.extField?.packingSpecification;
+        this.form.productCode = item.code;
+        this.form.produceType =
+          lbjtList[item.componentAttribute]?.toString() || '';
+        this.form.warehouseId = item.warehouseId;
+        this.form.measuringUnit = item.measuringUnit;
+        this.form.weightUnit = item.weightUnit;
+        console.log(item)
+        const priceRes = await getProductPrice(item.code);
+        if (priceRes) {
+          console.log(priceRes)
+          this.defaultPrice = priceRes.singlePrice || null;
+        }
+        this.form.warehouseList = await getIdWarehouseList({
+          categoryId: item.id
         });
-        this.form.warehouseNum = warehouseOutStock || 0;
-      },
+      });
+    },
 
-      //选择物品
-      handParent() {
-        this.$refs.BIZproductListRef.open('', 1);
-      },
+    // 提交保存
+    async save() {
+      try {
+        if (!this.form.categoryId) {
+          this.$message.error('请选择物品');
+          return;
+        }
+        await this.getValidate();
 
-      changeParentBiz(obj = [], idx) {
-        this.getGoodsCode('goods_code');
-        obj.forEach(async (item, index) => {
-          this.form.categoryId = item.id;
-          this.form.productName = item.name;
-          this.$set(this.form,'goodsName', item.name);
-          this.form.productCategoryName = item.categoryLevelPath;
-          this.form.packingSpecification = item.extField?.packingSpecification;
-          this.form.productCode = item.code;
-          this.form.produceType = lbjtList[item.componentAttribute].toString();
-          this.form.warehouseId = item.warehouseId;
-          this.form.measuringUnit = item.measuringUnit;
-          this.form.weightUnit = item.weightUnit;
-          this.form.warehouseList = await getIdWarehouseList({
-            categoryId: item.id
-          });
-        });
-      },
+        const commitData = this.$refs?.inventoryTable?.getTableValue();
+        if (!commitData || commitData.length < 1) {
+          this.$message.error('请添加价格信息');
+          return;
+        }
 
-      //提交
-      async save() {
-        //  console.log(this.form.imagesPaths)
-        //   return
-        try {
-          if (this.form.categoryId === '' && this.$message.error('请选择物品'))
-            return;
-          await this.getValidate();
-          // 表单验证通过,执行保存操作
-          let commitData = this.$refs?.inventoryTable?.getTableValue() || [];
-          if (commitData.length < 1) {
-            return;
-          }
+        const comitDatasource = {
+          categoryId: this.form.categoryId,
+          categoryLevelId: this.form.categoryLevelId,
+          goodsCode: this.form.goodsCode,
+          goodsName: this.form.goodsName,
+          imagesFileIds: this.imgs?.map((item) => item.id).toString(),
+          level: this.form.level,
+          packingSpecification: this.form.packingSpecification,
+          priceList: commitData
+        };
 
-          let comitDatasource = {};
-          const {
-            categoryLevelId,
-            goodsName,
-            goodsCode,
-            categoryId,
-            id,
-            level,
-            packingSpecification
-          } = this.form;
-          comitDatasource['categoryId'] = categoryId;
-          comitDatasource['categoryLevelId'] = categoryLevelId;
-          comitDatasource['goodsCode'] = goodsCode;
-          comitDatasource['goodsName'] = goodsName;
-          comitDatasource['imagesFileIds'] = this.imgs
-            ?.map((item) => item.id)
-            .toString();
+        this.loading = true;
+        const res = this.isUpdate
+          ? await updateGoods({ ...comitDatasource, id: this.form.id })
+          : await saveGoods(comitDatasource);
 
-          comitDatasource['level'] = level;
-          comitDatasource['packingSpecification'] = packingSpecification;
-          comitDatasource['priceList'] = commitData;
-          // console.log('comitDatasource', comitDatasource);
-          this.loading = true;
-          var res = {};
-          if (!this.isUpdate) {
-            res = await saveGoods(comitDatasource);
-          } else {
-            comitDatasource['id'] = id;
-            res = await updateGoods(comitDatasource);
-          }
-          if (res?.code === '0') {
-            this.$message.success('操作成功');
-            this.cancel();
-            this.$emit('done');
-          }
-        } catch (error) {
-          this.loading = false;
+        if (res?.code === '0') {
+          this.$message.success('操作成功');
+          this.cancel();
+          this.$emit('done');
         }
-      },
+      } catch (error) {
+        this.$message.error('操作失败');
+      } finally {
+        this.loading = false;
+      }
+    },
 
-      //查询商品编码
-      async getGoodsCode(code) {
-        this.form.goodsCode = await getCode(code);
-      },
+    // 获取商品编码
+    async getGoodsCode(code) {
+      this.form.goodsCode = await getCode(code);
+    },
 
-      cancel() {
-        this.$nextTick(() => {
-          this.$refs.inventoryTable?.putTableList([]);
-          this.$refs.imgUploadRef?.putValue();
-          this.imgs = [];
-          // 重置表单验证状态
-          // 关闭后,销毁所有的表单数据
-          (this.form = copyObj(formDef)), (this.visible = false);
-        });
-      },
+    // 取消
+    cancel() {
+      this.$nextTick(() => {
+        this.$refs.inventoryTable?.putTableList([]);
+        this.$refs.imgUploadRef?.putValue();
+        this.imgs = [];
+        this.form = copyObj(formDef);
+        this.visible = false;
+      });
+    },
 
-      getValidate() {
-        //开始表单校验
-        return Promise.all([
-          new Promise((resolve, reject) => {
-            this.$refs.form.validate((valid) => {
-              if (!valid) {
-                reject(false);
-              } else {
-                resolve(true);
-              }
-            });
-          }),
-          new Promise((resolve, reject) => {
-            this.$refs.inventoryTable.validateForm((valid) => {
-              if (!valid) {
-                reject(false);
-              } else {
-                resolve(true);
-              }
-            });
-          })
-        ]);
-      }
+    // 表单校验
+    getValidate() {
+      return Promise.all([
+        new Promise((resolve, reject) => {
+          this.$refs.form.validate((valid) =>
+            valid ? resolve(true) : reject(false)
+          );
+        }),
+        new Promise((resolve, reject) => {
+          this.$refs.inventoryTable.validateForm((valid) =>
+            valid ? resolve(true) : reject(false)
+          );
+        })
+      ]);
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  .el-form-item {
-    margin-bottom: 20px !important;
-  }
+.el-form-item {
+  margin-bottom: 20px !important;
+}
 
-  .el-form-item__error {
-    display: block !important;
-    color: red;
-    padding-top: 4px;
-  }
-</style>
+.el-form-item__error {
+  display: block !important;
+  color: red;
+  padding-top: 4px;
+}
+</style>

+ 211 - 203
src/views/commodityManagement/commodityPriceList/components/productTable.vue

@@ -23,7 +23,7 @@
           </el-button>
         </div>
       </template>
-      <template v-slot:unitPrice="scope"  v-if="type != 'view'">
+      <template v-slot:unitPrice="scope" v-if="type != 'view'">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.unitPrice'"
@@ -31,7 +31,6 @@
             required: true,
             message: '请输入正确的单价',
             trigger: 'change'
-            
           }"
         >
           <el-input
@@ -44,7 +43,7 @@
           </el-input>
         </el-form-item>
       </template>
-      <template v-slot:taxRate="scope"  v-if="type != 'view'">
+      <template v-slot:taxRate="scope" v-if="type != 'view'">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.taxRate'"
@@ -65,7 +64,7 @@
           :prop="'datasource.' + scope.$index + '.priceType'"
           :rules="{
             required: true,
-            message: '请输入选择价格类型',
+            message: '请选择价格类型',
             trigger: 'change'
           }"
         >
@@ -73,10 +72,9 @@
             dictName="商品价格类型"
             clearable
             v-model="scope.row.priceType"
-            :listFormatte="listFormatte"
-            :disabled="type=='view'"
-          >
-          </DictSelection>
+            :listFormatte="(data) => listFormatte(data, scope.row.priceType)"
+            :disabled="type == 'view'"
+          />
         </el-form-item>
       </template>
 
@@ -92,8 +90,18 @@
       <template v-slot:headerExcludeTaxPrice="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
-      <!-- 操作列 -->
+
       <template v-slot:action="scope" v-if="type != 'view'">
+        <el-link
+          :underline="false"
+          type="primary"
+          @click="setDefault(scope.row)"
+          :disabled="!scope.row.priceType || !scope.row.unitPrice"
+          v-if="!scope.row.isDefault"
+        >
+          设为默认价
+        </el-link>
+
         <el-popconfirm
           class="ele-action"
           title="确定要删除吗?"
@@ -116,219 +124,219 @@
   </el-form>
 </template>
 <script>
-  import dictMixins from '@/mixins/dictMixins';
+import dictMixins from '@/mixins/dictMixins';
+import { getCode } from '@/api/login/index';
 
-  import { getCode } from '@/api/login/index';
-
-  export default {
-    components: {},
-    mixins: [dictMixins],
-    props: { groupId: String, type: String },
-    data() {
-      return {
-        title: '',
-        visible: false,
-        form: {
-          datasource: []
+export default {
+  components: {},
+  mixins: [dictMixins],
+  props: {
+    groupId: String,
+    type: String,
+    categoryName: String, // 接收主组件传递的分类名称
+    defaultPrice: {
+      type: Number,
+      default: null
+    }
+  },
+  data() {
+    return {
+      form: {
+        datasource: []
+      },
+      loading: false,
+      goodsCode: ''
+    };
+  },
+  watch: {
+    categoryName: {
+      immediate: true,
+      handler() {
+        this.$forceUpdate();
+      }
+    }
+  },
+  computed: {
+    columns() {
+      return [
+        {
+          width: 80,
+          type: 'index',
+          columnKey: 'index',
+          align: 'center',
+          fixed: 'left',
+          label: '序号'
+        },
+        {
+          width: 200,
+          prop: 'priceType',
+          label: '价格类型',
+          slot: 'priceType',
+          headerSlot: 'headerPriceType',
+          align: 'center'
+        },
+        {
+          width: 200,
+          prop: 'unitPrice',
+          headerSlot: 'headerUnitPrice',
+          label: '含税单价',
+          slot: 'unitPrice',
+          align: 'center'
         },
-        // 提交状态
-        loading: false,
-        goodsCode: '' //商品编码
-      };
+        {
+          width: 200,
+          prop: 'taxRate',
+          slot: 'taxRate',
+          label: '税率',
+          align: 'center'
+        },
+        {
+          width: 200,
+          prop: 'excludeTaxPrice',
+          label: '不含税单价',
+          slot: 'excludeTaxPrice',
+          align: 'center'
+        },
+        {
+          width: 300,
+          columnKey: 'action',
+          label: '操作',
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ];
+    }
+  },
+  methods: {
+    changeCount(row, index) {
+      if (row.unitPrice == null) return;
+      const excludeTaxPrice = (
+        Number(row.unitPrice) /
+        (1 + (Number(row.taxRate) || 0) / 100)
+      ).toFixed(2);
+      this.form.datasource[index].excludeTaxPrice = excludeTaxPrice || 0;
     },
-    created() {},
 
-    computed: {
-      columns() {
-        return [
-          {
-            width: 80,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left',
-            label: '序号'
-          },
-          {
-            width: 200,
-            prop: 'priceType',
-            label: '价格类型',
-            slot: 'priceType',
-            headerSlot: 'headerPriceType',
-            align: 'center'
-          },
-          {
-            width: 200,
-            prop: 'unitPrice',
-            headerSlot: 'headerUnitPrice',
-            label: '含税单价',
-            slot: 'unitPrice',
-            align: 'center'
-          },
-          {
-            width: 200,
-            prop: 'taxRate',
-            slot: 'taxRate',
-            label: '税率',
-            align: 'center'
-          },
-          {
-            width: 200,
-            prop: 'excludeTaxPrice',
-            label: '不含税单价',
-            slot: 'excludeTaxPrice',
-            align: 'center'
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ];
+    getTableValue() {
+      const dList = this.form.datasource;
+      if (dList.length === 0) {
+        this.$message.error('请新增价格信息!');
+        return null;
+      }
+      const priceTypes = dList.map((item) => item.priceType);
+      if (new Set(priceTypes).size !== priceTypes.length) {
+        this.$message.error('价格类型不能重复!');
+        return null;
       }
+      return dList.map((item) => ({
+        ...item,
+        excludeTaxPrice: +item.excludeTaxPrice,
+        isDefault: item.isDefault || 0
+      }));
     },
 
-    methods: {
-      //改变单价或税率计算不含税单价
-      changeCount(row, index) {
-        if (row.unitPrice == null) return;
-        let excludeTaxPrice = (
-          Number(row.unitPrice) /
-          (1 + (Number(row.taxRate) || 0) / 100)
-        ).toFixed(2);
-        this.form.datasource[index].excludeTaxPrice = excludeTaxPrice || 0;
-      },
-      // 返回列表数据
-      getTableValue() {
-        let dList = this.form.datasource;
-        if (dList.length === 0) {
-          this.$message.error('请新增价格信息!');
-          return;
-        }
-        const priceTypes = dList.map((item) => item.priceType);
-        const uniquePriceTypes = new Set(priceTypes);
-        if (uniquePriceTypes.size !== priceTypes.length) {
-          this.$message.error('价格类型不能重复!');
-          return;
-        }
-        let priceList = dList.map((item) => {
-          item['excludeTaxPrice'] = +item.excludeTaxPrice;
+    putTableList(data) {
+      this.form.datasource = (data || []).map((item) => ({
+        ...item,
+        isDefault: item.isDefault ?? 0
+      }));
+    },
 
-          return item;
-        });
-        return priceList;
-      },
+    listFormatte(data, currentValue) {
+      const usedTypes = this.form.datasource
+        .map((item) => item.priceType)
+        .filter((type) => type !== currentValue);
+      let filtered = data.filter((item) => !usedTypes.includes(item.dictCode));
 
-      //修改回显
-      putTableList(data) {
-        // let list =
-        //   data.map((i) => {
-        //     return { taxRate: i.taxRate * 100, ...i };
-        //   }) || [];
-        this.form.datasource = data || [];
-      },
-      listFormatte(data, value) {
-        let dictCodeS = this.form.datasource
-          .map((item) => item.priceType)
-          .filter((item) => item != value);
-        return data.filter((item) => !dictCodeS.includes(item.dictCode));
-      },
+      const isMaterialTable = this.categoryName?.trim() === '物料表';
+      if (isMaterialTable) {
+        filtered = filtered.filter((item) => item.dictCode === '5');
+      } else {
+        filtered = filtered.filter((item) => item.dictCode !== '5');
+      }
 
-      remove(i) {
-        this.form.datasource.splice(i, 1);
-        this.setSort();
-      },
-      // 清空表格
-      restTable() {
-        debugger;
-        this.form.datasource = [];
-      },
-      // 重新排序
-      setSort() {
-        this.form.datasource.forEach((n, index) => {
-          n.key = index + 1;
-        });
-      },
-      //选择产品
-      handParent() {
-        let row = {};
-        this.$set(row, 'unitPrice', '');
-        this.$set(row, 'taxRate', '');
-        this.$set(row, 'priceType', '');
-        row.key = this.form.datasource.length + 1;
-        this.form.datasource.push(row);
-      },
+      if (
+        currentValue &&
+        !filtered.some((item) => item.dictCode === currentValue)
+      ) {
+        const row = this.form.datasource.find(
+          (item) => item.priceType === currentValue
+        );
+        if (row) row.priceType = '';
+      }
 
-      validateForm(callback) {
-        //开始表单校验
-        this.$refs.form.validate((valid, obj) => {
-          if (obj) {
-            let messages = Object.keys(obj).map((key) => obj[key][0]);
-            if (messages.length > 0) {
-              this.$message.warning(messages[0].message);
-            }
-          }
-          callback(valid);
-        });
-      },
+      return filtered;
+    },
 
-      //查询商品编码
-      async getGoodsCode(code) {
-        this.goodsCode = await getCode(code);
-      }
-    }
-  };
-</script>
-<style lang="scss" scoped>
-  .headbox {
-    display: flex;
-    justify-content: flex-start;
-    align-items: center;
+    remove(index) {
+      this.form.datasource.splice(index, 1);
+      this.setSort();
+    },
 
-    .amount {
-      font-size: 14px;
-      font-weight: bold;
-      padding-right: 30px;
-    }
-  }
+    restTable() {
+      this.form.datasource = [];
+    },
 
-  .time-form .el-form-item {
-    margin-bottom: 0 !important;
-  }
+    setSort() {
+      this.form.datasource.forEach((item, index) => {
+        item.key = index + 1;
+      });
+    },
 
-  ::v-deep .period {
-    display: flex;
+    handParent() {
+      this.form.datasource.push({
+        unitPrice: this.defaultPrice || '',
+        taxRate: '',
+        priceType: '',
+        key: this.form.datasource.length + 1,
+        isDefault: 0
+      });
+    },
 
-    .borderleftnone {
-      .el-input--medium .el-input__inner {
-        border-top-right-radius: 0;
-        border-bottom-right-radius: 0;
-      }
-    }
+    setDefault(row) {
+      this.form.datasource.forEach((item) => {
+        item.isDefault = 0;
+      });
+      row.isDefault = 1;
+    },
 
-    .borderrightnone {
-      .el-input--medium .el-input__inner {
-        border-top-left-radius: 0;
-        border-bottom-left-radius: 0;
-      }
+    validateForm(callback) {
+      this.$refs.form.validate((valid, obj) => {
+        if (obj) {
+          const messages = Object.keys(obj).map((key) => obj[key][0].message);
+          if (messages.length) this.$message.warning(messages[0]);
+        }
+        callback(valid);
+      });
     }
   }
+};
+</script>
+<style lang="scss" scoped>
+.headbox {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+}
 
-  ::v-deep .time-form tbody > tr:hover > td {
-    background-color: transparent !important;
-  }
+.time-form .el-form-item {
+  margin-bottom: 0 !important;
+}
 
-  ::v-deep .time-form .el-table tr {
-    background-color: #ffffff;
-  }
+::v-deep .time-form tbody > tr:hover > td {
+  background-color: transparent !important;
+}
 
-  .pricebox {
-    display: flex;
-    justify-content: flex-start;
-    align-items: center;
-    font-weight: bold;
-  }
-</style>
+::v-deep .time-form .el-table tr {
+  background-color: #ffffff;
+}
+
+// 新增默认价标识样式
+.default-tag {
+  color: #409eff;
+  margin-right: 10px;
+  font-size: 12px;
+}
+</style>

+ 330 - 305
src/views/commodityManagement/commodityPriceList/index.vue

@@ -64,6 +64,13 @@
                 @click="uploadFile"
                 >导入</el-button
               >
+              <el-button
+                type="primary"
+                size="small"
+                @click="allProductPrice"
+                :disabled="selection?.length === 0"
+                >批量更新产品清单价格</el-button
+              >
             </template>
 
             <!-- 展开列 -->
@@ -236,334 +243,352 @@
 </template>
 
 <script>
-  import HistoricalpriceDialog from './components/historicalpriceDialog.vue';
-  import EditPriceDialog from './components/editPriceDialog.vue';
-  import AssetTree from '@/components/AssetTree';
-  import PriceSearch from './components/priceSearch.vue';
-  import AddDialog from './components/addDialog.vue';
-  import tabMixins from '@/mixins/tableColumnsMixin';
-  import { getList, del, offOnSheft } from '@/api/goodsManage/index';
-  import dictMixins from '@/mixins/dictMixins';
-  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
-  import { reviewStatus } from '@/enum/dict';
-  import { mapGetters } from 'vuex';
-  import importDialog from '@/components/upload/import-dialog.vue';
+import HistoricalpriceDialog from './components/historicalpriceDialog.vue';
+import EditPriceDialog from './components/editPriceDialog.vue';
+import AssetTree from '@/components/AssetTree';
+import PriceSearch from './components/priceSearch.vue';
+import AddDialog from './components/addDialog.vue';
+import tabMixins from '@/mixins/tableColumnsMixin';
+import {
+  getList,
+  del,
+  offOnSheft,
+  updateProductsPrice
+} from '@/api/goodsManage/index';
+import dictMixins from '@/mixins/dictMixins';
+import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+import { reviewStatus } from '@/enum/dict';
+import { mapGetters } from 'vuex';
+import importDialog from '@/components/upload/import-dialog.vue';
 
-  export default {
-    mixins: [tabMixins, dictMixins],
-    components: {
-      AssetTree,
-      PriceSearch,
-      AddDialog,
-      EditPriceDialog,
-      HistoricalpriceDialog,
-      processSubmitDialog,importDialog
-    },
-    data() {
-      return {
-        locationUrl: window.location.origin,
-        loading: false,
-        processSubmitDialogFlag: false,
-        reviewStatus,
-        cacheKeyUrl: 'eos-01283c34-commodityManagement-commodityPriceList',
-        // 表格列配置
-        columns: [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center',
-            selectable: (row) => {
-              return row.goodsStatus == 0;
-            }
-          },
-          {
-            width: 45,
-            type: 'expand',
-            columnKey: 'expand',
-            align: 'center',
-            slot: 'expand'
-          },
-          {
-            columnKey: 'index',
-            type: 'index',
-            width: 50,
-            align: 'center',
-            showOverflowTooltip: true,
-            label: '序号'
-          },
-          {
-            prop: 'goodsCode',
-            label: '商品编码',
-            align: 'center',
-            showOverflowTooltip: true,
-            sortable: true,
-            width: 180
-          },
-          {
-            prop: 'imagesPaths',
-            label: '商品图片',
-            align: 'center',
-            slot: 'imagesPaths',
-            width: 180
-          },
-          {
-            prop: 'goodsName',
-            label: '商品名称',
-            align: 'center',
-            slot: 'goodsName',
-            showOverflowTooltip: true,
-            minWidth: 180
-          },
-          {
-            prop: 'categoryLevelName',
-            label: '商品分类',
-            align: 'center',
-            showOverflowTooltip: true,
-            width: 180
-          },
-          {
-            prop: 'categoryName',
-            align: 'center',
-            label: '产品名称',
-            showOverflowTooltip: true,
-            minWidth: 180
-          },
-          // {
-          //   prop: '产品编码',
-          //   label: '产品编码',
-          //   align: 'center',
-          //   showOverflowTooltip: true
-          // },
-          // {
-          //   prop: '产品类型',
-          //   label: '产品类型',
-          //   align: 'center',
-          //   showOverflowTooltip: true
-          // },
-          // {
-          //   prop: 'priceType',
-          //   label: '价格类型',
-          //   slot: 'priceType',
-          //   align: 'center',
-          //   width: 120,
-          //   formatter: (row, column) => {
-          //     if (row.priceType) {
-          //       return this.goodsTypeList.find((item) => item[row.priceType])?.[
-          //         row.priceType
-          //       ];
-          //     }
-          //   }
-          // },
-          // {
-          //   prop: 'unitPrice',
-          //   label: '含税单价',
-          //   slot: 'unitPrice',
-          //   align: 'center'
-          // },
-          // {
-          //   prop: 'taxRate',
-          //   slot: 'taxRate',
-          //   label: '税率',
-          //   align: 'center'
-          // },
-          // {
-          //   prop: 'excludeTaxPrice',
-          //   label: '不含税单价',
-          //   slot: 'excludeTaxPrice',
-          //   align: 'center'
-          // },
-          {
-            prop: 'goodsStatus',
-            align: 'center',
-            width: 150,
-            label: '状态',
-            showOverflowTooltip: true,
-            formatter: (row, column) => {
-              return row.goodsStatus === 0
-                ? '下架'
-                : row.goodsStatus === 1
-                ? '上架'
-                : '';
-            }
-          },
-          {
-            prop: 'approvalStatus',
-            label: '审核状态',
-            align: 'center',
-            slot: 'approvalStatus',
-            showOverflowTooltip: true,
-            minWidth: 100
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            width: 180
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 250,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true,
-            fixed: 'right'
+export default {
+  mixins: [tabMixins, dictMixins],
+  components: {
+    AssetTree,
+    PriceSearch,
+    AddDialog,
+    EditPriceDialog,
+    HistoricalpriceDialog,
+    processSubmitDialog,
+    importDialog
+  },
+  data() {
+    return {
+      locationUrl: window.location.origin,
+      loading: false,
+      processSubmitDialogFlag: false,
+      reviewStatus,
+      cacheKeyUrl: 'eos-01283c34-commodityManagement-commodityPriceList',
+      // 表格列配置
+      columns: [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          selectable: (row) => {
+            return row.goodsStatus == 0;
           }
-        ],
-        selection: [],
-        curNodeData: {} //右侧菜单选择对象
-      };
-    },
-    created() {
-      this.requestDict('商品价格类型');
+        },
+        {
+          width: 45,
+          type: 'expand',
+          columnKey: 'expand',
+          align: 'center',
+          slot: 'expand'
+        },
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 50,
+          align: 'center',
+          showOverflowTooltip: true,
+          label: '序号'
+        },
+        {
+          prop: 'goodsCode',
+          label: '商品编码',
+          align: 'center',
+          showOverflowTooltip: true,
+          sortable: true,
+          width: 180
+        },
+        {
+          prop: 'imagesPaths',
+          label: '商品图片',
+          align: 'center',
+          slot: 'imagesPaths',
+          width: 180
+        },
+        {
+          prop: 'goodsName',
+          label: '商品名称',
+          align: 'center',
+          slot: 'goodsName',
+          showOverflowTooltip: true,
+          minWidth: 180
+        },
+        {
+          prop: 'categoryLevelName',
+          label: '商品分类',
+          align: 'center',
+          showOverflowTooltip: true,
+          width: 180
+        },
+        {
+          prop: 'categoryName',
+          align: 'center',
+          label: '产品名称',
+          showOverflowTooltip: true,
+          minWidth: 180
+        },
+        // {
+        //   prop: '产品编码',
+        //   label: '产品编码',
+        //   align: 'center',
+        //   showOverflowTooltip: true
+        // },
+        // {
+        //   prop: '产品类型',
+        //   label: '产品类型',
+        //   align: 'center',
+        //   showOverflowTooltip: true
+        // },
+        // {
+        //   prop: 'priceType',
+        //   label: '价格类型',
+        //   slot: 'priceType',
+        //   align: 'center',
+        //   width: 120,
+        //   formatter: (row, column) => {
+        //     if (row.priceType) {
+        //       return this.goodsTypeList.find((item) => item[row.priceType])?.[
+        //         row.priceType
+        //       ];
+        //     }
+        //   }
+        // },
+        // {
+        //   prop: 'unitPrice',
+        //   label: '含税单价',
+        //   slot: 'unitPrice',
+        //   align: 'center'
+        // },
+        // {
+        //   prop: 'taxRate',
+        //   slot: 'taxRate',
+        //   label: '税率',
+        //   align: 'center'
+        // },
+        // {
+        //   prop: 'excludeTaxPrice',
+        //   label: '不含税单价',
+        //   slot: 'excludeTaxPrice',
+        //   align: 'center'
+        // },
+        {
+          prop: 'goodsStatus',
+          align: 'center',
+          width: 150,
+          label: '状态',
+          showOverflowTooltip: true,
+          formatter: (row, column) => {
+            return row.goodsStatus === 0
+              ? '下架'
+              : row.goodsStatus === 1
+              ? '上架'
+              : '';
+          }
+        },
+        {
+          prop: 'approvalStatus',
+          label: '审核状态',
+          align: 'center',
+          slot: 'approvalStatus',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          width: 180
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 250,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true,
+          fixed: 'right'
+        }
+      ],
+      selection: [],
+      curNodeData: {} //右侧菜单选择对象
+    };
+  },
+  created() {
+    this.requestDict('商品价格类型');
+  },
+  computed: {
+    ...mapGetters(['user'])
+  },
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      return getList({
+        pageNum: page,
+        size: limit,
+        // goodsStatus:1,
+        ...where
+      });
     },
-    computed: {
-      ...mapGetters(['user'])
+    openEditGoodsInfo(row) {
+      this.openEdit('editGoodsInfo', row);
     },
-    methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
-        return getList({
-          pageNum: page,
-          size: limit,
-          // goodsStatus:1,
-          ...where
-        });
-      },
-      openEditGoodsInfo(row) {
-        this.openEdit('editGoodsInfo', row);
-      },
 
-      // handleCommand(command, row) {
-      //   if (command === 'openEditGoodsInfo') {
+    // handleCommand(command, row) {
+    //   if (command === 'openEditGoodsInfo') {
 
-      //   } else if (command === 'openHistoricalprice') {
-      //     this.openEditPrice(row);
-      //   } else if (command === 'del') {
-      //     this.commitBtn([row.id]);
-      //   }
-      // },
+    //   } else if (command === 'openHistoricalprice') {
+    //     this.openEditPrice(row);
+    //   } else if (command === 'del') {
+    //     this.commitBtn([row.id]);
+    //   }
+    // },
 
-      handleNodeClick(data, node) {
-        this.curNodeData = data;
-        this.reload({ categoryLevelId: data.id });
-      },
+    handleNodeClick(data, node) {
+      this.curNodeData = data;
+      this.reload({ categoryLevelId: data.id });
+    },
 
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where });
-      },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where });
+    },
 
-      //历史价格
-      openHistoricalprice(row) {
-        this.$refs.historicalpriceDialogRef.open(row);
-      },
+    //历史价格
+    openHistoricalprice(row) {
+      this.$refs.historicalpriceDialogRef.open(row);
+    },
 
-      openEdit(type, row) {
-        this.$refs.addContactDialogRef.open(type, row, this.curNodeData.id);
-        this.$refs.addContactDialogRef.$refs.form &&
-          this.$refs.addContactDialogRef.$refs.form.clearValidate();
-      },
+    openEdit(type, row) {
+      this.$refs.addContactDialogRef.open(type, row, this.curNodeData.id);
+      this.$refs.addContactDialogRef.$refs.form &&
+        this.$refs.addContactDialogRef.$refs.form.clearValidate();
+    },
 
-      openEditPrice(row) {
-        this.$refs.editPriceDialogRef.open(row);
-        this.$refs.editPriceDialogRef.$refs.form &&
-          this.$refs.editPriceDialogRef.$refs.form.clearValidate();
-      },
+    openEditPrice(row) {
+      this.$refs.editPriceDialogRef.open(row);
+      this.$refs.editPriceDialogRef.$refs.form &&
+        this.$refs.editPriceDialogRef.$refs.form.clearValidate();
+    },
 
-      async submit(res) {
-        this.processSubmitDialogFlag = true;
-        this.$nextTick(() => {
-          let params = {
-            businessId: res.id,
-            businessKey: 'goods_manage_priceOffOnSheft_on',
-            formCreateUserId: this.user.info.userId,
-            variables: {
-              businessCode: res.goodsCode,
-              businessName: res.goodsName,
-              businessType: res.categoryLevelName
-            }
-          };
-          this.$refs.processSubmitDialogRef.init(params);
-        });
-      },
-      uploadFile() {
-        this.$refs.importDialogRef.open();
-      },
-      //上架下架操作
-      editGoodsStatus(row) {
-        const data = {
-          shelf_type: row.goodsStatus === 1 ? 'off' : 'on',
-          goods_id: [row.id]
+    async submit(res) {
+      this.processSubmitDialogFlag = true;
+      this.$nextTick(() => {
+        let params = {
+          businessId: res.id,
+          businessKey: 'goods_manage_priceOffOnSheft_on',
+          formCreateUserId: this.user.info.userId,
+          variables: {
+            businessCode: res.goodsCode,
+            businessName: res.goodsName,
+            businessType: res.categoryLevelName
+          }
         };
-        offOnSheft(data)
-          .then((res) => {
-            this.$message.success('操作成功!');
-            this.reload();
-          })
-          .catch((error) => {});
-      },
+        this.$refs.processSubmitDialogRef.init(params);
+      });
+    },
+    uploadFile() {
+      this.$refs.importDialogRef.open();
+    },
+    async allProductPrice() {
+      if (this.selection.length === 0) {
+        this.$message.warning('请先选择需要批量更新的商品');
+        return;
+      }
+      try {
+        const ids = this.selection.map((item) => item.id);
+        const result = await updateProductsPrice({ ids });
+        this.$message.success('批量更新产品清单价格成功');
+        this.reload(); // 刷新表格数据
+      } catch (error) {
+        this.$message.error(`批量更新失败:${error.message || '未知错误'}`);
+      }
+    },
+    //上架下架操作
+    editGoodsStatus(row) {
+      const data = {
+        shelf_type: row.goodsStatus === 1 ? 'off' : 'on',
+        goods_id: [row.id]
+      };
+      offOnSheft(data)
+        .then((res) => {
+          this.$message.success('操作成功!');
+          this.reload();
+        })
+        .catch((error) => {});
+    },
 
-      //批量删除
-      allDelBtn() {
-        if (this.selection.length === 0) return;
-        let flag = this.selection.some((item) =>
-          [1].includes(item.goodsStatus)
-        );
-        if (flag)
-          return this.$message.warning('抱歉已上架中的数据不能删除,请检查');
-        this.commitBtn();
-      },
+    //批量删除
+    allDelBtn() {
+      if (this.selection.length === 0) return;
+      let flag = this.selection.some((item) => [1].includes(item.goodsStatus));
+      if (flag)
+        return this.$message.warning('抱歉已上架中的数据不能删除,请检查');
+      this.commitBtn();
+    },
 
-      commitBtn(id) {
-        const dataId = id || this.selection.map((v) => v.id);
-        del(dataId)
-          .then((res) => {
-            this.$message.success('删除成功!');
-            this.reload();
-          })
-          .catch((error) => {});
-      }
+    commitBtn(id) {
+      const dataId = id || this.selection.map((v) => v.id);
+      del(dataId)
+        .then((res) => {
+          this.$message.success('删除成功!');
+          this.reload();
+        })
+        .catch((error) => {});
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  :deep(.el-link--inner) {
-    margin-left: 0px !important;
-  }
+:deep(.el-link--inner) {
+  margin-left: 0px !important;
+}
 
-  .sys-organization-list {
-    height: calc(100vh - 225px);
-    box-sizing: border-box;
-    border-width: 1px;
-    border-style: solid;
-    overflow: auto;
-  }
+.sys-organization-list {
+  height: calc(100vh - 225px);
+  box-sizing: border-box;
+  border-width: 1px;
+  border-style: solid;
+  overflow: auto;
+}
 
-  .sys-organization-list :deep(.el-tree-node__content) {
-    height: 40px;
+.sys-organization-list :deep(.el-tree-node__content) {
+  height: 40px;
 
-    & > .el-tree-node__expand-icon {
-      margin-left: 10px;
-    }
+  & > .el-tree-node__expand-icon {
+    margin-left: 10px;
   }
+}
 
-  .el-dropdown-link {
-    cursor: pointer;
-    color: var(--color-primary-5);
-  }
+.el-dropdown-link {
+  cursor: pointer;
+  color: var(--color-primary-5);
+}
 
-  .el-icon-arrow-down {
-    font-size: 12px;
-  }
+.el-icon-arrow-down {
+  font-size: 12px;
+}
 
-  .price-info {
-    border-bottom: 1px solid #ebeef5;
-    padding-bottom: 10px;
-    display: flex;
-    align-items: center;
-  }
+.price-info {
+  border-bottom: 1px solid #ebeef5;
+  padding-bottom: 10px;
+  display: flex;
+  align-items: center;
+}
 </style>

+ 2 - 1
src/views/saleManage/contact/components/darwerComponents/applyList.vue

@@ -7,7 +7,8 @@
     :need-page="false"
   >
     <template v-slot:approvalStatus="{ row }">
-      <el-link type="primary" :underline="false" @click="openDetail(row)">
+      <el-link type="primary" :underline="false" @click="openDetail(row)" 
+        :disabled="reviewStatus[row.approvalStatus] === '未提交'">
         {{ reviewStatus[row.approvalStatus] }}
       </el-link>
     </template>

+ 41 - 2
src/views/saleManage/quotation/index.vue

@@ -47,6 +47,22 @@
               @click="uploadFile"
               >导入</el-button
             >
+            <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-download"
+              @click="exportRowInfo()"
+              :disabled="selection?.length === 0"
+              >导出</el-button
+            >
+
+            <el-button
+              type="primary"
+              size="small"
+              @click="updatePrice()"
+              :disabled="!canBatchUpdatePrice"
+              >批量更新价格</el-button
+            >
           </template>
 
           <!-- 查看详情列 -->
@@ -183,7 +199,9 @@ import {
   getDetail,
   deleteInformation,
   submit,
-  quoteUpdateStatus
+  quoteUpdateStatus,
+  getExport,
+  updateProductPrice
 } from '@/api/saleManage/quotation';
 
 import dictMixins from '@/mixins/dictMixins';
@@ -388,11 +406,18 @@ export default {
       cacheKeyUrl: 'eos-5569a1b1-saleManage-quotation'
     };
   },
-  computed: {},
   created() {
     this.requestDict('客户状态');
     this.getTreeData();
   },
+  computed: {
+    canBatchUpdatePrice() {
+      if (this.selection?.length === 0) {
+        return false; // 没有选中项,禁用
+      }
+      return this.selection.every((row) => [0, 3].includes(row.status));
+    }
+  },
   methods: {
     quoteUpdateStatus,
     /* 表格数据源 */
@@ -409,6 +434,20 @@ export default {
         ...where
       });
     },
+    //导出
+    exportRowInfo() {
+      const ids = this.selection.map((row) => row.id);
+      if (ids.length === 0) {
+        this.$message.warning('请先选择需要导出的数据');
+        return;
+      }
+      getExport(ids);
+    },
+    updatePrice(){
+      
+      const ids = this.selection.map((row) => row.id);
+      updateProductPrice(ids)
+    },
     //获取合同分类
     async getTreeData() {
       try {

+ 8 - 6
src/views/salesServiceManagement/accessory/index.vue

@@ -47,13 +47,13 @@
             @click="returnAdd(row)"
             >归还入库</el-link
           >
-          <!-- <el-link
+          <el-link
             type="primary"
             v-if="row.source == 0"
             :underline="false"
             @click="openProcess(row)"
             >发起流程</el-link
-          > -->
+          >
           <el-popconfirm
             v-if="
               row.source == 0 && $hasPermission('eom:sparepartsapply:delete')
@@ -71,13 +71,13 @@
         </template>
       </ele-pro-table>
     </el-card>
-    <!-- <process-submit-dialog
+    <process-submit-dialog
       :isNotNeedProcess="false"
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
       v-if="processSubmitDialogFlag"
       ref="processSubmitDialogRef"
       @reload="reload"
-    ></process-submit-dialog> -->
+    ></process-submit-dialog>
     <!-- 新建或编辑弹窗 -->
     <accessoryDialog ref="accessoryDialog" @refresh="reload" />
     <returnAddDiaLog ref="returnAddDiaLogRef" @refresh="reload"></returnAddDiaLog>
@@ -89,6 +89,8 @@
   import accessoryDialog from './components/accessoryDialog.vue';
   import returnAddDiaLog from '@/views/salesServiceManagement/return/component/recycleDialog.vue';
 
+  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+
   import {
     accessoryPage,
     accessoryDelete
@@ -100,8 +102,8 @@
     components: {
       search,
       accessoryDialog,
-      returnAddDiaLog
-      // processSubmitDialog
+      returnAddDiaLog,
+      processSubmitDialog
     },
     data() {
       return {

+ 8 - 1
src/views/salesServiceManagement/components/info.vue

@@ -3,7 +3,7 @@
     ref="form"
     :model="form"
     :rules="rules"
-    label-width="100px"
+    label-width="130px"
     class="create-form"
   >
     <headerTitle
@@ -1537,6 +1537,9 @@ export default {
       if (node && node.id) {
         this.form.involveDeptId = node.id;
         this.form.involveDeptName = node.name;
+        this.$nextTick(() => {
+          this.$refs.form.validateField('involveDeptId');
+        });
       }
     },
 
@@ -1566,6 +1569,10 @@ export default {
 
       const deptName = findDeptName(this.deptTreeData, val);
       this.form.involveDeptName = deptName;
+      // 下拉选择后,手动验证involveDeptId字段
+      this.$nextTick(() => {
+        this.$refs.form.validateField('involveDeptId');
+      });
     },
     async getUserList() {
       try {

+ 2 - 0
src/views/salesServiceManagement/workOrder/index.vue

@@ -121,6 +121,8 @@
             v-if="
               acceptShow(row) &&
               $hasPermission('eom:aftersalesworkorder:checkAndAccept')
+              
+                
             "
             :underline="false"
             @click="handleCommand('checkAndAccept', row)"