|
|
|
@ -23,7 +23,7 @@ export class LoginSatus extends StatusBase {
|
|
|
|
|
|
|
|
|
|
institutionCreateWindow: InstitutionCreateWindow; |
|
|
|
|
|
|
|
|
|
institutionList: InsitutionDataSimple[];//单位简易信息列表
|
|
|
|
|
institutionList: InsitutionDataSimple[] = [];//单位简易信息列表
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 前端对接
|
|
|
|
@ -32,7 +32,7 @@ export class LoginSatus extends StatusBase {
|
|
|
|
|
* 新建单位 |
|
|
|
|
* @param insData 新的单位信息 |
|
|
|
|
*/ |
|
|
|
|
createInsitution(key: string, name: string, onSuccess?: (insDataSimple: InsitutionDataSimple) => void) { |
|
|
|
|
createInsitution(key: string, name: string, id: number, onSuccess?: (insDataSimple: InsitutionDataSimple) => void) { |
|
|
|
|
|
|
|
|
|
if (key == null) { |
|
|
|
|
console.error("创建单位key为null"); |
|
|
|
@ -42,7 +42,7 @@ export class LoginSatus extends StatusBase {
|
|
|
|
|
let insData = new InstitutionData(); |
|
|
|
|
insData.normalData = new NormalData(key, name); |
|
|
|
|
|
|
|
|
|
this.saveNewIns(this, insData, key, onSuccess); |
|
|
|
|
this.saveNewIns(this, insData, key, id, onSuccess); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
@ -71,15 +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); |
|
|
|
|
let isAdd = confirm('数据库为空,是否进行初始化?') |
|
|
|
|
if (isAdd) { |
|
|
|
|
//数据库没有数据,新建
|
|
|
|
|
this.institutionList = []; |
|
|
|
|
if (onSuccess) { |
|
|
|
|
onSuccess(this.institutionList, this.institutionList); |
|
|
|
|
} |
|
|
|
|
console.log("新建数据列表"); |
|
|
|
|
} |
|
|
|
|
console.log("新建数据列表"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
console.log("单纯报错", error instanceof HttpErrorResponse, error.status === 404) |
|
|
|
@ -194,10 +194,12 @@ export class LoginSatus extends StatusBase {
|
|
|
|
|
|
|
|
|
|
let status = this; |
|
|
|
|
|
|
|
|
|
ServeManager.instance.saveInstitutionListData(this.institutionList, () => { |
|
|
|
|
//进入新单位
|
|
|
|
|
status.onSelectInsSuccess(insData); |
|
|
|
|
}); |
|
|
|
|
//不再自己存列表
|
|
|
|
|
// ServeManager.instance.saveInstitutionListData(this.institutionList, () => {
|
|
|
|
|
// //进入新单位
|
|
|
|
|
// status.onSelectInsSuccess(insData);
|
|
|
|
|
// });
|
|
|
|
|
status.onSelectInsSuccess(insData); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//#endregion
|
|
|
|
@ -225,9 +227,9 @@ export class LoginSatus extends StatusBase {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存新单位信息至服务器
|
|
|
|
|
saveNewIns(status: LoginSatus, insData: InstitutionData, key: string, onSuccess?: (insDataSimple: InsitutionDataSimple) => void) { |
|
|
|
|
saveNewIns(status: LoginSatus, insData: InstitutionData, key: string, id: number, onSuccess?: (insDataSimple: InsitutionDataSimple) => void) { |
|
|
|
|
console.log("准备保存新单位"); |
|
|
|
|
ServeManager.instance.saveInstitutionData(insData, key, (key, result) => { |
|
|
|
|
ServeManager.instance.saveInstitutionData(insData, key, id, (key, result) => { |
|
|
|
|
console.log("在服务器新建单位" + key); |
|
|
|
|
let insDataSimple = new InsitutionDataSimple(); |
|
|
|
|
insDataSimple.key = key; |
|
|
|
|