瀏覽代碼

fix(materialModal): 修改表格行键为唯一标识,避免重复项

xieyong 1 周之前
父節點
當前提交
b73e720abb
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/views/produce/components/prenatalExamination/materialModal.vue

+ 6 - 1
src/views/produce/components/prenatalExamination/materialModal.vue

@@ -20,7 +20,7 @@
         :datasource="datasource"
         :selection.sync="selection"
         :need-page="false"
-        row-key="categoryCode"
+        row-key="rowKey"
       >
       </ele-pro-table>
     </el-card>
@@ -154,6 +154,11 @@
           // pageNum: page,
           // size: limit
         });
+        const list = (res && (res.data?.list || res.data || res)) || [];
+        // categoryCode 可能重复(同一物料多工序),拼接 index 合成唯一 rowKey
+        list.forEach((row, idx) => {
+          row.rowKey = `${row.categoryCode || ''}_${idx}`;
+        });
         return res;
       },
       /* 刷新表格 */