Ver Fonte

feat(库存表格详情): 新增quoteType参数并根据其值动态显示加工费相关字段列

yusheng há 7 meses atrás
pai
commit
dc193707e6
1 ficheiros alterados com 236 adições e 208 exclusões
  1. 236 208
      src/BIZComponents/inventoryTableDetails.vue

+ 236 - 208
src/BIZComponents/inventoryTableDetails.vue

@@ -154,6 +154,10 @@
       isProductionRequirements: {
         type: Boolean,
         default: false
+      },
+      quoteType: {
+        type: Number,
+        default: 1
       }
     },
     data() {
@@ -168,28 +172,23 @@
     },
     computed: {
       columns() {
-        let orderColumn = {
-          width: 1,
-          show: false
-        };
-        if (this.isOrderNo) {
-          orderColumn = {
-            minWidth: 200,
-            prop: 'orderNo',
-            label: '订单编码',
-            showOverflowTooltip: true,
-            align: 'center'
-          };
-        }
-        return [
+        // 基础列(新增字段之前的列)
+        const baseColumns = [
           {
             width: 45,
             type: 'index',
             columnKey: 'index',
             align: 'center'
           },
-          orderColumn,
 
+          {
+            minWidth: 200,
+            prop: 'orderNo',
+            label: '订单编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            isNone: !this.isOrderNo
+          },
           {
             width: 280,
             prop: 'productName',
@@ -218,74 +217,139 @@
             label: '规格',
             slot: 'specification',
             align: 'center'
-          },
-          this.contractBookType == 1
-            ? {
-                width: 200,
-                prop: 'customerMark',
-                label: '客户代号',
-                slot: 'customerMark',
-                headerSlot: 'headerCustomerMark',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          this.contractBookType == 2
-            ? {
-                width: 200,
-                prop: 'customerMark',
-                label: '供应商代号',
-                slot: 'customerMark',
-                headerSlot: 'headerSupplierMark',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          this.isCustomerMark
-            ? {
-                minWidth: 120,
-                prop: 'entrustedEnterpriseId',
-                label: '受托企业',
-                slot: 'entrustedEnterpriseId',
-                show: this.isCustomerMark,
-                align: 'center',
-                showOverflowTooltip: true,
-                formatter: (row, column) => {
-                  return (
-                    (this.supplierObj &&
-                      this.supplierObj[row.productId]?.find(
-                        (item) => item.id === row.entrustedEnterpriseId
-                      )?.name) ||
-                    ''
-                  );
+          }
+        ];
+        // 条件显示的新增字段列(仅当quoteType为2时显示)
+        const additionalColumns =
+          this.quoteType === 2
+            ? [
+                // 新增字段:厚度
+                {
+                  width: 150,
+                  prop: 'thickNess',
+                  label: '厚度',
+                  slot: 'thickNess',
+                  align: 'center'
+                },
+                // 新增字段:平方数
+                {
+                  width: 150,
+                  prop: 'squareNumber',
+                  label: '平方数',
+                  slot: 'squareNumber',
+                  align: 'center'
+                },
+                // 新增字段:加工费(未税)
+                {
+                  width: 150,
+                  prop: 'processingFeeBeforeTax',
+                  label: '加工费(未税)',
+                  slot: 'processingFeeBeforeTax',
+                  align: 'center'
+                },
+                // 新增字段:包装费(未税)
+                {
+                  width: 150,
+                  prop: 'packagingFeeNotTaxed',
+                  label: '包装费(未税)',
+                  slot: 'packagingFeeNotTaxed',
+                  align: 'center'
+                },
+                // 新增字段:运输费(未税)
+                {
+                  width: 150,
+                  prop: 'transportationFeeWithoutTax',
+                  label: '运输费(未税)',
+                  slot: 'transportationFeeWithoutTax',
+                  align: 'center'
+                },
+                // 新增字段:未税小计
+                {
+                  width: 150,
+                  prop: 'untaxedSubtotal',
+                  label: '未税小计',
+                  slot: 'additionalTaxRate_untaxed',
+                  align: 'center'
+                },
+                // 新增字段:税率(%)
+                {
+                  width: 150,
+                  prop: 'additionalTaxRate',
+                  label: '税率(%)',
+                  slot: 'additionalTaxRate',
+                  align: 'center'
+                },
+                // 新增字段:含税小计
+                {
+                  width: 150,
+                  prop: 'includingTaxPrice',
+                  label: '含税小计',
+                  slot: 'includingTaxPrice',
+                  align: 'center'
                 }
-              }
-            : {
-                width: 1
-              },
+              ]
+            : [];
+        const remainingColumns = [
           {
-            width: 150,
+            width: 200,
+            prop: 'customerMark',
+            label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
+            slot: 'customerMark',
+            headerSlot: 'headerCustomerMark',
+            isNone: this.quoteType === 2,
+            align: 'center'
+          },
+          {
+            minWidth: 240,
+            prop: 'taskName',
+            label: '工序',
+            slot: 'taskName',
+            align: 'center'
+          },
+          {
+            minWidth: 160,
+            prop: 'productionCodes',
+            label: '生产编号',
+            isNone: this.quoteType === 2,
+            align: 'center'
+          },
+          {
+            minWidth: 280,
+            prop: 'productionRequirements',
+            label: '生产要求',
+            align: 'center',
+            isNone: !this.isProductionRequirements
+          },
+          {
+            minWidth: 120,
+            prop: 'entrustedEnterpriseId',
+            label: '受托企业',
+            slot: 'entrustedEnterpriseId',
+            isNone: !this.isCustomerMark,
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row, column) => {
+              return (
+                this.supplierObj[row.productId]?.find(
+                  (item) => item.id === row.entrustedEnterpriseId
+                )?.name || ''
+              );
+            }
+          },
+          {
+            width: 180,
             prop: 'saleCount',
             label: '数量',
             slot: 'saleCount',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
-          // {
-          //   width: 150,
-          //   prop: 'saleUnit',
-          //   label: '单位',
-          //   slot: 'saleUnit',
-          //   headerSlot: 'headerTotalCount',
-          //   align: 'center'
-          // },
           {
             width: 120,
             prop: 'packingSpecification',
             align: 'center',
             label: '包装规格',
+            isNone: this.quoteType === 2,
             showOverflowTooltip: true
           },
           {
@@ -293,68 +357,32 @@
             prop: 'totalCount',
             label: '计量数量',
             slot: 'totalCount',
+            isNone: this.quoteType === 2,
+            headerSlot: 'headerTotalCount',
             formatter: (row, column) => {
               if (row.totalCount) {
                 return row.totalCount + ' ' + row.measuringUnit;
               }
             },
-            headerSlot: 'headerTotalCount',
             align: 'center'
           },
-          // {
-          //   width: 120,
-          //   prop: 'measuringUnit',
-          //   label: '计量单位',
-          //   slot: 'measuringUnit',
-          //   align: 'center'
-          // },
-          this.pageName == 'send'
-            ? {
-                minWidth: 110,
-                prop: 'sendTotalCount',
-                label: '已发货数量',
-                slot: 'sendTotalCount',
-                formatter: (row, column) => {
-                  if (row.sendTotalCount) {
-                    return row.sendTotalCount + ' ' + row.measuringUnit;
-                  }
-                },
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          this.pageName == 'send'
-            ? {
-                minWidth: 110,
-                prop: 'notSendTotalCount',
-                label: '未发货数量',
-                slot: 'notSendTotalCount',
-                formatter: (row, column) => {
-                  if (row.notSendTotalCount) {
-                    return row.notSendTotalCount + ' ' + row.measuringUnit;
-                  }
-                },
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
+
           {
-            width: 120,
+            width: 140,
             prop: 'singleWeight',
             label: '单重',
             slot: 'singleWeight',
+            isNone: this.quoteType === 2,
+            headerSlot: 'headerSingleWeight',
             formatter: (row, column) => {
               if (row.singleWeight) {
                 return row.singleWeight + ' ' + row.weightUnit;
               }
             },
-            headerSlot: 'headerSingleWeight',
             align: 'center'
           },
           {
-            width: 120,
+            width: 140,
             prop: 'totalWeight',
             label: '总重',
             slot: 'totalWeight',
@@ -365,31 +393,12 @@
             },
             align: 'center'
           },
-          // {
-          //   width: 120,
-          //   prop: 'weightUnit',
-          //   label: '重量单位',
-          //   slot: 'weightUnit',
-          //   align: 'center'
-          // },
-          // {
-          //   width: 160,
-          //   prop: 'pricingWay',
-          //   label: '计价方式',
-          //   slot: 'pricingWay',
-          //   align: 'center',
-          //   formatter: (row, column) => {
-          //     return row.pricingWay == 1
-          //       ? '按数量计费'
-          //       : row.pricingWay == 2
-          //       ? '按重量计费'
-          //       : '';
-          //   }
-          // },
+
           {
             width: 160,
             prop: 'goodsPriceType',
             label: '价格类型',
+            isNone: this.quoteType === 2,
             formatter: (row, column) => {
               return this.getDictValue('商品价格类型', row.goodsPriceType);
             },
@@ -400,40 +409,41 @@
             prop: 'singlePrice',
             label: '单价',
             slot: 'singlePrice',
+            isNone: this.quoteType === 2,
             headerSlot: 'headerSinglePrice',
             align: 'center'
           },
+
           {
             width: 160,
             prop: 'taxRate',
             label: '税率',
+            isNone: this.quoteType === 2,
             formatter: (_row, _column, cellValue) => {
               return _row.taxRate ? _row.taxRate + '%' : '';
             },
             align: 'center'
           },
           {
-            width: 160,
+            width: 150,
             prop: 'notaxSinglePrice',
             label: '不含税单价',
+            isNone: this.quoteType === 2,
+            slot: 'notaxSinglePrice',
             align: 'center'
           },
-          this.isDiscount
-            ? {
-                width: 160,
-                prop: 'discountSinglePrice',
-                label: '折让单价',
-                align: 'center',
-
-                formatter: (_row, _column, cellValue) => {
-                  return _row.discountSinglePrice
-                    ? Number(_row.discountSinglePrice).toFixed(2)
-                    : '';
-                }
-              }
-            : {
-                width: 1
-              },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            align: 'center',
+            isNone: !this.isDiscount,
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountSinglePrice
+                ? Number(_row.discountSinglePrice).toFixed(2)
+                : '';
+            }
+          },
           {
             width: 120,
             prop: 'totalPrice',
@@ -441,25 +451,23 @@
             slot: 'totalPrice',
             align: 'center'
           },
-          this.isDiscount
-            ? {
-                width: 160,
-                prop: 'discountTotalPrice',
-                label: '折让合计',
-                align: 'center',
-                formatter: (_row, _column, cellValue) => {
-                  return _row.discountTotalPrice
-                    ? Number(_row.discountTotalPrice).toFixed(2)
-                    : '';
-                }
-              }
-            : {
-                width: 1
-              },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            align: 'center',
+            isNone: !this.isDiscount,
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountTotalPrice
+                ? Number(_row.discountTotalPrice).toFixed(2)
+                : '';
+            }
+          },
           {
             minWidth: 120,
             prop: 'goodsLevel',
             label: '物品级别',
+            isNone: this.quoteType === 2,
             formatter: (_row, _column, cellValue) => {
               return levelList.find((item) => item.value == _row.goodsLevel)
                 ?.label;
@@ -471,6 +479,7 @@
             prop: 'batchNo',
             label: '批次号',
             slot: 'batchNo',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
           {
@@ -478,6 +487,7 @@
             prop: 'productBrand',
             label: '牌号',
             slot: 'productBrand',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
           {
@@ -485,34 +495,41 @@
             prop: 'modelType',
             label: '型号',
             slot: 'modelType',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
-          {
-            width: 120,
-            prop: 'imgCode',
-            align: 'center',
-            label: '图号/件号',
-            showOverflowTooltip: true
-          },
           {
             minWidth: 120,
             prop: 'modelKey',
             label: '机型',
+            slot: 'modelKey',
+            isNone: this.quoteType === 2,
             showOverflowTooltip: true,
             align: 'center'
           },
           {
             minWidth: 120,
             prop: 'colorKey',
+            slot: 'colorKey',
             showOverflowTooltip: true,
             label: '颜色',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'imgCode',
+            align: 'center',
+            label: '图号/件号',
+            isNone: this.quoteType === 2,
+            showOverflowTooltip: true
+          },
           {
             prop: 'provenance',
             label: '产地',
             slot: 'provenance',
             align: 'center',
+            isNone: this.quoteType === 2,
             minWidth: 200,
             showOverflowTooltip: true,
             formatter: (row, column) => {
@@ -528,6 +545,7 @@
             prop: 'produceType',
             align: 'center',
             label: '属性类型',
+            isNone: this.quoteType === 2,
             showOverflowTooltip: true,
             formatter: (row, column) => {
               if (row.produceType) {
@@ -539,56 +557,25 @@
               }
             }
           },
-          {
-            minWidth: 160,
-            prop: 'productionCodes',
-            label: '生产编号',
-            align: 'center'
-          },
-          this.isProductionRequirements
-            ? {
-                minWidth: 280,
-                prop: 'productionRequirements',
-                label: '生产要求',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          {
-            minWidth: 240,
-            prop: 'taskName',
-            label: '工序',
-            slot: 'taskName',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
           {
             width: 160,
             prop: 'arrivalWay',
             label: '到货方式',
             align: 'center',
+            isNone: !this.isArrivalWay || this.quoteType === 2,
             formatter: (_row, _column, cellValue) => {
               return _row.arrivalWay == 1
                 ? '一次性到货'
                 : _row.arrivalWay == 2
                 ? '分批到货'
                 : '';
-            },
-            show: this.isArrivalWay
+            }
           },
           {
             width: 160,
             prop: 'customerExpectDeliveryDeadline',
             label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
             slot: 'customerExpectDeliveryDeadline',
-
             align: 'center'
           },
           {
@@ -596,16 +583,17 @@
             prop: 'produceDeliveryDeadline',
             label: '生产交付交期',
             slot: 'produceDeliveryDeadline',
+            isNone: this.contractBookType != 1,
             headerSlot: 'headerProduceDeliveryDeadline',
-            show: this.contractBookType == 1,
             align: 'center'
           },
+
           {
             width: 200,
             prop: 'guaranteePeriod',
             label: '有效期',
+            isNone: this.quoteType === 2,
             slot: 'guaranteePeriod',
-
             align: 'center',
             formatter: (_row, _column, cellValue) => {
               return (
@@ -617,20 +605,43 @@
             width: 200,
             prop: 'guaranteePeriodDeadline',
             label: '有效期截止日期',
+            isNone: this.quoteType === 2,
             slot: 'guaranteePeriodDeadline',
             align: 'center'
           },
+
           {
             width: 220,
             prop: 'customerReqFiles',
             label: '客户需求',
             slot: 'customerReqFiles',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
+          // {
+          //   width: 100,
+          //   prop: 'density',
+          //   label: '密度',
+          //   align: 'center'
+          // },
+          {
+            width: 150,
+            prop: 'productType',
+            label: '生产加工方式',
+            align: 'center',
+            formatter: (_row, _column, cellValue) => {
+              return _row.productType == 2
+                ? '加工'
+                : _row.productType == 3
+                ? '装配'
+                : '';
+            }
+          },
           {
             width: 130,
             prop: 'technicalAnswerName',
             label: '技术答疑人',
+            isNone: this.quoteType === 2,
             slot: 'technicalAnswerName',
             align: 'center'
           },
@@ -638,6 +649,7 @@
             width: 220,
             prop: 'technicalParams',
             label: '技术参数',
+            isNone: this.quoteType === 2,
             slot: 'technicalParams',
             align: 'center'
           },
@@ -648,10 +660,18 @@
             slot: 'technicalDrawings',
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'drawingVersion',
+            isNone: this.quoteType === 2,
+            label: '图纸版本',
+            align: 'center'
+          },
           {
             width: 240,
             prop: 'technologyRouteName',
             label: '工艺路线',
+            isNone: this.quoteType === 2,
             slot: 'technologyRouteName',
             align: 'center'
           },
@@ -659,6 +679,7 @@
             width: 240,
             prop: 'industryArtFiles',
             label: '工艺附件',
+            isNone: this.quoteType === 2,
             slot: 'industryArtFiles',
             align: 'center'
           },
@@ -667,6 +688,7 @@
             prop: 'otherFiles',
             label: '其他附件',
             slot: 'otherFiles',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
           {
@@ -677,6 +699,12 @@
             align: 'center'
           }
         ];
+        // 合并所有列
+        return [
+          ...baseColumns,
+          ...additionalColumns,
+          ...remainingColumns
+        ].filter((item) => !item.isNone);
       }
     },