Browse Source

新增弹窗确认

dev
陈鹏飞 3 years ago
parent
commit
2d43df9b29
  1. 3
      src/app/babylon/controller/status/login-status.ts
  2. 3
      src/app/pages/plan/plan.component.ts

3
src/app/babylon/controller/status/login-status.ts

@ -71,6 +71,8 @@ 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) {
@ -78,6 +80,7 @@ export class LoginSatus extends StatusBase {
}
console.log("新建数据列表");
}
}
else {
console.log("单纯报错", error instanceof HttpErrorResponse, error.status === 404)
if (onFail) {

3
src/app/pages/plan/plan.component.ts

@ -64,10 +64,13 @@ export class PlanComponent implements OnInit {
this.beforeOneSatus = StatusManager.getStatus<LoginSatus>(LoginSatus);
this.beforeOneSatus.onSelectInsSuccess(find)
} else { //如果没有找到对应的单位key,则调用新建单位
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 })
if (find) {

Loading…
Cancel
Save