From 2d43df9b29995eb98e39406666005e912fdf9e77 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Thu, 4 Nov 2021 11:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BC=B9=E7=AA=97=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/babylon/controller/status/login-status.ts | 3 +++ src/app/pages/plan/plan.component.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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 })