|
|
@ -123,11 +123,28 @@ export class SingleloginComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
downloadAsTxt(obj) { |
|
|
|
|
|
|
|
// 将对象转换为 JSON 字符串
|
|
|
|
|
|
|
|
const jsonString = JSON.stringify(obj, null, 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建 Blob 对象
|
|
|
|
|
|
|
|
const blob = new Blob([jsonString], { type: "text/plain" }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建下载链接
|
|
|
|
|
|
|
|
const link = document.createElement("a"); |
|
|
|
|
|
|
|
link.href = URL.createObjectURL(blob); |
|
|
|
|
|
|
|
link.download = "错误参数.txt"; // 文件名为 data.txt
|
|
|
|
|
|
|
|
link.click(); // 触发下载
|
|
|
|
|
|
|
|
// 释放 URL 对象
|
|
|
|
|
|
|
|
URL.revokeObjectURL(link.href); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//中化用户登录获得自己的token信息
|
|
|
|
//中化用户登录获得自己的token信息
|
|
|
|
SinochemLogin() { |
|
|
|
SinochemLogin() { |
|
|
|
return new Promise<void>((resolve, reject) => { |
|
|
|
return new Promise<void>((resolve, reject) => { |
|
|
|
this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id; |
|
|
|
this.CurrentUserInfo.data.userId = this.CurrentUserInfo.data.id; |
|
|
|
delete this.CurrentUserInfo.data.id; |
|
|
|
delete this.CurrentUserInfo.data.id; |
|
|
|
|
|
|
|
delete this.CurrentUserInfo.data.permissions; |
|
|
|
let body = { |
|
|
|
let body = { |
|
|
|
user: this.CurrentUserInfo.data, |
|
|
|
user: this.CurrentUserInfo.data, |
|
|
|
org: this.AuthOrganInfos.data[0], |
|
|
|
org: this.AuthOrganInfos.data[0], |
|
|
@ -146,6 +163,7 @@ export class SingleloginComponent implements OnInit { |
|
|
|
resolve(); |
|
|
|
resolve(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
(err) => { |
|
|
|
(err) => { |
|
|
|
|
|
|
|
this.downloadAsTxt(body); |
|
|
|
alert(err?.error?.error?.message || "SinochemLogin接口请求失败"); |
|
|
|
alert(err?.error?.error?.message || "SinochemLogin接口请求失败"); |
|
|
|
reject(); |
|
|
|
reject(); |
|
|
|
} |
|
|
|
} |
|
|
|