优化:图纸损坏时可以打开历史记录

pull/2527/head
ChenX 10 months ago
parent a22389a68e
commit cb8258e3a2

@ -150,33 +150,45 @@ export class FileServer extends Singleton
}
catch (error)
{
let pos = Number(/at position[ ]+(\d+)/.exec(error.message)[1]);
let startPos = Math.max(0, pos - 100);
let endPos = Math.min(pos + 100, info.file.length - 1);
let newStr = prompt(`数据损坏,请修复数据,下面数据中,第${pos - startPos + 1}个字符出错了(如果您不会修复,请发送给售后工程师!)点击取消可以直接放弃修复,您可以打开历史记录还原图纸!`, info.file.substring(startPos, endPos));
if (newStr)
{
try
{
info.file = info.file.substring(0, startPos) + newStr + info.file.substring(endPos);
fileData = JSON.parse(info.file);
break;
}
catch (error)
{
}
}
else
if (error.message.indexOf("at position") === -1)
{
AppToaster.show({
message: "你放弃了修复,你现在可以打开历史记录修复图纸!",
message: "图纸损坏!您现在可以打开历史记录修复图纸!",
timeout: 3000,
intent: Intent.SUCCESS
intent: Intent.DANGER
}, 'canelfix');
break;
}
else
{
let pos = Number(/at position[ ]+(\d+)/.exec(error.message)[1]);
let startPos = Math.max(0, pos - 100);
let endPos = Math.min(pos + 100, info.file.length - 1);
let newStr = prompt(`数据损坏,请修复数据,下面数据中,第${pos - startPos + 1}个字符出错了(如果您不会修复,请发送给售后工程师!)点击取消可以直接放弃修复,您可以打开历史记录还原图纸!`, info.file.substring(startPos, endPos));
if (newStr)
{
try
{
info.file = info.file.substring(0, startPos) + newStr + info.file.substring(endPos);
fileData = JSON.parse(info.file);
break;
}
catch (error)
{
}
}
else
{
AppToaster.show({
message: "你放弃了修复,你现在可以打开历史记录修复图纸!",
timeout: 3000,
intent: Intent.SUCCESS
}, 'canelfix');
break;
}
}
}
}
@ -213,18 +225,16 @@ export class FileServer extends Singleton
intent: status ? Intent.SUCCESS : Intent.DANGER
}, 'openfile');
if (!status)
if (userConfig.openHistoryList)
{
await Sleep(5000);
location.reload();//重启WebCAD,避免因为错误导致的程序状态错误
let operLogs = new OperLogs();
operLogs.exec();
}
else
if (!status)
{
if (userConfig.openHistoryList)
{
let operLogs = new OperLogs();
operLogs.exec();
}
await Sleep(10000);
location.reload();//重启WebCAD,避免因为错误导致的程序状态错误
}
return status;

Loading…
Cancel
Save