diff --git a/src/app/babylon/controller/status/login-status.ts b/src/app/babylon/controller/status/login-status.ts index e146489..50aae2d 100644 --- a/src/app/babylon/controller/status/login-status.ts +++ b/src/app/babylon/controller/status/login-status.ts @@ -71,12 +71,15 @@ export class LoginSatus extends StatusBase { console.error("获取单位列表失败"); console.log(error); if (error instanceof HttpErrorResponse && error.status === 404) { + let isAdd = confirm('数据库为空,是否进行初始化?') + if (isAdd) { //数据库没有数据,新建 this.institutionList = []; if (onSuccess) { onSuccess(this.institutionList, this.institutionList); } console.log("新建数据列表"); + } } else { console.log("单纯报错", error instanceof HttpErrorResponse, error.status === 404) diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index d84cc07..13e1931 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -64,9 +64,12 @@ export class PlanComponent implements OnInit { this.beforeOneSatus = StatusManager.getStatus(LoginSatus); this.beforeOneSatus.onSelectInsSuccess(find) } else { //如果没有找到对应的单位key,则调用新建单位 - let name = 'ceshi'; - console.log("没找到单位,新建" + key); - loginStatus.createInsitution(key, name); + let isAdd = confirm('没有单位name,是否进行初始化?') + if (isAdd) { + let name = 'ceshi'; + console.log("没找到单位,新建" + key); + loginStatus.createInsitution(key, name); + } } } else { let find = data.find(item => { return item.key === ModeManager.institutionDemoKey })