Browse Source

新增弹窗确认

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

3
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)

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

@ -64,9 +64,12 @@ export class PlanComponent implements OnInit {
this.beforeOneSatus = StatusManager.getStatus<LoginSatus>(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 })

Loading…
Cancel
Save