|
|
@ -192,22 +192,6 @@ export class UserConfigStore extends Singleton
|
|
|
|
async SaveConfig(type: BoardModalType, store: IConfigStore, isInit: boolean = false, isCheckName = false)
|
|
|
|
async SaveConfig(type: BoardModalType, store: IConfigStore, isInit: boolean = false, isCheckName = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let name = store.configName;
|
|
|
|
let name = store.configName;
|
|
|
|
if (type === BoardModalType.ProcessGroupCategory)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let newConfig: IConfigOption = store.SaveConfig();
|
|
|
|
|
|
|
|
let dbStore = await IndexedDbStore.CADStore();
|
|
|
|
|
|
|
|
let data = await PostJson(ConfigUrls.Edit, { key: type, value: JSON.stringify(newConfig.processGroupCategory) });//
|
|
|
|
|
|
|
|
if (data.err_code === RequestStatus.Ok)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await dbStore.Put(StoreName.ConfigData, GetIndexDBID(type), newConfig.processGroupCategory);//
|
|
|
|
|
|
|
|
await dbStore.Put(StoreName.ConfigVersion, GetIndexDBID(type), data.version);
|
|
|
|
|
|
|
|
appCache.set(type, newConfig.processGroupCategory);//
|
|
|
|
|
|
|
|
userConfig.userConfigName[type] = type;
|
|
|
|
|
|
|
|
this.UpdateUserConfig(type, newConfig);//
|
|
|
|
|
|
|
|
await userConfig.UploadUserConfigNames();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name === "")
|
|
|
|
if (name === "")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AppToaster.show({
|
|
|
|
AppToaster.show({
|
|
|
@ -225,22 +209,32 @@ export class UserConfigStore extends Singleton
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let configs = (await this.GetAllConfigs(type)) || {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//新的配置
|
|
|
|
|
|
|
|
let newConfig: IConfigOption = store.SaveConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let configs = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type === BoardModalType.ProcessGroupCategory)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
configs = newConfig.processGroupCategory;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
configs = (await this.GetAllConfigs(type)) || {};
|
|
|
|
let isContinue = true;
|
|
|
|
let isContinue = true;
|
|
|
|
if (configs.hasOwnProperty(name) && !isInit && isCheckName)
|
|
|
|
if (configs.hasOwnProperty(name) && !isInit && isCheckName)
|
|
|
|
isContinue = confirm("配置名称已存在,是否覆盖");
|
|
|
|
isContinue = confirm("配置名称已存在,是否覆盖");
|
|
|
|
|
|
|
|
|
|
|
|
if (!isContinue) return;
|
|
|
|
if (!isContinue) return;
|
|
|
|
|
|
|
|
|
|
|
|
//新的配置
|
|
|
|
|
|
|
|
let newConfig: IConfigOption = store.SaveConfig();
|
|
|
|
|
|
|
|
// 配置添加到数据库
|
|
|
|
// 配置添加到数据库
|
|
|
|
configs[name] = newConfig;
|
|
|
|
configs[name] = newConfig;
|
|
|
|
observable(store.configsNames).replace(Object.keys(configs));
|
|
|
|
observable(store.configsNames).replace(Object.keys(configs));
|
|
|
|
|
|
|
|
|
|
|
|
if (type === BoardModalType.Dr)
|
|
|
|
if (type === BoardModalType.Dr)
|
|
|
|
this.ChangeDrillRuleMap(configs);
|
|
|
|
this.ChangeDrillRuleMap(configs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let dbStore = await IndexedDbStore.CADStore();
|
|
|
|
let dbStore = await IndexedDbStore.CADStore();
|
|
|
|
|
|
|
|
|
|
|
@ -251,6 +245,7 @@ export class UserConfigStore extends Singleton
|
|
|
|
await dbStore.Put(StoreName.ConfigData, GetIndexDBID(type), configs);
|
|
|
|
await dbStore.Put(StoreName.ConfigData, GetIndexDBID(type), configs);
|
|
|
|
await dbStore.Put(StoreName.ConfigVersion, GetIndexDBID(type), data.version);
|
|
|
|
await dbStore.Put(StoreName.ConfigVersion, GetIndexDBID(type), data.version);
|
|
|
|
appCache.set(type, configs);
|
|
|
|
appCache.set(type, configs);
|
|
|
|
|
|
|
|
if (type !== BoardModalType.ProcessGroupCategory)
|
|
|
|
AppToaster.show({
|
|
|
|
AppToaster.show({
|
|
|
|
message: isInit ? "初始化配置成功" : "配置保存成功",
|
|
|
|
message: isInit ? "初始化配置成功" : "配置保存成功",
|
|
|
|
timeout: 1000
|
|
|
|
timeout: 1000
|
|
|
|