增加了一个初始化过程中的出错声明

This commit is contained in:
Xu Chang 2024-10-08 22:01:48 +08:00
parent 003c09cdd2
commit 0da1c9cac4
3 changed files with 15 additions and 3 deletions

View File

@ -70,8 +70,12 @@ export default class TreeStore extends CascadeStore {
resetInitialData(data, stat) {
this.store = {};
const now = Date.now();
const schema = this.getSchema();
for (const entity in data) {
const { attributes } = this.getSchema()[entity];
if (!schema[entity]) {
throw new Error(`reset unknown entity:[${entity}]`);
}
const { attributes } = schema[entity];
this.store[entity] = {};
for (const row of data[entity]) {
for (const key in attributes) {

View File

@ -72,8 +72,12 @@ class TreeStore extends CascadeStore_1.CascadeStore {
resetInitialData(data, stat) {
this.store = {};
const now = Date.now();
const schema = this.getSchema();
for (const entity in data) {
const { attributes } = this.getSchema()[entity];
if (!schema[entity]) {
throw new Error(`reset unknown entity:[${entity}]`);
}
const { attributes } = schema[entity];
this.store[entity] = {};
for (const row of data[entity]) {
for (const key in attributes) {

View File

@ -134,8 +134,12 @@ export default class TreeStore<ED extends EntityDict & BaseEntityDict> extends C
}) {
this.store = {};
const now = Date.now();
const schema = this.getSchema();
for (const entity in data) {
const { attributes } = this.getSchema()[entity];
if (!schema[entity]) {
throw new Error(`reset unknown entity:[${entity as string}]`);
}
const { attributes } = schema[entity];
this.store[entity] = {};
for (const row of data[entity]!) {
for (const key in attributes) {