Sfoglia il codice sorgente

JLHWEB: 1、框架缓存机制修改:修改页切换至详情页时,刷新详情页;2、床垫报价-床网tab,大小单价格显示校准

JohnnyChan 1 giorno fa
parent
commit
bd16f20ce9

+ 1 - 1
JLHWEB/src/layouts/components/Tabs/index.vue

@@ -129,7 +129,7 @@ watch(
         }
       }
       tabStore.setTabs(tabsMenuList);
-      route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
+      route.meta.isKeepAlive && keepAliveStore.updateKeepAliveName(route);
       console.log("add keepAliveStore.keepAliveName :>> ", keepAliveStore.keepAliveName);
     }
     !isReplace && tabStore.addTabs(tabsParams);

+ 14 - 4
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -976,8 +976,18 @@ const footerMethod = ({ columns, data }: any) => {
         return count;
       } else if (column.field && column.field.indexOf("dannum") > -1) {
         let count = 0;
+
+        let fieldCost = column.field.split("_");
+        let _field = fieldCost[0] + "_cost";
+
+        column.field.indexOf("dannum") > -1;
+
         data.forEach((item: any) => {
-          count = floatAdd(count, floatMul(Number(item.costamt), 1 + item[column.field]));
+          if (item.hasOwnProperty(_field)) {
+            count = floatAdd(count, item[_field]);
+          } else {
+            count = floatAdd(count, floatMul(Number(item.costamt), 1 + item[column.field]));
+          }
         });
         return count;
       }
@@ -1807,8 +1817,8 @@ const save = async () => {
           });
           if (res.mattressid) {
             console.log("tabRemove route.fullPath :>> ", route.fullPath);
-            tabRemove(route.fullPath);
-            router.push(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
+            // tabRemove(route.fullPath);
+            router.replace(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
           } else {
             router.replace("/mattressQuote");
           }
@@ -2343,7 +2353,7 @@ const funcAfterMound = async () => {
         updateSubspecsTable();
       });
 
-      gotoSummy(8000);
+      gotoSummy();
     });
   }
 };

+ 53 - 0
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -2725,6 +2725,47 @@ export const useHooks = (t?: any) => {
       state.cmpFormulasOri = res.formulas_origin ?? [];
       state.cmpFormulasBednet = res.formulas_bednet ?? [];
       state.cmpDiffer = res.differ;
+
+      // 更新床网tab大小单单价显示
+      if (state.cmpDiffer.length > 0) {
+        let costArr = [];
+        state.cmpDiffer.forEach(o => {
+          let bednetMatch = o.replace.filter(itm => itm.label.indexOf("床网车间成本") > -1 && itm.label.indexOf("总") == -1);
+          if (!costArr.length) {
+            // 先加入空对象
+            bednetMatch.forEach(itm => {
+              costArr.push({
+                dannum2_cost: 0, // 标准
+                dannum1_cost: 0, // 散单
+                dannum3_cost: 0, // 大单
+                dannum4_cost: 0 // 小单
+              });
+            });
+          }
+          // 取文本出现的数字
+          let reg = /\d+/g;
+
+          if (bednetMatch.length) {
+            bednetMatch.forEach(itm => {
+              let matchIdx = itm.label.match(reg);
+              if (matchIdx && matchIdx.length) {
+                let idx = Number(matchIdx[0]);
+                costArr[idx - 1][`dannum${o.type}_cost`] = itm.value;
+              }
+            });
+          }
+        });
+
+        state.bednetMxData = state.bednetMxData.map((o, idx) => {
+          o.dannum2_cost = costArr[idx]?.dannum2_cost;
+          o.dannum1_cost = costArr[idx]?.dannum1_cost;
+          o.dannum3_cost = costArr[idx]?.dannum3_cost;
+          o.dannum4_cost = costArr[idx]?.dannum4_cost;
+          return o;
+        });
+
+        console.log("床网报价cost :>> ", costArr, state.bednetMxData);
+      }
     } else {
       setTimeout(() => {
         if (res.message) {
@@ -3752,6 +3793,9 @@ export const useHooks = (t?: any) => {
         return userInfo.usermode != 0;
       },
       render: (scope: any) => {
+        if (scope.row.hasOwnProperty("dannum2_cost")) {
+          return formatCutNumber({ val: scope.row.dannum2_cost });
+        }
         return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum2_rate) });
       }
     },
@@ -3763,6 +3807,9 @@ export const useHooks = (t?: any) => {
         return userInfo.usermode != 0;
       },
       render: (scope: any) => {
+        if (scope.row.hasOwnProperty("dannum1_cost")) {
+          return formatCutNumber({ val: scope.row.dannum1_cost });
+        }
         return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum1_rate) });
       }
     },
@@ -3774,6 +3821,9 @@ export const useHooks = (t?: any) => {
         return userInfo.usermode != 0;
       },
       render: (scope: any) => {
+        if (scope.row.hasOwnProperty("dannum3_cost")) {
+          return formatCutNumber({ val: scope.row.dannum3_cost });
+        }
         return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum3_rate) });
       }
     },
@@ -3785,6 +3835,9 @@ export const useHooks = (t?: any) => {
         return userInfo.usermode != 0;
       },
       render: (scope: any) => {
+        if (scope.row.hasOwnProperty("dannum4_cost")) {
+          return formatCutNumber({ val: scope.row.dannum4_cost });
+        }
         return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum4_rate) });
       }
     },