Преглед на файлове

feat(销售订单): 添加仓库名称显示和数量合计功能,添加裁线米段输入列, 调整表格列顺序和布局

liujt преди 1 месец
родител
ревизия
823de0214c

+ 46 - 13
src/BIZComponents/inventoryTable.vue

@@ -10,10 +10,10 @@
       full-height="calc(100vh - 76px)"
       @columns-change="handleColumnChange"
       :cache-key="cacheKeyUrl"
-      :selection.sync="selection"
-      :show-summary="showSummary"
-      :summary-method="getSummaries"
+      :selection.sync="selection" 
     >
+      <!-- :show-summary="showSummary"
+      :summary-method="getSummaries" -->
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
         <div class="headbox">
@@ -70,6 +70,7 @@
             />
           </div>
           <div class="pricebox">
+            <span class="amount" v-if="showSummary">数量合计:{{ allQuantity }}</span>
             <span class="amount">总计:{{ allPrice }}元</span>
 
             <el-form-item
@@ -926,6 +927,17 @@
           </el-input>
         </el-form-item>
       </template>
+      <template v-slot:cuttingLength="{ row, $index }">
+        <el-form-item
+          :prop="'datasource.' + $index + '.cuttingLength'"
+        >
+          <el-input
+            v-model="row.cuttingLength"
+            placeholder="请输入"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -985,7 +997,7 @@
   import ProductionVersion from '@/components/ProductionVersion2/index.vue';
   import { getInventoryTotalAPI } from '@/api/wms';
   import { pricingWayList, lbjtList } from '@/enum/dict.js';
-  import { changeCount, getAllPrice, getAllDiscountPrice, formatPrice } from '@/BIZComponents/setProduct.js';
+  import { changeCount, getAllPrice, getAllDiscountPrice, formatPrice, getAllQuantity } from '@/BIZComponents/setProduct.js';
   import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
   import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
   import timeDialog from '@/components/timeDialog/index.vue';
@@ -1192,6 +1204,7 @@
         levelList,
         taskinstanceDialogFlag: false,
         allPrice: 0,
+        allQuantity: 0,
         numberReg,
         defaultForm,
         form: {
@@ -1221,13 +1234,6 @@
 
         // 基础列定义
         let baseColumns = [
-          {
-            width: 65,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
-          },
           {
             label: '选择',
             width: 45,
@@ -1236,6 +1242,13 @@
             align: 'center',
             fixed: 'left'
           },
+          {
+            width: 65,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
           {
             minWidth: 200,
             prop: 'orderNo',
@@ -1441,6 +1454,14 @@
             slot: 'productionRequirements',
             isNone: !this.isProductionRequirements && this.quoteType === 2
           },
+          {
+            minWidth: 280,
+            prop: 'cuttingLength',
+            label: '裁线米段',
+            align: 'center',
+            slot: 'cuttingLength',
+            isNone: this.quoteType === 2
+          },
           {
             width: 200,
             prop: 'productCategoryName',
@@ -1546,6 +1567,14 @@
             align: 'center',
             isNone: this.quoteType === 2
           },
+          {
+            width: 120,
+            prop: 'warehouseName',
+            label: '仓库名称',
+            slot: 'warehouseName',
+            align: 'center',
+            isNone: this.quoteType === 2
+          },
           {
             width: 120,
             prop: 'availableCountBase',
@@ -2028,6 +2057,7 @@
 
       changeAll() {
         this.allPrice = getAllPrice(this.form.datasource) || 0;
+        this.allQuantity = getAllQuantity(this.form.datasource, this.countObj) || 0;
         this.form.discountTotalPrice = getAllDiscountPrice(this.form.datasource) || 0;
         if (this.isDiscountTotalPrice) {
           this.form.discountTotalPrice = this.form.discountTotalPrice;
@@ -2213,7 +2243,7 @@
 
           let codeList = this.form.datasource
             .filter((item) => item.productCode)
-            .map((item) => item.productCode);
+            .map((item) => item.batchNo ? [item.productCode, item.batchNo].join(',') : item.productCode);
           //获取仓库库存
           let inventoryTotalList = await getInventoryTotalAPI(codeList);
           this.form.datasource
@@ -2221,7 +2251,7 @@
             .forEach((item, index) => {
               let find =
                 inventoryTotalList.find(
-                  (key) => key.code == item.productCode
+                  (key) => (key.code + ',' + key.batchNo == item.productCode+','+item.batchNo)
                 ) || {};
               this.form.datasource;
               this.$set(
@@ -2234,6 +2264,7 @@
             this.changeCount();
           } else {
             this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
+            this.allQuantity = getAllQuantity(this.form.datasource, this.countObj);
           }
 
           if (this.isDiscountTotalPrice) {
@@ -2424,6 +2455,8 @@
           this.$set(parasm, 'productCode', item.productCode);
           this.$set(parasm, 'productName', item.productName);
           this.$set(parasm, 'modelType', item.categoryModel);
+          this.$set(parasm, 'warehouseId', item.warehouseId);
+          this.$set(parasm, 'warehouseName', item.warehouseName);
           this.$set(parasm, 'availableCountBase', item.measureQuantity);
           this.$set(parasm, 'measuringUnit', item.measuringUnit);
           this.$set(parasm, 'specification', item.specification);

+ 26 - 6
src/BIZComponents/inventoryTableDetails.vue

@@ -15,9 +15,9 @@
       @select-all="handleSelectionChange"
       :cache-key="cacheKeyUrl"
       @done="handleDone"
-      :show-summary="showSummary"
-      :summary-method="getSummaries"
     >
+      <!-- :show-summary="showSummary"
+      :summary-method="getSummaries" -->
       <!-- 原有插槽 -->
       <template v-slot:technicalDrawings="scope">
         <el-form-item
@@ -113,6 +113,7 @@
       <template v-slot:toolbar>
         <div class="headbox">
           <div class="pricebox">
+            <span class="amount" v-if="showSummary">数量合计:{{ allQuantity }}</span>
             <span class="amount" v-if="isAllPrice">总计:{{ allPrice }}元</span>
             <span class="amount" v-if="isDiscountTotalPrice"
               >优惠后总金额:{{ form.discountTotalPrice }}元</span
@@ -133,6 +134,7 @@
   import { levelList, pricingWayList, quoteTypeOp } from '@/enum/dict.js';
   import { getInventoryTotalAPI } from '@/api/wms';
   import { getSummaries } from '@/utils/util.js';
+  import { getAllQuantity } from '@/BIZComponents/setProduct.js';
 
   const dayjs = require('dayjs');
 
@@ -241,6 +243,7 @@
     data() {
       return {
         allPrice: 0,
+        allQuantity: 0,
         supplierObj: [],
         form: {
           discountTotalPrice: 0,
@@ -461,6 +464,14 @@
             align: 'center',
             isNone: !this.isProductionRequirements && this.quoteType === 2
           },
+          {
+            minWidth: 280,
+            prop: 'cuttingLength',
+            label: '裁线米段',
+            align: 'center',
+            slot: 'cuttingLength',
+            isNone: this.quoteType === 2
+          },
           {
             minWidth: 120,
             prop: 'entrustedEnterpriseId',
@@ -507,6 +518,14 @@
             },
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'warehouseName',
+            label: '仓库名称',
+            slot: 'warehouseName',
+            align: 'center',
+            isNone: this.quoteType === 2
+          },
           {
             minWidth: 160,
             prop: 'availableCountBase',
@@ -1038,6 +1057,7 @@
           this.form.datasource = productList;
           this.allPrice =
             data.totalAmount || data.totalPrice || data?.contractVO?.totalPrice;
+          this.allQuantity = getAllQuantity(this.form.datasource, this.countObj)  
           if (this.isDiscountTotalPrice) {
             this.form.discountTotalPrice =
               data.payAmount ||
@@ -1046,8 +1066,8 @@
           }
           if (this.isWms) {
             let codeList = this.form.datasource
-              .filter((item) => item.productCode)
-              .map((item) => item.productCode);
+            .filter((item) => item.productCode)
+            .map((item) => item.batchNo ? [item.productCode, item.batchNo].join(',') : item.productCode);
             //获取仓库库存
             let inventoryTotalList = await getInventoryTotalAPI(codeList);
             this.form.datasource
@@ -1055,8 +1075,8 @@
               .forEach((item, index) => {
                 let find =
                   inventoryTotalList.find(
-                    (key) => key.code == item.productCode
-                  ) || {};
+                                    (key) => (key.code + ',' + key.batchNo == item.productCode+','+item.batchNo)
+                                  ) || {};
                 this.form.datasource;
                 this.$set(
                   this.form.datasource[index],

+ 7 - 0
src/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue

@@ -205,6 +205,13 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'warehouseName',
+            label: '仓库',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 90
+          },
           {
             prop: 'measureQuantity',
             label: '库存',

+ 12 - 0
src/BIZComponents/setProduct.js

@@ -122,6 +122,7 @@ function setSingleWeight(row, countObj, endIndex) {
   }
 }
 export function getAllPrice(arr) {
+  console.log('arr~~~', arr);
   let sum = 0;
   arr.forEach((item) => {
     if (item.totalPrice) {
@@ -131,6 +132,17 @@ export function getAllPrice(arr) {
   return isNaN(sum) ? 0 : formatPrice(sum);
 }
 
+export function getAllQuantity(arr, countObj) {
+  let sum = 0;
+  arr.forEach((item) => {
+    console.log('item', item, countObj.countKey);
+    if (item[countObj.countKey]) {
+      sum += Number(item[countObj.countKey]);
+    }
+  });
+  return isNaN(sum) ? 0 : formatPrice(sum);
+}
+
 // 获取优惠后总金额
 export function getAllDiscountPrice(arr) {
   let sum = 0;

+ 2 - 0
src/views/saleManage/saleOrder/components/darwerComponents/saleOrderInfo.vue

@@ -317,6 +317,7 @@
       :isWms="true"
       :isIncreaseTotalWeight="true"
       :showSummary="true"
+      :cacheKeyUrl="cacheKeyUrl"
     ></inventoryTabledetail>
     <headerTitle title="类型清单" v-if="form.needProduce == 4"></headerTitle>
     <typeList
@@ -357,6 +358,7 @@
     },
     data() {
       return {
+        cacheKeyUrl: 'eom-sales-inventory-table-details-20260430',
         shippingModeOp, 
         transactionMethodsOp,
         settlementDate: [],