Explorar el Código

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

xieyong hace 1 semana
padre
commit
b73e720abb

+ 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;
       },
       /* 刷新表格 */