Browse Source

1、修复刷新配置不更新【带出】类型明细名称问题

MY 2 days ago
parent
commit
5e09115e24
1 changed files with 8 additions and 19 deletions
  1. 8 19
      JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

+ 8 - 19
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -1868,6 +1868,9 @@ export const useHooks = (t?: any) => {
     let { visibleData } = $table.getTableData();
     const copyMap = new Map();
 
+    const COMMON_PRESERVED_PROPS = ["bj_inputtype", "erp_pzname", "erp_pzcode", "bj_pzname", "bj_namemx", "itemname"];
+    const SPECIAL_PRESERVED_PROPS = ["actual_size", "sb_craft", "actual_size_sb", "ss_rate", "ls_rate"];
+    const FULL_PRESERVED_PROPS = [...COMMON_PRESERVED_PROPS, ...SPECIAL_PRESERVED_PROPS];
     //  inputtype 0 - 选择 1 - 录入 2 - 带出
     if (isPz === 0) {
       // 刷新配置 FEAT: 只刷新【带出】类型的配置,只刷新明细名称列,并检查核价是否有新增的【带出】类型资料,添加到配置
@@ -1875,28 +1878,16 @@ export const useHooks = (t?: any) => {
         copyMap.set(`${mx.erp_pzid}`, mx);
       });
 
-      const PRESERVE_PROPS = [
-        "bj_inputtype",
-        "erp_pzname",
-        "erp_pzcode",
-        "bj_pzname",
-        "bj_namemx",
-        "itemname",
-        "actual_size",
-        "sb_craft",
-        "actual_size_sb",
-        "ss_rate",
-        "ls_rate"
-      ];
       state.mattressYWList = res.mxList.map(mx => {
         const key = `${mx.erp_pzid}`;
         if (copyMap.has(key)) {
           const mx2 = copyMap.get(key);
           if (mx2.bj_inputtype === 2) {
-            mx.bj_inputtype = mx2.bj_inputtype;
-            mx.bj_namemx = mx2.bj_namemx;
+            SPECIAL_PRESERVED_PROPS.forEach(prop => {
+              mx[prop] = mx2[prop];
+            });
           } else {
-            PRESERVE_PROPS.forEach(prop => {
+            FULL_PRESERVED_PROPS.forEach(prop => {
               mx[prop] = mx2[prop];
             });
           }
@@ -1920,13 +1911,11 @@ export const useHooks = (t?: any) => {
       state.mattressQDList = visibleData.map((mx: any) => mx);
     } else {
       // 重新生成:  FEAT: 删除所有已经填写的【录入】和【选择)项目,根据核价资料,重新生成所有的【带出】资料
-      const PRESERVE_PROPS = ["actual_size", "sb_craft", "actual_size_sb", "ss_rate", "ls_rate"];
-
       visibleData.forEach(mx => copyMap.set(`${mx.erp_pzid}`, mx));
       state.mattressYWList = res.mxList.map(mx => {
         const key = `${mx.erp_pzid}`;
         if (copyMap.has(key)) {
-          PRESERVE_PROPS.forEach(prop => {
+          SPECIAL_PRESERVED_PROPS.forEach(prop => {
             mx[prop] = copyMap.get(key)[prop];
           });
         }