diff --git a/src/store/list.ts b/src/store/list.ts index 1019f404..43155bb2 100644 --- a/src/store/list.ts +++ b/src/store/list.ts @@ -11,7 +11,7 @@ import { } from './iRenderer'; import isEqual = require('lodash/isEqual'); import find = require('lodash/find'); -import { createObject, isObject } from "../utils/helper"; +import { createObject, isObject, guid } from "../utils/helper"; import { evalExpression } from "../utils/tpl"; export const Item = types @@ -172,7 +172,8 @@ export const ListStore = iRendererStore }; return { - id: String((item as any)[self.primaryField] || key), + // id: String((item as any)[self.primaryField] || key), + id: guid(), index: key, newIndex: key, pristine: item, diff --git a/src/store/table.ts b/src/store/table.ts index d4a41fad..6811ed2e 100644 --- a/src/store/table.ts +++ b/src/store/table.ts @@ -13,7 +13,7 @@ import { import { resolveVariable } from "../utils/tpl-builtin"; import isEqual = require('lodash/isEqual'); import find = require('lodash/find'); -import { isBreakpoint, createObject, isObject, isVisible } from "../utils/helper"; +import { isBreakpoint, createObject, isObject, isVisible, guid } from "../utils/helper"; import { evalExpression } from "../utils/tpl"; export const Column = types @@ -511,7 +511,8 @@ export const TableStore = iRendererStore }; return { - id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`), + // id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`), + id: guid(), key: String(`${pindex}-${depth}-${key}`), depth: depth, index: key, @@ -531,7 +532,8 @@ export const TableStore = iRendererStore self.expandedRows.clear(); let arr:Array = rows.map((item, key) => ({ - id: getEntryId ? getEntryId(item, key) : String(item && (item as any)[self.primaryField] || `${key}-1-${key}`), + // id: getEntryId ? getEntryId(item, key) : String(item && (item as any)[self.primaryField] || `${key}-1-${key}`), + id: getEntryId ? getEntryId(item, key) : guid(), key: String(`${key}-1-${key}`), depth: 1,// 最大父节点默认为第一层,逐层叠加 index: key,